diff --git a/ibm_cloud_networking_services/direct_link_v1.py b/ibm_cloud_networking_services/direct_link_v1.py index 9697ff0..42ab9b1 100644 --- a/ibm_cloud_networking_services/direct_link_v1.py +++ b/ibm_cloud_networking_services/direct_link_v1.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.43.1-ed736235-20211208-170818 +# IBM OpenAPI SDK Code Generator Version: 3.40.0-910cf8c2-20211006-154754 """ No description provided (generated by Openapi Generator @@ -93,6 +93,199 @@ def __init__(self, self.version = version + ######################### + # gatewayRouteReports + ######################### + + + def list_gateway_route_reports(self, + gateway_id: str, + **kwargs + ) -> DetailedResponse: + """ + List route reports. + + Retrieve all route reports for the specified Direct Link gateway. + + :param str gateway_id: Direct Link gateway identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `RouteReportCollection` object + """ + + if gateway_id is None: + raise ValueError('gateway_id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_gateway_route_reports') + headers.update(sdk_headers) + + params = { + 'version': self.version + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def create_gateway_route_report(self, + gateway_id: str, + **kwargs + ) -> DetailedResponse: + """ + Request a route report. + + Request route report generation. While report generation is in progress, + additional requests to generate a report are ignored and return the current + pending report. While `status` is `pending`, `gateway_routes`, `on_prem_routes`, + `virtual_connection_routes`, and `overlapping_routes` will be empty arrays. These + fields will be filled when the `status` enters the `completed` status. Call + `get_gateway_route_report` with the pending route report's `id` to check on the + current status of the report. + + :param str gateway_id: Direct Link gateway identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + """ + + if gateway_id is None: + raise ValueError('gateway_id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_gateway_route_report') + headers.update(sdk_headers) + + params = { + 'version': self.version + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def delete_gateway_route_report(self, + gateway_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Delete route report. + + Delete a route report. + + :param str gateway_id: Direct Link gateway identifier. + :param str id: Route report identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if gateway_id is None: + raise ValueError('gateway_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_gateway_route_report') + headers.update(sdk_headers) + + params = { + 'version': self.version + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_gateway_route_report(self, + gateway_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve route report. + + Retrieve a route report. + + :param str gateway_id: Direct Link gateway identifier. + :param str id: Route report identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + """ + + if gateway_id is None: + raise ValueError('gateway_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_gateway_route_report') + headers.update(sdk_headers) + + params = { + 'version': self.version + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + ######################### # gateways ######################### @@ -417,6 +610,7 @@ def create_gateway_action(self, id: str, action: str, *, + as_prepends: List['AsPrependTemplate'] = None, authentication_key: 'GatewayActionTemplateAuthenticationKey' = None, bfd_config: 'GatewayBfdConfigActionTemplate' = None, connection_mode: str = None, @@ -435,6 +629,9 @@ def create_gateway_action(self, :param str id: Direct Link Connect gateway identifier. :param str action: Action request. + :param List[AsPrependTemplate] as_prepends: (optional) Applicable for + create_gateway_approve requests to create AS Prepends. Contains an array of + AS Prepend configuration information. :param GatewayActionTemplateAuthenticationKey authentication_key: (optional) Applicable for create_gateway_approve requests to select the gateway's BGP MD5 authentication key. @@ -478,6 +675,8 @@ def create_gateway_action(self, raise ValueError('id must be provided') if action is None: raise ValueError('action must be provided') + if as_prepends is not None: + as_prepends = [convert_model(x) for x in as_prepends] if authentication_key is not None: authentication_key = convert_model(authentication_key) if bfd_config is not None: @@ -498,6 +697,7 @@ def create_gateway_action(self, data = { 'action': action, + 'as_prepends': as_prepends, 'authentication_key': authentication_key, 'bfd_config': bfd_config, 'connection_mode': connection_mode, @@ -1367,60 +1567,87 @@ class OfferingType(str, Enum): ############################################################################## -class CrossConnectRouter(): +class AsPrepend(): """ - Cross Connect Router details. + AS Prepend. - :attr List[str] capabilities: (optional) Array of capabilities for this router. - :attr str router_name: (optional) The name of the Router. - :attr int total_connections: (optional) Count of existing Direct Link Dedicated - gateways on this router for this account. + :attr datetime created_at: (optional) The date and time resource was created. + :attr str id: (optional) The unique identifier for this AS Prepend. + :attr int length: (optional) Number of times the ASN to appended to the AS Path. + :attr str policy: (optional) Route type this AS Prepend applies to. + :attr str prefix: (optional) Comma separated list of prefixes this AS Prepend + applies to. If empty, this applies to all prefixes. + :attr datetime updated_at: (optional) The date and time resource was last + updated. """ def __init__(self, *, - capabilities: List[str] = None, - router_name: str = None, - total_connections: int = None) -> None: - """ - Initialize a CrossConnectRouter object. - - :param List[str] capabilities: (optional) Array of capabilities for this - router. - :param str router_name: (optional) The name of the Router. - :param int total_connections: (optional) Count of existing Direct Link - Dedicated gateways on this router for this account. + created_at: datetime = None, + id: str = None, + length: int = None, + policy: str = None, + prefix: str = None, + updated_at: datetime = None) -> None: + """ + Initialize a AsPrepend object. + + :param datetime created_at: (optional) The date and time resource was + created. + :param str id: (optional) The unique identifier for this AS Prepend. + :param int length: (optional) Number of times the ASN to appended to the AS + Path. + :param str policy: (optional) Route type this AS Prepend applies to. + :param str prefix: (optional) Comma separated list of prefixes this AS + Prepend applies to. If empty, this applies to all prefixes. + :param datetime updated_at: (optional) The date and time resource was last + updated. """ - self.capabilities = capabilities - self.router_name = router_name - self.total_connections = total_connections + self.created_at = created_at + self.id = id + self.length = length + self.policy = policy + self.prefix = prefix + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'CrossConnectRouter': - """Initialize a CrossConnectRouter object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AsPrepend': + """Initialize a AsPrepend object from a json dictionary.""" args = {} - if 'capabilities' in _dict: - args['capabilities'] = _dict.get('capabilities') - if 'router_name' in _dict: - args['router_name'] = _dict.get('router_name') - if 'total_connections' in _dict: - args['total_connections'] = _dict.get('total_connections') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + if 'id' in _dict: + args['id'] = _dict.get('id') + if 'length' in _dict: + args['length'] = _dict.get('length') + if 'policy' in _dict: + args['policy'] = _dict.get('policy') + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') + if 'updated_at' in _dict: + args['updated_at'] = string_to_datetime(_dict.get('updated_at')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a CrossConnectRouter object from a json dictionary.""" + """Initialize a AsPrepend object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'capabilities') and self.capabilities is not None: - _dict['capabilities'] = self.capabilities - if hasattr(self, 'router_name') and self.router_name is not None: - _dict['router_name'] = self.router_name - if hasattr(self, 'total_connections') and self.total_connections is not None: - _dict['total_connections'] = self.total_connections + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'length') and self.length is not None: + _dict['length'] = self.length + if hasattr(self, 'policy') and self.policy is not None: + _dict['policy'] = self.policy + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) return _dict def _to_dict(self): @@ -1428,58 +1655,228 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this CrossConnectRouter object.""" + """Return a `str` version of this AsPrepend object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'CrossConnectRouter') -> bool: + def __eq__(self, other: 'AsPrepend') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'CrossConnectRouter') -> bool: + def __ne__(self, other: 'AsPrepend') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Gateway(): + class PolicyEnum(str, Enum): + """ + Route type this AS Prepend applies to. + """ + IMPORT = 'import' + EXPORT = 'export' + + +class AsPrependTemplate(): """ - gateway. + Create AS Prepend Configuration template. - :attr GatewayAuthenticationKey authentication_key: (optional) The identity of - the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdConfig bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: Customer BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and - no longer recognized by the Direct Link APIs. - See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation after - 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. - :attr int bgp_ibm_asn: (optional) IBM BGP ASN. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated - values for this property may expand in the future. Code and processes using this - field must tolerate unexpected values. - :attr datetime bgp_status_updated_at: (optional) Date and time bgp status was - updated. - :attr str carrier_name: (optional) Carrier name. Only set for type=dedicated - gateways. - :attr GatewayChangeRequest change_request: (optional) Changes pending approval - for provider managed Direct Link Connect gateways. - :attr str completion_notice_reject_reason: (optional) Reason for completion - notice rejection. Only included on type=dedicated gateways with a rejected - completion notice. - :attr str connection_mode: (optional) Type of services this Gateway is attached - to. Mode transit means this Gateway will be attached to Transit Gateway Service - and direct means this Gateway will be attached to vpc or classic connection. The - list of enumerated values for this property may expand in the future. Code and - processes using this field must tolerate unexpected values. - :attr datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :attr int length: Number of times the ASN to appended to the AS Path. + :attr str policy: Route type this AS Prepend applies to. + :attr str prefix: (optional) Comma separated list of prefixes this AS Prepend + applies to. Maximum of 10 prefixes. If not specified, this AS Prepend applies + to all prefixes. + """ + + def __init__(self, + length: int, + policy: str, + *, + prefix: str = None) -> None: + """ + Initialize a AsPrependTemplate object. + + :param int length: Number of times the ASN to appended to the AS Path. + :param str policy: Route type this AS Prepend applies to. + :param str prefix: (optional) Comma separated list of prefixes this AS + Prepend applies to. Maximum of 10 prefixes. If not specified, this AS + Prepend applies to all prefixes. + """ + self.length = length + self.policy = policy + self.prefix = prefix + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AsPrependTemplate': + """Initialize a AsPrependTemplate object from a json dictionary.""" + args = {} + if 'length' in _dict: + args['length'] = _dict.get('length') + else: + raise ValueError('Required property \'length\' not present in AsPrependTemplate JSON') + if 'policy' in _dict: + args['policy'] = _dict.get('policy') + else: + raise ValueError('Required property \'policy\' not present in AsPrependTemplate JSON') + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AsPrependTemplate object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'length') and self.length is not None: + _dict['length'] = self.length + if hasattr(self, 'policy') and self.policy is not None: + _dict['policy'] = self.policy + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AsPrependTemplate object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AsPrependTemplate') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AsPrependTemplate') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class PolicyEnum(str, Enum): + """ + Route type this AS Prepend applies to. + """ + IMPORT = 'import' + EXPORT = 'export' + + +class CrossConnectRouter(): + """ + Cross Connect Router details. + + :attr List[str] capabilities: (optional) Array of capabilities for this router. + :attr str router_name: (optional) The name of the Router. + :attr int total_connections: (optional) Count of existing Direct Link Dedicated + gateways on this router for this account. + """ + + def __init__(self, + *, + capabilities: List[str] = None, + router_name: str = None, + total_connections: int = None) -> None: + """ + Initialize a CrossConnectRouter object. + + :param List[str] capabilities: (optional) Array of capabilities for this + router. + :param str router_name: (optional) The name of the Router. + :param int total_connections: (optional) Count of existing Direct Link + Dedicated gateways on this router for this account. + """ + self.capabilities = capabilities + self.router_name = router_name + self.total_connections = total_connections + + @classmethod + def from_dict(cls, _dict: Dict) -> 'CrossConnectRouter': + """Initialize a CrossConnectRouter object from a json dictionary.""" + args = {} + if 'capabilities' in _dict: + args['capabilities'] = _dict.get('capabilities') + if 'router_name' in _dict: + args['router_name'] = _dict.get('router_name') + if 'total_connections' in _dict: + args['total_connections'] = _dict.get('total_connections') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a CrossConnectRouter object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'capabilities') and self.capabilities is not None: + _dict['capabilities'] = self.capabilities + if hasattr(self, 'router_name') and self.router_name is not None: + _dict['router_name'] = self.router_name + if hasattr(self, 'total_connections') and self.total_connections is not None: + _dict['total_connections'] = self.total_connections + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this CrossConnectRouter object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'CrossConnectRouter') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'CrossConnectRouter') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class Gateway(): + """ + gateway. + + :attr List[AsPrepend] as_prepends: (optional) array of AS Prepend information. + :attr GatewayAuthenticationKey authentication_key: (optional) The identity of + the standard key to use for BGP MD5 authentication key. + The key material that you provide must be base64 encoded and original string + must be maximum 126 ASCII characters in length. + To clear the optional `authentication_key` field patch its crn to `""`. + :attr GatewayBfdConfig bfd_config: (optional) BFD configuration information. + :attr int bgp_asn: Customer BGP ASN. + :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and + no longer recognized by the Direct Link APIs. + See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. + Deprecated field bgp_base_cidr will be removed from the API specificiation after + 15-MAR-2021. + :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :attr int bgp_ibm_asn: (optional) IBM BGP ASN. + :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + values for this property may expand in the future. Code and processes using this + field must tolerate unexpected values. + :attr datetime bgp_status_updated_at: (optional) Date and time bgp status was + updated. + :attr str carrier_name: (optional) Carrier name. Only set for type=dedicated + gateways. + :attr GatewayChangeRequest change_request: (optional) Changes pending approval + for provider managed Direct Link Connect gateways. + :attr str completion_notice_reject_reason: (optional) Reason for completion + notice rejection. Only included on type=dedicated gateways with a rejected + completion notice. + :attr str connection_mode: (optional) Type of services this Gateway is attached + to. Mode transit means this Gateway will be attached to Transit Gateway Service + and direct means this Gateway will be attached to vpc or classic connection. The + list of enumerated values for this property may expand in the future. Code and + processes using this field must tolerate unexpected values. + :attr datetime created_at: The date and time resource was created. + :attr str crn: The CRN (Cloud Resource Name) of this gateway. + :attr str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :attr str customer_name: (optional) Customer name. Only set for type=dedicated gateways. @@ -1533,6 +1930,7 @@ def __init__(self, speed_mbps: int, type: str, *, + as_prepends: List['AsPrepend'] = None, authentication_key: 'GatewayAuthenticationKey' = None, bfd_config: 'GatewayBfdConfig' = None, bgp_base_cidr: str = None, @@ -1577,6 +1975,8 @@ def __init__(self, :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + :param List[AsPrepend] as_prepends: (optional) array of AS Prepend + information. :param GatewayAuthenticationKey authentication_key: (optional) The identity of the standard key to use for BGP MD5 authentication key. The key material that you provide must be base64 encoded and original @@ -1634,6 +2034,7 @@ def __init__(self, :param int vlan: (optional) VLAN allocated for this gateway. Only set for type=connect gateways. """ + self.as_prepends = as_prepends self.authentication_key = authentication_key self.bfd_config = bfd_config self.bgp_asn = bgp_asn @@ -1673,6 +2074,8 @@ def __init__(self, def from_dict(cls, _dict: Dict) -> 'Gateway': """Initialize a Gateway object from a json dictionary.""" args = {} + if 'as_prepends' in _dict: + args['as_prepends'] = [AsPrepend.from_dict(x) for x in _dict.get('as_prepends')] if 'authentication_key' in _dict: args['authentication_key'] = GatewayAuthenticationKey.from_dict(_dict.get('authentication_key')) if 'bfd_config' in _dict: @@ -1775,6 +2178,8 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'as_prepends') and self.as_prepends is not None: + _dict['as_prepends'] = [x.to_dict() for x in self.as_prepends] if hasattr(self, 'authentication_key') and self.authentication_key is not None: _dict['authentication_key'] = self.authentication_key.to_dict() if hasattr(self, 'bfd_config') and self.bfd_config is not None: @@ -3686,7 +4091,7 @@ class GatewayStatusCollection(): """ gateway status. - :attr List[GatewayStatus] status: (optional) + :attr List[GatewayStatus] status: (optional) array of status. """ def __init__(self, @@ -3695,7 +4100,7 @@ def __init__(self, """ Initialize a GatewayStatusCollection object. - :param List[GatewayStatus] status: (optional) + :param List[GatewayStatus] status: (optional) array of status. """ self.status = status @@ -3747,6 +4152,8 @@ class GatewayTemplate(): """ Create gateway template. + :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :attr GatewayTemplateAuthenticationKey authentication_key: (optional) The identity of the standard key to use for BGP MD5 authentication key. The key material that you provide must be base64 encoded and original string @@ -3803,6 +4210,7 @@ def __init__(self, speed_mbps: int, type: str, *, + as_prepends: List['AsPrependTemplate'] = None, authentication_key: 'GatewayTemplateAuthenticationKey' = None, bfd_config: 'GatewayBfdConfigTemplate' = None, bgp_base_cidr: str = None, @@ -3823,6 +4231,8 @@ def __init__(self, :param str name: The unique user-defined name for this gateway. :param int speed_mbps: Gateway speed in megabits per second. :param str type: Offering type. + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :param GatewayTemplateAuthenticationKey authentication_key: (optional) The identity of the standard key to use for BGP MD5 authentication key. The key material that you provide must be base64 encoded and original @@ -4727,71 +5137,507 @@ class PortCollection(): """ def __init__(self, - first: 'PortsPaginatedCollectionFirst', - limit: int, - total_count: int, - *, - next: 'PortsPaginatedCollectionNext' = None, - ports: List['Port'] = None) -> None: + first: 'PortsPaginatedCollectionFirst', + limit: int, + total_count: int, + *, + next: 'PortsPaginatedCollectionNext' = None, + ports: List['Port'] = None) -> None: + """ + Initialize a PortCollection object. + + :param PortsPaginatedCollectionFirst first: A reference to the first page + of resources. + :param int limit: The maximum number of resources can be returned by the + request. + :param int total_count: The total number of resources across all pages. + :param PortsPaginatedCollectionNext next: (optional) A reference to the + next page of resources; this reference is included for all pages except the + last page. + :param List[Port] ports: (optional) Array of ports. + """ + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + self.ports = ports + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PortCollection': + """Initialize a PortCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = PortsPaginatedCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in PortCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in PortCollection JSON') + if 'next' in _dict: + args['next'] = PortsPaginatedCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in PortCollection JSON') + if 'ports' in _dict: + args['ports'] = [Port.from_dict(x) for x in _dict.get('ports')] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PortCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'ports') and self.ports is not None: + _dict['ports'] = [x.to_dict() for x in self.ports] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PortCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PortCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PortCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class PortsPaginatedCollectionFirst(): + """ + A reference to the first page of resources. + + :attr str href: The URL for the first page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a PortsPaginatedCollectionFirst object. + + :param str href: The URL for the first page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionFirst': + """Initialize a PortsPaginatedCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PortsPaginatedCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PortsPaginatedCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PortsPaginatedCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PortsPaginatedCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PortsPaginatedCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class PortsPaginatedCollectionNext(): + """ + A reference to the next page of resources; this reference is included for all pages + except the last page. + + :attr str href: URL for the next page of resources. + :attr str start: (optional) start token for the next page of resources. + """ + + def __init__(self, + href: str, + *, + start: str = None) -> None: + """ + Initialize a PortsPaginatedCollectionNext object. + + :param str href: URL for the next page of resources. + :param str start: (optional) start token for the next page of resources. + """ + self.href = href + self.start = start + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionNext': + """Initialize a PortsPaginatedCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PortsPaginatedCollectionNext JSON') + if 'start' in _dict: + args['start'] = _dict.get('start') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PortsPaginatedCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'start') and self.start is not None: + _dict['start'] = self.start + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PortsPaginatedCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PortsPaginatedCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PortsPaginatedCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class ResourceGroupIdentity(): + """ + Resource group for this resource. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + + :attr str id: Resource group identifier. + """ + + def __init__(self, + id: str) -> None: + """ + Initialize a ResourceGroupIdentity object. + + :param str id: Resource group identifier. + """ + self.id = id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentity': + """Initialize a ResourceGroupIdentity object from a json dictionary.""" + args = {} + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ResourceGroupIdentity JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ResourceGroupIdentity object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ResourceGroupIdentity object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ResourceGroupIdentity') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ResourceGroupIdentity') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class ResourceGroupReference(): + """ + Resource group reference. + + :attr str id: Resource group identifier. + """ + + def __init__(self, + id: str) -> None: + """ + Initialize a ResourceGroupReference object. + + :param str id: Resource group identifier. + """ + self.id = id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': + """Initialize a ResourceGroupReference object from a json dictionary.""" + args = {} + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ResourceGroupReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ResourceGroupReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ResourceGroupReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ResourceGroupReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class RouteReport(): + """ + route report. + + :attr datetime created_at: Date and time route report was requested. + :attr List[RouteReportRoute] gateway_routes: Array of local/direct routes. + :attr str id: Report identifier. + :attr List[RouteReportOnPremRoute] on_prem_routes: Array of on premises routes. + :attr List[RouteReportOverlappingRouteGroup] overlapping_routes: Array of + overlapping routes. + :attr str status: Route report status. The list of enumerated values for this + property may expand in the future. Code and processes using this field must + tolerate unexpected values. + :attr datetime updated_at: (optional) Date and time route report was last + modified. + :attr List[RouteReportConnection] virtual_connection_routes: Array of routes on + virtual connections. + """ + + def __init__(self, + created_at: datetime, + gateway_routes: List['RouteReportRoute'], + id: str, + on_prem_routes: List['RouteReportOnPremRoute'], + overlapping_routes: List['RouteReportOverlappingRouteGroup'], + status: str, + virtual_connection_routes: List['RouteReportConnection'], + *, + updated_at: datetime = None) -> None: + """ + Initialize a RouteReport object. + + :param datetime created_at: Date and time route report was requested. + :param List[RouteReportRoute] gateway_routes: Array of local/direct routes. + :param str id: Report identifier. + :param List[RouteReportOnPremRoute] on_prem_routes: Array of on premises + routes. + :param List[RouteReportOverlappingRouteGroup] overlapping_routes: Array of + overlapping routes. + :param str status: Route report status. The list of enumerated values for + this property may expand in the future. Code and processes using this field + must tolerate unexpected values. + :param List[RouteReportConnection] virtual_connection_routes: Array of + routes on virtual connections. + :param datetime updated_at: (optional) Date and time route report was last + modified. + """ + self.created_at = created_at + self.gateway_routes = gateway_routes + self.id = id + self.on_prem_routes = on_prem_routes + self.overlapping_routes = overlapping_routes + self.status = status + self.updated_at = updated_at + self.virtual_connection_routes = virtual_connection_routes + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteReport': + """Initialize a RouteReport object from a json dictionary.""" + args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in RouteReport JSON') + if 'gateway_routes' in _dict: + args['gateway_routes'] = [RouteReportRoute.from_dict(x) for x in _dict.get('gateway_routes')] + else: + raise ValueError('Required property \'gateway_routes\' not present in RouteReport JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in RouteReport JSON') + if 'on_prem_routes' in _dict: + args['on_prem_routes'] = [RouteReportOnPremRoute.from_dict(x) for x in _dict.get('on_prem_routes')] + else: + raise ValueError('Required property \'on_prem_routes\' not present in RouteReport JSON') + if 'overlapping_routes' in _dict: + args['overlapping_routes'] = [RouteReportOverlappingRouteGroup.from_dict(x) for x in _dict.get('overlapping_routes')] + else: + raise ValueError('Required property \'overlapping_routes\' not present in RouteReport JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in RouteReport JSON') + if 'updated_at' in _dict: + args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if 'virtual_connection_routes' in _dict: + args['virtual_connection_routes'] = [RouteReportConnection.from_dict(x) for x in _dict.get('virtual_connection_routes')] + else: + raise ValueError('Required property \'virtual_connection_routes\' not present in RouteReport JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteReport object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'gateway_routes') and self.gateway_routes is not None: + _dict['gateway_routes'] = [x.to_dict() for x in self.gateway_routes] + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'on_prem_routes') and self.on_prem_routes is not None: + _dict['on_prem_routes'] = [x.to_dict() for x in self.on_prem_routes] + if hasattr(self, 'overlapping_routes') and self.overlapping_routes is not None: + _dict['overlapping_routes'] = [x.to_dict() for x in self.overlapping_routes] + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) + if hasattr(self, 'virtual_connection_routes') and self.virtual_connection_routes is not None: + _dict['virtual_connection_routes'] = [x.to_dict() for x in self.virtual_connection_routes] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RouteReport object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteReport') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'RouteReport') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + Route report status. The list of enumerated values for this property may expand in + the future. Code and processes using this field must tolerate unexpected values. + """ + COMPLETE = 'complete' + PENDING = 'pending' + + +class RouteReportCollection(): + """ + route reports. + + :attr List[RouteReport] route_reports: Array of route reports. + """ + + def __init__(self, + route_reports: List['RouteReport']) -> None: """ - Initialize a PortCollection object. + Initialize a RouteReportCollection object. - :param PortsPaginatedCollectionFirst first: A reference to the first page - of resources. - :param int limit: The maximum number of resources can be returned by the - request. - :param int total_count: The total number of resources across all pages. - :param PortsPaginatedCollectionNext next: (optional) A reference to the - next page of resources; this reference is included for all pages except the - last page. - :param List[Port] ports: (optional) Array of ports. + :param List[RouteReport] route_reports: Array of route reports. """ - self.first = first - self.limit = limit - self.next = next - self.total_count = total_count - self.ports = ports + self.route_reports = route_reports @classmethod - def from_dict(cls, _dict: Dict) -> 'PortCollection': - """Initialize a PortCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReportCollection': + """Initialize a RouteReportCollection object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = PortsPaginatedCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in PortCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in PortCollection JSON') - if 'next' in _dict: - args['next'] = PortsPaginatedCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if 'route_reports' in _dict: + args['route_reports'] = [RouteReport.from_dict(x) for x in _dict.get('route_reports')] else: - raise ValueError('Required property \'total_count\' not present in PortCollection JSON') - if 'ports' in _dict: - args['ports'] = [Port.from_dict(x) for x in _dict.get('ports')] + raise ValueError('Required property \'route_reports\' not present in RouteReportCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PortCollection object from a json dictionary.""" + """Initialize a RouteReportCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'ports') and self.ports is not None: - _dict['ports'] = [x.to_dict() for x in self.ports] + if hasattr(self, 'route_reports') and self.route_reports is not None: + _dict['route_reports'] = [x.to_dict() for x in self.route_reports] return _dict def _to_dict(self): @@ -4799,55 +5645,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PortCollection object.""" + """Return a `str` version of this RouteReportCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PortCollection') -> bool: + def __eq__(self, other: 'RouteReportCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PortCollection') -> bool: + def __ne__(self, other: 'RouteReportCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PortsPaginatedCollectionFirst(): +class RouteReportConnection(): """ - A reference to the first page of resources. + Routes of a virtual connection. - :attr str href: The URL for the first page of resources. + :attr List[RouteReportRoute] routes: Array of virtual connection's routes. + :attr str virtual_connection_id: (optional) ID of virtual connection. + :attr str virtual_connection_name: (optional) name of virtual connection. + :attr str virtual_connection_type: (optional) type of virtual connection. """ def __init__(self, - href: str) -> None: + routes: List['RouteReportRoute'], + *, + virtual_connection_id: str = None, + virtual_connection_name: str = None, + virtual_connection_type: str = None) -> None: """ - Initialize a PortsPaginatedCollectionFirst object. + Initialize a RouteReportConnection object. - :param str href: The URL for the first page of resources. + :param List[RouteReportRoute] routes: Array of virtual connection's routes. + :param str virtual_connection_id: (optional) ID of virtual connection. + :param str virtual_connection_name: (optional) name of virtual connection. + :param str virtual_connection_type: (optional) type of virtual connection. """ - self.href = href + self.routes = routes + self.virtual_connection_id = virtual_connection_id + self.virtual_connection_name = virtual_connection_name + self.virtual_connection_type = virtual_connection_type @classmethod - def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionFirst': - """Initialize a PortsPaginatedCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReportConnection': + """Initialize a RouteReportConnection object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'routes' in _dict: + args['routes'] = [RouteReportRoute.from_dict(x) for x in _dict.get('routes')] else: - raise ValueError('Required property \'href\' not present in PortsPaginatedCollectionFirst JSON') + raise ValueError('Required property \'routes\' not present in RouteReportConnection JSON') + if 'virtual_connection_id' in _dict: + args['virtual_connection_id'] = _dict.get('virtual_connection_id') + if 'virtual_connection_name' in _dict: + args['virtual_connection_name'] = _dict.get('virtual_connection_name') + if 'virtual_connection_type' in _dict: + args['virtual_connection_type'] = _dict.get('virtual_connection_type') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PortsPaginatedCollectionFirst object from a json dictionary.""" + """Initialize a RouteReportConnection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'routes') and self.routes is not None: + _dict['routes'] = [x.to_dict() for x in self.routes] + if hasattr(self, 'virtual_connection_id') and self.virtual_connection_id is not None: + _dict['virtual_connection_id'] = self.virtual_connection_id + if hasattr(self, 'virtual_connection_name') and self.virtual_connection_name is not None: + _dict['virtual_connection_name'] = self.virtual_connection_name + if hasattr(self, 'virtual_connection_type') and self.virtual_connection_type is not None: + _dict['virtual_connection_type'] = self.virtual_connection_type return _dict def _to_dict(self): @@ -4855,65 +5726,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PortsPaginatedCollectionFirst object.""" + """Return a `str` version of this RouteReportConnection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PortsPaginatedCollectionFirst') -> bool: + def __eq__(self, other: 'RouteReportConnection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PortsPaginatedCollectionFirst') -> bool: + def __ne__(self, other: 'RouteReportConnection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PortsPaginatedCollectionNext(): +class RouteReportOnPremRoute(): """ - A reference to the next page of resources; this reference is included for all pages - except the last page. + on-prem route. - :attr str href: URL for the next page of resources. - :attr str start: (optional) start token for the next page of resources. + :attr str next_hop: (optional) Next hop address. + :attr str prefix: (optional) prefix. """ def __init__(self, - href: str, *, - start: str = None) -> None: + next_hop: str = None, + prefix: str = None) -> None: """ - Initialize a PortsPaginatedCollectionNext object. + Initialize a RouteReportOnPremRoute object. - :param str href: URL for the next page of resources. - :param str start: (optional) start token for the next page of resources. + :param str next_hop: (optional) Next hop address. + :param str prefix: (optional) prefix. """ - self.href = href - self.start = start + self.next_hop = next_hop + self.prefix = prefix @classmethod - def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionNext': - """Initialize a PortsPaginatedCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReportOnPremRoute': + """Initialize a RouteReportOnPremRoute object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in PortsPaginatedCollectionNext JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if 'next_hop' in _dict: + args['next_hop'] = _dict.get('next_hop') + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PortsPaginatedCollectionNext object from a json dictionary.""" + """Initialize a RouteReportOnPremRoute object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start + if hasattr(self, 'next_hop') and self.next_hop is not None: + _dict['next_hop'] = self.next_hop + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix return _dict def _to_dict(self): @@ -4921,56 +5789,77 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PortsPaginatedCollectionNext object.""" + """Return a `str` version of this RouteReportOnPremRoute object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PortsPaginatedCollectionNext') -> bool: + def __eq__(self, other: 'RouteReportOnPremRoute') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PortsPaginatedCollectionNext') -> bool: + def __ne__(self, other: 'RouteReportOnPremRoute') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ResourceGroupIdentity(): +class RouteReportOverlappingRoute(): """ - Resource group for this resource. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + overlapping route details. - :attr str id: Resource group identifier. + """ + + def __init__(self) -> None: + """ + Initialize a RouteReportOverlappingRoute object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RouteReportOverlappingRouteForConnection', 'RouteReportOverlappingRouteForOthers'])) + raise Exception(msg) + +class RouteReportOverlappingRouteGroup(): + """ + Collection of overlapping route. + + :attr List[RouteReportOverlappingRoute] routes: (optional) Array of overlapping + connection/prefix pairs. """ def __init__(self, - id: str) -> None: + *, + routes: List['RouteReportOverlappingRoute'] = None) -> None: """ - Initialize a ResourceGroupIdentity object. + Initialize a RouteReportOverlappingRouteGroup object. - :param str id: Resource group identifier. + :param List[RouteReportOverlappingRoute] routes: (optional) Array of + overlapping connection/prefix pairs. """ - self.id = id + self.routes = routes @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentity': - """Initialize a ResourceGroupIdentity object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteGroup': + """Initialize a RouteReportOverlappingRouteGroup object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ResourceGroupIdentity JSON') + if 'routes' in _dict: + args['routes'] = _dict.get('routes') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourceGroupIdentity object from a json dictionary.""" + """Initialize a RouteReportOverlappingRouteGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'routes') and self.routes is not None: + routes_list = [] + for x in self.routes: + if isinstance(x, dict): + routes_list.append(x) + else: + routes_list.append(x.to_dict()) + _dict['routes'] = routes_list return _dict def _to_dict(self): @@ -4978,55 +5867,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourceGroupIdentity object.""" + """Return a `str` version of this RouteReportOverlappingRouteGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourceGroupIdentity') -> bool: + def __eq__(self, other: 'RouteReportOverlappingRouteGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ResourceGroupIdentity') -> bool: + def __ne__(self, other: 'RouteReportOverlappingRouteGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ResourceGroupReference(): +class RouteReportRoute(): """ - Resource group reference. + route. - :attr str id: Resource group identifier. + :attr str prefix: (optional) prefix. """ def __init__(self, - id: str) -> None: + *, + prefix: str = None) -> None: """ - Initialize a ResourceGroupReference object. + Initialize a RouteReportRoute object. - :param str id: Resource group identifier. + :param str prefix: (optional) prefix. """ - self.id = id + self.prefix = prefix @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': - """Initialize a ResourceGroupReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReportRoute': + """Initialize a RouteReportRoute object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourceGroupReference object from a json dictionary.""" + """Initialize a RouteReportRoute object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix return _dict def _to_dict(self): @@ -5034,16 +5922,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourceGroupReference object.""" + """Return a `str` version of this RouteReportRoute object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourceGroupReference') -> bool: + def __eq__(self, other: 'RouteReportRoute') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ResourceGroupReference') -> bool: + def __ne__(self, other: 'RouteReportRoute') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -6076,6 +6964,8 @@ class GatewayTemplateGatewayTypeConnectTemplate(GatewayTemplate): """ Gateway fields specific to type=connect gateway create. + :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :attr GatewayTemplateAuthenticationKey authentication_key: (optional) :attr GatewayBfdConfigTemplate bfd_config: (optional) :attr int bgp_asn: BGP ASN. @@ -6127,6 +7017,7 @@ def __init__(self, type: str, port: 'GatewayPortIdentity', *, + as_prepends: List['AsPrependTemplate'] = None, authentication_key: 'GatewayTemplateAuthenticationKey' = None, bfd_config: 'GatewayBfdConfigTemplate' = None, bgp_base_cidr: str = None, @@ -6149,6 +7040,8 @@ def __init__(self, :param str type: Offering type. :param GatewayPortIdentity port: Select Port Label for new type=connect gateway. + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :param GatewayTemplateAuthenticationKey authentication_key: (optional) :param GatewayBfdConfigTemplate bfd_config: (optional) :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. @@ -6182,6 +7075,7 @@ def __init__(self, :param ResourceGroupIdentity resource_group: (optional) """ # pylint: disable=super-init-not-called + self.as_prepends = as_prepends self.authentication_key = authentication_key self.bfd_config = bfd_config self.bgp_asn = bgp_asn @@ -6202,6 +7096,8 @@ def __init__(self, def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeConnectTemplate': """Initialize a GatewayTemplateGatewayTypeConnectTemplate object from a json dictionary.""" args = {} + if 'as_prepends' in _dict: + args['as_prepends'] = [AsPrependTemplate.from_dict(x) for x in _dict.get('as_prepends')] if 'authentication_key' in _dict: args['authentication_key'] = GatewayTemplateAuthenticationKey.from_dict(_dict.get('authentication_key')) if 'bfd_config' in _dict: @@ -6256,6 +7152,8 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'as_prepends') and self.as_prepends is not None: + _dict['as_prepends'] = [x.to_dict() for x in self.as_prepends] if hasattr(self, 'authentication_key') and self.authentication_key is not None: _dict['authentication_key'] = self.authentication_key.to_dict() if hasattr(self, 'bfd_config') and self.bfd_config is not None: @@ -6330,6 +7228,8 @@ class GatewayTemplateGatewayTypeDedicatedTemplate(GatewayTemplate): """ Gateway fields specific to type=dedicated gateway create. + :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :attr GatewayTemplateAuthenticationKey authentication_key: (optional) :attr GatewayBfdConfigTemplate bfd_config: (optional) :attr int bgp_asn: BGP ASN. @@ -6389,6 +7289,7 @@ def __init__(self, customer_name: str, location_name: str, *, + as_prepends: List['AsPrependTemplate'] = None, authentication_key: 'GatewayTemplateAuthenticationKey' = None, bfd_config: 'GatewayBfdConfigTemplate' = None, bgp_base_cidr: str = None, @@ -6414,6 +7315,8 @@ def __init__(self, :param str cross_connect_router: Cross connect router. :param str customer_name: Customer name. :param str location_name: Gateway location. + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + configuration information. :param GatewayTemplateAuthenticationKey authentication_key: (optional) :param GatewayBfdConfigTemplate bfd_config: (optional) :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. @@ -6449,6 +7352,7 @@ def __init__(self, configuration information. Contact IBM support for access to MACsec. """ # pylint: disable=super-init-not-called + self.as_prepends = as_prepends self.authentication_key = authentication_key self.bfd_config = bfd_config self.bgp_asn = bgp_asn @@ -6473,6 +7377,8 @@ def __init__(self, def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeDedicatedTemplate': """Initialize a GatewayTemplateGatewayTypeDedicatedTemplate object from a json dictionary.""" args = {} + if 'as_prepends' in _dict: + args['as_prepends'] = [AsPrependTemplate.from_dict(x) for x in _dict.get('as_prepends')] if 'authentication_key' in _dict: args['authentication_key'] = GatewayTemplateAuthenticationKey.from_dict(_dict.get('authentication_key')) if 'bfd_config' in _dict: @@ -6541,6 +7447,8 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'as_prepends') and self.as_prepends is not None: + _dict['as_prepends'] = [x.to_dict() for x in self.as_prepends] if hasattr(self, 'authentication_key') and self.authentication_key is not None: _dict['authentication_key'] = self.authentication_key.to_dict() if hasattr(self, 'bfd_config') and self.bfd_config is not None: @@ -6618,3 +7526,162 @@ class TypeEnum(str, Enum): CONNECT = 'connect' DEDICATED = 'dedicated' + +class RouteReportOverlappingRouteForConnection(RouteReportOverlappingRoute): + """ + overlapping route details. + + :attr str prefix: overlapping prefix. + :attr str type: type of the route. + :attr str virtual_connection_id: virtual connection ID. + """ + + def __init__(self, + prefix: str, + type: str, + virtual_connection_id: str) -> None: + """ + Initialize a RouteReportOverlappingRouteForConnection object. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + :param str virtual_connection_id: virtual connection ID. + """ + # pylint: disable=super-init-not-called + self.prefix = prefix + self.type = type + self.virtual_connection_id = virtual_connection_id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForConnection': + """Initialize a RouteReportOverlappingRouteForConnection object from a json dictionary.""" + args = {} + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') + else: + raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForConnection JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForConnection JSON') + if 'virtual_connection_id' in _dict: + args['virtual_connection_id'] = _dict.get('virtual_connection_id') + else: + raise ValueError('Required property \'virtual_connection_id\' not present in RouteReportOverlappingRouteForConnection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteReportOverlappingRouteForConnection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'virtual_connection_id') and self.virtual_connection_id is not None: + _dict['virtual_connection_id'] = self.virtual_connection_id + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RouteReportOverlappingRouteForConnection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteReportOverlappingRouteForConnection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'RouteReportOverlappingRouteForConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + type of the route. + """ + VIRTUAL_CONNECTION = 'virtual_connection' + + +class RouteReportOverlappingRouteForOthers(RouteReportOverlappingRoute): + """ + overlapping route details. + + :attr str prefix: overlapping prefix. + :attr str type: type of the route. + """ + + def __init__(self, + prefix: str, + type: str) -> None: + """ + Initialize a RouteReportOverlappingRouteForOthers object. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + """ + # pylint: disable=super-init-not-called + self.prefix = prefix + self.type = type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForOthers': + """Initialize a RouteReportOverlappingRouteForOthers object from a json dictionary.""" + args = {} + if 'prefix' in _dict: + args['prefix'] = _dict.get('prefix') + else: + raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForOthers JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForOthers JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteReportOverlappingRouteForOthers object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RouteReportOverlappingRouteForOthers object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteReportOverlappingRouteForOthers') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'RouteReportOverlappingRouteForOthers') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + type of the route. + """ + GATEWAY = 'gateway' + ON_PREM = 'on_prem' + diff --git a/pylint.sh b/pylint.sh index d3909f0..ee4d19b 100755 --- a/pylint.sh +++ b/pylint.sh @@ -1,3 +1,3 @@ #!/bin/bash -pylint ibm_cloud_networking_services test --exit-zero +python -m pylint ibm_cloud_networking_services test/unit test/integration diff --git a/test/unit/test_direct_link_v1.py b/test/unit/test_direct_link_v1.py index c826954..63e3168 100644 --- a/test/unit/test_direct_link_v1.py +++ b/test/unit/test_direct_link_v1.py @@ -42,6 +42,413 @@ _base_url = 'https://directlink.cloud.ibm.com/v1' _service.set_service_url(_base_url) +############################################################################## +# Start of Service: GatewayRouteReports +############################################################################## +# region + +class TestNewInstance(): + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = DirectLinkV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, DirectLinkV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = DirectLinkV1.new_instance( + version=version, + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = DirectLinkV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = DirectLinkV1.new_instance( + version=None, + ) +class TestListGatewayRouteReports(): + """ + Test Class for list_gateway_route_reports + """ + + def preprocess_url(self, request_url: str): + """ + Preprocess the request URL to ensure the mock response will be found. + """ + request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded + request_url = urllib.parse.quote(request_url, safe=':/') + if re.fullmatch('.*/+', request_url) is None: + return request_url + else: + return re.compile(request_url.rstrip('/') + '/+') + + @responses.activate + def test_list_gateway_route_reports_all_params(self): + """ + list_gateway_route_reports() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports') + mock_response = '{"route_reports": [{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + gateway_id = 'testString' + + # Invoke method + response = _service.list_gateway_route_reports( + gateway_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_gateway_route_reports_all_params_with_retries(self): + # Enable retries and run test_list_gateway_route_reports_all_params. + _service.enable_retries() + self.test_list_gateway_route_reports_all_params() + + # Disable retries and run test_list_gateway_route_reports_all_params. + _service.disable_retries() + self.test_list_gateway_route_reports_all_params() + + @responses.activate + def test_list_gateway_route_reports_value_error(self): + """ + test_list_gateway_route_reports_value_error() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports') + mock_response = '{"route_reports": [{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + gateway_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_gateway_route_reports(**req_copy) + + + def test_list_gateway_route_reports_value_error_with_retries(self): + # Enable retries and run test_list_gateway_route_reports_value_error. + _service.enable_retries() + self.test_list_gateway_route_reports_value_error() + + # Disable retries and run test_list_gateway_route_reports_value_error. + _service.disable_retries() + self.test_list_gateway_route_reports_value_error() + +class TestCreateGatewayRouteReport(): + """ + Test Class for create_gateway_route_report + """ + + def preprocess_url(self, request_url: str): + """ + Preprocess the request URL to ensure the mock response will be found. + """ + request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded + request_url = urllib.parse.quote(request_url, safe=':/') + if re.fullmatch('.*/+', request_url) is None: + return request_url + else: + return re.compile(request_url.rstrip('/') + '/+') + + @responses.activate + def test_create_gateway_route_report_all_params(self): + """ + create_gateway_route_report() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202) + + # Set up parameter values + gateway_id = 'testString' + + # Invoke method + response = _service.create_gateway_route_report( + gateway_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 202 + + def test_create_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_create_gateway_route_report_all_params. + _service.enable_retries() + self.test_create_gateway_route_report_all_params() + + # Disable retries and run test_create_gateway_route_report_all_params. + _service.disable_retries() + self.test_create_gateway_route_report_all_params() + + @responses.activate + def test_create_gateway_route_report_value_error(self): + """ + test_create_gateway_route_report_value_error() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202) + + # Set up parameter values + gateway_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_gateway_route_report(**req_copy) + + + def test_create_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_create_gateway_route_report_value_error. + _service.enable_retries() + self.test_create_gateway_route_report_value_error() + + # Disable retries and run test_create_gateway_route_report_value_error. + _service.disable_retries() + self.test_create_gateway_route_report_value_error() + +class TestDeleteGatewayRouteReport(): + """ + Test Class for delete_gateway_route_report + """ + + def preprocess_url(self, request_url: str): + """ + Preprocess the request URL to ensure the mock response will be found. + """ + request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded + request_url = urllib.parse.quote(request_url, safe=':/') + if re.fullmatch('.*/+', request_url) is None: + return request_url + else: + return re.compile(request_url.rstrip('/') + '/+') + + @responses.activate + def test_delete_gateway_route_report_all_params(self): + """ + delete_gateway_route_report() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + gateway_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.delete_gateway_route_report( + gateway_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_delete_gateway_route_report_all_params. + _service.enable_retries() + self.test_delete_gateway_route_report_all_params() + + # Disable retries and run test_delete_gateway_route_report_all_params. + _service.disable_retries() + self.test_delete_gateway_route_report_all_params() + + @responses.activate + def test_delete_gateway_route_report_value_error(self): + """ + test_delete_gateway_route_report_value_error() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + gateway_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_gateway_route_report(**req_copy) + + + def test_delete_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_delete_gateway_route_report_value_error. + _service.enable_retries() + self.test_delete_gateway_route_report_value_error() + + # Disable retries and run test_delete_gateway_route_report_value_error. + _service.disable_retries() + self.test_delete_gateway_route_report_value_error() + +class TestGetGatewayRouteReport(): + """ + Test Class for get_gateway_route_report + """ + + def preprocess_url(self, request_url: str): + """ + Preprocess the request URL to ensure the mock response will be found. + """ + request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded + request_url = urllib.parse.quote(request_url, safe=':/') + if re.fullmatch('.*/+', request_url) is None: + return request_url + else: + return re.compile(request_url.rstrip('/') + '/+') + + @responses.activate + def test_get_gateway_route_report_all_params(self): + """ + get_gateway_route_report() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + gateway_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.get_gateway_route_report( + gateway_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_get_gateway_route_report_all_params. + _service.enable_retries() + self.test_get_gateway_route_report_all_params() + + # Disable retries and run test_get_gateway_route_report_all_params. + _service.disable_retries() + self.test_get_gateway_route_report_all_params() + + @responses.activate + def test_get_gateway_route_report_value_error(self): + """ + test_get_gateway_route_report_value_error() + """ + # Set up mock + url = self.preprocess_url(_base_url + '/gateways/testString/route_reports/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + gateway_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_gateway_route_report(**req_copy) + + + def test_get_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_get_gateway_route_report_value_error. + _service.enable_retries() + self.test_get_gateway_route_report_value_error() + + # Disable retries and run test_get_gateway_route_report_value_error. + _service.disable_retries() + self.test_get_gateway_route_report_value_error() + +# endregion +############################################################################## +# End of Service: GatewayRouteReports +############################################################################## + ############################################################################## # Start of Service: Gateways ############################################################################## @@ -113,7 +520,7 @@ def test_list_gateways_all_params(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways') - mock_response = '{"gateways": [{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' + mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' responses.add(responses.GET, url, body=mock_response, @@ -129,13 +536,13 @@ def test_list_gateways_all_params(self): assert response.status_code == 200 def test_list_gateways_all_params_with_retries(self): - # Enable retries and run test_list_gateways_all_params. - _service.enable_retries() - self.test_list_gateways_all_params() + # Enable retries and run test_list_gateways_all_params. + _service.enable_retries() + self.test_list_gateways_all_params() - # Disable retries and run test_list_gateways_all_params. - _service.disable_retries() - self.test_list_gateways_all_params() + # Disable retries and run test_list_gateways_all_params. + _service.disable_retries() + self.test_list_gateways_all_params() @responses.activate def test_list_gateways_value_error(self): @@ -144,7 +551,7 @@ def test_list_gateways_value_error(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways') - mock_response = '{"gateways": [{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' + mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' responses.add(responses.GET, url, body=mock_response, @@ -161,13 +568,13 @@ def test_list_gateways_value_error(self): def test_list_gateways_value_error_with_retries(self): - # Enable retries and run test_list_gateways_value_error. - _service.enable_retries() - self.test_list_gateways_value_error() + # Enable retries and run test_list_gateways_value_error. + _service.enable_retries() + self.test_list_gateways_value_error() - # Disable retries and run test_list_gateways_value_error. - _service.disable_retries() - self.test_list_gateways_value_error() + # Disable retries and run test_list_gateways_value_error. + _service.disable_retries() + self.test_list_gateways_value_error() class TestCreateGateway(): """ @@ -192,13 +599,19 @@ def test_create_gateway_all_params(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a AsPrependTemplate model + as_prepend_template_model = {} + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + # Construct a dict representation of a GatewayTemplateAuthenticationKey model gateway_template_authentication_key_model = {} gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -229,6 +642,7 @@ def test_create_gateway_all_params(self): # Construct a dict representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_model = {} + gateway_template_model['as_prepends'] = [as_prepend_template_model] gateway_template_model['authentication_key'] = gateway_template_authentication_key_model gateway_template_model['bfd_config'] = gateway_bfd_config_template_model gateway_template_model['bgp_asn'] = 64999 @@ -266,13 +680,13 @@ def test_create_gateway_all_params(self): assert req_body == gateway_template def test_create_gateway_all_params_with_retries(self): - # Enable retries and run test_create_gateway_all_params. - _service.enable_retries() - self.test_create_gateway_all_params() + # Enable retries and run test_create_gateway_all_params. + _service.enable_retries() + self.test_create_gateway_all_params() - # Disable retries and run test_create_gateway_all_params. - _service.disable_retries() - self.test_create_gateway_all_params() + # Disable retries and run test_create_gateway_all_params. + _service.disable_retries() + self.test_create_gateway_all_params() @responses.activate def test_create_gateway_value_error(self): @@ -281,13 +695,19 @@ def test_create_gateway_value_error(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a AsPrependTemplate model + as_prepend_template_model = {} + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + # Construct a dict representation of a GatewayTemplateAuthenticationKey model gateway_template_authentication_key_model = {} gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -318,6 +738,7 @@ def test_create_gateway_value_error(self): # Construct a dict representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_model = {} + gateway_template_model['as_prepends'] = [as_prepend_template_model] gateway_template_model['authentication_key'] = gateway_template_authentication_key_model gateway_template_model['bfd_config'] = gateway_bfd_config_template_model gateway_template_model['bgp_asn'] = 64999 @@ -352,13 +773,13 @@ def test_create_gateway_value_error(self): def test_create_gateway_value_error_with_retries(self): - # Enable retries and run test_create_gateway_value_error. - _service.enable_retries() - self.test_create_gateway_value_error() + # Enable retries and run test_create_gateway_value_error. + _service.enable_retries() + self.test_create_gateway_value_error() - # Disable retries and run test_create_gateway_value_error. - _service.disable_retries() - self.test_create_gateway_value_error() + # Disable retries and run test_create_gateway_value_error. + _service.disable_retries() + self.test_create_gateway_value_error() class TestDeleteGateway(): """ @@ -401,13 +822,13 @@ def test_delete_gateway_all_params(self): assert response.status_code == 204 def test_delete_gateway_all_params_with_retries(self): - # Enable retries and run test_delete_gateway_all_params. - _service.enable_retries() - self.test_delete_gateway_all_params() + # Enable retries and run test_delete_gateway_all_params. + _service.enable_retries() + self.test_delete_gateway_all_params() - # Disable retries and run test_delete_gateway_all_params. - _service.disable_retries() - self.test_delete_gateway_all_params() + # Disable retries and run test_delete_gateway_all_params. + _service.disable_retries() + self.test_delete_gateway_all_params() @responses.activate def test_delete_gateway_value_error(self): @@ -434,13 +855,13 @@ def test_delete_gateway_value_error(self): def test_delete_gateway_value_error_with_retries(self): - # Enable retries and run test_delete_gateway_value_error. - _service.enable_retries() - self.test_delete_gateway_value_error() + # Enable retries and run test_delete_gateway_value_error. + _service.enable_retries() + self.test_delete_gateway_value_error() - # Disable retries and run test_delete_gateway_value_error. - _service.disable_retries() - self.test_delete_gateway_value_error() + # Disable retries and run test_delete_gateway_value_error. + _service.disable_retries() + self.test_delete_gateway_value_error() class TestGetGateway(): """ @@ -465,7 +886,7 @@ def test_get_gateway_all_params(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.GET, url, body=mock_response, @@ -486,13 +907,13 @@ def test_get_gateway_all_params(self): assert response.status_code == 200 def test_get_gateway_all_params_with_retries(self): - # Enable retries and run test_get_gateway_all_params. - _service.enable_retries() - self.test_get_gateway_all_params() + # Enable retries and run test_get_gateway_all_params. + _service.enable_retries() + self.test_get_gateway_all_params() - # Disable retries and run test_get_gateway_all_params. - _service.disable_retries() - self.test_get_gateway_all_params() + # Disable retries and run test_get_gateway_all_params. + _service.disable_retries() + self.test_get_gateway_all_params() @responses.activate def test_get_gateway_value_error(self): @@ -501,7 +922,7 @@ def test_get_gateway_value_error(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.GET, url, body=mock_response, @@ -522,13 +943,13 @@ def test_get_gateway_value_error(self): def test_get_gateway_value_error_with_retries(self): - # Enable retries and run test_get_gateway_value_error. - _service.enable_retries() - self.test_get_gateway_value_error() + # Enable retries and run test_get_gateway_value_error. + _service.enable_retries() + self.test_get_gateway_value_error() - # Disable retries and run test_get_gateway_value_error. - _service.disable_retries() - self.test_get_gateway_value_error() + # Disable retries and run test_get_gateway_value_error. + _service.disable_retries() + self.test_get_gateway_value_error() class TestUpdateGateway(): """ @@ -553,7 +974,7 @@ def test_update_gateway_all_params(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.PATCH, url, body=mock_response, @@ -642,13 +1063,13 @@ def test_update_gateway_all_params(self): assert req_body['speed_mbps'] == 1000 def test_update_gateway_all_params_with_retries(self): - # Enable retries and run test_update_gateway_all_params. - _service.enable_retries() - self.test_update_gateway_all_params() + # Enable retries and run test_update_gateway_all_params. + _service.enable_retries() + self.test_update_gateway_all_params() - # Disable retries and run test_update_gateway_all_params. - _service.disable_retries() - self.test_update_gateway_all_params() + # Disable retries and run test_update_gateway_all_params. + _service.disable_retries() + self.test_update_gateway_all_params() @responses.activate def test_update_gateway_value_error(self): @@ -657,7 +1078,7 @@ def test_update_gateway_value_error(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.PATCH, url, body=mock_response, @@ -716,13 +1137,13 @@ def test_update_gateway_value_error(self): def test_update_gateway_value_error_with_retries(self): - # Enable retries and run test_update_gateway_value_error. - _service.enable_retries() - self.test_update_gateway_value_error() + # Enable retries and run test_update_gateway_value_error. + _service.enable_retries() + self.test_update_gateway_value_error() - # Disable retries and run test_update_gateway_value_error. - _service.disable_retries() - self.test_update_gateway_value_error() + # Disable retries and run test_update_gateway_value_error. + _service.disable_retries() + self.test_update_gateway_value_error() class TestCreateGatewayAction(): """ @@ -747,13 +1168,19 @@ def test_create_gateway_action_all_params(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString/actions') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a AsPrependTemplate model + as_prepend_template_model = {} + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + # Construct a dict representation of a GatewayActionTemplateAuthenticationKey model gateway_action_template_authentication_key_model = {} gateway_action_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -774,6 +1201,7 @@ def test_create_gateway_action_all_params(self): # Set up parameter values id = 'testString' action = 'create_gateway_approve' + as_prepends = [as_prepend_template_model] authentication_key = gateway_action_template_authentication_key_model bfd_config = gateway_bfd_config_action_template_model connection_mode = 'transit' @@ -786,6 +1214,7 @@ def test_create_gateway_action_all_params(self): response = _service.create_gateway_action( id, action, + as_prepends=as_prepends, authentication_key=authentication_key, bfd_config=bfd_config, connection_mode=connection_mode, @@ -802,6 +1231,7 @@ def test_create_gateway_action_all_params(self): # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) assert req_body['action'] == 'create_gateway_approve' + assert req_body['as_prepends'] == [as_prepend_template_model] assert req_body['authentication_key'] == gateway_action_template_authentication_key_model assert req_body['bfd_config'] == gateway_bfd_config_action_template_model assert req_body['connection_mode'] == 'transit' @@ -811,13 +1241,13 @@ def test_create_gateway_action_all_params(self): assert req_body['updates'] == [gateway_action_template_updates_item_model] def test_create_gateway_action_all_params_with_retries(self): - # Enable retries and run test_create_gateway_action_all_params. - _service.enable_retries() - self.test_create_gateway_action_all_params() + # Enable retries and run test_create_gateway_action_all_params. + _service.enable_retries() + self.test_create_gateway_action_all_params() - # Disable retries and run test_create_gateway_action_all_params. - _service.disable_retries() - self.test_create_gateway_action_all_params() + # Disable retries and run test_create_gateway_action_all_params. + _service.disable_retries() + self.test_create_gateway_action_all_params() @responses.activate def test_create_gateway_action_value_error(self): @@ -826,13 +1256,19 @@ def test_create_gateway_action_value_error(self): """ # Set up mock url = self.preprocess_url(_base_url + '/gateways/testString/actions') - mock_response = '{"authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "active", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a AsPrependTemplate model + as_prepend_template_model = {} + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + # Construct a dict representation of a GatewayActionTemplateAuthenticationKey model gateway_action_template_authentication_key_model = {} gateway_action_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -853,6 +1289,7 @@ def test_create_gateway_action_value_error(self): # Set up parameter values id = 'testString' action = 'create_gateway_approve' + as_prepends = [as_prepend_template_model] authentication_key = gateway_action_template_authentication_key_model bfd_config = gateway_bfd_config_action_template_model connection_mode = 'transit' @@ -873,13 +1310,13 @@ def test_create_gateway_action_value_error(self): def test_create_gateway_action_value_error_with_retries(self): - # Enable retries and run test_create_gateway_action_value_error. - _service.enable_retries() - self.test_create_gateway_action_value_error() + # Enable retries and run test_create_gateway_action_value_error. + _service.enable_retries() + self.test_create_gateway_action_value_error() - # Disable retries and run test_create_gateway_action_value_error. - _service.disable_retries() - self.test_create_gateway_action_value_error() + # Disable retries and run test_create_gateway_action_value_error. + _service.disable_retries() + self.test_create_gateway_action_value_error() class TestListGatewayCompletionNotice(): """ @@ -925,13 +1362,13 @@ def test_list_gateway_completion_notice_all_params(self): assert response.status_code == 200 def test_list_gateway_completion_notice_all_params_with_retries(self): - # Enable retries and run test_list_gateway_completion_notice_all_params. - _service.enable_retries() - self.test_list_gateway_completion_notice_all_params() + # Enable retries and run test_list_gateway_completion_notice_all_params. + _service.enable_retries() + self.test_list_gateway_completion_notice_all_params() - # Disable retries and run test_list_gateway_completion_notice_all_params. - _service.disable_retries() - self.test_list_gateway_completion_notice_all_params() + # Disable retries and run test_list_gateway_completion_notice_all_params. + _service.disable_retries() + self.test_list_gateway_completion_notice_all_params() @responses.activate def test_list_gateway_completion_notice_value_error(self): @@ -961,13 +1398,13 @@ def test_list_gateway_completion_notice_value_error(self): def test_list_gateway_completion_notice_value_error_with_retries(self): - # Enable retries and run test_list_gateway_completion_notice_value_error. - _service.enable_retries() - self.test_list_gateway_completion_notice_value_error() + # Enable retries and run test_list_gateway_completion_notice_value_error. + _service.enable_retries() + self.test_list_gateway_completion_notice_value_error() - # Disable retries and run test_list_gateway_completion_notice_value_error. - _service.disable_retries() - self.test_list_gateway_completion_notice_value_error() + # Disable retries and run test_list_gateway_completion_notice_value_error. + _service.disable_retries() + self.test_list_gateway_completion_notice_value_error() class TestCreateGatewayCompletionNotice(): """ @@ -1014,13 +1451,13 @@ def test_create_gateway_completion_notice_all_params(self): assert response.status_code == 204 def test_create_gateway_completion_notice_all_params_with_retries(self): - # Enable retries and run test_create_gateway_completion_notice_all_params. - _service.enable_retries() - self.test_create_gateway_completion_notice_all_params() + # Enable retries and run test_create_gateway_completion_notice_all_params. + _service.enable_retries() + self.test_create_gateway_completion_notice_all_params() - # Disable retries and run test_create_gateway_completion_notice_all_params. - _service.disable_retries() - self.test_create_gateway_completion_notice_all_params() + # Disable retries and run test_create_gateway_completion_notice_all_params. + _service.disable_retries() + self.test_create_gateway_completion_notice_all_params() @responses.activate def test_create_gateway_completion_notice_required_params(self): @@ -1047,13 +1484,13 @@ def test_create_gateway_completion_notice_required_params(self): assert response.status_code == 204 def test_create_gateway_completion_notice_required_params_with_retries(self): - # Enable retries and run test_create_gateway_completion_notice_required_params. - _service.enable_retries() - self.test_create_gateway_completion_notice_required_params() + # Enable retries and run test_create_gateway_completion_notice_required_params. + _service.enable_retries() + self.test_create_gateway_completion_notice_required_params() - # Disable retries and run test_create_gateway_completion_notice_required_params. - _service.disable_retries() - self.test_create_gateway_completion_notice_required_params() + # Disable retries and run test_create_gateway_completion_notice_required_params. + _service.disable_retries() + self.test_create_gateway_completion_notice_required_params() @responses.activate def test_create_gateway_completion_notice_value_error(self): @@ -1080,13 +1517,13 @@ def test_create_gateway_completion_notice_value_error(self): def test_create_gateway_completion_notice_value_error_with_retries(self): - # Enable retries and run test_create_gateway_completion_notice_value_error. - _service.enable_retries() - self.test_create_gateway_completion_notice_value_error() + # Enable retries and run test_create_gateway_completion_notice_value_error. + _service.enable_retries() + self.test_create_gateway_completion_notice_value_error() - # Disable retries and run test_create_gateway_completion_notice_value_error. - _service.disable_retries() - self.test_create_gateway_completion_notice_value_error() + # Disable retries and run test_create_gateway_completion_notice_value_error. + _service.disable_retries() + self.test_create_gateway_completion_notice_value_error() class TestListGatewayLetterOfAuthorization(): """ @@ -1132,13 +1569,13 @@ def test_list_gateway_letter_of_authorization_all_params(self): assert response.status_code == 200 def test_list_gateway_letter_of_authorization_all_params_with_retries(self): - # Enable retries and run test_list_gateway_letter_of_authorization_all_params. - _service.enable_retries() - self.test_list_gateway_letter_of_authorization_all_params() + # Enable retries and run test_list_gateway_letter_of_authorization_all_params. + _service.enable_retries() + self.test_list_gateway_letter_of_authorization_all_params() - # Disable retries and run test_list_gateway_letter_of_authorization_all_params. - _service.disable_retries() - self.test_list_gateway_letter_of_authorization_all_params() + # Disable retries and run test_list_gateway_letter_of_authorization_all_params. + _service.disable_retries() + self.test_list_gateway_letter_of_authorization_all_params() @responses.activate def test_list_gateway_letter_of_authorization_value_error(self): @@ -1168,13 +1605,13 @@ def test_list_gateway_letter_of_authorization_value_error(self): def test_list_gateway_letter_of_authorization_value_error_with_retries(self): - # Enable retries and run test_list_gateway_letter_of_authorization_value_error. - _service.enable_retries() - self.test_list_gateway_letter_of_authorization_value_error() + # Enable retries and run test_list_gateway_letter_of_authorization_value_error. + _service.enable_retries() + self.test_list_gateway_letter_of_authorization_value_error() - # Disable retries and run test_list_gateway_letter_of_authorization_value_error. - _service.disable_retries() - self.test_list_gateway_letter_of_authorization_value_error() + # Disable retries and run test_list_gateway_letter_of_authorization_value_error. + _service.disable_retries() + self.test_list_gateway_letter_of_authorization_value_error() class TestGetGatewayStatistics(): """ @@ -1226,13 +1663,13 @@ def test_get_gateway_statistics_all_params(self): assert 'type={}'.format(type) in query_string def test_get_gateway_statistics_all_params_with_retries(self): - # Enable retries and run test_get_gateway_statistics_all_params. - _service.enable_retries() - self.test_get_gateway_statistics_all_params() + # Enable retries and run test_get_gateway_statistics_all_params. + _service.enable_retries() + self.test_get_gateway_statistics_all_params() - # Disable retries and run test_get_gateway_statistics_all_params. - _service.disable_retries() - self.test_get_gateway_statistics_all_params() + # Disable retries and run test_get_gateway_statistics_all_params. + _service.disable_retries() + self.test_get_gateway_statistics_all_params() @responses.activate def test_get_gateway_statistics_value_error(self): @@ -1264,13 +1701,13 @@ def test_get_gateway_statistics_value_error(self): def test_get_gateway_statistics_value_error_with_retries(self): - # Enable retries and run test_get_gateway_statistics_value_error. - _service.enable_retries() - self.test_get_gateway_statistics_value_error() + # Enable retries and run test_get_gateway_statistics_value_error. + _service.enable_retries() + self.test_get_gateway_statistics_value_error() - # Disable retries and run test_get_gateway_statistics_value_error. - _service.disable_retries() - self.test_get_gateway_statistics_value_error() + # Disable retries and run test_get_gateway_statistics_value_error. + _service.disable_retries() + self.test_get_gateway_statistics_value_error() class TestGetGatewayStatus(): """ @@ -1322,13 +1759,13 @@ def test_get_gateway_status_all_params(self): assert 'type={}'.format(type) in query_string def test_get_gateway_status_all_params_with_retries(self): - # Enable retries and run test_get_gateway_status_all_params. - _service.enable_retries() - self.test_get_gateway_status_all_params() + # Enable retries and run test_get_gateway_status_all_params. + _service.enable_retries() + self.test_get_gateway_status_all_params() - # Disable retries and run test_get_gateway_status_all_params. - _service.disable_retries() - self.test_get_gateway_status_all_params() + # Disable retries and run test_get_gateway_status_all_params. + _service.disable_retries() + self.test_get_gateway_status_all_params() @responses.activate def test_get_gateway_status_required_params(self): @@ -1358,13 +1795,13 @@ def test_get_gateway_status_required_params(self): assert response.status_code == 200 def test_get_gateway_status_required_params_with_retries(self): - # Enable retries and run test_get_gateway_status_required_params. - _service.enable_retries() - self.test_get_gateway_status_required_params() + # Enable retries and run test_get_gateway_status_required_params. + _service.enable_retries() + self.test_get_gateway_status_required_params() - # Disable retries and run test_get_gateway_status_required_params. - _service.disable_retries() - self.test_get_gateway_status_required_params() + # Disable retries and run test_get_gateway_status_required_params. + _service.disable_retries() + self.test_get_gateway_status_required_params() @responses.activate def test_get_gateway_status_value_error(self): @@ -1394,13 +1831,13 @@ def test_get_gateway_status_value_error(self): def test_get_gateway_status_value_error_with_retries(self): - # Enable retries and run test_get_gateway_status_value_error. - _service.enable_retries() - self.test_get_gateway_status_value_error() + # Enable retries and run test_get_gateway_status_value_error. + _service.enable_retries() + self.test_get_gateway_status_value_error() - # Disable retries and run test_get_gateway_status_value_error. - _service.disable_retries() - self.test_get_gateway_status_value_error() + # Disable retries and run test_get_gateway_status_value_error. + _service.disable_retries() + self.test_get_gateway_status_value_error() # endregion ############################################################################## @@ -1499,13 +1936,13 @@ def test_list_offering_type_locations_all_params(self): assert response.status_code == 200 def test_list_offering_type_locations_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_locations_all_params. - _service.enable_retries() - self.test_list_offering_type_locations_all_params() + # Enable retries and run test_list_offering_type_locations_all_params. + _service.enable_retries() + self.test_list_offering_type_locations_all_params() - # Disable retries and run test_list_offering_type_locations_all_params. - _service.disable_retries() - self.test_list_offering_type_locations_all_params() + # Disable retries and run test_list_offering_type_locations_all_params. + _service.disable_retries() + self.test_list_offering_type_locations_all_params() @responses.activate def test_list_offering_type_locations_value_error(self): @@ -1535,13 +1972,13 @@ def test_list_offering_type_locations_value_error(self): def test_list_offering_type_locations_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_locations_value_error. - _service.enable_retries() - self.test_list_offering_type_locations_value_error() + # Enable retries and run test_list_offering_type_locations_value_error. + _service.enable_retries() + self.test_list_offering_type_locations_value_error() - # Disable retries and run test_list_offering_type_locations_value_error. - _service.disable_retries() - self.test_list_offering_type_locations_value_error() + # Disable retries and run test_list_offering_type_locations_value_error. + _service.disable_retries() + self.test_list_offering_type_locations_value_error() class TestListOfferingTypeLocationCrossConnectRouters(): """ @@ -1589,13 +2026,13 @@ def test_list_offering_type_location_cross_connect_routers_all_params(self): assert response.status_code == 200 def test_list_offering_type_location_cross_connect_routers_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_location_cross_connect_routers_all_params. - _service.enable_retries() - self.test_list_offering_type_location_cross_connect_routers_all_params() + # Enable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + _service.enable_retries() + self.test_list_offering_type_location_cross_connect_routers_all_params() - # Disable retries and run test_list_offering_type_location_cross_connect_routers_all_params. - _service.disable_retries() - self.test_list_offering_type_location_cross_connect_routers_all_params() + # Disable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + _service.disable_retries() + self.test_list_offering_type_location_cross_connect_routers_all_params() @responses.activate def test_list_offering_type_location_cross_connect_routers_value_error(self): @@ -1627,13 +2064,13 @@ def test_list_offering_type_location_cross_connect_routers_value_error(self): def test_list_offering_type_location_cross_connect_routers_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_location_cross_connect_routers_value_error. - _service.enable_retries() - self.test_list_offering_type_location_cross_connect_routers_value_error() + # Enable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + _service.enable_retries() + self.test_list_offering_type_location_cross_connect_routers_value_error() - # Disable retries and run test_list_offering_type_location_cross_connect_routers_value_error. - _service.disable_retries() - self.test_list_offering_type_location_cross_connect_routers_value_error() + # Disable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + _service.disable_retries() + self.test_list_offering_type_location_cross_connect_routers_value_error() class TestListOfferingTypeSpeeds(): """ @@ -1679,13 +2116,13 @@ def test_list_offering_type_speeds_all_params(self): assert response.status_code == 200 def test_list_offering_type_speeds_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_speeds_all_params. - _service.enable_retries() - self.test_list_offering_type_speeds_all_params() + # Enable retries and run test_list_offering_type_speeds_all_params. + _service.enable_retries() + self.test_list_offering_type_speeds_all_params() - # Disable retries and run test_list_offering_type_speeds_all_params. - _service.disable_retries() - self.test_list_offering_type_speeds_all_params() + # Disable retries and run test_list_offering_type_speeds_all_params. + _service.disable_retries() + self.test_list_offering_type_speeds_all_params() @responses.activate def test_list_offering_type_speeds_value_error(self): @@ -1715,13 +2152,13 @@ def test_list_offering_type_speeds_value_error(self): def test_list_offering_type_speeds_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_speeds_value_error. - _service.enable_retries() - self.test_list_offering_type_speeds_value_error() + # Enable retries and run test_list_offering_type_speeds_value_error. + _service.enable_retries() + self.test_list_offering_type_speeds_value_error() - # Disable retries and run test_list_offering_type_speeds_value_error. - _service.disable_retries() - self.test_list_offering_type_speeds_value_error() + # Disable retries and run test_list_offering_type_speeds_value_error. + _service.disable_retries() + self.test_list_offering_type_speeds_value_error() # endregion ############################################################################## @@ -1830,13 +2267,13 @@ def test_list_ports_all_params(self): assert 'location_name={}'.format(location_name) in query_string def test_list_ports_all_params_with_retries(self): - # Enable retries and run test_list_ports_all_params. - _service.enable_retries() - self.test_list_ports_all_params() + # Enable retries and run test_list_ports_all_params. + _service.enable_retries() + self.test_list_ports_all_params() - # Disable retries and run test_list_ports_all_params. - _service.disable_retries() - self.test_list_ports_all_params() + # Disable retries and run test_list_ports_all_params. + _service.disable_retries() + self.test_list_ports_all_params() @responses.activate def test_list_ports_required_params(self): @@ -1861,13 +2298,13 @@ def test_list_ports_required_params(self): assert response.status_code == 200 def test_list_ports_required_params_with_retries(self): - # Enable retries and run test_list_ports_required_params. - _service.enable_retries() - self.test_list_ports_required_params() + # Enable retries and run test_list_ports_required_params. + _service.enable_retries() + self.test_list_ports_required_params() - # Disable retries and run test_list_ports_required_params. - _service.disable_retries() - self.test_list_ports_required_params() + # Disable retries and run test_list_ports_required_params. + _service.disable_retries() + self.test_list_ports_required_params() @responses.activate def test_list_ports_value_error(self): @@ -1893,13 +2330,13 @@ def test_list_ports_value_error(self): def test_list_ports_value_error_with_retries(self): - # Enable retries and run test_list_ports_value_error. - _service.enable_retries() - self.test_list_ports_value_error() + # Enable retries and run test_list_ports_value_error. + _service.enable_retries() + self.test_list_ports_value_error() - # Disable retries and run test_list_ports_value_error. - _service.disable_retries() - self.test_list_ports_value_error() + # Disable retries and run test_list_ports_value_error. + _service.disable_retries() + self.test_list_ports_value_error() class TestGetPort(): """ @@ -1945,13 +2382,13 @@ def test_get_port_all_params(self): assert response.status_code == 200 def test_get_port_all_params_with_retries(self): - # Enable retries and run test_get_port_all_params. - _service.enable_retries() - self.test_get_port_all_params() + # Enable retries and run test_get_port_all_params. + _service.enable_retries() + self.test_get_port_all_params() - # Disable retries and run test_get_port_all_params. - _service.disable_retries() - self.test_get_port_all_params() + # Disable retries and run test_get_port_all_params. + _service.disable_retries() + self.test_get_port_all_params() @responses.activate def test_get_port_value_error(self): @@ -1981,13 +2418,13 @@ def test_get_port_value_error(self): def test_get_port_value_error_with_retries(self): - # Enable retries and run test_get_port_value_error. - _service.enable_retries() - self.test_get_port_value_error() + # Enable retries and run test_get_port_value_error. + _service.enable_retries() + self.test_get_port_value_error() - # Disable retries and run test_get_port_value_error. - _service.disable_retries() - self.test_get_port_value_error() + # Disable retries and run test_get_port_value_error. + _service.disable_retries() + self.test_get_port_value_error() # endregion ############################################################################## @@ -2086,13 +2523,13 @@ def test_list_gateway_virtual_connections_all_params(self): assert response.status_code == 200 def test_list_gateway_virtual_connections_all_params_with_retries(self): - # Enable retries and run test_list_gateway_virtual_connections_all_params. - _service.enable_retries() - self.test_list_gateway_virtual_connections_all_params() + # Enable retries and run test_list_gateway_virtual_connections_all_params. + _service.enable_retries() + self.test_list_gateway_virtual_connections_all_params() - # Disable retries and run test_list_gateway_virtual_connections_all_params. - _service.disable_retries() - self.test_list_gateway_virtual_connections_all_params() + # Disable retries and run test_list_gateway_virtual_connections_all_params. + _service.disable_retries() + self.test_list_gateway_virtual_connections_all_params() @responses.activate def test_list_gateway_virtual_connections_value_error(self): @@ -2122,13 +2559,13 @@ def test_list_gateway_virtual_connections_value_error(self): def test_list_gateway_virtual_connections_value_error_with_retries(self): - # Enable retries and run test_list_gateway_virtual_connections_value_error. - _service.enable_retries() - self.test_list_gateway_virtual_connections_value_error() + # Enable retries and run test_list_gateway_virtual_connections_value_error. + _service.enable_retries() + self.test_list_gateway_virtual_connections_value_error() - # Disable retries and run test_list_gateway_virtual_connections_value_error. - _service.disable_retries() - self.test_list_gateway_virtual_connections_value_error() + # Disable retries and run test_list_gateway_virtual_connections_value_error. + _service.disable_retries() + self.test_list_gateway_virtual_connections_value_error() class TestCreateGatewayVirtualConnection(): """ @@ -2185,13 +2622,13 @@ def test_create_gateway_virtual_connection_all_params(self): assert req_body['network_id'] == 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' def test_create_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_create_gateway_virtual_connection_all_params. - _service.enable_retries() - self.test_create_gateway_virtual_connection_all_params() + # Enable retries and run test_create_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_create_gateway_virtual_connection_all_params() - # Disable retries and run test_create_gateway_virtual_connection_all_params. - _service.disable_retries() - self.test_create_gateway_virtual_connection_all_params() + # Disable retries and run test_create_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_create_gateway_virtual_connection_all_params() @responses.activate def test_create_gateway_virtual_connection_value_error(self): @@ -2226,13 +2663,13 @@ def test_create_gateway_virtual_connection_value_error(self): def test_create_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_create_gateway_virtual_connection_value_error. - _service.enable_retries() - self.test_create_gateway_virtual_connection_value_error() + # Enable retries and run test_create_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_create_gateway_virtual_connection_value_error() - # Disable retries and run test_create_gateway_virtual_connection_value_error. - _service.disable_retries() - self.test_create_gateway_virtual_connection_value_error() + # Disable retries and run test_create_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_create_gateway_virtual_connection_value_error() class TestDeleteGatewayVirtualConnection(): """ @@ -2277,13 +2714,13 @@ def test_delete_gateway_virtual_connection_all_params(self): assert response.status_code == 204 def test_delete_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_delete_gateway_virtual_connection_all_params. - _service.enable_retries() - self.test_delete_gateway_virtual_connection_all_params() + # Enable retries and run test_delete_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_delete_gateway_virtual_connection_all_params() - # Disable retries and run test_delete_gateway_virtual_connection_all_params. - _service.disable_retries() - self.test_delete_gateway_virtual_connection_all_params() + # Disable retries and run test_delete_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_delete_gateway_virtual_connection_all_params() @responses.activate def test_delete_gateway_virtual_connection_value_error(self): @@ -2312,13 +2749,13 @@ def test_delete_gateway_virtual_connection_value_error(self): def test_delete_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_delete_gateway_virtual_connection_value_error. - _service.enable_retries() - self.test_delete_gateway_virtual_connection_value_error() + # Enable retries and run test_delete_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_delete_gateway_virtual_connection_value_error() - # Disable retries and run test_delete_gateway_virtual_connection_value_error. - _service.disable_retries() - self.test_delete_gateway_virtual_connection_value_error() + # Disable retries and run test_delete_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_delete_gateway_virtual_connection_value_error() class TestGetGatewayVirtualConnection(): """ @@ -2366,13 +2803,13 @@ def test_get_gateway_virtual_connection_all_params(self): assert response.status_code == 200 def test_get_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_get_gateway_virtual_connection_all_params. - _service.enable_retries() - self.test_get_gateway_virtual_connection_all_params() + # Enable retries and run test_get_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_get_gateway_virtual_connection_all_params() - # Disable retries and run test_get_gateway_virtual_connection_all_params. - _service.disable_retries() - self.test_get_gateway_virtual_connection_all_params() + # Disable retries and run test_get_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_get_gateway_virtual_connection_all_params() @responses.activate def test_get_gateway_virtual_connection_value_error(self): @@ -2404,13 +2841,13 @@ def test_get_gateway_virtual_connection_value_error(self): def test_get_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_get_gateway_virtual_connection_value_error. - _service.enable_retries() - self.test_get_gateway_virtual_connection_value_error() + # Enable retries and run test_get_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_get_gateway_virtual_connection_value_error() - # Disable retries and run test_get_gateway_virtual_connection_value_error. - _service.disable_retries() - self.test_get_gateway_virtual_connection_value_error() + # Disable retries and run test_get_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_get_gateway_virtual_connection_value_error() class TestUpdateGatewayVirtualConnection(): """ @@ -2466,13 +2903,13 @@ def test_update_gateway_virtual_connection_all_params(self): assert req_body['status'] == 'attached' def test_update_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_update_gateway_virtual_connection_all_params. - _service.enable_retries() - self.test_update_gateway_virtual_connection_all_params() + # Enable retries and run test_update_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_update_gateway_virtual_connection_all_params() - # Disable retries and run test_update_gateway_virtual_connection_all_params. - _service.disable_retries() - self.test_update_gateway_virtual_connection_all_params() + # Disable retries and run test_update_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_update_gateway_virtual_connection_all_params() @responses.activate def test_update_gateway_virtual_connection_value_error(self): @@ -2506,13 +2943,13 @@ def test_update_gateway_virtual_connection_value_error(self): def test_update_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_update_gateway_virtual_connection_value_error. - _service.enable_retries() - self.test_update_gateway_virtual_connection_value_error() + # Enable retries and run test_update_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_update_gateway_virtual_connection_value_error() - # Disable retries and run test_update_gateway_virtual_connection_value_error. - _service.disable_retries() - self.test_update_gateway_virtual_connection_value_error() + # Disable retries and run test_update_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_update_gateway_virtual_connection_value_error() # endregion ############################################################################## @@ -2524,6 +2961,71 @@ def test_update_gateway_virtual_connection_value_error_with_retries(self): # Start of Model Tests ############################################################################## # region +class TestModel_AsPrepend(): + """ + Test Class for AsPrepend + """ + + def test_as_prepend_serialization(self): + """ + Test serialization/deserialization for AsPrepend + """ + + # Construct a json representation of a AsPrepend model + as_prepend_model_json = {} + as_prepend_model_json['created_at'] = "2019-01-01T12:00:00Z" + as_prepend_model_json['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + as_prepend_model_json['length'] = 4 + as_prepend_model_json['policy'] = 'import' + as_prepend_model_json['prefix'] = '172.17.0.0/16' + as_prepend_model_json['updated_at'] = "2019-01-01T12:00:00Z" + + # Construct a model instance of AsPrepend by calling from_dict on the json representation + as_prepend_model = AsPrepend.from_dict(as_prepend_model_json) + assert as_prepend_model != False + + # Construct a model instance of AsPrepend by calling from_dict on the json representation + as_prepend_model_dict = AsPrepend.from_dict(as_prepend_model_json).__dict__ + as_prepend_model2 = AsPrepend(**as_prepend_model_dict) + + # Verify the model instances are equivalent + assert as_prepend_model == as_prepend_model2 + + # Convert model instance back to dict and verify no loss of data + as_prepend_model_json2 = as_prepend_model.to_dict() + assert as_prepend_model_json2 == as_prepend_model_json + +class TestModel_AsPrependTemplate(): + """ + Test Class for AsPrependTemplate + """ + + def test_as_prepend_template_serialization(self): + """ + Test serialization/deserialization for AsPrependTemplate + """ + + # Construct a json representation of a AsPrependTemplate model + as_prepend_template_model_json = {} + as_prepend_template_model_json['length'] = 4 + as_prepend_template_model_json['policy'] = 'import' + as_prepend_template_model_json['prefix'] = '172.17.0.0/16' + + # Construct a model instance of AsPrependTemplate by calling from_dict on the json representation + as_prepend_template_model = AsPrependTemplate.from_dict(as_prepend_template_model_json) + assert as_prepend_template_model != False + + # Construct a model instance of AsPrependTemplate by calling from_dict on the json representation + as_prepend_template_model_dict = AsPrependTemplate.from_dict(as_prepend_template_model_json).__dict__ + as_prepend_template_model2 = AsPrependTemplate(**as_prepend_template_model_dict) + + # Verify the model instances are equivalent + assert as_prepend_template_model == as_prepend_template_model2 + + # Convert model instance back to dict and verify no loss of data + as_prepend_template_model_json2 = as_prepend_template_model.to_dict() + assert as_prepend_template_model_json2 == as_prepend_template_model_json + class TestModel_CrossConnectRouter(): """ Test Class for CrossConnectRouter @@ -2567,6 +3069,14 @@ def test_gateway_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + as_prepend_model = {} # AsPrepend + as_prepend_model['created_at'] = "2019-01-01T12:00:00Z" + as_prepend_model['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + as_prepend_model['length'] = 4 + as_prepend_model['policy'] = 'import' + as_prepend_model['prefix'] = '172.17.0.0/16' + as_prepend_model['updated_at'] = "2019-01-01T12:00:00Z" + gateway_authentication_key_model = {} # GatewayAuthenticationKey gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -2613,6 +3123,7 @@ def test_gateway_serialization(self): # Construct a json representation of a Gateway model gateway_model_json = {} + gateway_model_json['as_prepends'] = [as_prepend_model] gateway_model_json['authentication_key'] = gateway_authentication_key_model gateway_model_json['bfd_config'] = gateway_bfd_config_model gateway_model_json['bgp_asn'] = 64999 @@ -2855,6 +3366,14 @@ def test_gateway_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + as_prepend_model = {} # AsPrepend + as_prepend_model['created_at'] = "2019-01-01T12:00:00Z" + as_prepend_model['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + as_prepend_model['length'] = 4 + as_prepend_model['policy'] = 'import' + as_prepend_model['prefix'] = '172.17.0.0/16' + as_prepend_model['updated_at'] = "2019-01-01T12:00:00Z" + gateway_authentication_key_model = {} # GatewayAuthenticationKey gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -2900,6 +3419,7 @@ def test_gateway_collection_serialization(self): resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' gateway_model = {} # Gateway + gateway_model['as_prepends'] = [as_prepend_model] gateway_model['authentication_key'] = gateway_authentication_key_model gateway_model['bfd_config'] = gateway_bfd_config_model gateway_model['bgp_asn'] = 64999 @@ -3979,6 +4499,259 @@ def test_resource_group_reference_serialization(self): resource_group_reference_model_json2 = resource_group_reference_model.to_dict() assert resource_group_reference_model_json2 == resource_group_reference_model_json +class TestModel_RouteReport(): + """ + Test Class for RouteReport + """ + + def test_route_report_serialization(self): + """ + Test serialization/deserialization for RouteReport + """ + + # Construct dict forms of any model objects needed in order to build this model. + + route_report_route_model = {} # RouteReportRoute + route_report_route_model['prefix'] = '172.17.0.0/16' + + route_report_on_prem_route_model = {} # RouteReportOnPremRoute + route_report_on_prem_route_model['next_hop'] = '172.17.0.0' + route_report_on_prem_route_model['prefix'] = '172.17.0.0/16' + + route_report_overlapping_route_model = {} # RouteReportOverlappingRouteForConnection + route_report_overlapping_route_model['prefix'] = '172.17.0.0/16' + route_report_overlapping_route_model['type'] = 'virtual_connection' + route_report_overlapping_route_model['virtual_connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' + + route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup + route_report_overlapping_route_group_model['routes'] = [route_report_overlapping_route_model] + + route_report_connection_model = {} # RouteReportConnection + route_report_connection_model['routes'] = [route_report_route_model] + route_report_connection_model['virtual_connection_id'] = '3c265a62-91da-4261-a950-950b6af0eb58' + route_report_connection_model['virtual_connection_name'] = 'vpc1' + route_report_connection_model['virtual_connection_type'] = 'vpc' + + # Construct a json representation of a RouteReport model + route_report_model_json = {} + route_report_model_json['created_at'] = "2019-01-01T12:00:00Z" + route_report_model_json['gateway_routes'] = [route_report_route_model] + route_report_model_json['id'] = '1a15dcab-7e26-45e1-b7c5-bc690eaa9724' + route_report_model_json['on_prem_routes'] = [route_report_on_prem_route_model] + route_report_model_json['overlapping_routes'] = [route_report_overlapping_route_group_model] + route_report_model_json['status'] = 'complete' + route_report_model_json['updated_at'] = "2019-01-01T12:00:00Z" + route_report_model_json['virtual_connection_routes'] = [route_report_connection_model] + + # Construct a model instance of RouteReport by calling from_dict on the json representation + route_report_model = RouteReport.from_dict(route_report_model_json) + assert route_report_model != False + + # Construct a model instance of RouteReport by calling from_dict on the json representation + route_report_model_dict = RouteReport.from_dict(route_report_model_json).__dict__ + route_report_model2 = RouteReport(**route_report_model_dict) + + # Verify the model instances are equivalent + assert route_report_model == route_report_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_model_json2 = route_report_model.to_dict() + assert route_report_model_json2 == route_report_model_json + +class TestModel_RouteReportCollection(): + """ + Test Class for RouteReportCollection + """ + + def test_route_report_collection_serialization(self): + """ + Test serialization/deserialization for RouteReportCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + route_report_route_model = {} # RouteReportRoute + route_report_route_model['prefix'] = '172.17.0.0/16' + + route_report_on_prem_route_model = {} # RouteReportOnPremRoute + route_report_on_prem_route_model['next_hop'] = '172.17.0.0' + route_report_on_prem_route_model['prefix'] = '172.17.0.0/16' + + route_report_overlapping_route_model = {} # RouteReportOverlappingRouteForConnection + route_report_overlapping_route_model['prefix'] = '172.17.0.0/16' + route_report_overlapping_route_model['type'] = 'virtual_connection' + route_report_overlapping_route_model['virtual_connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' + + route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup + route_report_overlapping_route_group_model['routes'] = [route_report_overlapping_route_model] + + route_report_connection_model = {} # RouteReportConnection + route_report_connection_model['routes'] = [route_report_route_model] + route_report_connection_model['virtual_connection_id'] = '3c265a62-91da-4261-a950-950b6af0eb58' + route_report_connection_model['virtual_connection_name'] = 'vpc1' + route_report_connection_model['virtual_connection_type'] = 'vpc' + + route_report_model = {} # RouteReport + route_report_model['created_at'] = "2019-01-01T12:00:00Z" + route_report_model['gateway_routes'] = [route_report_route_model] + route_report_model['id'] = '1a15dcab-7e26-45e1-b7c5-bc690eaa9724' + route_report_model['on_prem_routes'] = [route_report_on_prem_route_model] + route_report_model['overlapping_routes'] = [route_report_overlapping_route_group_model] + route_report_model['status'] = 'complete' + route_report_model['updated_at'] = "2019-01-01T12:00:00Z" + route_report_model['virtual_connection_routes'] = [route_report_connection_model] + + # Construct a json representation of a RouteReportCollection model + route_report_collection_model_json = {} + route_report_collection_model_json['route_reports'] = [route_report_model] + + # Construct a model instance of RouteReportCollection by calling from_dict on the json representation + route_report_collection_model = RouteReportCollection.from_dict(route_report_collection_model_json) + assert route_report_collection_model != False + + # Construct a model instance of RouteReportCollection by calling from_dict on the json representation + route_report_collection_model_dict = RouteReportCollection.from_dict(route_report_collection_model_json).__dict__ + route_report_collection_model2 = RouteReportCollection(**route_report_collection_model_dict) + + # Verify the model instances are equivalent + assert route_report_collection_model == route_report_collection_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_collection_model_json2 = route_report_collection_model.to_dict() + assert route_report_collection_model_json2 == route_report_collection_model_json + +class TestModel_RouteReportConnection(): + """ + Test Class for RouteReportConnection + """ + + def test_route_report_connection_serialization(self): + """ + Test serialization/deserialization for RouteReportConnection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + route_report_route_model = {} # RouteReportRoute + route_report_route_model['prefix'] = '172.17.0.0/16' + + # Construct a json representation of a RouteReportConnection model + route_report_connection_model_json = {} + route_report_connection_model_json['routes'] = [route_report_route_model] + route_report_connection_model_json['virtual_connection_id'] = '3c265a62-91da-4261-a950-950b6af0eb58' + route_report_connection_model_json['virtual_connection_name'] = 'vpc1' + route_report_connection_model_json['virtual_connection_type'] = 'vpc' + + # Construct a model instance of RouteReportConnection by calling from_dict on the json representation + route_report_connection_model = RouteReportConnection.from_dict(route_report_connection_model_json) + assert route_report_connection_model != False + + # Construct a model instance of RouteReportConnection by calling from_dict on the json representation + route_report_connection_model_dict = RouteReportConnection.from_dict(route_report_connection_model_json).__dict__ + route_report_connection_model2 = RouteReportConnection(**route_report_connection_model_dict) + + # Verify the model instances are equivalent + assert route_report_connection_model == route_report_connection_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_connection_model_json2 = route_report_connection_model.to_dict() + assert route_report_connection_model_json2 == route_report_connection_model_json + +class TestModel_RouteReportOnPremRoute(): + """ + Test Class for RouteReportOnPremRoute + """ + + def test_route_report_on_prem_route_serialization(self): + """ + Test serialization/deserialization for RouteReportOnPremRoute + """ + + # Construct a json representation of a RouteReportOnPremRoute model + route_report_on_prem_route_model_json = {} + route_report_on_prem_route_model_json['next_hop'] = '172.17.0.0' + route_report_on_prem_route_model_json['prefix'] = '172.17.0.0/16' + + # Construct a model instance of RouteReportOnPremRoute by calling from_dict on the json representation + route_report_on_prem_route_model = RouteReportOnPremRoute.from_dict(route_report_on_prem_route_model_json) + assert route_report_on_prem_route_model != False + + # Construct a model instance of RouteReportOnPremRoute by calling from_dict on the json representation + route_report_on_prem_route_model_dict = RouteReportOnPremRoute.from_dict(route_report_on_prem_route_model_json).__dict__ + route_report_on_prem_route_model2 = RouteReportOnPremRoute(**route_report_on_prem_route_model_dict) + + # Verify the model instances are equivalent + assert route_report_on_prem_route_model == route_report_on_prem_route_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_on_prem_route_model_json2 = route_report_on_prem_route_model.to_dict() + assert route_report_on_prem_route_model_json2 == route_report_on_prem_route_model_json + +class TestModel_RouteReportOverlappingRouteGroup(): + """ + Test Class for RouteReportOverlappingRouteGroup + """ + + def test_route_report_overlapping_route_group_serialization(self): + """ + Test serialization/deserialization for RouteReportOverlappingRouteGroup + """ + + # Construct dict forms of any model objects needed in order to build this model. + + route_report_overlapping_route_model = {} # RouteReportOverlappingRouteForConnection + route_report_overlapping_route_model['prefix'] = '172.17.0.0/16' + route_report_overlapping_route_model['type'] = 'virtual_connection' + route_report_overlapping_route_model['virtual_connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' + + # Construct a json representation of a RouteReportOverlappingRouteGroup model + route_report_overlapping_route_group_model_json = {} + route_report_overlapping_route_group_model_json['routes'] = [route_report_overlapping_route_model] + + # Construct a model instance of RouteReportOverlappingRouteGroup by calling from_dict on the json representation + route_report_overlapping_route_group_model = RouteReportOverlappingRouteGroup.from_dict(route_report_overlapping_route_group_model_json) + assert route_report_overlapping_route_group_model != False + + # Construct a model instance of RouteReportOverlappingRouteGroup by calling from_dict on the json representation + route_report_overlapping_route_group_model_dict = RouteReportOverlappingRouteGroup.from_dict(route_report_overlapping_route_group_model_json).__dict__ + route_report_overlapping_route_group_model2 = RouteReportOverlappingRouteGroup(**route_report_overlapping_route_group_model_dict) + + # Verify the model instances are equivalent + assert route_report_overlapping_route_group_model == route_report_overlapping_route_group_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_overlapping_route_group_model_json2 = route_report_overlapping_route_group_model.to_dict() + assert route_report_overlapping_route_group_model_json2 == route_report_overlapping_route_group_model_json + +class TestModel_RouteReportRoute(): + """ + Test Class for RouteReportRoute + """ + + def test_route_report_route_serialization(self): + """ + Test serialization/deserialization for RouteReportRoute + """ + + # Construct a json representation of a RouteReportRoute model + route_report_route_model_json = {} + route_report_route_model_json['prefix'] = '172.17.0.0/16' + + # Construct a model instance of RouteReportRoute by calling from_dict on the json representation + route_report_route_model = RouteReportRoute.from_dict(route_report_route_model_json) + assert route_report_route_model != False + + # Construct a model instance of RouteReportRoute by calling from_dict on the json representation + route_report_route_model_dict = RouteReportRoute.from_dict(route_report_route_model_json).__dict__ + route_report_route_model2 = RouteReportRoute(**route_report_route_model_dict) + + # Verify the model instances are equivalent + assert route_report_route_model == route_report_route_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_route_model_json2 = route_report_route_model.to_dict() + assert route_report_route_model_json2 == route_report_route_model_json + class TestModel_GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate(): """ Test Class for GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate @@ -4411,6 +5184,11 @@ def test_gateway_template_gateway_type_connect_template_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + as_prepend_template_model = {} # AsPrependTemplate + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + gateway_template_authentication_key_model = {} # GatewayTemplateAuthenticationKey gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -4426,6 +5204,7 @@ def test_gateway_template_gateway_type_connect_template_serialization(self): # Construct a json representation of a GatewayTemplateGatewayTypeConnectTemplate model gateway_template_gateway_type_connect_template_model_json = {} + gateway_template_gateway_type_connect_template_model_json['as_prepends'] = [as_prepend_template_model] gateway_template_gateway_type_connect_template_model_json['authentication_key'] = gateway_template_authentication_key_model gateway_template_gateway_type_connect_template_model_json['bfd_config'] = gateway_bfd_config_template_model gateway_template_gateway_type_connect_template_model_json['bgp_asn'] = 64999 @@ -4469,6 +5248,11 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + as_prepend_template_model = {} # AsPrependTemplate + as_prepend_template_model['length'] = 4 + as_prepend_template_model['policy'] = 'import' + as_prepend_template_model['prefix'] = '172.17.0.0/16' + gateway_template_authentication_key_model = {} # GatewayTemplateAuthenticationKey gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' @@ -4493,6 +5277,7 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): # Construct a json representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_gateway_type_dedicated_template_model_json = {} + gateway_template_gateway_type_dedicated_template_model_json['as_prepends'] = [as_prepend_template_model] gateway_template_gateway_type_dedicated_template_model_json['authentication_key'] = gateway_template_authentication_key_model gateway_template_gateway_type_dedicated_template_model_json['bfd_config'] = gateway_bfd_config_template_model gateway_template_gateway_type_dedicated_template_model_json['bgp_asn'] = 64999 @@ -4528,6 +5313,67 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): gateway_template_gateway_type_dedicated_template_model_json2 = gateway_template_gateway_type_dedicated_template_model.to_dict() assert gateway_template_gateway_type_dedicated_template_model_json2 == gateway_template_gateway_type_dedicated_template_model_json +class TestModel_RouteReportOverlappingRouteForConnection(): + """ + Test Class for RouteReportOverlappingRouteForConnection + """ + + def test_route_report_overlapping_route_for_connection_serialization(self): + """ + Test serialization/deserialization for RouteReportOverlappingRouteForConnection + """ + + # Construct a json representation of a RouteReportOverlappingRouteForConnection model + route_report_overlapping_route_for_connection_model_json = {} + route_report_overlapping_route_for_connection_model_json['prefix'] = '172.17.0.0/16' + route_report_overlapping_route_for_connection_model_json['type'] = 'virtual_connection' + route_report_overlapping_route_for_connection_model_json['virtual_connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' + + # Construct a model instance of RouteReportOverlappingRouteForConnection by calling from_dict on the json representation + route_report_overlapping_route_for_connection_model = RouteReportOverlappingRouteForConnection.from_dict(route_report_overlapping_route_for_connection_model_json) + assert route_report_overlapping_route_for_connection_model != False + + # Construct a model instance of RouteReportOverlappingRouteForConnection by calling from_dict on the json representation + route_report_overlapping_route_for_connection_model_dict = RouteReportOverlappingRouteForConnection.from_dict(route_report_overlapping_route_for_connection_model_json).__dict__ + route_report_overlapping_route_for_connection_model2 = RouteReportOverlappingRouteForConnection(**route_report_overlapping_route_for_connection_model_dict) + + # Verify the model instances are equivalent + assert route_report_overlapping_route_for_connection_model == route_report_overlapping_route_for_connection_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_overlapping_route_for_connection_model_json2 = route_report_overlapping_route_for_connection_model.to_dict() + assert route_report_overlapping_route_for_connection_model_json2 == route_report_overlapping_route_for_connection_model_json + +class TestModel_RouteReportOverlappingRouteForOthers(): + """ + Test Class for RouteReportOverlappingRouteForOthers + """ + + def test_route_report_overlapping_route_for_others_serialization(self): + """ + Test serialization/deserialization for RouteReportOverlappingRouteForOthers + """ + + # Construct a json representation of a RouteReportOverlappingRouteForOthers model + route_report_overlapping_route_for_others_model_json = {} + route_report_overlapping_route_for_others_model_json['prefix'] = '172.17.0.0/16' + route_report_overlapping_route_for_others_model_json['type'] = 'gateway' + + # Construct a model instance of RouteReportOverlappingRouteForOthers by calling from_dict on the json representation + route_report_overlapping_route_for_others_model = RouteReportOverlappingRouteForOthers.from_dict(route_report_overlapping_route_for_others_model_json) + assert route_report_overlapping_route_for_others_model != False + + # Construct a model instance of RouteReportOverlappingRouteForOthers by calling from_dict on the json representation + route_report_overlapping_route_for_others_model_dict = RouteReportOverlappingRouteForOthers.from_dict(route_report_overlapping_route_for_others_model_json).__dict__ + route_report_overlapping_route_for_others_model2 = RouteReportOverlappingRouteForOthers(**route_report_overlapping_route_for_others_model_dict) + + # Verify the model instances are equivalent + assert route_report_overlapping_route_for_others_model == route_report_overlapping_route_for_others_model2 + + # Convert model instance back to dict and verify no loss of data + route_report_overlapping_route_for_others_model_json2 = route_report_overlapping_route_for_others_model.to_dict() + assert route_report_overlapping_route_for_others_model_json2 == route_report_overlapping_route_for_others_model_json + # endregion ############################################################################## diff --git a/tox.ini b/tox.ini index a44df4a..42fd980 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ envlist = py37-lint, py36, py37, py38, py39 [testenv:py37-lint] -basepython = python3.7 -deps = pylint -commands = pylint --rcfile=.pylintrc ibm_cloud_networking_services test +; basepython = python3.7 +; deps = pylint +; commands = pylint --rcfile=.pylintrc ibm_cloud_networking_services test [testenv] passenv = TOXENV CI TRAVIS*