NTTC-CIS Compute Driver Documentation

NTT Communications has a cloud offering known as Cloud Infrastructure Services (NTTC-CIS). NTT-CIS provides IT-as-a-Service to customers around the globe on their cloud platform (Compute as a Service). The CaaS service is available either on one a hybrid cloud instance or as a private instance on premises.

../../_images/ntt.png

CaaS has its own non-standard API , libcloud provides a Python wrapper on top of this API with common methods with other IaaS solutions and Public cloud providers. Therefore, you can use use the NTTC-CIS libcloud driver to communicate with both the public and private clouds. Currently libcloud supports API versions >= 2.4.

Instantiating a driver

When you instantiate a driver you need to pass the following arguments to the driver constructor:

  • user_id - Your Dimension Data Cloud username
  • key - Your Dimension Data Cloud password
  • region - The region key, one of the possible region keys

Possible regions:

  • na : NTTC-CIS North America (USA)
  • eu : NTTC-CIS Europe
  • af : NTTC-CIS Africa
  • au : NTTC-CIS Australia
  • ap : NTTC-CIS Asia Pacific
  • ca : Dimension Data Canada region

The base libcloud API allows you to:

  • list nodes, images, instance types, locations

Non-standard functionality and extension methods

The NTTC-CIS driver exposes some libcloud non-standard functionalities through extension methods and arguments.

These functionalities include:

  • start and stop a node
  • list networks
  • create firewalls, configure network address translation
  • provision layer 3 networks

For information on how to use these functionalities please see the method docstrings below. You can also use an interactive shell for exploration as shown in the examples.

API Docs

class libcloud.compute.drivers.nttcis.NttCisNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='na', **kwargs)[source]

NttCis node driver. Default api_version is used unless specified.

attach_volume(node, volume, device=None)

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

connectionCls

alias of libcloud.common.nttcis.NttCisConnection

copy_image(source_region, node_image, name, description=None)

Copies an image from a source region to the current region.

Parameters:
  • source_region (str) – Region to copy the node from.
  • node_image (NodeImage:) – NodeImage to copy.
  • name (str) – name for new image.
  • description – description for new image.
Return type:

NodeImage:

Returns:

NodeImage instance on success.

create_image(node, name, description=None)

Creates an image from a node object.

Parameters:
  • node (Node) – Node to run the task on.
  • name (description) – name for new image.
  • description – description for new image.
Return type:

NodeImage:

Returns:

NodeImage instance on success.

create_key_pair(name)

Create a new key pair object.

Parameters:name (str) – Key pair name.
Return type:KeyPair object
create_node(name, image, auth, ex_network_domain=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_description=None, ex_disks=None, ex_cpu_specification=None, ex_memory_gb=None, ex_is_started=True, ex_primary_dns=None, ex_secondary_dns=None, ex_ipv4_gateway=None, ex_microsoft_time_zone=None, **kwargs)[source]

Create a new NTTCIS node in MCP2. However, it is still backward compatible for MCP1 for a limited time. Please consider using MCP2 datacenter as MCP1 will phase out soon.

Legacy Create Node for MCP1 datacenter

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = False
>>> NTTCIS = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU1')
>>>
>>> # Get network by location
>>> my_network = driver.list_networks(location=location)[0]
>>> pprint(my_network)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> node = driver.create_node(name='test_blah_2', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test3 node',
>>>                           ex_network=my_network,
>>>                           ex_is_started=False)
>>> pprint(node)

