Example #1
0
class CIC(resource2.Resource):

    resource_key = None
    resources_key = None
    base_path = '/mCICs/%(mcic_id)s/CICs'
    service = connectivity_service.ConnectivityService()

    # capabilities
    allow_get = True
    allow_list = True
    allow_create = True
    allow_delete = True
    allow_update = True

    _query_mapping = resource2.QueryParameters("sort_key", "sort_dir")

    cic_id = resource2.Body("cic_id", alternate_id=True)
    cic_name = resource2.Body("cic_name")
    cic_status = resource2.Body("cic_status")
    network_id = resource2.Body("network_id")
    network_name = resource2.Body("network_name")
    destination_vlan = resource2.Body("destination_vlan", type=int)
    colo_vlan = resource2.Body("colo_vlan", type=int)
    bandwidth = resource2.Body("bandwidth", type=int)
    mcic_id = resource2.URI("mcic_id")

    def update(self, session, mcic_id, cic_id, has_body=True, **attrs):
        uri = self.base_path % ({'mcic_id': mcic_id})
        uri = utils.urljoin(uri, cic_id)
        args = {'json': attrs}
        resp = session.put(uri, endpoint_filter=self.service, **args)
        self._translate_response(resp, has_body=False)
        return self
 def test_service(self):
     sot = connectivity_service.ConnectivityService()
     self.assertEqual('interconnectivity', 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)
Example #3
0
    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())
Example #4
0
class Version(resource.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = connectivity_service.ConnectivityService(
        version=connectivity_service.ConnectivityService.UNVERSIONED
    )

    # capabilities
    allow_list = True

    # Properties
    links = resource.prop('links')
    status = resource.prop('status')
    updated = resource.prop('updated')
Example #5
0
class ServerSegment(resource2.Resource):

    resource_key = None  # Get is not allowed.
    resources_key = 'server_segments'

    base_path = '/ec_services/%(service_id)s/server_segments'
    service = connectivity_service.ConnectivityService()

    # capabilities
    allow_get = False
    allow_list = True

    # _query_mapping = resource2.QueryParameters("mcic_id", "cic_id")

    # Properties
    #: server segment number.
    server_segment_nbr = resource2.Body('server_segment_nbr',
                                        type=int,
                                        alternate_id=True)
    #: server segment name.
    server_segment_name = resource2.Body('server_segment_name')
Example #6
0
class MCIC(resource2.Resource):
    resource_key = None
    resources_key = None
    base_path = '/mCICs'
    service = connectivity_service.ConnectivityService()

    # capabilities
    allow_get = True
    allow_list = True

    _query_mapping = resource2.QueryParameters("tenant_id", "sort_key",
                                               "sort_dir")

    mcic_id = resource2.Body('mcic_id', alternate_id=True)
    mcic_name = resource2.Body('mcic_name')
    mcic_status = resource2.Body('mcic_status')
    tenant_id = resource2.Body('tenant_id')
    tenant_name = resource2.Body('tenant_name')
    service_type = resource2.Body('service_type')
    ngc = resource2.Body('ngc', dict)
    colo = resource2.Body('colo', dict)
    timezone = resource2.Body('timezone')
Example #7
0
class Operation(resource2.Resource):

    resource_key = None
    resources_key = None

    base_path = '/operations'
    service = connectivity_service.ConnectivityService()

    # capabilities
    allow_get = True
    allow_list = True

    _query_mapping = resource2.QueryParameters("mcic_id", "cic_id")

    operation_id = resource2.Body('operation_id', alternate_id=True)
    operation_status = resource2.Body('operation_status')
    operation_type = resource2.Body('operation_type')
    operation_body = resource2.Body('operation_body', dict)
    mcic_id = resource2.Body('mcic_id')
    cic_id = resource2.Body('cic_id')
    user_id = resource2.Body('user_id')
    user_name = resource2.Body('user_name')
    receipt_date = resource2.Body('receipt_date')
    error_messages = resource2.Body('error_messages', list)