예제 #1
0
class Chassis(resource.Resource):

    resources_key = 'chassis'
    base_path = '/chassis'
    service = bare_metal_service.BareMetalService()

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

    _query_mapping = resource.QueryParameters(
        'fields'
    )

    #: Timestamp at which the chassis was created.
    created_at = resource.Body('created_at')
    #: A descriptive text about the service
    description = resource.Body('description')
    #: A set of one or more arbitrary metadata key and value pairs.
    extra = resource.Body('extra')
    #: The UUID for the chassis
    id = resource.Body('uuid', alternate_id=True)
    #: A list of relative links, including the self and bookmark links.
    links = resource.Body('links', type=list)
    #: Links to the collection of nodes contained in the chassis
    nodes = resource.Body('nodes', type=list)
    #: Timestamp at which the chassis was last updated.
    updated_at = resource.Body('updated_at')
예제 #2
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.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(alarm_service.AlarmService(version="v2"))
        self._add_service(bare_metal_service.BareMetalService(version="v1"))
        self._add_service(block_store_service.BlockStoreService(version="v2"))
        self._add_service(cluster_service.ClusterService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(telemetry_service.TelemetryService(version="v2"))

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
 def test_service(self):
     sot = bare_metal_service.BareMetalService()
     self.assertEqual('baremetal', 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)
예제 #4
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.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(anti_ddos_service.AntiDDosService(version="v1"))
        self._add_service(alarm_service.AlarmService(version="v2"))
        self._add_service(bare_metal_service.BareMetalService(version="v1"))
        self._add_service(block_store_service.BlockStoreService(version="v2"))
        self._add_service(cluster_service.ClusterService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(cts_service.CTSService(version="v1"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(dms_service.DMSService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(kms_service.KMSService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v1"))
        self._add_service(maas_service.MaaSService(version="v1"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(rds_service.RDSService(version="v1"))
        self._add_service(rds_os_service.RDSService(version="v1"))
        self._add_service(smn_service.SMNService(version="v2"))
        self._add_service(telemetry_service.TelemetryService(version="v2"))
        self._add_service(workflow_service.WorkflowService(version="v2"))
        # QianBiao.NG HuaWei Services
        self._add_service(dns_service.DNSService(version="v2"))
        self._add_service(cloud_eye_service.CloudEyeService(version="v1"))
        ass = auto_scaling_service.AutoScalingService(version="v1")
        self._add_service(ass)
        vbs_v2 = volume_backup_service.VolumeBackupService(version="v2")
        self._add_service(vbs_v2)
        self._add_service(map_reduce_service.MapReduceService(version="v1"))

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
예제 #5
0
class Version(resource2.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = bare_metal_service.BareMetalService(
        version=bare_metal_service.BareMetalService.UNVERSIONED)

    # Capabilities
    allow_list = True

    # Attributes
    links = resource2.Body('links')
    status = resource2.Body('status')
    updated = resource2.Body('updated')
예제 #6
0
class PortGroup(resource.Resource):

    resources_key = 'portgroups'
    base_path = '/portgroups'
    service = bare_metal_service.BareMetalService()

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

    _query_mapping = resource.QueryParameters(
        'node',
        'address',
        'fields',
    )

    #: The physical hardware address of the portgroup, typically the hardware
    #: MAC address. Added in API microversion 1.23.
    address = resource.Body('address')
    #: Timestamp at which the portgroup was created.
    created_at = resource.Body('created_at')
    #: A set of one or more arbitrary metadata key and value pairs.
    extra = resource.Body('extra', type=dict)
    #: The name of the portgroup
    name = resource.Body('name')
    #: The UUID for the portgroup
    id = resource.Body('uuid', alternate_id=True)
    #: Internal metadaa set and stored by the portgroup.
    internal_info = resource.Body('internal_info')
    #: Whether ports that are members of this portgroup can be used as
    #: standalone ports. Added in API microversion 1.23.
    is_standalone_ports_supported = resource.Body('standalone_ports_supported',
                                                  type=bool)
    #: A list of relative links, including the self and bookmark links.
    links = resource.Body('links', type=list)
    #: UUID of the node this portgroup belongs to.
    node_id = resource.Body('node_uuid')
    #: A list of links to the collection of ports belonging to this portgroup.
    #: Added in API microversion 1.24.
    ports = resource.Body('ports')
    #: Timestamp at which the portgroup was last updated.
    updated_at = resource.Body('updated_at')
예제 #7
0
class Port(resource.Resource):

    resources_key = 'ports'
    base_path = '/ports'
    service = bare_metal_service.BareMetalService()

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

    _query_mapping = resource.QueryParameters('fields')

    #: The physical hardware address of the network port, typically the
    #: hardware MAC address.
    address = resource.Body('address')
    #: Timestamp at which the port was created.
    created_at = resource.Body('created_at')
    #: A set of one or more arbitrary metadata key and value pairs.
    extra = resource.Body('extra')
    #: The UUID of the port
    id = resource.Body('uuid', alternate_id=True)
    #: Internal metadata set and stored by the port. This field is read-only.
    #: Added in API microversion 1.18.
    internal_info = resource.Body('internal_info')
    #: Whether PXE is enabled on the port. Added in API microversion 1.19.
    is_pxe_enabled = resource.Body('pxe_enabled', type=bool)
    #: A list of relative links, including the self and bookmark links.
    links = resource.Body('links', type=list)
    #: The port bindig profile. If specified, must contain ``switch_id`` and
    #: ``port_id`` fields. ``switch_info`` field is an optional string field
    #: to be used to store vendor specific information. Added in API
    #: microversion 1.19.
    local_link_connection = resource.Body('local_link_connection')
    #: The UUID of node this port belongs to
    node_id = resource.Body('node_uuid')
    #: The UUID of PortGroup this port belongs to. Added in API microversion
    #: 1.23.
    port_group_id = resource.Body('portgroup_uuid')
    #: Timestamp at which the port was last updated.
    updated_at = resource.Body('updated_at')
예제 #8
0
class Driver(resource.Resource):

    resources_key = 'drivers'
    base_path = '/drivers'
    service = bare_metal_service.BareMetalService()

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

    # NOTE: Query mapping?

    #: The name of the driver
    name = resource.Body('name', alternate_id=True)
    #: A list of active hosts that support this driver.
    hosts = resource.Body('hosts', type=list)
    #: A list of relative links, including the self and bookmark links.
    links = resource.Body('links', type=list)
    #: A list of links to driver properties.
    properties = resource.Body('properties', type=list)
예제 #9
0
class Node(resource.Resource):

    resources_key = 'nodes'
    base_path = '/nodes'
    service = bare_metal_service.BareMetalService()

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

    _query_mapping = resource.QueryParameters(
        'associated',
        'driver',
        'fields',
        'provision_state',
        'resource_class',
        instance_id='instance_uuid',
        is_maintenance='maintenance',
    )

    # Properties
    #: The UUID of the chassis associated wit this node. Can be empty or None.
    chassis_id = resource.Body("chassis_uuid")
    #: The current clean step.
    clean_step = resource.Body("clean_step")
    #: Timestamp at which the node was last updated.
    created_at = resource.Body("created_at")
    #: The name of the driver.
    driver = resource.Body("driver")
    #: All the metadata required by the driver to manage this node. List of
    #: fields varies between drivers, and can be retrieved from the
    #: :class:`openstack.bare_metal.v1.driver.Driver` resource.
    driver_info = resource.Body("driver_info", type=dict)
    #: Internal metadata set and stored by node's driver. This is read-only.
    driver_internal_info = resource.Body("driver_internal_info", type=dict)
    #: A set of one or more arbitrary metadata key and value pairs.
    extra = resource.Body("extra")
    #: The UUID of the node resource.
    id = resource.Body("uuid", alternate_id=True)
    #: Information used to customize the deployed image, e.g. size of root
    #: partition, config drive in the form of base64 encoded string and other
    #: metadata.
    instance_info = resource.Body("instance_info")
    #: UUID of the nova instance associated with this node.
    instance_id = resource.Body("instance_uuid")
    #: Whether console access is enabled on this node.
    is_console_enabled = resource.Body("console_enabled", type=bool)
    #: Whether node is currently in "maintenance mode". Nodes put into
    #: maintenance mode are removed from the available resource pool.
    is_maintenance = resource.Body("maintenance", type=bool)
    #: Any error from the most recent transaction that started but failed to
    #: finish.
    last_error = resource.Body("last_error")
    #: A list of relative links, including self and bookmark links.
    links = resource.Body("links", type=list)
    #: user settable description of the reason why the node was placed into
    #: maintenance mode.
    maintenance_reason = resource.Body("maintenance_reason")
    #: Human readable identifier for the node. May be undefined. Certain words
    #: are reserved. Added in API microversion 1.5
    name = resource.Body("name")
    #: Network interface provider to use when plumbing the network connections
    #: for this node. Introduced in API microversion 1.20.
    network_interface = resource.Body("network_interface")
    #: Links to the collection of ports on this node.
    ports = resource.Body("ports", type=list)
    #: Links to the collection of portgroups on this node. Available since
    #: API microversion 1.24.
    port_groups = resource.Body("portgroups", type=list)
    #: The current power state. Usually "power on" or "power off", but may be
    #: "None" if service is unable to determine the power state.
    power_state = resource.Body("power_state")
    #: Physical characteristics of the node. Content populated by the service
    #: during inspection.
    properties = resource.Body("properties", type=dict)
    #: The current provisioning state of the node.
    provision_state = resource.Body("provision_state")
    #: The current RAID configuration of the node.
    raid_config = resource.Body("raid_config")
    #: The name of an service conductor host which is holding a lock on this
    #: node, if a lock is held.
    reservation = resource.Body("reservation")
    #: A string to be used by external schedulers to identify this node as a
    #: unit of a specific type of resource. Added in API microversion 1.21.
    resource_class = resource.Body("resource_class")
    #: Links to the collection of states.
    states = resource.Body("states", type=list)
    #: The requested state if a provisioning action has been requested. For
    #: example, ``AVAILABLE``, ``DEPLOYING``, ``DEPLOYWAIT``, ``DEPLOYING``,
    #: ``ACTIVE`` etc.
    target_provision_state = resource.Body("target_provision_state")
    #: The requested state during a state transition.
    target_power_state = resource.Body("target_power_state")
    #: The requested RAID configration of the node which will be applied when
    #: the node next transitions through the CLEANING state.
    target_raid_config = resource.Body("target_raid_config")
    #: Timestamp at which the node was last updated.
    updated_at = resource.Body("updated_at")