Create Node in MCP2 Data CenterF

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> vlan = driver.ex_list_vlans(location=location,
>>>                             network_domain=my_network_domain)[0]
>>> pprint(vlan)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> # Create node using vlan instead of private IPv4
>>> node = driver.create_node(name='test_server_01', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test2 node',
>>>                           ex_network_domain=my_network_domain,
>>>                           ex_primary_nic_vlan=vlan,
>>>                           ex_is_started=False)
>>>
>>> # Option: Create node using private IPv4 instead of vlan
>>> # node = driver.create_node(name='test_server_02', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_private_ipv4='10.1.1.7',
>>> #                           ex_is_started=False)
>>>
>>> # Option: Create node using by specifying Network Adapter
>>> # node = driver.create_node(name='test_server_03', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_vlan=vlan,
>>> #                           ex_primary_nic_network_adapter='E1000',
>>> #                           ex_is_started=False)
>>>
Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (required) OS Image to boot on node.
  • auth (NodeAuthPassword or str or None) – Initial authentication information for the node. (If this is a customer LINUX image auth will be ignored)
  • ex_description (str) – (optional) description for this node
  • ex_network_domain (DimensionDataNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’NttCisNic’ or str) – (optional) List :class:’NttCisNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (DimensionDataServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_primary_dns (str) – (Optional) The node’s primary DNS
  • ex_secondary_dns (str) – (Optional) The node’s secondary DNS
  • ex_ipv4_gateway (str) – (Optional) IPv4 address in dot-decimal notation, which will be used as the Primary NIC gateway instead of the default gateway assigned by the system. If ipv4Gateway is provided it does not have to be on the VLAN of the Primary NIC but MUST be reachable or the Guest OS will not be configured correctly.
  • ex_disks (List or tuple of :class:'DimensionDataServerDisk`) – (optional) NTTCIS disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_microsoft_time_zone (str`) – (optional) For use with Microsoft Windows source Server Images only. For the exact value to use please refer to the table of time zone indexes in the following Microsoft Technet documentation. If none is supplied, the default time zone for the data center geographic region will be used.
Returns:

The newly created Node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None)

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot(volume, name=None)

Creates a snapshot of the storage volume.

Parameters:
  • volume (StorageVolume) – The StorageVolume to create a VolumeSnapshot from
  • name (str) – Name of created snapshot (optional)
Return type:

VolumeSnapshot

delete_image(node_image)

Deletes a node image from a provider.

Parameters:node_image (NodeImage) – Node image object.
Returns:True if delete_image was successful, False otherwise.
Return type:bool
delete_key_pair(key_pair)

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object.
Return type:bool
deploy_node(deploy, ssh_username='root', ssh_alternate_usernames=None, ssh_port=22, ssh_timeout=10, ssh_key=None, ssh_key_password=None, auth=None, timeout=300, max_tries=3, ssh_interface='public_ips', at_exit_func=None, wait_period=5, **create_node_kwargs)

Create a new node, and start deployment.

In order to be able to SSH into a created node access credentials are required.

A user can pass either a NodeAuthPassword or NodeAuthSSHKey to the auth argument. If the create_node implementation supports that kind if credential (as declared in self.features['create_node']) then it is passed on to create_node. Otherwise it is not passed on to create_node and it is only used for authentication.

If the auth parameter is not supplied but the driver declares it supports generates_password then the password returned by create_node will be used to SSH into the server.

Finally, if the ssh_key_file is supplied that key will be used to SSH into the server.

This function may raise a DeploymentException, if a create_node call was successful, but there is a later error (like SSH failing or timing out). This exception includes a Node object which you may want to destroy if incomplete deployments are not desirable.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> from libcloud.compute.deployment import ScriptDeployment
>>> from libcloud.compute.deployment import MultiStepDeployment
>>> from libcloud.compute.base import NodeAuthSSHKey
>>> driver = DummyNodeDriver(0)
>>> key = NodeAuthSSHKey('...') # read from file
>>> script = ScriptDeployment("yum -y install emacs strace tcpdump")
>>> msd = MultiStepDeployment([key, script])
>>> def d():
...     try:
...         driver.deploy_node(deploy=msd)
...     except NotImplementedError:
...         print ("not implemented for dummy driver")
>>> d()
not implemented for dummy driver

Deploy node is typically not overridden in subclasses. The existing implementation should be able to handle most such.

Parameters:
  • deploy (Deployment) – Deployment to run once machine is online and available to SSH.
  • ssh_username (str) – Optional name of the account which is used when connecting to SSH server (default is root)
  • ssh_alternate_usernames (list) – Optional list of ssh usernames to try to connect with if using the default one fails
  • ssh_port (int) – Optional SSH server port (default is 22)
  • ssh_timeout (float) – Optional SSH connection timeout in seconds (default is 10)
  • auth (NodeAuthSSHKey or NodeAuthPassword) – Initial authentication information for the node (optional)
  • ssh_key (str or list of str) – A path (or paths) to an SSH private key with which to attempt to authenticate. (optional)
  • ssh_key_password (str) – Optional password used for encrypted keys.
  • timeout (int) – How many seconds to wait before timing out. (default is 600)
  • max_tries (int) – How many times to retry if a deployment fails before giving up (default is 3)
  • ssh_interface (str) – The interface to wait for. Default is ‘public_ips’, other option is ‘private_ips’.
  • at_exit_func (func) –

    Optional atexit handler function which will be registered and called with created node if user cancels the deploy process (e.g. CTRL+C), after the node has been created, but before the deploy process has finished.

    This method gets passed in two keyword arguments:

    • driver -> node driver in question
    • node -> created Node object

    Keep in mind that this function will only be called in such scenario. In case the method finishes (this includes throwing an exception), at exit handler function won’t be called.

  • wait_period (int) – How many seconds to wait between each iteration while waiting for node to transition into running state and have IP assigned. (default is 5)
destroy_node(node)[source]

Deletes a node, node must be stopped before deletion

Parameters:node (Node) – The node to delete
Return type:bool
destroy_volume(volume)

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
destroy_volume_snapshot(snapshot)

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
detach_volume(volume)

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_add_scsi_controller_to_node(server_id, adapter_type, bus_number=None)[source]

Added 8/27/18: Adds a SCSI Controller by node id :param server_id: server id :param adapter_type: the type of SCSI Adapter, i.e., LSI_LOGIC_PARALLEL :param bus_number: optional number of server’s bus :return: whether addition is in progress or ‘OK’ otherwise false

ex_add_storage_to_node(amount, node=None, speed='STANDARD', controller_id=None, scsi_id=None)[source]

Updated 8/23/18 Add storage to the node One of node or controller_id must be selected

Parameters:
  • node (Node) – The server to add storage to (required if controller_id is not used
  • amount (int) – The amount of storage to add, in GB
  • speed (str) – The disk speed type
  • conrollter_id – The disk may be added using the cotnroller id (required if node object is not used)
  • scsi_id (int) – The target SCSI ID (optional)
Return type:

bool

ex_apply_tag_to_asset(asset, tag_key, value=None)[source]

Apply a tag to a NTTC-CIS Asset

Parameters:
  • asset (Node or NodeImage or NttCisNewtorkDomain or NttCisVlan or NttCisPublicIpBlock) – The asset to apply a tag to. (required)
  • tag_key (NttCisTagKey or str) – The tag_key to apply to the asset. (required)
  • value (str) – The value to be assigned to the tag key This is only required if the NttCisTagKey requires it
Return type:

bool

ex_attach_node_to_vlan(node, vlan=None, private_ipv4=None)[source]

Attach a node to a VLAN by adding an additional NIC to the node on the target VLAN. The IP will be automatically assigned based on the VLAN IP network space. Alternatively, provide a private IPv4 address instead of VLAN information, and this will be assigned to the node on corresponding NIC.

Parameters:
  • node (Node) – Node which should be used
  • vlan (NttCisVlan) – VLAN to attach the node to (required unless private_ipv4)
  • private_ipv4 (str) – Private nic IPv4 Address (required unless vlan)
Return type:

bool

ex_audit_log_report(start_date, end_date)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_backup_usage_report(start_date, end_date, location)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Return type:

list of list

ex_change_nic_network_adapter(nic_id, network_adapter_name)[source]

Change network adapter of a NIC on a cloud server

Parameters:
  • nic_id (:str) – Nic ID
  • network_adapter_name (:str) – Network adapter name
Return type:

bool

ex_change_storage_size(disk_id, size)[source]

Change the size of a disk

Parameters:
  • node (Node) – The server to change the disk of
  • disk_id (str) – The ID of the disk to resize
  • size (int) – The disk size in GB
Return type:

bool

ex_change_storage_speed(disk_id, speed, iops=None)[source]

Change the speed (disk tier) of a disk

Parameters:
  • node (Node) – The server to change the disk speed of
  • disk_id (str) – The ID of the disk to change
  • speed (str) – The disk speed type e.g. STANDARD
Return type:

bool

ex_clean_failed_deployment(node)[source]

Removes a node that has failed to deploy

Parameters:node (Node or str) – The failed node to clean
ex_clone_node_to_image(node, image_name, image_description=None, cluster_id=None, is_guest_Os_Customization=None, tag_key_id=None, tag_value=None)[source]

Clone a server into a customer image.

Parameters:
  • node (Node) – The server to clone
  • image_name (str) – The name of the clone image
  • description (str) – The description of the image
Return type:

bool

ex_create_anti_affinity_rule(node_list)[source]

Edited to work with api 2.x. No longer supports 1.0 Create an anti affinity rule given a list of nodes Anti affinity rules ensure that servers will not reside on the same VMware ESX host

Parameters:node_list (list of Node or list of str) – The list of nodes to create a rule for
Return type:bool
ex_create_consistency_group(name, journal_size_gb, source_server_id, target_server_id, description=None)[source]

Create a consistency group

Parameters:
  • name (str) – Name of consistency group
  • journal_size_gb (str) – Journal size in GB
  • source_server_id (str) – Id of the server to copy
  • target_server_id – Id of the server to receive the copy
  • description – (Optional) Description of consistency group
Type:

target_server_id: str

Type:

description: str

Return type:

NttCisConsistencyGroup

ex_create_firewall_rule(network_domain, name, action, ip_version, protocol, source_addr, dest_addr, position, enabled=1, position_relative_to_rule=None)[source]

Creates a firewall rule

Parameters:
  • network_domain (NttCisNetworkDomain or str) – The network domain in which to create the firewall rule
  • name (str) – The rule’s name
  • action (str) – ‘ACCEPT_DECISIVELY’ or ‘DROP’
  • ip_version (str) – ‘IPV4’ or ‘IPV6’
  • protocol (str) – One of ‘IP’, ‘ICMP’, ‘TCP’, or ‘UDP’
  • source_addr (NttCisFirewallAddress) – The source address, which must be an NttCisFirewallAddress instance
  • dest_addr (NttCisFirewallAddress`) – The destination address, which must be an NttCisFirewallAddress instance
  • position (str) – The position in which to create the rule There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • enabled (int) – Firewall rule is enabled upon creation. Set to 1 for true or 0 for false.
  • position_relative_to_rule (:NttCisFirewallRule or str) – The rule or rule name in which to decide positioning by
Return type:

bool

ex_create_ip_address_list(ex_network_domain, name, description, ip_version, ip_address_collection, child_ip_address_list=None)[source]

Create IP Address List. IP Address list.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.nttcis import NttCisIpAddress
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # IP Address collection
>>> ipAddress_1 = NttCisIpAddress(begin='190.2.2.100')
>>> ipAddress_2 = NttCisIpAddress(begin='190.2.2.106',
                                         end='190.2.2.108')
>>> ipAddress_3 = NttCisIpAddress(begin='190.2.2.0',
                                         prefix_size='24')
>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3]
>>>
>>> # Create IPAddressList
>>> result = driver.ex_create_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     name='My_IP_AddressList_2',
>>>     ip_version='IPV4',
>>>     description='Test only',
>>>     ip_address_collection=ip_address_collection,
>>>     child_ip_address_list='08468e26-eeb3-4c3d-8ff2-5351fa6d8a04'
>>> )
>>>
>>> pprint(result)
Parameters:
  • ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
  • name (:str) – IP Address List Name (required)
  • description (:str) – IP Address List Description (optional)
  • ip_version (:str) – IP Version of ip address (required)
  • ip_address_collection (:str) – List of IP Address. At least one ipAddress element or one childIpAddressListId element must be provided.
  • child_ip_address_list (:class:’NttCisChildIpAddressList` or str`) – Child IP Address List or id to be included in this IP Address List. At least one ipAddress or one childIpAddressListId must be provided.
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_create_nat_rule(network_domain, internal_ip, external_ip)[source]

Create a NAT rule

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain the rule belongs to
  • internal_ip (str) – The IPv4 address internally
  • external_ip (str) – The IPv4 address externally
Return type:

NttCisNatRule

ex_create_network(location, name, description=None)[source]

Create a new network in an MCP 1.0 location

Parameters:
  • location (NodeLocation or str) – The target location (MCP1)
  • name (str) – The name of the network
  • description (str) – Additional description of the network
Returns:

A new instance of NttCisNetwork

Return type:

Instance of NttCisNetwork

ex_create_network_domain(location, name, service_plan, description=None)[source]

Deploy a new network domain to a data center

Parameters:
  • location (NodeLocation or str) – The data center to list
  • name (str) – The name of the network domain to create
  • service_plan (str) – The service plan, either “ESSENTIALS” or “ADVANCED”
  • description (str) – An additional description of the network domain
Returns:

an instance of NttCisNetworkDomain

Return type:

NttCisNetworkDomain

ex_create_node_uncustomized(name, image, ex_network_domain, ex_is_started=True, ex_description=None, ex_cluster_id=None, ex_cpu_specification=None, ex_memory_gb=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_disks=None, ex_tagid_value_pairs=None, ex_tagname_value_pairs=None)[source]

This MCP 2.0 only function deploys a new Cloud Server from a CloudControl compatible Server Image, which does not utilize VMware Guest OS Customization process.

Create Node in MCP2 Data Center

Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (UUID of the Server Image being used as the target for the new Server deployment. The source Server Image (OS Image or Customer Image) must have osCustomization set to true. See Get/List OS Image(s) and Get/List Customer Image(s).
  • ex_network_domain (NttCisNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_description (str) – (optional) description for this node
  • ex_cluster_id – (optional) For multiple cluster

environments, it is possible to set a destination cluster for the new Customer Image. Note that performance of this function is optimal when either the Server cluster and destination are the same or when shared data storage is in place for the multiple clusters. :type ex_cluster_id: str

Parameters:
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’NttCisNic’ or str) – (optional) List :class:’NttCisNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (NttCisServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_disks (List or tuple of :class:'NttCisServerDisk`) – (optional) NttCis disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_tagid_value_pairs – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
  • ex_tagname_value_pairs (dict`.) – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
Returns:

The newly created Node.

Return type:

Node

ex_create_portlist(ex_network_domain, name, description, port_collection, child_portlist_list=None)[source]

Create Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.nttcis import NttCisPort
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='1000')
>>> port_2 = DimensionDataPort(begin='1001', end='1003')
>>> port_collection = [port_1, port_2]
>>>
>>> # Create Port List
>>> new_portlist = driver.ex_create_portlist(
>>>     ex_network_domain=my_network_domain,
>>>     name='MyPortListX',
>>>     description="Test only",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>>     )
>>> pprint(new_portlist)
Parameters:
  • ex_network_domain (:str) – (required) The network domain in which to create PortList. Provide networkdomain object or its id.
  • name (:str) – Port List Name
  • description (:str) – IP Address List Description
  • port_collection (:str) – List of Port Address
  • child_portlist_list (:str or ‘’list of :class:’NttCisChildPortList’) – List of Child Portlist to be included in this Port List
Returns:

result of operation

Return type:

bool

ex_create_snapshot_preview_server(snapshot_id, server_name, server_started, nics_connected, server_description=None, target_cluster_id=None, preserve_mac_addresses=None, tag_key_name=None, tag_key_id=None, tag_value=None)[source]

Create a snapshot preview of a server to clone to a new server

Parameters:
  • snapshot_id (str) – ID of the specific snahpshot to use in creating preview server.
  • server_name – Name of the server created from the snapshot

:type str

Parameters:nics_connected – ‘true’ or ‘false’. Should the nics be automatically connected

:type str

Parameters:server_description – (Optional) A brief description of the server.

:type str

Parameters:target_cluster_id – (Optional) The ID of a specific cluster as opposed to the default.

:type str

Parameters:preserve_mac_address – (Optional) If set to ‘true’ will preserve mac address from the original server.

:type str

Parameters:tag_key_name – (Optional) If tagging is desired and by name is desired, set this to the tag name.

:type str

Parameters:tag_key_id – (Optional) If tagging is desired and by id is desired, set this to the tag id.

:type str

Parameters:tag_value – (Optional) If using a tag_key_id or tag_key_name, set the value fo tag_value.
Return type:str
ex_create_tag_key(name, description=None, value_required=True, display_on_report=True)[source]

Creates a tag key in the NTTC-CIS Cloud

Parameters:
  • name (str) – The name of the tag key (required)
  • description (str) – The description of the tag key
  • value_required (bool) – If a value is required for the tag Tags themselves can be just a tag, or be a key/value pair
  • display_on_report (bool) – Should this key show up on the usage reports
Return type:

bool

ex_create_vlan(network_domain, name, private_ipv4_base_address, description=None, private_ipv4_prefix_size=24)[source]

Deploy a new VLAN to a network domain

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain to add the VLAN to
  • name (str) – The name of the VLAN to create
  • private_ipv4_base_address (str) – The base IPv4 address e.g. 192.168.1.0
  • description (str) – An additional description of the VLAN
  • private_ipv4_prefix_size (int) – The size of the IPv4 address space, e.g 24
Returns:

an instance of NttCisVlan

Return type:

NttCisVlan

ex_delete_anti_affinity_rule(anti_affinity_rule)[source]

Remove anti affinity rule

Parameters:anti_affinity_rule (NttCisAntiAffinityRule or str) – The anti affinity rule to delete
Return type:bool
ex_delete_consistency_group(consistency_group_id)[source]

Delete’s a Consistency Group

Parameters:consistency_group_id – Id of Consistency Group to delete

:type str :return: True if response_code contains either IN_PROGRESS’ or ‘OK’ otherwise False :rtype: bool

ex_delete_firewall_rule(rule)[source]

Delete a firewall rule

Parameters:rule (NttCisFirewallRule) – The rule to delete
Return type:bool
ex_delete_ip_address_list(ex_ip_address_list)[source]

Delete IP Address List by ID

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> result = driver.ex_delete_ip_address_list(ip_address_list_id)
>>> pprint(result)
Parameters:ex_ip_address_list (:class:’NttCisIpAddressList’ or str) – IP Address List object or IP Address List ID (required)
Return type:bool
ex_delete_nat_rule(rule)[source]

Delete an existing NAT rule

Parameters:rule (NttCisNatRule) – The rule to delete
Return type:bool
ex_delete_network(network)[source]

Delete a network from an MCP 1 data center

Parameters:network (NttCisNetwork) – The network to delete
Return type:bool
ex_delete_network_domain(network_domain)[source]

Delete a network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain to delete
Return type:bool
ex_delete_portlist(ex_portlist)[source]

Delete Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Delete Port List
>>> portlist_id = '157531ce-77d4-493c-866b-d3d3fc4a912a'
>>> response = driver.ex_delete_portlist(portlist_id)
>>> pprint(response)
Parameters:ex_portlist (:str or :class:’NttCisPortList’) – Port List to be deleted
Return type:bool
ex_delete_vlan(vlan)[source]

Deletes an existing VLAN

Parameters:vlan (DNttCisNetworkDomain) – The VLAN to delete
Return type:bool
ex_destroy_nic(nic_id)[source]

Remove a NIC on a node, removing the node from a VLAN

Parameters:nic_id (str) – The identifier of the NIC to remove
Return type:bool
ex_detailed_usage_report(start_date, end_date)[source]

Get detailed usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_disable_monitoring(node)[source]

Disables cloud monitoring for a node

Parameters:node (Node) – The node to stop monitoring
Return type:bool
ex_disable_snapshots(node)[source]

Disable snapshots on a server. This also deletes current snapshots.

Parameters:node (str) – Node ID of the node on which to enable snapshots.

:return True or False :rtype: bool

ex_edit_firewall_rule(rule, position=None, relative_rule_for_position=None)[source]

Edit a firewall rule

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>>
>>> # List firewall rules
>>> firewall_rules = driver.ex_list_firewall_rules(my_network_domain)
>>>
>>> # Get Firewall Rule by name
>>> pprint("List specific firewall rule by name")
>>> fire_rule_under_test = (list(filter(lambda x: x.name ==
                           'My_New_Firewall_Rule', firewall_rules))[0])
>>> pprint(fire_rule_under_test.source)
>>> pprint(fire_rule_under_test.destination)
>>>
>>> # Edit Firewall
>>> fire_rule_under_test.destination.address_list_id =
        '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> fire_rule_under_test.destination.port_list_id =
        'b6557c5a-45fa-4138-89bd-8fe68392691b'
>>> result = driver.ex_edit_firewall_rule(fire_rule_under_test, 'LAST')
>>> pprint(result)
Parameters:
  • rule (DNttCisFirewallRule) – (required) The rule in which to create
  • position (str) – (required) There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • relative_rule_for_position (NttCisFirewallRule or str) – (optional) The rule or rule name in which to decide the relative rule for positioning.
Return type:

bool

ex_edit_ip_address_list(ex_ip_address_list, description=None, ip_address_collection=None, child_ip_address_lists=None)[source]

Edit IP Address List. IP Address list. Bear in mind you cannot add ip addresses to >>> from pprint import pprint >>> from libcloud.compute.types import Provider >>> from libcloud.compute.providers import get_driver >>> from libcloud.common.NTTCIS import NttCisIpAddress >>> import libcloud.security >>> >>> # Get NTTC-CIS driver >>> libcloud.security.VERIFY_SSL_CERT = True >>> cls = get_driver(Provider.NTTCIS) >>> driver = cls(‘myusername’,’mypassword’, region=’dd-au’) >>> >>> # IP Address collection >>> ipAddress_1 = NttCisIpAddress(begin=’190.2.2.100’) >>> ipAddress_2 = NttCisIpAddress(begin=’190.2.2.106’, >>> end=’190.2.2.108’) >>> ipAddress_3 = NttCisIpAddress( >>> begin=’190.2.2.0’, prefix_size=’24’) >>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3] >>> >>> # Edit IP Address List >>> ip_address_list_id = ‘5e7c323f-c885-4e4b-9a27-94c44217dbd3’ >>> result = driver.ex_edit_ip_address_list( >>> ex_ip_address_list=ip_address_list_id, >>> description=”Edit Test”, >>> ip_address_collection=ip_address_collection, >>> child_ip_address_lists=None >>> ) >>> pprint(result)

Parameters:
  • ex_ip_address_list (:class:’NttCisIpAddressList’ or str) – (required) IpAddressList object or IpAddressList ID
  • description (:str) – IP Address List Description
  • ip_address_collection (''list'' of :class:'NttCisIpAddressList') – List of IP Address
  • child_ip_address_lists (list of :class:’NttCisChildIpAddressList’ or str) – Child IP Address List or id to be included in this IP Address List
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_edit_portlist(ex_portlist, description=None, port_collection=None, child_portlist_list=None)[source]

Edit Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.NTTCIS import DimensionDataPort
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='4200')
>>> port_2 = DimensionDataPort(begin='4201', end='4210')
>>> port_collection = [port_1, port_2]
>>>
>>> # Edit Port List
>>> editPortlist = driver.ex_get_portlist(
    '27dd8c66-80ff-496b-9f54-2a3da2fe679e')
>>>
>>> result = driver.ex_edit_portlist(
>>>     ex_portlist=editPortlist.id,
>>>     description="Make Changes in portlist",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>> )
>>> pprint(result)
Parameters:
  • ex_portlist (:str or :class:’DNttCisPortList’) – Port List to be edited (required)
  • description (:str) – Port List Description
  • port_collection (:str) – List of Ports
  • child_portlist_list (:list of :class’NttCisChildPortList’ or ‘’str’’) – Child PortList to be included in this IP Address List
Returns:

a list of NttCisPortList objects

Return type:

list of NttCisPortList

ex_enable_monitoring(node, service_plan='ESSENTIALS')[source]

Enables cloud monitoring on a node

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_enable_snapshots(node, window, plan='ADVANCED', initiate='true')[source]

Enable snapshot service on a server

Parameters:
  • node (str) – Node ID of the node on which to enable snapshots.
  • window – The window id of the window in which the snapshot is enabled.
  • plan (str) – Pland type ‘ESSENTIALS’ or ‘ADVANCED
  • initiate – Run a snapshot upon configuration of the snapshot.

:type str

Return type:bool
ex_exchange_nic_vlans(nic_id_1, nic_id_2)[source]

Exchange NIC Vlans

Parameters:
  • nic_id_1 (:str) – Nic ID 1
  • nic_id_2 (:str) – Nic ID 2
Return type:

bool

ex_expand_journal(consistency_group_id, size_gb)[source]

Expand the consistency group’s journhal size in 100Gb increments.

Parameters:
  • consistency_group_id (str) – The consistency group’s UUID
  • size_gb (str) – Gb in 100 Gb increments
Returns:

True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False

Return type:

bool

ex_expand_vlan(vlan)[source]

Expands the VLAN to the prefix size in private_ipv4_range_size The expansion will not be permitted if the proposed IP space overlaps with an already deployed VLANs IP space.

Parameters:vlan (NttCisNetworkDomain) – The VLAN to update
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_get_base_image_by_id(id)[source]

Gets a Base image in the NTTC-CIS Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_consistency_group(consistency_group_id)[source]

Retrieves a Consistency by it’s id and is more efficient thatn listing all consistency groups and filtering that result.

Parameters:consistency_group_id (str) – An id of a consistency group
Return type:NttCisConsistencygroup
ex_get_customer_image_by_id(id)[source]

Gets a Customer image in the NTTC-CIS Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_image_by_id(id)[source]

Gets a Base/Customer image in the NTTC-CIS Cloud given the id

Note: This first checks the base image
If it is not a base image we check if it is a customer image If it is not in either of these a NttCisAPIException is thrown
Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_ip_address_list(ex_network_domain, ex_ip_address_list_name)[source]

Get IP Address List by name in network domain specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Get IP Address List by Name
>>> ipaddresslist_list_by_name = driver.ex_get_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     ex_ip_address_list_name='My_IP_AddressList_1')
>>> pprint(ipaddresslist_list_by_name)
Parameters:
  • ex_network_domain (NttCisNetworkDomain or ‘str’) – (required) The network domain or network domain ID in which ipaddresslist resides.
  • ex_ip_address_list_name (:str) – (required) Get ‘IP Address List’ by name
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_get_location_by_id(id)[source]

Get location by ID.

Parameters:id (str) – ID of the node location which should be used
Return type:NodeLocation
ex_get_nat_rule(network_domain, rule_id)[source]

Get a NAT rule by ID

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain the rule belongs to
  • rule_id (str) – The ID of the NAT rule to fetch
Return type:

NttCisNatRule

ex_get_network_domain(network_domain_id)[source]

Get an individual Network Domain, by identifier

Parameters:network_domain_id (str) – The identifier of the network domain
Return type:NttCisNetworkDomain
ex_get_portlist(ex_portlist_id)[source]

Get Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get specific portlist by ID
>>> portlist_id = '27dd8c66-80ff-496b-9f54-2a3da2fe679e'
>>> portlist = driver.ex_get_portlist(portlist_id)
>>> pprint(portlist)
Parameters:ex_portlist_id (NttCisNetworkDomain or ‘str’) – The ex_port_list or ex_port_list ID
Returns:NttCisPortList object
Return type:NttCisPort
ex_get_tag_key_by_id(id)[source]

Get a specific tag key by ID

Parameters:id (str) – ID of the tag key you want (required)
Return type:NttCisTagKey
ex_get_tag_key_by_name(name)[source]
NOTICE: Tag key is one of those instances where Libloud
handles the search of a list for the client code. This behavior exists inconsistently across libcloud. Get a specific tag key by Name
Parameters:name (str) – Name of the tag key you want (required)
Return type:NttCisTagKey
ex_get_vlan(vlan_id)[source]

Get a single VLAN, by it’s identifier

Parameters:vlan_id (str) – The identifier of the VLAN
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_initiate_drs_failover(consistency_group_id)[source]

This method is irreversible. It will failover the Consistency Group while removing it as well.

Parameters:consistency_group_id (str) – Consistency Group’s Id to failover
Returns:True if response_code contains either

IN_PROGRESS’ or ‘OK’ otherwise False :rtype: bool

ex_initiate_manual_snapshot(name=None, server_id=None)[source]

Initiate a manual snapshot of server on the fly

Parameters:
  • name (str) – optional name of server
  • server_id – optinal parameter to use instead of name

:type server_id`str`

Returns:True of False
Return type:bool
ex_list_anti_affinity_rules(network=None, network_domain=None, node=None, filter_id=None, filter_state=None)[source]

List anti affinity rules for a network, network domain, or node

Parameters:
  • network (NttCisNetwork or str) – The network to list anti affinity rules for One of network, network_domain, or node is required
  • network_domain (NttCisNetworkDomain or str) – The network domain to list anti affinity rules One of network, network_domain, or node is required
  • node (Node or str) – The node to list anti affinity rules for One of network, netwok_domain, or node is required
  • filter_id (str) – This will allow you to filter the rules by this node id
Return type:

list of :class:NttCisAntiAffinityRule`

ex_list_consistency_group_snapshots(consistency_group_id, create_time_min=None, create_time_max=None)[source]

Optional parameters identify the date of creation of Consistency Group snapshots in *XML Schema (XSD) date time format. Best used as a combination of createTime.MIN and createTime.MAX. If neither is provided then all snapshots up to the possible maximum of 1014 will be returned. If MIN is provided by itself, all snapshots between the time specified by MIN and the point in time of execution will be returned. If MAX is provided by itself, then all snapshots up to that point in time (up to the maximum number of 1014) will be returned. MIN and MAX are inclusive for this API function

Parameters:
  • consistency_group_id (str) – The id of consistency group
  • create_time_min (str) – (Optional) in form YYYY-MM-DDT00:00.00.00Z or substitute time offset for Z, i.e, -05:00
  • create_time_max (str) – (Optional) in form YYYY-MM-DDT00:00:00.000Z or substitute time offset for Z, i.e, -05:00
Return type:

list of NttCisSnapshots

ex_list_consistency_groups(params={})[source]

Functions takes a named parameter that must be one of the following :param params: A dictionary composed of one of the following keys and a value * target_data_center_id= * source_network_domain_id= * target_network_domain_id= * source_server_id= * target_server_id= * name= * state= * operation_status= * drs_infrastructure_status= :rtype: list of :class: NttCisConsistencyGroup

ex_list_customer_images(location=None)[source]

Return a list of customer imported images

Parameters:location (NodeLocation or str) – The target location
Return type:list of NodeImage
ex_list_ip_address_list(ex_network_domain)[source]

List IP Address List by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # List IP Address List of network domain
>>> ipaddresslist_list = driver.ex_list_ip_address_list(
>>>     ex_network_domain=my_network_domain)
>>> pprint(ipaddresslist_list)
Parameters:ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of NttCisIpAddressList objects
Return type:list of NttCisIpAddressList
ex_list_nat_rules(network_domain)[source]

Get NAT rules for the network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain the rules belongs to
Return type:list of NttCisNatRule
ex_list_network_domains(location=None, name=None, service_plan=None, state=None)[source]

List networks domains deployed across all data center locations domain.

for your organization. The response includes the location of each network :param location: Only network domains in the location (optional) :type location: NodeLocation or str

Parameters:
  • name (str) – Only network domains of this name (optional)
  • service_plan (str) – Only network domains of this type (optional)
  • state (str) – Only network domains in this state (optional)
Returns:

a list of NttCisNetwork objects

Return type:

list of NttCisNetwork

ex_list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The target location
Returns:a list of NttCisNetwork objects
Return type:list of NttCisNetwork
ex_list_nodes_paginated(name=None, location=None, ipv6=None, ipv4=None, vlan=None, image=None, deployed=None, started=None, state=None, network=None, network_domain=None)[source]

Return a generator which yields node lists in pages

Parameters:
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
  • name – Filters the node list to nodes that have this name

:type name str

Parameters:
  • ipv6 (str) – Filters the node list to nodes that have this ipv6 address
  • ipv4 (str) – Filters the node list to nodes that have this ipv4 address
  • vlan (NttCisVlan or str) – Filters the node list to nodes that are in this VLAN
  • image (NodeImage or str) – Filters the node list to nodes that have this image
  • deployed (bool) – Filters the node list to nodes that are deployed or not
  • started (bool) – Filters the node list to nodes that are started or not
  • state (str) – Filters the node list to nodes that are in this state
  • network (NttCisNetwork or str) – Filters the node list to nodes in this network
  • network_domain (NttCisNetworkDomain or str) – Filters the node list to nodes in this network domain
Returns:

a list of Node objects

Return type:

generator of list of Node

ex_list_portlist(ex_network_domain)[source]

List Portlist by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
>>>                                               networkDomainName][0]
>>>
>>> # List portlist
>>> portLists = driver.ex_list_portlist(
>>>     ex_network_domain=my_network_domain)
>>> pprint(portLists)
>>>
Parameters:ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of NttCisPortList objects
Return type:list of NttCisPortList
ex_list_tag_keys(id=None, name=None, value_required=None, display_on_report=None)[source]

List tag keys in the NTTC-CIS Cloud

Parameters:
  • id (str) – Filter the list to the id of the tag key
  • name (str) – Filter the list to the name of the tag key
  • value_required (bool) – Filter the list to if a value is required for a tag key
  • display_on_report (bool) – Filter the list to if the tag key should show up on usage reports
Return type:

list of NttCisTagKey

ex_list_tags(asset_id=None, asset_type=None, location=None, tag_key_name=None, tag_key_id=None, value=None, value_required=None, display_on_report=None)[source]

List tags in the NTTC-CIS Cloud

Parameters:
  • asset_id (str) – Filter the list by asset id
  • asset_type (str) – Filter the list by asset type
  • location (:class:NodeLocation or str) – Filter the list by the assets location
  • tag_key_name (str) – Filter the list by a tag key name
  • tag_key_id (str) – Filter the list by a tag key id
  • value (str) – Filter the list by a tag value
  • value_required (bool) – Filter the list to if a value is required for a tag
  • display_on_report (bool) – Filter the list to if the tag should show up on usage reports
Return type:

list of NttCisTag

ex_list_vlans(location=None, network_domain=None, name=None, ipv4_address=None, ipv6_address=None, state=None)[source]

List VLANs available, can filter by location and/or network domain

Parameters:
  • location (NodeLocation or str) – Only VLANs in this location (optional)
  • network_domain (NttCisNetworkDomain) – Only VLANs in this domain (optional)
  • name (str) – Only VLANs with this name (optional)
  • ipv4_address (str) – Only VLANs with this ipv4 address (optional)
  • ipv6_address (str) – Only VLANs with this ipv6 address (optional)
  • state (str) – Only VLANs with this state (optional)
Returns:

a list of NttCisVlan objects

Return type:

list of NttCisVlan

ex_modify_tag_key(tag_key, name=None, description=None, value_required=None, display_on_report=None)[source]

Modify a specific tag key

Parameters:
  • tag_key (NttCisTagKey or str) – The tag key you want to modify (required)
  • name (str) – Set to modifiy the name of the tag key
  • description (str) – Set to modify the description of the tag key
  • value_required (bool) – Set to modify if a value is required for the tag key
  • display_on_report (bool) – Set to modify if this tag key should display on the usage reports
Return type:

bool

ex_power_off(node)[source]

This function will abruptly power-off a server. Unlike ex_shutdown_graceful, success ensures the node will stop but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_reconfigure_node(node, memory_gb=None, cpu_count=None, cores_per_socket=None, cpu_performance=None)[source]

Reconfigure the virtual hardware specification of a node

Parameters:
  • node (Node) – The server to change
  • memory_gb (int) – The amount of memory in GB (optional)
  • cpu_count (int) – The number of CPU (optional)
  • cores_per_socket (int) – Number of CPU cores per socket (optional)
  • cpu_performance (str) – CPU Performance type (optional)
Return type:

bool

ex_remove_scsi_controller(controller_id)[source]

Added 8/27/18: Adds a SCSI Controller by node id :param controller_id: Scsi controller’s id :return: whether addition is in progress or ‘OK’ otherwise false

ex_remove_storage(disk_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • disk_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_storage_from_node(node, scsi_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • scsi_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_tag_from_asset(asset, tag_key)[source]

Remove a tag from an asset

Parameters:
  • asset (Node or NodeImage or NttCisNewtorkDomain or NttCisVlan or NttCisPublicIpBlock) – The asset to remove a tag from. (required)
  • tag_key (NttCisTagKey or str) – The tag key you want to remove (required)
Return type:

bool

ex_remove_tag_key(tag_key)[source]

Modify a specific tag key

Parameters:tag_key (NttCisTagKey or str) – The tag key you want to remove (required)
Return type:bool
ex_rename_network(network, new_name)[source]

Rename a network in MCP 1 data center

Parameters:
  • network (NttCisNetwork) – The network to rename
  • new_name (str) – The new name of the network
Return type:

bool

ex_reset(node)[source]

This function will abruptly reset a server. Unlike reboot_node, success ensures the node will restart but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_set_firewall_rule_state(rule, state)[source]

Change the state (enabled or disabled) of a rule

Parameters:
  • rule (NttCisFirewallRule) – The rule to delete
  • state (bool) – The desired state enabled (True) or disabled (False)
Return type:

bool

ex_software_usage_report(start_date, end_date)[source]

Get detailed software usage reports

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_start_drs_failover_preview(consistency_group_id, snapshot_id)[source]

Brings a Consistency Group into PREVIEWING_SNAPSHOT mode.

Parameters:
  • consistency_group_id (str) – Id of the Consistency Group to put into PRIEVEW_MODE
  • snapshot_id (str) – Id of the Snapshot to preview
Returns:

True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False

Return type:

bool

ex_stop_drs_failover_preview(consistency_group_id)[source]

Takes a Consistency Group out of PREVIEW_MODE and back to DRS_MODE

Parameters:consistency_group_id – Consistency Group’s Id

:type str

Returns:True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False
Return type:bool
ex_summary_usage_report(start_date, end_date)[source]

Get summary usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_update_monitoring_plan(node, service_plan='ESSENTIALS')[source]

Updates the service plan on a node with monitoring

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_update_network_domain(network_domain)[source]

Update the properties of a network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain with updated properties
Returns:an instance of NttCisNetworkDomain
Return type:NttCisNetworkDomain
ex_update_node(node, name=None, description=None, cpu_count=None, ram_mb=None)[source]

Update the node, the name, CPU or RAM

Parameters:
  • node (Node) – Node which should be used
  • name (str) – The new name (optional)
  • description (str) – The new description (optional)
  • cpu_count (int) – The new CPU count (optional)
  • ram_mb (int) – The new Memory in MB (optional)
Return type:

bool

ex_update_vlan(vlan)[source]

Updates the properties of the given VLAN Only name and description are updated

Parameters:vlan (NttCisetworkDomain) – The VLAN to update
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_update_vm_tools(node)[source]

This function triggers an update of the VMware Tools software running on the guest OS of a Server.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]

Wait for the function which returns a instance with field status to match

Keep polling func until one of the desired states is matched

Parameters:
  • state (str or list) – Either the desired state (str) or a list of states
  • func (function) – The function to call, e.g. ex_get_vlan
  • poll_interval (int) – The number of seconds to wait between checks
  • timeout (int) – The total number of seconds to wait to reach a state
  • args (Positional arguments) – The arguments for func
  • kwargs (Keyword arguments) – The arguments for func
get_image(image_id)

Returns a single node image from a provider.

Parameters:image_id (str) – Node to run the task on.

:rtype NodeImage: :return: NodeImage instance on success.

get_key_pair(name)

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
get_snapshot(snapshot_id)[source]

Get snapshot of a server by snapshot id.

Parameters:snapshot_id (str) – ID of snapshot to retrieve.

:return a snapshot :rtype: dict

import_image(ovf_package_name, name, cluster_id=None, datacenter_id=None, description=None, is_guest_os_customization=None, tagkey_name_value_dictionaries=None)[source]

Import image

Parameters:
  • ovf_package_name (str) – Image OVF package name
  • name (str) – Image name
  • cluster_id (str) – Provide either cluster_id or datacenter_id
  • datacenter_id (str) – Provide either cluster_id or datacenter_id
  • description (str) – Optional. Description of image
  • is_guest_os_customization (bool) – Optional. true for NGOC image
  • tagkey_name_value_dictionaries (dictionaries) – Optional tagkey name value dict
Returns:

Return true if successful

Return type:

bool

import_key_pair_from_file(name, key_file_path)

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_file_path (str) – Path to the public key file.
Return type:

KeyPair object

import_key_pair_from_string(name, key_material)

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_datacenter_properties(location)[source]
return a list of available sizes
Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.

@inherits: NodeDriver.list_sizes

list_images(location=None)[source]

List images available

Note: Currently only returns the default ‘base OS images’
provided by NTTCIS. Customer images (snapshots) use ex_list_customer_images
Parameters:ex_location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Returns:List of images available
Return type:list of NodeImage
list_key_pairs()

List all the available key pair objects.

Return type:list of KeyPair objects
list_locations(ex_id=None)[source]

List locations (datacenters) available for instantiating servers and networks.

Parameters:ex_id (str) – Filters the location list to this id
Returns:List of locations
Return type:list of NttCisDatacenter
list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The location
Returns:a list of NttCisNetwork objects
Return type:list of NttCisNetwork
list_nodes(ex_location=None, ex_name=None, ex_ipv6=None, ex_ipv4=None, ex_vlan=None, ex_image=None, ex_deployed=None, ex_started=None, ex_state=None, ex_network_domain=None, ex_snaphots=None)[source]

List nodes deployed for your organization.

keyword ex_location:
 Filters the node list to nodes that are located in this location
type ex_location:
 NodeLocation or str
keyword ex_name:
 Filters the node list to nodes that have this name

:type ex_name str

keyword ex_ipv6:
 Filters the node list to nodes that have this ipv6 address
type ex_ipv6:
 str
keyword ex_ipv4:
 Filters the node list to nodes that have this ipv4 address
type ex_ipv4:
 str
keyword ex_vlan:
 Filters the node list to nodes that are in this VLAN
type ex_vlan:
 DimensionDataVlan or str
keyword ex_image:
 Filters the node list to nodes that have this image
type ex_image:
 NodeImage or str
keyword ex_deployed:
 Filters the node list to nodes that are deployed or not
type ex_deployed:
 bool
keyword ex_started:
 Filters the node list to nodes that are started or not
type ex_started:
 bool
keyword ex_state:
 Filters the node list by nodes that are in this state
type ex_state:
 str
Parameters:ex_network_domain
Filters the node list to nodes in this
network domain
type ex_network_domain:
 NttCisNetworkDomain or str
return:a list of Node objects
rtype:list of Node
list_sizes(location=None)[source]
return a list of available sizes
Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.

@inherits: NodeDriver.list_sizes

list_snapshot_windows(location, plan)[source]

List snapshot windows in a given location :param location: a location object or location id such as “NA9” :param plan: ‘ESSENTIALS’ or ‘ADVANCED’ :return: dictionary with keys id, day_of_week, start_hour, availability :rtype: dict

list_snapshots(node, page_size=None)[source]

List snapshots of a server. The list of snapshots can get large. Therefore, page_size is optional to limit this if desired.

Parameters:
  • node (str) – Node nameof the node on which to enable snapshots.
  • page_size – (Optional) Limit the number of records returned

:return snapshots :rtype: list of dictionaries

list_volume_snapshots(volume)

List snapshots for a storage volume.

Return type:list of VolumeSnapshot
list_volumes()

List storage volumes.

Return type:list of StorageVolume
reboot_node(node)[source]

Reboots a node by requesting the OS restart via the hypervisor

Parameters:node (Node) – The node to reboot
Return type:bool
start_node(node)[source]

Powers on an existing deployed server

Parameters:node (Node) – Node which should be used
Return type:bool
stop_node(node)[source]

This function will attempt to “gracefully” stop a server by initiating a shutdown sequence within the guest operating system. A successful response on this function means the system has successfully passed the request into the operating system.

Parameters:node (Node) – Node which should be used
Return type:bool
wait_until_running(nodes, wait_period=5, timeout=600, ssh_interface='public_ips', force_ipv4=True, ex_list_nodes_kwargs=None)

Block until the provided nodes are considered running.

Node is considered running when it’s state is “running” and when it has at least one IP address assigned.

Parameters:
  • nodes (list of Node) – List of nodes to wait for.
  • wait_period (int) – How many seconds to wait between each loop iteration. (default is 3)
  • timeout (int) – How many seconds to wait before giving up. (default is 600)
  • ssh_interface (str) – Which attribute on the node to use to obtain an IP address. Valid options: public_ips, private_ips. Default is public_ips.
  • force_ipv4 (bool) – Ignore IPv6 addresses (default is True).
  • ex_list_nodes_kwargs (dict) – Optional driver-specific keyword arguments which are passed to the list_nodes method.
Returns:

[(Node, ip_addresses)] list of tuple of Node instance and list of ip_address on success.

Return type:

list of tuple

Debugging Tips

Problem description: XML parsing issue for python version 2.7.5

Example:

ip_address_collection=ip_addr_collection, child_ip_address_lists=None)
File "/Users/andrewdas/Documents/Python/lib/python2.7/site-packages/libcloud/compute/drivers/dimensiondata.py", line 3185, in ex_edit_ip_address_list
  'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance"
File "lxml.etree.pyx", line 2912, in lxml.etree.Element (src/lxml/lxml.etree.c:68681)
File "apihelpers.pxi", line 140, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15242)
File "apihelpers.pxi", line 128, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15125)
File "apihelpers.pxi", line 287, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:17012)
File "apihelpers.pxi", line 296, in lxml.etree._addAttributeToNode (src/lxml/lxml.etree.c:17180)
File "apihelpers.pxi", line 1583, in lxml.etree._attributeValidOrRaise (src/lxml/lxml.etree.c:29377)
ValueError: Invalid attribute name u'xmlns:xsi'

Solution: - Upgrade to python version 2.7.12 and above