class Operation(resource2.Resource): resources_key = "operations" service = provider_connectivity_service.ProviderConnectivityService("v1.0") base_path = '/' + service.version + '/icc/operations' # Capabilities allow_list = True _query_mapping = resource2.QueryParameters("connection_id",) # Properties #: It identifies connection resource uniquely. connection_id = resource2.Body('connection_id', alternate_id=True) #: order type. order_type = resource2.Body('order_type') #: operation phase. phase = resource2.Body('phase') #: Status of phase. operation_status = resource2.Body('operation_status') #: reception datetime. YYYY-MM-DD HH:MM:SS format. reception_datetime = resource2.Body('reception_datetime') #: commit datetime. YYYY-MM-DD HH:MM:SS format. commit_datetime = resource2.Body('commit_datetime') #: Request body is stored. request_body = resource2.Body('request_body')
class AddressAssignment(resource2.Resource): resources_key = "address_assignments" resource_key = "address_assignment" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + \ '/tenant_connection_requests/' \ '%(tenant_connection_request_id)s/address_assignment' # capabilities allow_list = True #: tenant_connection_request unique ID. tenant_connection_request_id = resource2.URI( "tenant_connection_request_id") #: tenant_connection unique ID. tenant_connection_id = resource2.Body("tenant_connection_id") #: Network unique ID network_id = resource2.Body("network_id") #: mac address assigned with port mac_address = resource2.Body("mac_address") #: List of fixes IP addresses assign to port. fixed_ips = resource2.Body("fixed_ips") #: Allowed address pairs allowed_address_pairs = resource2.Body("allowed_address_pairs") @staticmethod def _get_id(value): if isinstance(value, resource2.Resource): # Don't check _alternate_id unless we need to. It's an uncommon # case and it involves looping through the class' dict. id = value.id or getattr( value, value._alternate_id(), hashlib.new('md5', str(value)).hexdigest()) return id else: return value def __getattribute__(self, name): """Return an attribute on this instance This is mostly a pass-through except for a specialization on the 'id' name, as this can exist under a different name via the `alternate_id` argument to resource.Body. """ if name == "id": if name in self._body: return self._body[name] elif self._alternate_id(): return self._body[self._alternate_id()] else: return hashlib.new('md5', str(self)).hexdigest() else: return object.__getattribute__(self, name)
def test_service(self): sot = provider_connectivity_service.ProviderConnectivityService() self.assertEqual('provider-connectivity', sot.service_type) self.assertEqual('public', sot.interface) self.assertIsNone(sot.region) self.assertIsNone(sot.service_name) self.assertEqual(1, len(sot.valid_versions)) self.assertEqual('v1', sot.valid_versions[0].module) self.assertEqual('v1', sot.valid_versions[0].path)
class GCPConnection(ProviderConnectivityBaseResource): resources_key = "gcp_connections" resource_key = "gcp_connection" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/gcp_connections' # Capabilities allow_list = True allow_get = True allow_create = True allow_update = True allow_delete = True # _query_mapping = resource2.QueryParameters() # TBD # Properties #: It identifies connection resource uniquely. id = resource2.Body('id') #: Name of connection. name = resource2.Body('name') #: Description of connection. description = resource2.Body('description') #: Status of connection. status = resource2.Body('status') #: Status of operation for gcp_connection. operation_status = resource2.Body('operation_status') #: Pairing Key for Active Cloud Router in GCP. pairing_key_primary = resource2.Body('pairing_key_primary') #: Pairing Key for Standby Cloud Router in GCP. pairing_key_secondary = resource2.Body('pairing_key_secondary') #: Tenant ID of the owner. tenant_id = resource2.Body('tenant_id') #: Bandwidth assigned with this connection. bandwidth = resource2.Body('bandwidth') #: QoS type assigned with this connection. qos_type = resource2.Body('qos_type') #: ID of exchange_points. exchange_point_id = resource2.Body('exchange_point_id') #: VLAN ID. vlan = resource2.Body('vlan') #: ID of gcp_gateway which gcp_connection connected. gcp_gateway_id = resource2.Body('gcp_gateway_id') #: ID of gcp_interface which gcp_connection connected. gcp_interface_id = resource2.Body('gcp_interface_id') #: Name of Region where customer's cloud router exist. gcp_region_name = resource2.Body('gcp_region_name') #: Name of primary Interconnect. primary_interconnect_name = resource2.Body('primary_interconnect_name') #: Name of primary Interconnect Attachment. primary_interconnect_attachment_name = \ resource2.Body('primary_interconnect_attachment_name') #: Name of secondary Interconnect. secondary_interconnect_name = resource2.Body('secondary_interconnect_name') #: Name of secondary Interconnect Attachment. secondary_interconnect_attachment_name = \ resource2.Body('secondary_interconnect_attachment_name')
class TenantConnectionRequest(ProviderConnectivityBaseResource): resources_key = "tenant_connection_requests" resource_key = "tenant_connection_request" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/tenant_connection_requests' # Capabilities allow_list = True allow_get = True allow_create = True allow_update = True allow_delete = True #: tenant_connection_request unique ID. tenant_connection_request_id = resource2.Body( 'tenant_connection_request_id', alternate_id=True) id = resource2.Body("id") #: Name of tenant_connection_request. name = resource2.Body('name') #: Description description = resource2.Body('description') #: Status of tenant_connection_request. status = resource2.Body('status') #: Tags tags = resource2.Body('tags') #: Keystone User ID who can access to the owner tenant of # tenant_connection_request. keystone_user_id = resource2.Body('keystone_user_id') #: Tenant ID of the owner. tenant_id = resource2.Body('tenant_id') #: Name for the owner of network name_other = resource2.Body('name_other') #: Description for the owner of the network description_other = resource2.Body('description_other') #: Tags for the owner of the network tags_other = resource2.Body('tags_other') #: The owner tenant of the network tenant_id_other = resource2.Body('tenant_id_other') #: Network unique ID network_id = resource2.Body('network_id') #: Approval unique ID approval_request_id = resource2.Body('approval_request_id')
def __init__(self, plugins=None): """User preference for each service. :param list plugins: List of entry point namespaces to load. Create a new :class:`~ecl.profile.Profile` object with no preferences defined, but knowledge of the services. Services are identified by their service type, e.g.: 'identity', 'compute', etc. """ self._services = {} self._add_service(compute_service.ComputeService(version="v2")) self._add_service( connectivity_service.ConnectivityService(version="v1")) self._add_service(identity_service.IdentityService(version="v3")) self._add_service(image_service.ImageService(version="v2")) self._add_service(network_service.NetworkService(version="v2")) self._add_service(sss_service.SssService(version="v1")) self._add_service( orchestration_service.OrchestrationService(version="v1")) self._add_service( provider_connectivity_service.ProviderConnectivityService( version="v2")) self._add_service(telemetry_service.TelemetryService(version="v2")) self._add_service(block_store_service.BlockStoreService(version="v2")) self._add_service(storage_service.StorageService(version="v1")) self._add_service( security_order_service.SecurityOrderService(version="v2")) self._add_service( security_portal_service.SecurityPortalService(version="v2")) ## This section will be deleted if MSS v1 API is not available self._add_service( security_order_service_v1.SecurityOrderService(version="v1")) self._add_service( security_portal_service_v1.SecurityPortalService(version="v1")) ## end of the section self._add_service(rca_service.RcaService(version="v1")) self._add_service(baremetal_service.BaremetalService(version="v2")) self._add_service( dedicated_hypervisor_service.DedicatedHypervisorService( version="v1")) self._add_service(dns_service.DnsService(version="v2")) self._add_service( virtual_network_appliance_service.VirtualNetworkApplianceService( version="v1")) self._add_service(mvna_service.MVNAService(version="v1")) # NOTE: The Metric service is not added here as it currently # only retrieves the /capabilities API. if plugins: for plugin in plugins: self._load_plugin(plugin) self.service_keys = sorted(self._services.keys())
class ExchangePoint(resource2.Resource): resources_key = "exchange_points" service = provider_connectivity_service.ProviderConnectivityService("v1.0") base_path = '/' + service.version + '/icc/exchange_points' # Capabilities allow_list = True # Properties #: It identifies exchange_point resource uniquely. id = resource2.Body('id') #: Pair of location name of AWS and ECL2.0. location_names = resource2.Body('location_names')
class AWSConnection(ProviderConnectivityBaseResource): resources_key = "aws_connections" resource_key = "aws_connection" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/aws_connections' # Capabilities allow_list = True allow_get = True allow_create = True allow_update = True allow_delete = True # _query_mapping = resource2.QueryParameters() # TBD # Properties #: It identifies connection resource uniquely. id = resource2.Body('id') #: Name of connection. name = resource2.Body('name') #: Description of connection. description = resource2.Body('description') #: Status of connection. status = resource2.Body('status') #: Tenant ID of the owner. tenant_id = resource2.Body('tenant_id') #: Bandwidth assigned with this connection. bandwidth = resource2.Body('bandwidth') #: QoS type assigned with this connection. qos_type = resource2.Body('qos_type') #: ID of exchange_points. exchange_point_id = resource2.Body('exchange_point_id') aws_account_id = resource2.Body('aws_account_id') connected_network_address = resource2.Body('connected_network_address') #: Network params between ECL2.0 and UNO. aws_network1 = resource2.Body('aws_network1') #: Network params between UNO and AWS. aws_network2 = resource2.Body('aws_network2') def approve(self, session, connection_id, action): """Approve/Disapprove connection between ECL2.0 and AWS.""" uri = self.base_path + '/' + connection_id + '/action' resp = session.put(uri, endpoint_filter=self.service, json={"action": action}) self._translate_response(resp, has_body=False) return self
class TenantConnection(TenantConnectionBaseResource): resources_key = "tenant_connections" resource_key = "tenant_connection" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/tenant_connections' # Capabilities allow_list = True allow_get = True allow_create = True allow_update = True allow_delete = True id = resource2.Body("id") tenant_connection_id = resource2.Body("id") tenant_connection_request_id = resource2.Body( "tenant_connection_request_id") name = resource2.Body("name") description = resource2.Body("description") tags = resource2.Body("tags") tenant_id = resource2.Body("tenant_id") name_other = resource2.Body("name_other") description_other = resource2.Body("description_other") tags_other = resource2.Body("tags_other") tenant_id_other = resource2.Body("tenant_id_other") network_id = resource2.Body("network_id") device_type = resource2.Body("device_type") device_id = resource2.Body("device_id") device_interface_id = resource2.Body("device_interface_id") attachment_opts = resource2.Body("attachment_opts") port_id = resource2.Body("port_id") status = resource2.Body("status")
class ICCSubnet(subnet.Subnet): service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + \ '/tenant_connection_requests/' \ '%(tenant_connection_request_id)s/subnets' id = resource2.Body("id") tenant_connection_request_id = resource2.URI( "tenant_connection_request_id") allow_list = True allow_create = False allow_delete = False allow_update = False allow_get = True dhcp_server_address = resource2.Body('dhcp_server_address')
class ICCNetwork(network.Network): service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + \ '/tenant_connection_requests/' \ '%(tenant_connection_request_id)s/network' allow_list = False allow_create = False allow_delete = False allow_update = False allow_get = True def get(self, session, tenant_connection_request_id): uri = self.base_path % { "tenant_connection_request_id": tenant_connection_request_id } resp = session.get(uri, endpoint_filter=self.service) self._translate_response(resp, has_body=True) return self
class Operation(resource2.Resource): resources_key = "operations" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/operations' # Capabilities allow_list = True _query_mapping = resource2.QueryParameters("service_type", "resource_type", "resource_id", "latest") # Properties #: ID of operation. id = resource2.Body('id', alternate_id=True) #: Service type. service_type = resource2.Body('service_type') #: ID of resource. resource_id = resource2.Body('resource_id') #: Reource type. resource_type = resource2.Body('resource_type') #: Request type. request_type = resource2.Body('request_type') #: operation phase. phase = resource2.Body('phase') #: Status of operation. operation_status = resource2.Body('operation_status') #: reception datetime. YYYY-MM-DD HH:MM:SS format. reception_datetime = resource2.Body('reception_datetime') #: commit datetime. YYYY-MM-DD HH:MM:SS format. commit_datetime = resource2.Body('commit_datetime') #: Request body is stored. request_body = resource2.Body('request_body') #: Note notes = resource2.Body('notes') #: Tenant ID tenant_id = resource2.Body('tenant_id') #: If use this query, the latest operation is returned. latest = resource2.Body('latest') #: Error error = resource2.Body('error')
class TenantConnection(ProviderConnectivityBaseResource): resources_key = "tenant_connections" resource_key = "tenant_connection" service = provider_connectivity_service.ProviderConnectivityService("v2.0") base_path = '/' + service.version + '/tenant_connections' # Capabilities allow_list = True allow_get = True allow_create = True allow_update = True allow_delete = True #: tenant_connection unique ID. id = resource2.Body("id") #: tenant_connection unique ID. tenant_connection_id = resource2.Body("id") #: tenant_connection request ID. tenant_connection_request_id = resource2.Body( "tenant_connection_request_id") #: Name of tenant_connection. name = resource2.Body("name") #: Description description = resource2.Body("description") #: Tags tags = resource2.Body("tags") #: tenant_id tenant_id = resource2.Body("tenant_id") #: Name of network owner tenant name_other = resource2.Body("name_other") #: Description of network owner tenant description_other = resource2.Body("description_other") #: Tags of network owner tenant tags_other = resource2.Body("tags_other") #: Network owner tenant ID tenant_id_other = resource2.Body("tenant_id_other") #: Network ID network_id = resource2.Body("network_id") #: Device type, baremetal or virutal server device_type = resource2.Body("device_type") #: Device ID device_id = resource2.Body("device_id") #: Device interface ID device_interface_id = resource2.Body("device_interface_id") #: Attachment options of the connection attachment_opts = resource2.Body("attachment_opts") #: Port ID of the connection port_id = resource2.Body("port_id") #: Status of tenant_connection status = resource2.Body("status")