Validate network parameter

Add tests to cover the success and error cases.