diff --git a/CHANGES.rst b/CHANGES.rst index 09dc688897..048d163435 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,13 @@ Changes in Apache Libcloud 4.0.0 Common ~~~~~~ +- Remove obsolete Dimension Data (Compute, Backup, and Load Balancer) and + Internet Solutions (Compute) drivers, along with their associated documentation + and tests. + + (#2231) + [Samuel Marks - @SamuelMarks, Miguel Caballer - @micafer] + - Accept bracketed IPv6 endpoint URLs, with default or explicit ports, in the shared connection class. (GITHUB-2220) @@ -188,6 +195,7 @@ Storage [Sanjay Santhanam - @Sanjays2402] DNS +~~~ - [Route53] Fix ``delete_record`` failing with ``RecordDoesNotExistError`` for records which are part of a multi value record set (e.g. MX). Route53 only diff --git a/docs/_static/images/provider_logos/dimensiondata.png b/docs/_static/images/provider_logos/dimensiondata.png deleted file mode 100644 index 6a15b863f5..0000000000 Binary files a/docs/_static/images/provider_logos/dimensiondata.png and /dev/null differ diff --git a/docs/backup/_supported_methods.rst b/docs/backup/_supported_methods.rst index a4c7f64aec..42e6f0bc92 100644 --- a/docs/backup/_supported_methods.rst +++ b/docs/backup/_supported_methods.rst @@ -3,11 +3,9 @@ ====================================== ========================== ============ ============= ======================= ==================================== ============= ============= ==================== ============== =========================== ================ ================= ================= ================== ================= Provider get supported target types list targets create target create target from node create target from storage container update target delete target list recovery points recover target recover target out of place list target jobs create target job resume target job suspend target job cancel target job ====================================== ========================== ============ ============= ======================= ==================================== ============= ============= ==================== ============== =========================== ================ ================= ================= ================== ================= -`Dimension Data Backup`_ yes yes yes yes no yes yes yes yes yes yes yes yes yes yes -`Amazon EBS Backup Driver`_ yes yes yes yes no yes yes yes yes yes yes yes yes yes yes +`Amazon EBS Backup Driver`_ yes yes yes yes no yes yes yes yes yes yes yes yes yes yes `Google Compute Engine Backup Driver`_ yes yes yes yes no yes yes yes yes yes yes yes yes yes yes ====================================== ========================== ============ ============= ======================= ==================================== ============= ============= ==================== ============== =========================== ================ ================= ================= ================== ================= -.. _`Dimension Data Backup`: https://cloud.dimensiondata.com/ .. _`Amazon EBS Backup Driver`: http://aws.amazon.com/ebs/ .. _`Google Compute Engine Backup Driver`: http://cloud.google.com/ diff --git a/docs/backup/_supported_providers.rst b/docs/backup/_supported_providers.rst index c7ee635180..0d23103be6 100644 --- a/docs/backup/_supported_providers.rst +++ b/docs/backup/_supported_providers.rst @@ -3,11 +3,9 @@ ====================================== ============================================ ================= ==================== ============================================ ================================== Provider Documentation Provider Constant Supported Regions Module Class Name ====================================== ============================================ ================= ==================== ============================================ ================================== -`Dimension Data Backup`_ :doc:`Click ` DIMENSIONDATA single region driver :mod:`libcloud.backup.drivers.dimensiondata` :class:`DimensionDataBackupDriver` -`Amazon EBS Backup Driver`_ EBS single region driver :mod:`libcloud.backup.drivers.ebs` :class:`EBSBackupDriver` +`Amazon EBS Backup Driver`_ EBS single region driver :mod:`libcloud.backup.drivers.ebs` :class:`EBSBackupDriver` `Google Compute Engine Backup Driver`_ GCE single region driver :mod:`libcloud.backup.drivers.gce` :class:`GCEBackupDriver` ====================================== ============================================ ================= ==================== ============================================ ================================== -.. _`Dimension Data Backup`: https://cloud.dimensiondata.com/ .. _`Amazon EBS Backup Driver`: http://aws.amazon.com/ebs/ .. _`Google Compute Engine Backup Driver`: http://cloud.google.com/ diff --git a/docs/backup/drivers/dimensiondata.rst b/docs/backup/drivers/dimensiondata.rst deleted file mode 100644 index a13231e4ee..0000000000 --- a/docs/backup/drivers/dimensiondata.rst +++ /dev/null @@ -1,66 +0,0 @@ -Dimension Data Cloud Backup Driver Documentation -================================================ - -Dimension Data are a global IT Services company and form part of the NTT Group. -Dimension Data provide 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 of the public cloud instances or as a private instance on premises. - -.. figure:: /_static/images/provider_logos/dimensiondata.png - :align: center - :width: 300 - :target: http://cloud.dimensiondata.com/ - -Backup-as-a-Service includes Cloud Backup, Cloud Backup -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 Dimension Data libcloud -driver to communicate with both the public and private clouds. - -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: - -* ``dd-na`` : Dimension Data North America (USA) -* ``dd-eu`` : Dimension Data Europe -* ``dd-af`` : Dimension Data Africa -* ``dd-au`` : Dimension Data Australia -* ``dd-latam`` : Dimension Data Latin America -* ``dd-ap`` : Dimension Data Asia Pacific -* ``dd-canada`` : Dimension Data Canada region - -The base `libcloud` API allows you to: - -* enable backups, add backup clients and configure backup clients - -Non-standard functionality and extension methods ------------------------------------------------- - -The Dimension Data driver exposes some `libcloud` non-standard -functionalities through extension methods and arguments. - -These functionalities include: - -* set retention periods -* configure secondary copes - -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 --------- - -.. autoclass:: libcloud.backup.drivers.dimensiondata.DimensionDataBackupDriver - :members: - :inherited-members: - -.. _`API`: http://cloud.dimensiondata.com/au/en/services/public-cloud/api diff --git a/docs/backup/index.rst b/docs/backup/index.rst index 3b372194b9..20524879dd 100644 --- a/docs/backup/index.rst +++ b/docs/backup/index.rst @@ -10,7 +10,7 @@ Backup This driver is **experimental** - please use to test functionality and develop new driver instances, not for production use. Backup API allows you to manage Backup as A Service and services such as EBS Snaps, -GCE volume snap and dimension data backup. +GCE volume snapshots and backup. Terminology ----------- diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst index ff2763f1ff..4da813e8d4 100644 --- a/docs/compute/_supported_methods_block_storage.rst +++ b/docs/compute/_supported_methods_block_storage.rst @@ -5,84 +5,76 @@ Provider list volumes create volume destroy volume attach ============================== ============ ============= ============== ============= ============= ============== =============== `Abiquo`_ no no no no no no no `Aliyun ECS`_ yes yes yes yes yes yes yes -`PCextreme AuroraCompute`_ yes yes yes yes yes no yes -`Azure Virtual machines`_ yes yes yes yes yes no yes -`Azure Virtual machines`_ yes yes yes yes yes yes yes -`Brightbox`_ no no no no no no no -`Cloudscale`_ no no no no no no no -`CloudSigma (API v2.0)`_ yes yes yes yes yes no no -`CloudStack`_ yes yes yes yes yes no yes -`DigitalOcean`_ yes yes yes yes yes yes yes -`DimensionData`_ no no no no no no no -`Amazon EC2`_ yes yes yes yes yes yes yes -`EquinixMetal`_ no no no no no no no -`Eucalyptus`_ yes yes yes yes yes yes yes -`Exoscale`_ yes yes yes yes yes no yes -`Gandi`_ yes yes yes yes yes no no -`Google Compute Engine`_ yes yes yes yes yes yes yes -`GiG G8 Node Provider`_ yes yes yes yes yes no no -`Gridscale`_ yes yes yes yes yes yes yes -`Ikoula`_ yes yes yes yes yes no yes -`InternetSolutions`_ no no no no no no no -`Kamatera`_ no no no no no no no -`KTUCloud`_ yes yes yes yes yes no yes -`kubevirt`_ yes yes yes yes yes no no -`Libvirt`_ no no no no no no no -`Linode`_ yes yes yes yes yes no no -`Maxihost`_ no no no no no no no -`Nimbus`_ yes yes yes yes yes yes yes -`NTTAmerica`_ no no no no no no no -`NTTC-CIS`_ no no no no no no no -`OnApp`_ no no no no no no no -`OpenNebula (v3.8)`_ yes yes yes yes yes no no -`OpenStack`_ yes yes yes yes yes no no -`Outscale API`_ yes yes yes yes yes yes yes -`Outscale INC`_ yes yes yes yes yes yes yes -`Outscale SAS`_ yes yes yes yes yes yes yes -`Ovh`_ yes yes yes yes yes yes yes -`Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yes yes -`Rackspace Cloud (First Gen)`_ yes yes yes yes yes no no -`RimuHosting`_ no no no no no no no -`Scaleway`_ yes yes yes no no yes yes -`vCloud`_ no no no no no no no -`Upcloud`_ no no no no no no no -`VCL`_ no no no no no no no -`vCloud`_ no no no no no no no -`vps.net`_ no no no no no no no -`VMware vSphere`_ no no no no no no no -`Vultr`_ yes yes yes yes yes no no +`Amazon EC2`_ yes yes yes yes yes yes yes +`Azure Virtual machines`_ yes yes yes yes yes yes yes +`Brightbox`_ no no no no no no no +`CloudSigma (API v2.0)`_ yes yes yes yes yes no no +`CloudStack`_ yes yes yes yes yes no yes +`Cloudscale`_ no no no no no no no +`DigitalOcean`_ yes yes yes yes yes yes yes +`EquinixMetal`_ no no no no no no no +`Eucalyptus`_ yes yes yes yes yes yes yes +`Exoscale`_ yes yes yes yes yes no yes +`Gandi`_ yes yes yes yes yes no no +`GiG G8 Node Provider`_ yes yes yes yes yes no no +`Google Compute Engine`_ yes yes yes yes yes yes yes +`Gridscale`_ yes yes yes yes yes yes yes +`Ikoula`_ yes yes yes yes yes no yes +`KTUCloud`_ yes yes yes yes yes no yes +`Kamatera`_ no no no no no no no +`Libvirt`_ no no no no no no no +`Linode`_ yes yes yes yes yes no no +`Maxihost`_ no no no no no no no +`NTTAmerica`_ no no no no no no no +`NTTC-CIS`_ no no no no no no no +`Nimbus`_ yes yes yes yes yes yes yes +`OnApp`_ no no no no no no no +`OpenNebula (v3.8)`_ yes yes yes yes yes no no +`OpenStack`_ yes yes yes yes yes no no +`Outscale API`_ yes yes yes yes yes yes yes +`Outscale INC`_ yes yes yes yes yes yes yes +`Outscale SAS`_ yes yes yes yes yes yes yes +`Ovh`_ yes yes yes yes yes yes yes +`PCextreme AuroraCompute`_ yes yes yes yes yes no yes +`Rackspace Cloud (First Gen)`_ yes yes yes yes yes no no +`Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yes yes +`RimuHosting`_ no no no no no no no +`Scaleway`_ yes yes yes no no yes yes +`Upcloud`_ no no no no no no no +`VCL`_ no no no no no no no +`VMware vSphere`_ no no no no no no no +`Vultr`_ yes yes yes yes yes no no +`kubevirt`_ yes yes yes yes yes no no +`vCloud`_ no no no no no no no +`vCloud`_ no no no no no no no +`vps.net`_ no no no no no no no ============================== ============ ============= ============== ============= ============= ============== =============== .. _`Abiquo`: http://www.abiquo.com/ .. _`Aliyun ECS`: https://www.aliyun.com/product/ecs -.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute -.. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ +.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ .. _`Brightbox`: http://www.brightbox.co.uk/ -.. _`Cloudscale`: https://www.cloudscale.ch .. _`CloudSigma (API v2.0)`: http://www.cloudsigma.com/ .. _`CloudStack`: http://cloudstack.org/ +.. _`Cloudscale`: https://www.cloudscale.ch .. _`DigitalOcean`: https://www.digitalocean.com -.. _`DimensionData`: http://www.dimensiondata.com/ -.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`EquinixMetal`: https://metal.equinix.com/ .. _`Eucalyptus`: http://www.eucalyptus.com/ .. _`Exoscale`: https://www.exoscale.com/ .. _`Gandi`: http://www.gandi.net/ -.. _`Google Compute Engine`: https://cloud.google.com/ .. _`GiG G8 Node Provider`: https://gig.tech +.. _`Google Compute Engine`: https://cloud.google.com/ .. _`Gridscale`: https://gridscale.io .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack -.. _`InternetSolutions`: http://www.is.co.za/ -.. _`Kamatera`: https://www.kamatera.com/ .. _`KTUCloud`: https://ucloudbiz.olleh.com/ -.. _`kubevirt`: https://www.kubevirt.io +.. _`Kamatera`: https://www.kamatera.com/ .. _`Libvirt`: http://libvirt.org/ .. _`Linode`: http://www.linode.com/ .. _`Maxihost`: https://www.maxihost.com/ -.. _`Nimbus`: http://www.nimbusproject.org/ .. _`NTTAmerica`: http://www.nttamerica.com/ .. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html +.. _`Nimbus`: http://www.nimbusproject.org/ .. _`OnApp`: http://onapp.com/ .. _`OpenNebula (v3.8)`: http://opennebula.org/ .. _`OpenStack`: http://openstack.org/ @@ -90,14 +82,15 @@ Provider list volumes create volume destroy volume attach .. _`Outscale INC`: http://www.outscale.com .. _`Outscale SAS`: http://www.outscale.com .. _`Ovh`: https://www.ovh.com/ -.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com +.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute .. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com +.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com .. _`RimuHosting`: http://rimuhosting.com/ .. _`Scaleway`: https://www.scaleway.com/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ .. _`Upcloud`: https://www.upcloud.com .. _`VCL`: http://incubator.apache.org/vcl/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ -.. _`vps.net`: http://vps.net/ .. _`VMware vSphere`: http://www.vmware.com/products/vsphere/ .. _`Vultr`: https://www.vultr.com +.. _`kubevirt`: https://www.kubevirt.io +.. _`vCloud`: http://www.vmware.com/products/vcloud/ +.. _`vps.net`: http://vps.net/ diff --git a/docs/compute/_supported_methods_image_management.rst b/docs/compute/_supported_methods_image_management.rst index 7c0bdf9eda..9be9dff3ec 100644 --- a/docs/compute/_supported_methods_image_management.rst +++ b/docs/compute/_supported_methods_image_management.rst @@ -6,15 +6,13 @@ Provider list images get image create image delete image c `Abiquo`_ yes no no no no `Aliyun ECS`_ yes yes yes yes yes `PCextreme AuroraCompute`_ yes no no no no -`Azure Virtual machines`_ yes no no no no -`Azure Virtual machines`_ yes yes no no no +`Azure Virtual machines`_ yes yes no no no `Brightbox`_ yes no no no no `Cloudscale`_ yes no no no no `CloudSigma (API v2.0)`_ yes no no no no `CloudStack`_ yes no no no no `DigitalOcean`_ yes yes yes yes no -`DimensionData`_ yes no no no no -`Amazon EC2`_ yes yes yes yes yes +`Amazon EC2`_ yes yes yes yes yes `EquinixMetal`_ yes no no no no `Eucalyptus`_ yes yes yes yes yes `Exoscale`_ yes no no no no @@ -23,8 +21,7 @@ Provider list images get image create image delete image c `GiG G8 Node Provider`_ yes no no no no `Gridscale`_ yes yes yes yes no `Ikoula`_ yes no no no no -`InternetSolutions`_ yes no no no no -`Kamatera`_ yes no no no no +`Kamatera`_ yes no no no no `KTUCloud`_ yes no no no no `kubevirt`_ yes no no no no `Libvirt`_ no no no no no @@ -57,13 +54,11 @@ Provider list images get image create image delete image c .. _`Aliyun ECS`: https://www.aliyun.com/product/ecs .. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute .. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ -.. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ .. _`Brightbox`: http://www.brightbox.co.uk/ .. _`Cloudscale`: https://www.cloudscale.ch .. _`CloudSigma (API v2.0)`: http://www.cloudsigma.com/ .. _`CloudStack`: http://cloudstack.org/ .. _`DigitalOcean`: https://www.digitalocean.com -.. _`DimensionData`: http://www.dimensiondata.com/ .. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`EquinixMetal`: https://metal.equinix.com/ .. _`Eucalyptus`: http://www.eucalyptus.com/ @@ -73,7 +68,6 @@ Provider list images get image create image delete image c .. _`GiG G8 Node Provider`: https://gig.tech .. _`Gridscale`: https://gridscale.io .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack -.. _`InternetSolutions`: http://www.is.co.za/ .. _`Kamatera`: https://www.kamatera.com/ .. _`KTUCloud`: https://ucloudbiz.olleh.com/ .. _`kubevirt`: https://www.kubevirt.io @@ -94,7 +88,6 @@ Provider list images get image create image delete image c .. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com .. _`RimuHosting`: http://rimuhosting.com/ .. _`Scaleway`: https://www.scaleway.com/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ .. _`Upcloud`: https://www.upcloud.com .. _`VCL`: http://incubator.apache.org/vcl/ .. _`vCloud`: http://www.vmware.com/products/vcloud/ diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst index ddfed43900..6a9d4c38e4 100644 --- a/docs/compute/_supported_methods_key_pair_management.rst +++ b/docs/compute/_supported_methods_key_pair_management.rst @@ -5,84 +5,76 @@ Provider list key pairs get key pair create key pair impor ============================== ============== ============ =============== ============================= =========================== =============== `Abiquo`_ no no no no no no `Aliyun ECS`_ no no no no no no -`PCextreme AuroraCompute`_ yes yes yes yes no yes -`Azure Virtual machines`_ no no no no no no -`Azure Virtual machines`_ no no no no no no -`Brightbox`_ no no no no no no -`Cloudscale`_ no no no no no no -`CloudSigma (API v2.0)`_ yes yes yes yes no yes -`CloudStack`_ yes yes yes yes no yes -`DigitalOcean`_ yes yes yes no no yes -`DimensionData`_ no no no no no no -`Amazon EC2`_ yes yes yes yes no yes -`EquinixMetal`_ yes no yes no no yes -`Eucalyptus`_ yes yes yes yes no yes -`Exoscale`_ yes yes yes yes no yes -`Gandi`_ yes yes no yes no yes -`Google Compute Engine`_ no no no no no no -`GiG G8 Node Provider`_ no no no no no no -`Gridscale`_ yes no no yes no no -`Ikoula`_ yes yes yes yes no yes -`InternetSolutions`_ no no no no no no -`Kamatera`_ no no no no no no -`KTUCloud`_ yes yes yes yes no yes -`kubevirt`_ no no no no no no -`Libvirt`_ no no no no no no -`Linode`_ yes no yes no no no -`Maxihost`_ yes no yes no no no -`Nimbus`_ yes yes yes yes no yes -`NTTAmerica`_ no no no no no no -`NTTC-CIS`_ no no no no no no -`OnApp`_ yes yes no yes no yes -`OpenNebula (v3.8)`_ no no no no no no -`OpenStack`_ no no no no no no -`Outscale API`_ yes yes yes no no yes -`Outscale INC`_ yes yes yes yes no yes -`Outscale SAS`_ yes yes yes yes no yes -`Ovh`_ yes yes no yes no yes -`Rackspace Cloud (Next Gen)`_ yes yes yes yes no yes -`Rackspace Cloud (First Gen)`_ no no no no no no -`RimuHosting`_ no no no no no no -`Scaleway`_ yes no no yes no yes -`vCloud`_ no no no no no no -`Upcloud`_ no no no no no no -`VCL`_ no no no no no no -`vCloud`_ no no no no no no -`vps.net`_ no no no no no no -`VMware vSphere`_ no no no no no no -`Vultr`_ yes yes no yes no yes +`Amazon EC2`_ yes yes yes yes no yes +`Azure Virtual machines`_ no no no no no no +`Brightbox`_ no no no no no no +`CloudSigma (API v2.0)`_ yes yes yes yes no yes +`CloudStack`_ yes yes yes yes no yes +`Cloudscale`_ no no no no no no +`DigitalOcean`_ yes yes yes no no yes +`EquinixMetal`_ yes no yes no no yes +`Eucalyptus`_ yes yes yes yes no yes +`Exoscale`_ yes yes yes yes no yes +`Gandi`_ yes yes no yes no yes +`GiG G8 Node Provider`_ no no no no no no +`Google Compute Engine`_ no no no no no no +`Gridscale`_ yes no no yes no no +`Ikoula`_ yes yes yes yes no yes +`KTUCloud`_ yes yes yes yes no yes +`Kamatera`_ no no no no no no +`Libvirt`_ no no no no no no +`Linode`_ yes no yes no no no +`Maxihost`_ yes no yes no no no +`NTTAmerica`_ no no no no no no +`NTTC-CIS`_ no no no no no no +`Nimbus`_ yes yes yes yes no yes +`OnApp`_ yes yes no yes no yes +`OpenNebula (v3.8)`_ no no no no no no +`OpenStack`_ no no no no no no +`Outscale API`_ yes yes yes no no yes +`Outscale INC`_ yes yes yes yes no yes +`Outscale SAS`_ yes yes yes yes no yes +`Ovh`_ yes yes no yes no yes +`PCextreme AuroraCompute`_ yes yes yes yes no yes +`Rackspace Cloud (First Gen)`_ no no no no no no +`Rackspace Cloud (Next Gen)`_ yes yes yes yes no yes +`RimuHosting`_ no no no no no no +`Scaleway`_ yes no no yes no yes +`Upcloud`_ no no no no no no +`VCL`_ no no no no no no +`VMware vSphere`_ no no no no no no +`Vultr`_ yes yes no yes no yes +`kubevirt`_ no no no no no no +`vCloud`_ no no no no no no +`vCloud`_ no no no no no no +`vps.net`_ no no no no no no ============================== ============== ============ =============== ============================= =========================== =============== .. _`Abiquo`: http://www.abiquo.com/ .. _`Aliyun ECS`: https://www.aliyun.com/product/ecs -.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute -.. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ +.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ .. _`Brightbox`: http://www.brightbox.co.uk/ -.. _`Cloudscale`: https://www.cloudscale.ch .. _`CloudSigma (API v2.0)`: http://www.cloudsigma.com/ .. _`CloudStack`: http://cloudstack.org/ +.. _`Cloudscale`: https://www.cloudscale.ch .. _`DigitalOcean`: https://www.digitalocean.com -.. _`DimensionData`: http://www.dimensiondata.com/ -.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`EquinixMetal`: https://metal.equinix.com/ .. _`Eucalyptus`: http://www.eucalyptus.com/ .. _`Exoscale`: https://www.exoscale.com/ .. _`Gandi`: http://www.gandi.net/ -.. _`Google Compute Engine`: https://cloud.google.com/ .. _`GiG G8 Node Provider`: https://gig.tech +.. _`Google Compute Engine`: https://cloud.google.com/ .. _`Gridscale`: https://gridscale.io .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack -.. _`InternetSolutions`: http://www.is.co.za/ -.. _`Kamatera`: https://www.kamatera.com/ .. _`KTUCloud`: https://ucloudbiz.olleh.com/ -.. _`kubevirt`: https://www.kubevirt.io +.. _`Kamatera`: https://www.kamatera.com/ .. _`Libvirt`: http://libvirt.org/ .. _`Linode`: http://www.linode.com/ .. _`Maxihost`: https://www.maxihost.com/ -.. _`Nimbus`: http://www.nimbusproject.org/ .. _`NTTAmerica`: http://www.nttamerica.com/ .. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html +.. _`Nimbus`: http://www.nimbusproject.org/ .. _`OnApp`: http://onapp.com/ .. _`OpenNebula (v3.8)`: http://opennebula.org/ .. _`OpenStack`: http://openstack.org/ @@ -90,14 +82,15 @@ Provider list key pairs get key pair create key pair impor .. _`Outscale INC`: http://www.outscale.com .. _`Outscale SAS`: http://www.outscale.com .. _`Ovh`: https://www.ovh.com/ -.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com +.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute .. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com +.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com .. _`RimuHosting`: http://rimuhosting.com/ .. _`Scaleway`: https://www.scaleway.com/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ .. _`Upcloud`: https://www.upcloud.com .. _`VCL`: http://incubator.apache.org/vcl/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ -.. _`vps.net`: http://vps.net/ .. _`VMware vSphere`: http://www.vmware.com/products/vsphere/ .. _`Vultr`: https://www.vultr.com +.. _`kubevirt`: https://www.kubevirt.io +.. _`vCloud`: http://www.vmware.com/products/vcloud/ +.. _`vps.net`: http://vps.net/ diff --git a/docs/compute/_supported_methods_main.rst b/docs/compute/_supported_methods_main.rst index 0fffc48a1b..b77cb2960e 100644 --- a/docs/compute/_supported_methods_main.rst +++ b/docs/compute/_supported_methods_main.rst @@ -5,84 +5,76 @@ Provider list nodes create node reboot node destroy node s ============================== ========== =========== =========== ============ ========== ========= =========== ========== =========== `Abiquo`_ yes yes yes yes no no yes yes no `Aliyun ECS`_ yes yes yes yes yes yes yes yes yes -`PCextreme AuroraCompute`_ yes yes yes yes no no yes yes yes -`Azure Virtual machines`_ yes yes yes yes no no yes yes yes -`Azure Virtual machines`_ yes yes yes yes yes yes yes yes yes -`Brightbox`_ yes yes no yes no no yes yes no -`Cloudscale`_ yes yes yes yes yes yes yes yes no -`CloudSigma (API v2.0)`_ yes yes yes yes yes yes yes yes no -`CloudStack`_ yes yes yes yes no no yes yes yes -`DigitalOcean`_ yes yes yes yes no no yes yes no -`DimensionData`_ yes yes yes yes yes yes yes yes yes -`Amazon EC2`_ yes yes yes yes yes yes yes yes yes -`EquinixMetal`_ yes yes yes yes yes yes yes yes no -`Eucalyptus`_ yes yes yes yes yes yes yes yes yes -`Exoscale`_ yes yes yes yes no no yes yes yes -`Gandi`_ yes yes yes yes no no yes yes no -`Google Compute Engine`_ yes yes yes yes yes yes yes yes yes -`GiG G8 Node Provider`_ yes yes yes yes yes yes yes yes no -`Gridscale`_ yes yes yes yes yes no yes no yes -`Ikoula`_ yes yes yes yes no no yes yes yes -`InternetSolutions`_ yes yes yes yes yes yes yes yes yes -`Kamatera`_ yes yes yes yes yes yes yes yes yes -`KTUCloud`_ yes yes yes yes no no yes yes yes -`kubevirt`_ yes yes yes yes yes yes yes yes yes -`Libvirt`_ yes no yes yes yes yes no no no -`Linode`_ yes yes yes yes yes yes yes yes no -`Maxihost`_ yes yes yes yes yes yes yes yes no -`Nimbus`_ yes yes yes yes yes yes yes yes yes -`NTTAmerica`_ yes yes yes yes yes yes yes yes yes -`NTTC-CIS`_ yes yes yes yes yes yes yes yes yes -`OnApp`_ yes yes no yes no no yes no no -`OpenNebula (v3.8)`_ yes yes yes yes no no yes yes no -`OpenStack`_ yes no yes yes yes yes yes yes no -`Outscale API`_ yes yes yes yes yes yes yes no no -`Outscale INC`_ yes yes yes yes yes yes yes yes yes -`Outscale SAS`_ yes yes yes yes yes yes yes yes yes -`Ovh`_ yes yes no yes no no yes yes yes -`Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yes yes yes yes -`Rackspace Cloud (First Gen)`_ yes yes yes yes yes yes yes yes yes -`RimuHosting`_ yes yes yes yes no no yes yes yes -`Scaleway`_ yes yes yes yes no no yes yes no -`vCloud`_ yes yes yes yes no no yes yes yes -`Upcloud`_ yes yes yes yes no no yes yes yes -`VCL`_ yes yes no yes no no yes yes no -`vCloud`_ yes yes yes yes no no yes yes yes -`vps.net`_ yes yes yes yes no no yes yes no -`VMware vSphere`_ yes yes yes yes yes yes yes yes no -`Vultr`_ yes yes yes yes yes yes yes yes no +`Amazon EC2`_ yes yes yes yes yes yes yes yes yes +`Azure Virtual machines`_ yes yes yes yes yes yes yes yes yes +`Brightbox`_ yes yes no yes no no yes yes no +`CloudSigma (API v2.0)`_ yes yes yes yes yes yes yes yes no +`CloudStack`_ yes yes yes yes no no yes yes yes +`Cloudscale`_ yes yes yes yes yes yes yes yes no +`DigitalOcean`_ yes yes yes yes no no yes yes no +`EquinixMetal`_ yes yes yes yes yes yes yes yes no +`Eucalyptus`_ yes yes yes yes yes yes yes yes yes +`Exoscale`_ yes yes yes yes no no yes yes yes +`Gandi`_ yes yes yes yes no no yes yes no +`GiG G8 Node Provider`_ yes yes yes yes yes yes yes yes no +`Google Compute Engine`_ yes yes yes yes yes yes yes yes yes +`Gridscale`_ yes yes yes yes yes no yes no yes +`Ikoula`_ yes yes yes yes no no yes yes yes +`KTUCloud`_ yes yes yes yes no no yes yes yes +`Kamatera`_ yes yes yes yes yes yes yes yes yes +`Libvirt`_ yes no yes yes yes yes no no no +`Linode`_ yes yes yes yes yes yes yes yes no +`Maxihost`_ yes yes yes yes yes yes yes yes no +`NTTAmerica`_ yes yes yes yes yes yes yes yes yes +`NTTC-CIS`_ yes yes yes yes yes yes yes yes yes +`Nimbus`_ yes yes yes yes yes yes yes yes yes +`OnApp`_ yes yes no yes no no yes no no +`OpenNebula (v3.8)`_ yes yes yes yes no no yes yes no +`OpenStack`_ yes no yes yes yes yes yes yes no +`Outscale API`_ yes yes yes yes yes yes yes no no +`Outscale INC`_ yes yes yes yes yes yes yes yes yes +`Outscale SAS`_ yes yes yes yes yes yes yes yes yes +`Ovh`_ yes yes no yes no no yes yes yes +`PCextreme AuroraCompute`_ yes yes yes yes no no yes yes yes +`Rackspace Cloud (First Gen)`_ yes yes yes yes yes yes yes yes yes +`Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yes yes yes yes +`RimuHosting`_ yes yes yes yes no no yes yes yes +`Scaleway`_ yes yes yes yes no no yes yes no +`Upcloud`_ yes yes yes yes no no yes yes yes +`VCL`_ yes yes no yes no no yes yes no +`VMware vSphere`_ yes yes yes yes yes yes yes yes no +`Vultr`_ yes yes yes yes yes yes yes yes no +`kubevirt`_ yes yes yes yes yes yes yes yes yes +`vCloud`_ yes yes yes yes no no yes yes yes +`vCloud`_ yes yes yes yes no no yes yes yes +`vps.net`_ yes yes yes yes no no yes yes no ============================== ========== =========== =========== ============ ========== ========= =========== ========== =========== .. _`Abiquo`: http://www.abiquo.com/ .. _`Aliyun ECS`: https://www.aliyun.com/product/ecs -.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute -.. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ +.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ .. _`Brightbox`: http://www.brightbox.co.uk/ -.. _`Cloudscale`: https://www.cloudscale.ch .. _`CloudSigma (API v2.0)`: http://www.cloudsigma.com/ .. _`CloudStack`: http://cloudstack.org/ +.. _`Cloudscale`: https://www.cloudscale.ch .. _`DigitalOcean`: https://www.digitalocean.com -.. _`DimensionData`: http://www.dimensiondata.com/ -.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`EquinixMetal`: https://metal.equinix.com/ .. _`Eucalyptus`: http://www.eucalyptus.com/ .. _`Exoscale`: https://www.exoscale.com/ .. _`Gandi`: http://www.gandi.net/ -.. _`Google Compute Engine`: https://cloud.google.com/ .. _`GiG G8 Node Provider`: https://gig.tech +.. _`Google Compute Engine`: https://cloud.google.com/ .. _`Gridscale`: https://gridscale.io .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack -.. _`InternetSolutions`: http://www.is.co.za/ -.. _`Kamatera`: https://www.kamatera.com/ .. _`KTUCloud`: https://ucloudbiz.olleh.com/ -.. _`kubevirt`: https://www.kubevirt.io +.. _`Kamatera`: https://www.kamatera.com/ .. _`Libvirt`: http://libvirt.org/ .. _`Linode`: http://www.linode.com/ .. _`Maxihost`: https://www.maxihost.com/ -.. _`Nimbus`: http://www.nimbusproject.org/ .. _`NTTAmerica`: http://www.nttamerica.com/ .. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html +.. _`Nimbus`: http://www.nimbusproject.org/ .. _`OnApp`: http://onapp.com/ .. _`OpenNebula (v3.8)`: http://opennebula.org/ .. _`OpenStack`: http://openstack.org/ @@ -90,14 +82,15 @@ Provider list nodes create node reboot node destroy node s .. _`Outscale INC`: http://www.outscale.com .. _`Outscale SAS`: http://www.outscale.com .. _`Ovh`: https://www.ovh.com/ -.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com +.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute .. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com +.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com .. _`RimuHosting`: http://rimuhosting.com/ .. _`Scaleway`: https://www.scaleway.com/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ .. _`Upcloud`: https://www.upcloud.com .. _`VCL`: http://incubator.apache.org/vcl/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ -.. _`vps.net`: http://vps.net/ .. _`VMware vSphere`: http://www.vmware.com/products/vsphere/ .. _`Vultr`: https://www.vultr.com +.. _`kubevirt`: https://www.kubevirt.io +.. _`vCloud`: http://www.vmware.com/products/vcloud/ +.. _`vps.net`: http://vps.net/ diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst index 353ae00c8a..8a0131f98d 100644 --- a/docs/compute/_supported_providers.rst +++ b/docs/compute/_supported_providers.rst @@ -5,84 +5,77 @@ Provider Documentation ============================== ================================================= =================== ======================================================================================================================================================================================================================================================================================================== ================================================= ==================================== `Abiquo`_ ABIQUO single region driver :mod:`libcloud.compute.drivers.abiquo` :class:`AbiquoNodeDriver` `Aliyun ECS`_ :doc:`Click ` ALIYUN_ECS single region driver :mod:`libcloud.compute.drivers.ecs` :class:`ECSDriver` -`PCextreme AuroraCompute`_ :doc:`Click ` AURORACOMPUTE single region driver :mod:`libcloud.compute.drivers.auroracompute` :class:`AuroraComputeNodeDriver` -`Azure Virtual machines`_ :doc:`Click ` AZURE single region driver :mod:`libcloud.compute.drivers.azure` :class:`AzureNodeDriver` -`Azure Virtual machines`_ :doc:`Click ` AZURE_ARM single region driver :mod:`libcloud.compute.drivers.azure_arm` :class:`AzureNodeDriver` -`Brightbox`_ BRIGHTBOX single region driver :mod:`libcloud.compute.drivers.brightbox` :class:`BrightboxNodeDriver` -`Cloudscale`_ :doc:`Click ` CLOUDSCALE single region driver :mod:`libcloud.compute.drivers.cloudscale` :class:`CloudscaleNodeDriver` -`CloudSigma (API v2.0)`_ :doc:`Click ` CLOUDSIGMA single region driver :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaNodeDriver` -`CloudStack`_ :doc:`Click ` CLOUDSTACK single region driver :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver` -`DigitalOcean`_ :doc:`Click ` DIGITAL_OCEAN single region driver :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver` -`DimensionData`_ :doc:`Click ` DIMENSIONDATA single region driver :mod:`libcloud.compute.drivers.dimensiondata` :class:`DimensionDataNodeDriver` -`Amazon EC2`_ :doc:`Click ` EC2 af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, sa-east-1, us-east-1, us-east-2, us-gov-west-1, us-west-1, us-west-2 :mod:`libcloud.compute.drivers.ec2` :class:`EC2NodeDriver` -`EquinixMetal`_ :doc:`Click ` EQUINIXMETAL single region driver :mod:`libcloud.compute.drivers.equinixmetal` :class:`EquinixMetalNodeDriver` -`Eucalyptus`_ EUCALYPTUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`EucNodeDriver` -`Exoscale`_ :doc:`Click ` EXOSCALE single region driver :mod:`libcloud.compute.drivers.exoscale` :class:`ExoscaleNodeDriver` -`Gandi`_ :doc:`Click ` GANDI single region driver :mod:`libcloud.compute.drivers.gandi` :class:`GandiNodeDriver` -`Google Compute Engine`_ :doc:`Click ` GCE single region driver :mod:`libcloud.compute.drivers.gce` :class:`GCENodeDriver` -`GiG G8 Node Provider`_ GIG_G8 single region driver :mod:`libcloud.compute.drivers.gig_g8` :class:`G8NodeDriver` -`Gridscale`_ :doc:`Click ` GRIDSCALE single region driver :mod:`libcloud.compute.drivers.gridscale` :class:`GridscaleNodeDriver` -`Ikoula`_ :doc:`Click ` IKOULA single region driver :mod:`libcloud.compute.drivers.ikoula` :class:`IkoulaNodeDriver` -`InternetSolutions`_ :doc:`Click ` INTERNETSOLUTIONS single region driver :mod:`libcloud.compute.drivers.internetsolutions` :class:`InternetSolutionsNodeDriver` -`Kamatera`_ :doc:`Click ` KAMATERA single region driver :mod:`libcloud.compute.drivers.kamatera` :class:`KamateraNodeDriver` -`KTUCloud`_ KTUCLOUD single region driver :mod:`libcloud.compute.drivers.ktucloud` :class:`KTUCloudNodeDriver` -`kubevirt`_ KUBEVIRT single region driver :mod:`libcloud.compute.drivers.kubevirt` :class:`KubeVirtNodeDriver` -`Libvirt`_ :doc:`Click ` LIBVIRT single region driver :mod:`libcloud.compute.drivers.libvirt_driver` :class:`LibvirtNodeDriver` -`Linode`_ LINODE single region driver :mod:`libcloud.compute.drivers.linode` :class:`LinodeNodeDriver` -`Maxihost`_ :doc:`Click ` MAXIHOST single region driver :mod:`libcloud.compute.drivers.maxihost` :class:`MaxihostNodeDriver` -`Nimbus`_ :doc:`Click ` NIMBUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`NimbusNodeDriver` -`NTTAmerica`_ :doc:`Click ` NTTA single region driver :mod:`libcloud.compute.drivers.ntta` :class:`NTTAmericaNodeDriver` -`NTTC-CIS`_ :doc:`Click ` NTTCIS single region driver :mod:`libcloud.compute.drivers.nttcis` :class:`NttCisNodeDriver` -`OnApp`_ :doc:`Click ` ONAPP single region driver :mod:`libcloud.compute.drivers.onapp` :class:`OnAppNodeDriver` -`OpenNebula (v3.8)`_ OPENNEBULA single region driver :mod:`libcloud.compute.drivers.opennebula` :class:`OpenNebulaNodeDriver` -`OpenStack`_ :doc:`Click ` OPENSTACK single region driver :mod:`libcloud.compute.drivers.openstack` :class:`OpenStackNodeDriver` -`Outscale API`_ :doc:`Click ` OUTSCALE single region driver :mod:`libcloud.compute.drivers.outscale` :class:`OutscaleNodeDriver` -`Outscale INC`_ :doc:`Click ` OUTSCALE_INC single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleINCNodeDriver` -`Outscale SAS`_ :doc:`Click ` OUTSCALE_SAS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleSASNodeDriver` -`Ovh`_ :doc:`Click ` OVH ca, eu :mod:`libcloud.compute.drivers.ovh` :class:`OvhNodeDriver` -`Rackspace Cloud (Next Gen)`_ :doc:`Click ` RACKSPACE single region driver :mod:`libcloud.compute.drivers.rackspace` :class:`RackspaceNodeDriver` +`Amazon EC2`_ :doc:`Click ` EC2 af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, sa-east-1, us-east-1, us-east-2, us-gov-west-1, us-west-1, us-west-2 :mod:`libcloud.compute.drivers.ec2` :class:`EC2NodeDriver` +`Azure Virtual machines`_ :doc:`Click ` AZURE single region driver :mod:`libcloud.compute.drivers.azure` :class:`AzureNodeDriver` +`Azure Virtual machines`_ :doc:`Click ` AZURE_ARM single region driver :mod:`libcloud.compute.drivers.azure_arm` :class:`AzureNodeDriver` +`Brightbox`_ BRIGHTBOX single region driver :mod:`libcloud.compute.drivers.brightbox` :class:`BrightboxNodeDriver` +`CloudSigma (API v2.0)`_ :doc:`Click ` CLOUDSIGMA single region driver :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaNodeDriver` +`CloudStack`_ :doc:`Click ` CLOUDSTACK single region driver :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver` +`Cloudscale`_ :doc:`Click ` CLOUDSCALE single region driver :mod:`libcloud.compute.drivers.cloudscale` :class:`CloudscaleNodeDriver` +`DigitalOcean`_ :doc:`Click ` DIGITAL_OCEAN single region driver :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver` +`EquinixMetal`_ :doc:`Click ` EQUINIXMETAL single region driver :mod:`libcloud.compute.drivers.equinixmetal` :class:`EquinixMetalNodeDriver` +`Eucalyptus`_ EUCALYPTUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`EucNodeDriver` +`Exoscale`_ :doc:`Click ` EXOSCALE single region driver :mod:`libcloud.compute.drivers.exoscale` :class:`ExoscaleNodeDriver` +`Gandi`_ :doc:`Click ` GANDI single region driver :mod:`libcloud.compute.drivers.gandi` :class:`GandiNodeDriver` +`GiG G8 Node Provider`_ GIG_G8 single region driver :mod:`libcloud.compute.drivers.gig_g8` :class:`G8NodeDriver` +`Google Compute Engine`_ :doc:`Click ` GCE single region driver :mod:`libcloud.compute.drivers.gce` :class:`GCENodeDriver` +`Gridscale`_ :doc:`Click ` GRIDSCALE single region driver :mod:`libcloud.compute.drivers.gridscale` :class:`GridscaleNodeDriver` +`Ikoula`_ :doc:`Click ` IKOULA single region driver :mod:`libcloud.compute.drivers.ikoula` :class:`IkoulaNodeDriver` +`KTUCloud`_ KTUCLOUD single region driver :mod:`libcloud.compute.drivers.ktucloud` :class:`KTUCloudNodeDriver` +`Kamatera`_ :doc:`Click ` KAMATERA single region driver :mod:`libcloud.compute.drivers.kamatera` :class:`KamateraNodeDriver` +`Libvirt`_ :doc:`Click ` LIBVIRT single region driver :mod:`libcloud.compute.drivers.libvirt_driver` :class:`LibvirtNodeDriver` +`Linode`_ LINODE single region driver :mod:`libcloud.compute.drivers.linode` :class:`LinodeNodeDriver` +`Maxihost`_ :doc:`Click ` MAXIHOST single region driver :mod:`libcloud.compute.drivers.maxihost` :class:`MaxihostNodeDriver` +`NTTAmerica`_ :doc:`Click ` NTTA single region driver :mod:`libcloud.compute.drivers.ntta` :class:`NTTAmericaNodeDriver` +`NTTC-CIS`_ :doc:`Click ` NTTCIS single region driver :mod:`libcloud.compute.drivers.nttcis` :class:`NttCisNodeDriver` +`Nimbus`_ :doc:`Click ` NIMBUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`NimbusNodeDriver` +`OnApp`_ :doc:`Click ` ONAPP single region driver :mod:`libcloud.compute.drivers.onapp` :class:`OnAppNodeDriver` +`OpenNebula (v3.8)`_ OPENNEBULA single region driver :mod:`libcloud.compute.drivers.opennebula` :class:`OpenNebulaNodeDriver` +`OpenStack`_ :doc:`Click ` OPENSTACK single region driver :mod:`libcloud.compute.drivers.openstack` :class:`OpenStackNodeDriver` +`Outscale API`_ :doc:`Click ` OUTSCALE single region driver :mod:`libcloud.compute.drivers.outscale` :class:`OutscaleNodeDriver` +`Outscale INC`_ :doc:`Click ` OUTSCALE_INC single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleINCNodeDriver` +`Outscale SAS`_ :doc:`Click ` OUTSCALE_SAS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleSASNodeDriver` +`Ovh`_ :doc:`Click ` OVH ca, eu :mod:`libcloud.compute.drivers.ovh` :class:`OvhNodeDriver` +`PCextreme AuroraCompute`_ :doc:`Click ` AURORACOMPUTE single region driver :mod:`libcloud.compute.drivers.auroracompute` :class:`AuroraComputeNodeDriver` `Rackspace Cloud (First Gen)`_ RACKSPACE_FIRST_GEN single region driver :mod:`libcloud.compute.drivers.rackspace` :class:`RackspaceFirstGenNodeDriver` -`RimuHosting`_ RIMUHOSTING single region driver :mod:`libcloud.compute.drivers.rimuhosting` :class:`RimuHostingNodeDriver` -`Scaleway`_ :doc:`Click ` SCALEWAY single region driver :mod:`libcloud.compute.drivers.scaleway` :class:`ScalewayNodeDriver` -`vCloud`_ TERREMARK single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`TerremarkDriver` -`Upcloud`_ :doc:`Click ` UPCLOUD single region driver :mod:`libcloud.compute.drivers.upcloud` :class:`UpcloudDriver` -`VCL`_ VCL single region driver :mod:`libcloud.compute.drivers.vcl` :class:`VCLNodeDriver` -`vCloud`_ :doc:`Click ` VCLOUD single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`VCloudNodeDriver` -`vps.net`_ VPSNET single region driver :mod:`libcloud.compute.drivers.vpsnet` :class:`VPSNetNodeDriver` -`VMware vSphere`_ :doc:`Click ` VSPHERE single region driver :mod:`libcloud.compute.drivers.vsphere` :class:`VSphereNodeDriver` -`Vultr`_ :doc:`Click ` VULTR single region driver :mod:`libcloud.compute.drivers.vultr` :class:`VultrNodeDriver` +`Rackspace Cloud (Next Gen)`_ :doc:`Click ` RACKSPACE single region driver :mod:`libcloud.compute.drivers.rackspace` :class:`RackspaceNodeDriver` +`RimuHosting`_ RIMUHOSTING single region driver :mod:`libcloud.compute.drivers.rimuhosting` :class:`RimuHostingNodeDriver` +`Scaleway`_ :doc:`Click ` SCALEWAY single region driver :mod:`libcloud.compute.drivers.scaleway` :class:`ScalewayNodeDriver` +`Upcloud`_ :doc:`Click ` UPCLOUD single region driver :mod:`libcloud.compute.drivers.upcloud` :class:`UpcloudDriver` +`VCL`_ VCL single region driver :mod:`libcloud.compute.drivers.vcl` :class:`VCLNodeDriver` +`VMware vSphere`_ :doc:`Click ` VSPHERE single region driver :mod:`libcloud.compute.drivers.vsphere` :class:`VSphereNodeDriver` +`Vultr`_ :doc:`Click ` VULTR single region driver :mod:`libcloud.compute.drivers.vultr` :class:`VultrNodeDriver` +`kubevirt`_ KUBEVIRT single region driver :mod:`libcloud.compute.drivers.kubevirt` :class:`KubeVirtNodeDriver` +`vCloud`_ TERREMARK single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`TerremarkDriver` +`vCloud`_ :doc:`Click ` VCLOUD single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`VCloudNodeDriver` +`vps.net`_ VPSNET single region driver :mod:`libcloud.compute.drivers.vpsnet` :class:`VPSNetNodeDriver` ============================== ================================================= =================== ======================================================================================================================================================================================================================================================================================================== ================================================= ==================================== .. _`Abiquo`: http://www.abiquo.com/ .. _`Aliyun ECS`: https://www.aliyun.com/product/ecs -.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute -.. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ +.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`Azure Virtual machines`: http://azure.microsoft.com/en-us/services/virtual-machines/ .. _`Brightbox`: http://www.brightbox.co.uk/ -.. _`Cloudscale`: https://www.cloudscale.ch .. _`CloudSigma (API v2.0)`: http://www.cloudsigma.com/ .. _`CloudStack`: http://cloudstack.org/ +.. _`Cloudscale`: https://www.cloudscale.ch .. _`DigitalOcean`: https://www.digitalocean.com -.. _`DimensionData`: http://www.dimensiondata.com/ -.. _`Amazon EC2`: http://aws.amazon.com/ec2/ .. _`EquinixMetal`: https://metal.equinix.com/ .. _`Eucalyptus`: http://www.eucalyptus.com/ .. _`Exoscale`: https://www.exoscale.com/ .. _`Gandi`: http://www.gandi.net/ -.. _`Google Compute Engine`: https://cloud.google.com/ .. _`GiG G8 Node Provider`: https://gig.tech +.. _`Google Compute Engine`: https://cloud.google.com/ .. _`Gridscale`: https://gridscale.io .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack -.. _`InternetSolutions`: http://www.is.co.za/ -.. _`Kamatera`: https://www.kamatera.com/ .. _`KTUCloud`: https://ucloudbiz.olleh.com/ -.. _`kubevirt`: https://www.kubevirt.io +.. _`Kamatera`: https://www.kamatera.com/ .. _`Libvirt`: http://libvirt.org/ .. _`Linode`: http://www.linode.com/ .. _`Maxihost`: https://www.maxihost.com/ -.. _`Nimbus`: http://www.nimbusproject.org/ .. _`NTTAmerica`: http://www.nttamerica.com/ .. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html +.. _`Nimbus`: http://www.nimbusproject.org/ .. _`OnApp`: http://onapp.com/ .. _`OpenNebula (v3.8)`: http://opennebula.org/ .. _`OpenStack`: http://openstack.org/ @@ -90,14 +83,15 @@ Provider Documentation .. _`Outscale INC`: http://www.outscale.com .. _`Outscale SAS`: http://www.outscale.com .. _`Ovh`: https://www.ovh.com/ -.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com +.. _`PCextreme AuroraCompute`: https://www.pcextreme.com/aurora/compute .. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com +.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com .. _`RimuHosting`: http://rimuhosting.com/ .. _`Scaleway`: https://www.scaleway.com/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ .. _`Upcloud`: https://www.upcloud.com .. _`VCL`: http://incubator.apache.org/vcl/ -.. _`vCloud`: http://www.vmware.com/products/vcloud/ -.. _`vps.net`: http://vps.net/ .. _`VMware vSphere`: http://www.vmware.com/products/vsphere/ .. _`Vultr`: https://www.vultr.com +.. _`kubevirt`: https://www.kubevirt.io +.. _`vCloud`: http://www.vmware.com/products/vcloud/ +.. _`vps.net`: http://vps.net/ diff --git a/docs/compute/drivers/dimensiondata.rst b/docs/compute/drivers/dimensiondata.rst deleted file mode 100644 index 49928ea7b4..0000000000 --- a/docs/compute/drivers/dimensiondata.rst +++ /dev/null @@ -1,90 +0,0 @@ -Dimension Data Cloud Compute Driver Documentation -================================================= - -Dimension Data are a global IT Services company and form part of the NTT Group. -Dimension Data provide 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 of the public cloud instances or as a private instance on premises. - -.. figure:: /_static/images/provider_logos/dimensiondata.png - :align: center - :width: 300 - :target: http://cloud.dimensiondata.com/ - -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 Dimension Data libcloud -driver to communicate with both the public and private clouds. - -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: - -* ``dd-na`` : Dimension Data North America (USA) -* ``dd-eu`` : Dimension Data Europe -* ``dd-af`` : Dimension Data Africa -* ``dd-au`` : Dimension Data Australia -* ``dd-au-gov`` : Dimension Data Australia ACT (Canberra) -* ``dd-latam`` : Dimension Data Latin America -* ``dd-ap`` : Dimension Data Asia Pacific -* ``dd-canada`` : Dimension Data Canada region - -The base `libcloud` API allows you to: - -* list nodes, images, instance types, locations - -Non-standard functionality and extension methods ------------------------------------------------- - -The Dimension Data 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 --------- - -.. autoclass:: libcloud.compute.drivers.dimensiondata.DimensionDataNodeDriver - :members: - :inherited-members: - -.. _`API`: http://cloud.dimensiondata.com/au/en/services/public-cloud/api - - -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 diff --git a/docs/compute/drivers/internetsolutions.rst b/docs/compute/drivers/internetsolutions.rst deleted file mode 100644 index 454a615c25..0000000000 --- a/docs/compute/drivers/internetsolutions.rst +++ /dev/null @@ -1,69 +0,0 @@ -Internet Solutions Compute Driver Documentation -=============================================== - -Internet Solutions (IS) is the first commericial ISP in South Africa and currently the largest in -the southern cape. IS offer a public cloud service based called Compute-as-a-Service (CAAS). -The CaaS service is available on one of the public cloud instances. - -.. figure:: /_static/images/provider_logos/internetsolutions.png - :align: center - :width: 300 - :target: http://www.cloud.is.co.za/ - -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 Internet Solutions libcloud -driver to communicate with both the public and private clouds. - -Instantiating a driver ----------------------- - -When you instantiate a driver you need to pass the following arguments to the -driver constructor: - -* ``user_id`` - Your Internet Solutions Cloud username -* ``key`` - Your Internet Solutions Cloud password -* ``region`` - The region key, one of the possible region keys - -Possible regions: - -* ``is-na`` : Internet Solutions North America (USA) -* ``is-eu`` : Internet Solutions Europe -* ``is-af`` : Internet Solutions Africa - **Default** -* ``is-au`` : Internet Solutions Australia -* ``is-latam`` : Internet Solutions Latin America -* ``is-ap`` : Internet Solutions Asia Pacific -* ``is-canada`` : Internet Solutions Canada region - -.. literalinclude:: /examples/compute/internetsolutions/instantiate_driver.py - :language: python - -The base `libcloud` API allows you to: - -* list nodes, images, instance types, locations - -Non-standard functionality and extension methods ------------------------------------------------- - -The Internet Solutions 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 --------- - -.. autoclass:: libcloud.compute.drivers.internetsolutions.InternetSolutionsNodeDriver - :members: - :inherited-members: - -.. _`API`: http://www.cloud.is.co.za/IS-Public-CaaS/Pages/REST-based-API.aspx diff --git a/docs/dns/_supported_methods.rst b/docs/dns/_supported_methods.rst index 168a30fdfb..8a9a5fb84d 100644 --- a/docs/dns/_supported_methods.rst +++ b/docs/dns/_supported_methods.rst @@ -3,11 +3,11 @@ ================= ========== ============ =========== =========== ============= ============= =========== ============= Provider list zones list records create zone update zone create record update record delete zone delete record ================= ========== ============ =========== =========== ============= ============= =========== ============= -`AuroraDNS`_ yes yes yes no yes yes yes yes -`BuddyNS DNS`_ yes no yes no no no yes no +`AuroraDNS`_ yes yes yes no yes yes yes yes +`BuddyNS DNS`_ yes no yes no no no yes no `CloudFlare DNS`_ yes yes yes yes yes yes yes yes -`DigitalOcean`_ yes yes yes no yes yes yes yes -`DNSimple`_ yes yes yes no yes yes yes yes +`DNSimple`_ yes yes yes no yes yes yes yes +`DigitalOcean`_ yes yes yes no yes yes yes yes `DurableDNS`_ yes yes yes yes yes yes yes yes `Gandi DNS`_ yes yes yes yes yes yes yes yes `Gandi LiveDNS`_ yes yes yes no yes yes no yes @@ -30,11 +30,10 @@ Provider list zones list records create zone update zone create record `Zonomi DNS`_ yes yes yes no yes no yes yes ================= ========== ============ =========== =========== ============= ============= =========== ============= -.. _`AuroraDNS`: https://www.pcextreme.nl/en/aurora/dns .. _`BuddyNS DNS`: https://www.buddyns.com .. _`CloudFlare DNS`: https://www.cloudflare.com -.. _`DigitalOcean`: https://www.digitalocean.com .. _`DNSimple`: https://dnsimple.com/ +.. _`DigitalOcean`: https://www.digitalocean.com .. _`DurableDNS`: https://durabledns.com .. _`Gandi DNS`: http://www.gandi.net/domain .. _`Gandi LiveDNS`: http://www.gandi.net/domain @@ -55,3 +54,4 @@ Provider list zones list records create zone update zone create record .. _`World Wide DNS`: https://www.worldwidedns.net/ .. _`Zerigo DNS`: http://www.zerigo.com/ .. _`Zonomi DNS`: https://zonomi.com +.. _`AuroraDNS`: https://www.pcextreme.nl/en/aurora/dns diff --git a/docs/dns/_supported_providers.rst b/docs/dns/_supported_providers.rst index 39da462b90..0623e2bc50 100644 --- a/docs/dns/_supported_providers.rst +++ b/docs/dns/_supported_providers.rst @@ -3,11 +3,11 @@ ================= ========================================= ================= ==================== ======================================== ============================== Provider Documentation Provider Constant Supported Regions Module Class Name ================= ========================================= ================= ==================== ======================================== ============================== -`AuroraDNS`_ :doc:`Click ` AURORADNS single region driver :mod:`libcloud.dns.drivers.auroradns` :class:`AuroraDNSDriver` -`BuddyNS DNS`_ :doc:`Click ` BUDDYNS single region driver :mod:`libcloud.dns.drivers.buddyns` :class:`BuddyNSDNSDriver` +`AuroraDNS`_ :doc:`Click ` AURORADNS single region driver :mod:`libcloud.dns.drivers.auroradns` :class:`AuroraDNSDriver` +`BuddyNS DNS`_ :doc:`Click ` BUDDYNS single region driver :mod:`libcloud.dns.drivers.buddyns` :class:`BuddyNSDNSDriver` `CloudFlare DNS`_ :doc:`Click ` CLOUDFLARE single region driver :mod:`libcloud.dns.drivers.cloudflare` :class:`CloudFlareDNSDriver` +`DNSimple`_ :doc:`Click ` DNSIMPLE single region driver :mod:`libcloud.dns.drivers.dnsimple` :class:`DNSimpleDNSDriver` `DigitalOcean`_ :doc:`Click ` DIGITAL_OCEAN single region driver :mod:`libcloud.dns.drivers.digitalocean` :class:`DigitalOceanDNSDriver` -`DNSimple`_ :doc:`Click ` DNSIMPLE single region driver :mod:`libcloud.dns.drivers.dnsimple` :class:`DNSimpleDNSDriver` `DurableDNS`_ :doc:`Click ` DURABLEDNS single region driver :mod:`libcloud.dns.drivers.durabledns` :class:`DurableDNSDriver` `Gandi DNS`_ GANDI single region driver :mod:`libcloud.dns.drivers.gandi` :class:`GandiDNSDriver` `Gandi LiveDNS`_ GANDI_LIVE single region driver :mod:`libcloud.dns.drivers.gandi_live` :class:`GandiLiveDNSDriver` @@ -30,11 +30,10 @@ Provider Documentation Provider Constant Su `Zonomi DNS`_ :doc:`Click ` ZONOMI single region driver :mod:`libcloud.dns.drivers.zonomi` :class:`ZonomiDNSDriver` ================= ========================================= ================= ==================== ======================================== ============================== -.. _`AuroraDNS`: https://www.pcextreme.nl/en/aurora/dns .. _`BuddyNS DNS`: https://www.buddyns.com .. _`CloudFlare DNS`: https://www.cloudflare.com -.. _`DigitalOcean`: https://www.digitalocean.com .. _`DNSimple`: https://dnsimple.com/ +.. _`DigitalOcean`: https://www.digitalocean.com .. _`DurableDNS`: https://durabledns.com .. _`Gandi DNS`: http://www.gandi.net/domain .. _`Gandi LiveDNS`: http://www.gandi.net/domain @@ -55,3 +54,4 @@ Provider Documentation Provider Constant Su .. _`World Wide DNS`: https://www.worldwidedns.net/ .. _`Zerigo DNS`: http://www.zerigo.com/ .. _`Zonomi DNS`: https://zonomi.com +.. _`AuroraDNS`: https://www.pcextreme.nl/en/aurora/dns diff --git a/docs/examples/backup/create_backup_from_node.py b/docs/examples/backup/create_backup_from_node.py index ccf5f2a495..78b731d5ad 100644 --- a/docs/examples/backup/create_backup_from_node.py +++ b/docs/examples/backup/create_backup_from_node.py @@ -7,8 +7,14 @@ from libcloud.backup.providers import get_driver as get_backup_driver from libcloud.compute.providers import get_driver as get_compute_driver -backup_driver = get_backup_driver(BackupProvider.DIMENSIONDATA)("username", "api key") -compute_driver = get_compute_driver(ComputeProvider.DIMENSIONDATA)("username", "api key") +CREDENTIALS = ("service-account@example.com", "path/to/private-key.pem") +PROJECT = "your-gce-project" + +compute_driver_cls = get_compute_driver(ComputeProvider.GCE) +compute_driver = compute_driver_cls(*CREDENTIALS, project=PROJECT) + +backup_driver_cls = get_backup_driver(BackupProvider.GCE) +backup_driver = backup_driver_cls(*CREDENTIALS, project=PROJECT) nodes = compute_driver.list_nodes() diff --git a/docs/examples/compute/dimensiondata/Nodes_Create_mcp2_Uncustomised.py b/docs/examples/compute/dimensiondata/Nodes_Create_mcp2_Uncustomised.py deleted file mode 100644 index 831671c12d..0000000000 --- a/docs/examples/compute/dimensiondata/Nodes_Create_mcp2_Uncustomised.py +++ /dev/null @@ -1,57 +0,0 @@ -from pprint import pprint - -import libcloud.security -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver - -# Get dimension data driver -libcloud.security.VERIFY_SSL_CERT = True -cls = get_driver(Provider.DIMENSIONDATA) -driver = cls("myusername", "mypassword", region="dd-au") - -# Get location -location = driver.ex_get_location_by_id(id="AU9") - -# Get network domain by location -networkDomainName = "Test Apache Libcloud" -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(name="Libcloud Test VLAN")[0] - -# Get Image -images = driver.ex_list_customer_images(location=location) -image = images[1] - -tags = driver.ex_list_tags() -pprint(tags) - -ex_tagname_value_pairs = {} -ex_tagname_value_pairs["AA_Tag1"] = "demo 1" -ex_tagname_value_pairs["AA_Tag2"] = "demo 2" - -ex_tagid_value_pairs = {} -ex_tagid_value_pairs["4927c8fd-7f41-4206-a7d5-c5def927c6d2"] = "demo 1" -ex_tagid_value_pairs["2579fc7c-a89c-47cd-ac3b-67999dded93b"] = "demo 2" - - -# Create node using vlan instead of private IPv4 -node = driver.ex_create_node_uncustomized( - name="test_server_05", - image=image, - ex_network_domain=my_network_domain, - ex_is_started=False, - 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=vlan, - ex_primary_nic_network_adapter=None, - ex_additional_nics=None, - ex_disks=None, - ex_tagid_value_pairs=ex_tagid_value_pairs, - ex_tagname_value_pairs=None, -) - -pprint(node) diff --git a/docs/examples/compute/internetsolutions/__init__.py b/docs/examples/compute/internetsolutions/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docs/examples/compute/internetsolutions/instantiate_driver.py b/docs/examples/compute/internetsolutions/instantiate_driver.py deleted file mode 100644 index 3cd4b3f072..0000000000 --- a/docs/examples/compute/internetsolutions/instantiate_driver.py +++ /dev/null @@ -1,9 +0,0 @@ -from pprint import pprint - -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver - -cls = get_driver(Provider.INTERNETSOLUTIONS) -driver = cls("my username", "my password", region="is-af") - -pprint(driver.list_nodes()) diff --git a/docs/loadbalancer/_supported_methods.rst b/docs/loadbalancer/_supported_methods.rst index c08ccd50bc..1a589d9094 100644 --- a/docs/loadbalancer/_supported_methods.rst +++ b/docs/loadbalancer/_supported_methods.rst @@ -7,7 +7,6 @@ Provider create balancer list balancers list membe `Aliyun Server Load Balancer`_ yes yes yes yes yes yes `Brightbox`_ yes yes yes yes yes yes `CloudStack`_ yes yes yes yes yes no -`Dimension Data Load Balancer`_ yes yes yes yes yes no `Amazon Elastic Load Balancing`_ yes yes yes no yes yes `Google Compute Engine Load Balancer`_ yes yes yes yes yes yes `Ninefold LB`_ yes yes yes yes yes no @@ -19,7 +18,6 @@ Provider create balancer list balancers list membe .. _`Aliyun Server Load Balancer`: https://www.aliyun.com/product/slb .. _`Brightbox`: http://www.brightbox.co.uk/ .. _`CloudStack`: http://cloudstack.org/ -.. _`Dimension Data Load Balancer`: https://cloud.dimensiondata.com/ .. _`Amazon Elastic Load Balancing`: http://aws.amazon.com/elasticloadbalancing/ .. _`Google Compute Engine Load Balancer`: https://cloud.google.com/ .. _`Ninefold LB`: http://ninefold.com/ diff --git a/docs/loadbalancer/_supported_providers.rst b/docs/loadbalancer/_supported_providers.rst index 543d163b9e..1e0062b93e 100644 --- a/docs/loadbalancer/_supported_providers.rst +++ b/docs/loadbalancer/_supported_providers.rst @@ -7,7 +7,6 @@ Provider Documentation `Aliyun Server Load Balancer`_ ALIYUN_SLB single region driver :mod:`libcloud.loadbalancer.drivers.slb` :class:`SLBDriver` `Brightbox`_ BRIGHTBOX single region driver :mod:`libcloud.loadbalancer.drivers.brightbox` :class:`BrightboxLBDriver` `CloudStack`_ CLOUDSTACK single region driver :mod:`libcloud.loadbalancer.drivers.cloudstack` :class:`CloudStackLBDriver` -`Dimension Data Load Balancer`_ :doc:`Click ` DIMENSIONDATA single region driver :mod:`libcloud.loadbalancer.drivers.dimensiondata` :class:`DimensionDataLBDriver` `Amazon Elastic Load Balancing`_ :doc:`Click ` ELB single region driver :mod:`libcloud.loadbalancer.drivers.elb` :class:`ElasticLBDriver` `Google Compute Engine Load Balancer`_ :doc:`Click ` GCE single region driver :mod:`libcloud.loadbalancer.drivers.gce` :class:`GCELBDriver` `Ninefold LB`_ NINEFOLD single region driver :mod:`libcloud.loadbalancer.drivers.ninefold` :class:`NinefoldLBDriver` @@ -19,7 +18,6 @@ Provider Documentation .. _`Aliyun Server Load Balancer`: https://www.aliyun.com/product/slb .. _`Brightbox`: http://www.brightbox.co.uk/ .. _`CloudStack`: http://cloudstack.org/ -.. _`Dimension Data Load Balancer`: https://cloud.dimensiondata.com/ .. _`Amazon Elastic Load Balancing`: http://aws.amazon.com/elasticloadbalancing/ .. _`Google Compute Engine Load Balancer`: https://cloud.google.com/ .. _`Ninefold LB`: http://ninefold.com/ diff --git a/docs/loadbalancer/drivers/dimensiondata.rst b/docs/loadbalancer/drivers/dimensiondata.rst deleted file mode 100644 index 65289d7323..0000000000 --- a/docs/loadbalancer/drivers/dimensiondata.rst +++ /dev/null @@ -1,66 +0,0 @@ -Dimension Data Load Balancer Driver Documentation -================================================= - -Dimension Data are a global IT Services company and form part of the NTT Group. -Dimension Data provide 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 of the public cloud instances or as a private instance on premises. - -.. figure:: /_static/images/provider_logos/dimensiondata.png - :align: center - :width: 300 - :target: http://cloud.dimensiondata.com/ - -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 Dimension Data libcloud -driver to communicate with both the public and private clouds. - -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: - -* ``dd-na`` : Dimension Data North America (USA) -* ``dd-eu`` : Dimension Data Europe -* ``dd-af`` : Dimension Data Africa -* ``dd-au`` : Dimension Data Australia -* ``dd-latam`` : Dimension Data Latin America -* ``dd-ap`` : Dimension Data Asia Pacific -* ``dd-canada`` : Dimension Data Canada region - -The base `libcloud` API allows you to: - -* create balancers, add members and destroy members - -Non-standard functionality and extension methods ------------------------------------------------- - -The Dimension Data driver exposes some `libcloud` non-standard -functionalities through extension methods and arguments. - -These functionalities include: - -* list nodes -* list pools -* set the network domain (zone) - -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 --------- - -.. autoclass:: libcloud.loadbalancer.drivers.dimensiondata.DimensionDataLBDriver - :members: - :inherited-members: - -.. _`API`: http://cloud.dimensiondata.com/au/en/services/public-cloud/api diff --git a/libcloud/backup/drivers/dimensiondata.py b/libcloud/backup/drivers/dimensiondata.py deleted file mode 100644 index 4ea775067b..0000000000 --- a/libcloud/backup/drivers/dimensiondata.py +++ /dev/null @@ -1,671 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.utils.py3 import ET -from libcloud.utils.xml import findall, findtext, fixxpath -from libcloud.backup.base import BackupDriver, BackupTarget, BackupTargetJob -from libcloud.backup.types import Provider, BackupTargetType -from libcloud.common.dimensiondata import ( - BACKUP_NS, - TYPES_URN, - GENERAL_NS, - API_ENDPOINTS, - DEFAULT_REGION, - DimensionDataConnection, - DimensionDataBackupClient, - DimensionDataBackupDetails, - DimensionDataBackupClientType, - DimensionDataBackupClientAlert, - DimensionDataBackupStoragePolicy, - DimensionDataBackupSchedulePolicy, - dd_object_to_id, -) - -# pylint: disable=no-member - -DEFAULT_BACKUP_PLAN = "Advanced" - - -class DimensionDataBackupDriver(BackupDriver): - """ - DimensionData backup driver. - """ - - selected_region = None - connectionCls = DimensionDataConnection - name = "Dimension Data Backup" - website = "https://cloud.dimensiondata.com/" - type = Provider.DIMENSIONDATA - api_version = 1.0 - - network_domain_id = None - - def __init__( - self, - key, - secret=None, - secure=True, - host=None, - port=None, - api_version=None, - region=DEFAULT_REGION, - **kwargs, - ): - if region not in API_ENDPOINTS and host is None: - raise ValueError("Invalid region: %s, no host specified" % (region)) - if region is not None: - self.selected_region = API_ENDPOINTS[region] - - super().__init__( - key=key, - secret=secret, - secure=secure, - host=host, - port=port, - api_version=api_version, - region=region, - **kwargs, - ) - - def _ex_connection_class_kwargs(self): - """ - Add the region to the kwargs before the connection is instantiated - """ - - kwargs = super()._ex_connection_class_kwargs() - kwargs["region"] = self.selected_region - return kwargs - - def get_supported_target_types(self): - """ - Get a list of backup target types this driver supports - - :return: ``list`` of :class:``BackupTargetType`` - """ - return [BackupTargetType.VIRTUAL] - - def list_targets(self): - """ - List all backuptargets - - :rtype: ``list`` of :class:`BackupTarget` - """ - targets = self._to_targets(self.connection.request_with_orgId_api_2("server/server").object) - return targets - - def create_target(self, name, address, type=BackupTargetType.VIRTUAL, extra=None): - """ - Creates a new backup target - - :param name: Name of the target (not used) - :type name: ``str`` - - :param address: The ID of the node in Dimension Data Cloud - :type address: ``str`` - - :param type: Backup target type, only Virtual supported - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTarget` - """ - if extra is not None: - service_plan = extra.get("servicePlan", DEFAULT_BACKUP_PLAN) - else: - service_plan = DEFAULT_BACKUP_PLAN - extra = {"servicePlan": service_plan} - - create_node = ET.Element("NewBackup", {"xmlns": BACKUP_NS}) - create_node.set("servicePlan", service_plan) - - response = self.connection.request_with_orgId_api_1( - "server/%s/backup" % (address), method="POST", data=ET.tostring(create_node) - ).object - - asset_id = None - for info in findall(response, "additionalInformation", GENERAL_NS): - if info.get("name") == "assetId": - asset_id = findtext(info, "value", GENERAL_NS) - - return BackupTarget( - id=asset_id, name=name, address=address, type=type, extra=extra, driver=self - ) - - def create_target_from_node(self, node, type=BackupTargetType.VIRTUAL, extra=None): - """ - Creates a new backup target from an existing node - - :param node: The Node to backup - :type node: ``Node`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTarget` - """ - return self.create_target( - name=node.name, address=node.id, type=BackupTargetType.VIRTUAL, extra=extra - ) - - def create_target_from_container(self, container, type=BackupTargetType.OBJECT, extra=None): - """ - Creates a new backup target from an existing storage container - - :param node: The Container to backup - :type node: ``Container`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTarget` - """ - return NotImplementedError("create_target_from_container not supported for this driver") - - def update_target(self, target, name=None, address=None, extra=None): - """ - Update the properties of a backup target, only changing the serviceplan - is supported. - - :param target: Backup target to update - :type target: Instance of :class:`BackupTarget` or ``str`` - - :param name: Name of the target - :type name: ``str`` - - :param address: Hostname, FQDN, IP, file path etc. - :type address: ``str`` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTarget` - """ - if extra is not None: - service_plan = extra.get("servicePlan", DEFAULT_BACKUP_PLAN) - else: - service_plan = DEFAULT_BACKUP_PLAN - request = ET.Element("ModifyBackup", {"xmlns": BACKUP_NS}) - request.set("servicePlan", service_plan) - server_id = self._target_to_target_address(target) - self.connection.request_with_orgId_api_1( - "server/%s/backup/modify" % (server_id), - method="POST", - data=ET.tostring(request), - ).object - if isinstance(target, BackupTarget): - target.extra = extra - else: - target = self.ex_get_target_by_id(server_id) - return target - - def delete_target(self, target): - """ - Delete a backup target - - :param target: Backup target to delete - :type target: Instance of :class:`BackupTarget` or ``str`` - - :rtype: ``bool`` - """ - server_id = self._target_to_target_address(target) - response = self.connection.request_with_orgId_api_1( - "server/%s/backup?disable" % (server_id), method="GET" - ).object - response_code = findtext(response, "result", GENERAL_NS) - return response_code in ["IN_PROGRESS", "SUCCESS"] - - def list_recovery_points(self, target, start_date=None, end_date=None): - """ - List the recovery points available for a target - - :param target: Backup target to delete - :type target: Instance of :class:`BackupTarget` - - :param start_date: The start date to show jobs between (optional) - :type start_date: :class:`datetime.datetime` - - :param end_date: The end date to show jobs between (optional) - :type end_date: :class:`datetime.datetime`` - - :rtype: ``list`` of :class:`BackupTargetRecoveryPoint` - """ - raise NotImplementedError("list_recovery_points not implemented for this driver") - - def recover_target(self, target, recovery_point, path=None): - """ - Recover a backup target to a recovery point - - :param target: Backup target to delete - :type target: Instance of :class:`BackupTarget` - - :param recovery_point: Backup target with the backup data - :type recovery_point: Instance of :class:`BackupTarget` - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`BackupTargetJob` - """ - raise NotImplementedError("recover_target not implemented for this driver") - - def recover_target_out_of_place(self, target, recovery_point, recovery_target, path=None): - """ - Recover a backup target to a recovery point out-of-place - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :param recovery_point: Backup target with the backup data - :type recovery_point: Instance of :class:`BackupTarget` - - :param recovery_target: Backup target with to recover the data to - :type recovery_target: Instance of :class:`BackupTarget` - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`BackupTargetJob` - """ - raise NotImplementedError("recover_target_out_of_place not implemented for this driver") - - def get_target_job(self, target, id): - """ - Get a specific backup job by ID - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :param id: Backup target with the backup data - :type id: Instance of :class:`BackupTarget` - - :rtype: :class:`BackupTargetJob` - """ - jobs = self.list_target_jobs(target) - return list(filter(lambda x: x.id == id, jobs))[0] - - def list_target_jobs(self, target): - """ - List the backup jobs on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :rtype: ``list`` of :class:`BackupTargetJob` - """ - raise NotImplementedError("list_target_jobs not implemented for this driver") - - def create_target_job(self, target, extra=None): - """ - Create a new backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTargetJob` - """ - raise NotImplementedError("create_target_job not implemented for this driver") - - def resume_target_job(self, target, job): - """ - Resume a suspended backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :param job: Backup target job to resume - :type job: Instance of :class:`BackupTargetJob` - - :rtype: ``bool`` - """ - raise NotImplementedError("resume_target_job not implemented for this driver") - - def suspend_target_job(self, target, job): - """ - Suspend a running backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` - - :param job: Backup target job to suspend - :type job: Instance of :class:`BackupTargetJob` - - :rtype: ``bool`` - """ - raise NotImplementedError("suspend_target_job not implemented for this driver") - - def cancel_target_job(self, job, ex_client=None, ex_target=None): - """ - Cancel a backup job on a target - - :param job: Backup target job to cancel. If it is ``None`` - ex_client and ex_target must be set - :type job: Instance of :class:`BackupTargetJob` or ``None`` - - :param ex_client: Client of the job to cancel. - Not necessary if job is specified. - DimensionData only has 1 job per client - :type ex_client: Instance of :class:`DimensionDataBackupClient` - or ``str`` - - :param ex_target: Target to cancel a job from. - Not necessary if job is specified. - :type ex_target: Instance of :class:`BackupTarget` or ``str`` - - :rtype: ``bool`` - """ - if job is None: - if ex_client is None or ex_target is None: - raise ValueError("Either job or ex_client and " "ex_target have to be set") - server_id = self._target_to_target_address(ex_target) - client_id = self._client_to_client_id(ex_client) - else: - server_id = job.target.address - client_id = job.extra["clientId"] - - response = self.connection.request_with_orgId_api_1( - "server/{}/backup/client/{}?cancelJob".format(server_id, client_id), - method="GET", - ).object - response_code = findtext(response, "result", GENERAL_NS) - return response_code in ["IN_PROGRESS", "SUCCESS"] - - def ex_get_target_by_id(self, id): - """ - Get a target by server id - - :param id: The id of the target you want to get - :type id: ``str`` - - :rtype: :class:`BackupTarget` - """ - node = self.connection.request_with_orgId_api_2("server/server/%s" % id).object - return self._to_target(node) - - def ex_add_client_to_target( - self, target, client_type, storage_policy, schedule_policy, trigger, email - ): - """ - Add a client to a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`BackupTarget` or ``str`` - - :param client: Client to add to the target - :type client: Instance of :class:`DimensionDataBackupClientType` - or ``str`` - - :param storage_policy: The storage policy for the client - :type storage_policy: Instance of - :class:`DimensionDataBackupStoragePolicy` - or ``str`` - - :param schedule_policy: The schedule policy for the client - :type schedule_policy: Instance of - :class:`DimensionDataBackupSchedulePolicy` - or ``str`` - - :param trigger: The notify trigger for the client - :type trigger: ``str`` - - :param email: The notify email for the client - :type email: ``str`` - - :rtype: ``bool`` - """ - server_id = self._target_to_target_address(target) - - backup_elm = ET.Element("NewBackupClient", {"xmlns": BACKUP_NS}) - if isinstance(client_type, DimensionDataBackupClientType): - ET.SubElement(backup_elm, "type").text = client_type.type - else: - ET.SubElement(backup_elm, "type").text = client_type - - if isinstance(storage_policy, DimensionDataBackupStoragePolicy): - ET.SubElement(backup_elm, "storagePolicyName").text = storage_policy.name - else: - ET.SubElement(backup_elm, "storagePolicyName").text = storage_policy - - if isinstance(schedule_policy, DimensionDataBackupSchedulePolicy): - ET.SubElement(backup_elm, "schedulePolicyName").text = schedule_policy.name - else: - ET.SubElement(backup_elm, "schedulePolicyName").text = schedule_policy - - alerting_elm = ET.SubElement(backup_elm, "alerting") - alerting_elm.set("trigger", trigger) - ET.SubElement(alerting_elm, "emailAddress").text = email - - response = self.connection.request_with_orgId_api_1( - "server/%s/backup/client" % (server_id), - method="POST", - data=ET.tostring(backup_elm), - ).object - response_code = findtext(response, "result", GENERAL_NS) - return response_code in ["IN_PROGRESS", "SUCCESS"] - - def ex_remove_client_from_target(self, target, backup_client): - """ - Removes a client from a backup target - - :param target: The backup target to remove the client from - :type target: :class:`BackupTarget` or ``str`` - - :param backup_client: The backup client to remove - :type backup_client: :class:`DimensionDataBackupClient` or ``str`` - - :rtype: ``bool`` - """ - server_id = self._target_to_target_address(target) - client_id = self._client_to_client_id(backup_client) - response = self.connection.request_with_orgId_api_1( - "server/{}/backup/client/{}?disable".format(server_id, client_id), method="GET" - ).object - response_code = findtext(response, "result", GENERAL_NS) - return response_code in ["IN_PROGRESS", "SUCCESS"] - - def ex_get_backup_details_for_target(self, target): - """ - Returns a backup details object for a target - - :param target: The backup target to get details for - :type target: :class:`BackupTarget` or ``str`` - - :rtype: :class:`DimensionDataBackupDetails` - """ - if not isinstance(target, BackupTarget): - target = self.ex_get_target_by_id(target) - if target is None: - return - response = self.connection.request_with_orgId_api_1( - "server/%s/backup" % (target.address), method="GET" - ).object - return self._to_backup_details(response, target) - - def ex_list_available_client_types(self, target): - """ - Returns a list of available backup client types - - :param target: The backup target to list available types for - :type target: :class:`BackupTarget` or ``str`` - - :rtype: ``list`` of :class:`DimensionDataBackupClientType` - """ - server_id = self._target_to_target_address(target) - response = self.connection.request_with_orgId_api_1( - "server/%s/backup/client/type" % (server_id), method="GET" - ).object - return self._to_client_types(response) - - def ex_list_available_storage_policies(self, target): - """ - Returns a list of available backup storage policies - - :param target: The backup target to list available policies for - :type target: :class:`BackupTarget` or ``str`` - - :rtype: ``list`` of :class:`DimensionDataBackupStoragePolicy` - """ - server_id = self._target_to_target_address(target) - response = self.connection.request_with_orgId_api_1( - "server/%s/backup/client/storagePolicy" % (server_id), method="GET" - ).object - return self._to_storage_policies(response) - - def ex_list_available_schedule_policies(self, target): - """ - Returns a list of available backup schedule policies - - :param target: The backup target to list available policies for - :type target: :class:`BackupTarget` or ``str`` - - :rtype: ``list`` of :class:`DimensionDataBackupSchedulePolicy` - """ - server_id = self._target_to_target_address(target) - response = self.connection.request_with_orgId_api_1( - "server/%s/backup/client/schedulePolicy" % (server_id), method="GET" - ).object - return self._to_schedule_policies(response) - - def _to_storage_policies(self, object): - elements = object.findall(fixxpath("storagePolicy", BACKUP_NS)) - - return [self._to_storage_policy(el) for el in elements] - - def _to_storage_policy(self, element): - return DimensionDataBackupStoragePolicy( - retention_period=int(element.get("retentionPeriodInDays")), - name=element.get("name"), - secondary_location=element.get("secondaryLocation"), - ) - - def _to_schedule_policies(self, object): - elements = object.findall(fixxpath("schedulePolicy", BACKUP_NS)) - - return [self._to_schedule_policy(el) for el in elements] - - def _to_schedule_policy(self, element): - return DimensionDataBackupSchedulePolicy( - name=element.get("name"), description=element.get("description") - ) - - def _to_client_types(self, object): - elements = object.findall(fixxpath("backupClientType", BACKUP_NS)) - - return [self._to_client_type(el) for el in elements] - - def _to_client_type(self, element): - description = element.get("description") - if description is None: - description = findtext(element, "description", BACKUP_NS) - return DimensionDataBackupClientType( - type=element.get("type"), - description=description, - is_file_system=bool(element.get("isFileSystem") == "true"), - ) - - def _to_backup_details(self, object, target): - return DimensionDataBackupDetails( - asset_id=object.get("assetId"), - service_plan=object.get("servicePlan"), - status=object.get("state"), - clients=self._to_clients(object, target), - ) - - def _to_clients(self, object, target): - elements = object.findall(fixxpath("backupClient", BACKUP_NS)) - - return [self._to_client(el, target) for el in elements] - - def _to_client(self, element, target): - client_id = element.get("id") - return DimensionDataBackupClient( - id=client_id, - type=self._to_client_type(element), - status=element.get("status"), - schedule_policy=findtext(element, "schedulePolicyName", BACKUP_NS), - storage_policy=findtext(element, "storagePolicyName", BACKUP_NS), - download_url=findtext(element, "downloadUrl", BACKUP_NS), - running_job=self._to_backup_job(element, target, client_id), - alert=self._to_alert(element), - ) - - def _to_alert(self, element): - alert = element.find(fixxpath("alerting", BACKUP_NS)) - if alert is not None: - notify_list = [ - email_addr.text for email_addr in alert.findall(fixxpath("emailAddress", BACKUP_NS)) - ] - return DimensionDataBackupClientAlert( - trigger=element.get("trigger"), notify_list=notify_list - ) - return None - - def _to_backup_job(self, element, target, client_id): - running_job = element.find(fixxpath("runningJob", BACKUP_NS)) - if running_job is not None: - return BackupTargetJob( - id=running_job.get("id"), - status=running_job.get("status"), - progress=int(running_job.get("percentageComplete")), - driver=self.connection.driver, - target=target, - extra={"clientId": client_id}, - ) - return None - - def _to_targets(self, object): - node_elements = object.findall(fixxpath("server", TYPES_URN)) - - return [self._to_target(el) for el in node_elements] - - def _to_target(self, element): - backup = findall(element, "backup", TYPES_URN) - if len(backup) == 0: - return - extra = { - "description": findtext(element, "description", TYPES_URN), - "sourceImageId": findtext(element, "sourceImageId", TYPES_URN), - "datacenterId": element.get("datacenterId"), - "deployedTime": findtext(element, "createTime", TYPES_URN), - "servicePlan": backup[0].get("servicePlan"), - } - - n = BackupTarget( - id=backup[0].get("assetId"), - name=findtext(element, "name", TYPES_URN), - address=element.get("id"), - driver=self.connection.driver, - type=BackupTargetType.VIRTUAL, - extra=extra, - ) - return n - - @staticmethod - def _client_to_client_id(backup_client): - return dd_object_to_id(backup_client, DimensionDataBackupClient) - - @staticmethod - def _target_to_target_address(target): - return dd_object_to_id(target, BackupTarget, id_value="address") diff --git a/libcloud/backup/providers.py b/libcloud/backup/providers.py index 8a56f0112e..7acfa09d59 100644 --- a/libcloud/backup/providers.py +++ b/libcloud/backup/providers.py @@ -21,10 +21,6 @@ Provider.DUMMY: ("libcloud.backup.drivers.dummy", "DummyBackupDriver"), Provider.EBS: ("libcloud.backup.drivers.ebs", "EBSBackupDriver"), Provider.GCE: ("libcloud.backup.drivers.gce", "GCEBackupDriver"), - Provider.DIMENSIONDATA: ( - "libcloud.backup.drivers.dimensiondata", - "DimensionDataBackupDriver", - ), } diff --git a/libcloud/backup/types.py b/libcloud/backup/types.py index 912f90b520..5700374996 100644 --- a/libcloud/backup/types.py +++ b/libcloud/backup/types.py @@ -25,7 +25,6 @@ class Provider: """ DUMMY = "dummy" - DIMENSIONDATA = "dimensiondata" EBS = "ebs" GCE = "gce" diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index 09aa088e2b..73d524c8a4 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -45,81 +45,6 @@ # API end-points API_ENDPOINTS = { - "dd-na": { - "name": "North America (NA)", - "host": "api-na.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-eu": { - "name": "Europe (EU)", - "host": "api-eu.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-au": { - "name": "Australia (AU)", - "host": "api-au.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-au-gov": { - "name": "Australia Canberra ACT (AU)", - "host": "api-canberra.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-af": { - "name": "Africa (AF)", - "host": "api-mea.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-ap": { - "name": "Asia Pacific (AP)", - "host": "api-ap.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-latam": { - "name": "South America (LATAM)", - "host": "api-latam.dimensiondata.com", - "vendor": "DimensionData", - }, - "dd-canada": { - "name": "Canada (CA)", - "host": "api-canada.dimensiondata.com", - "vendor": "DimensionData", - }, - "is-na": { - "name": "North America (NA)", - "host": "usapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-eu": { - "name": "Europe (EU)", - "host": "euapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-au": { - "name": "Australia (AU)", - "host": "auapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-af": { - "name": "Africa (AF)", - "host": "meaapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-ap": { - "name": "Asia Pacific (AP)", - "host": "apapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-latam": { - "name": "South America (LATAM)", - "host": "latamapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-canada": { - "name": "Canada (CA)", - "host": "canadaapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, "ntta-na": { "name": "North America (NA)", "host": "cloudapi.nttamerica.com", diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py index fba02289a5..b105e2d3f9 100644 --- a/libcloud/common/nttcis.py +++ b/libcloud/common/nttcis.py @@ -92,41 +92,6 @@ "host": "api-canada.dimensiondata.com", "vendor": "NTTC-CIS", }, - "is-na": { - "name": "North America (NA)", - "host": "usapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-eu": { - "name": "Europe (EU)", - "host": "euapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-au": { - "name": "Australia (AU)", - "host": "auapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-af": { - "name": "Africa (AF)", - "host": "meaapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-ap": { - "name": "Asia Pacific (AP)", - "host": "apapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-latam": { - "name": "South America (LATAM)", - "host": "latamapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, - "is-canada": { - "name": "Canada (CA)", - "host": "canadaapi.cloud.is.co.za", - "vendor": "InternetSolutions", - }, "ntta-na": { "name": "North America (NA)", "host": "cloudapi.nttamerica.com", diff --git a/libcloud/compute/drivers/__init__.py b/libcloud/compute/drivers/__init__.py index ba5af84270..1731907b6b 100644 --- a/libcloud/compute/drivers/__init__.py +++ b/libcloud/compute/drivers/__init__.py @@ -19,8 +19,8 @@ __all__ = [ "abiquo", + "auroracompute", "brightbox", - "dimensiondata", "dummy", "ec2", "cloudsigma", diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index db837171ad..11b3bb8e89 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -103,7 +103,7 @@ class DimensionDataNodeDriver(NodeDriver): connectionCls = DimensionDataConnection name = "DimensionData" website = "http://www.dimensiondata.com/" - type = Provider.DIMENSIONDATA + type = Provider.NTTA features = {"create_node": ["password"]} api_version = 1.0 @@ -305,7 +305,7 @@ def create_node( >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = False - >>> DimensionData = get_driver(Provider.DIMENSIONDATA) + >>> DimensionData = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Password @@ -340,7 +340,7 @@ def create_node( >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Password @@ -1942,7 +1942,7 @@ def ex_edit_firewall_rule(self, rule, position, relative_rule_for_position=None) >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3015,7 +3015,7 @@ def ex_list_ip_address_list(self, ex_network_domain): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3055,7 +3055,7 @@ def ex_get_ip_address_list(self, ex_network_domain, ex_ip_address_list_name): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3109,7 +3109,7 @@ def ex_create_ip_address_list( >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3234,7 +3234,7 @@ def ex_edit_ip_address_list( >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # IP Address collection @@ -3327,7 +3327,7 @@ def ex_delete_ip_address_list(self, ex_ip_address_list): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3' @@ -3370,7 +3370,7 @@ def ex_list_portlist(self, ex_network_domain): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3411,7 +3411,7 @@ def ex_get_portlist(self, ex_portlist_id): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get specific portlist by ID @@ -3449,7 +3449,7 @@ def ex_create_portlist( >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location @@ -3539,7 +3539,7 @@ def ex_edit_portlist(self, ex_portlist, description, port_collection, child_port >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Port Collection @@ -3625,7 +3625,7 @@ def ex_delete_portlist(self, ex_portlist): >>> >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True - >>> cls = get_driver(Provider.DIMENSIONDATA) + >>> cls = get_driver(Provider.NTTA) >>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Delete Port List diff --git a/libcloud/compute/drivers/internetsolutions.py b/libcloud/compute/drivers/internetsolutions.py deleted file mode 100644 index 32cc424394..0000000000 --- a/libcloud/compute/drivers/internetsolutions.py +++ /dev/null @@ -1,64 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Internet Solutions Driver -""" - -from libcloud.compute.providers import Provider -from libcloud.common.dimensiondata import API_ENDPOINTS, DimensionDataConnection -from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver - -DEFAULT_REGION = "is-af" - - -class InternetSolutionsNodeDriver(DimensionDataNodeDriver): - """ - InternetSolutions node driver, based on Dimension Data driver - """ - - selected_region = None - connectionCls = DimensionDataConnection - name = "InternetSolutions" - website = "http://www.is.co.za/" - type = Provider.INTERNETSOLUTIONS - features = {"create_node": ["password"]} - api_version = 1.0 - - def __init__( - self, - key, - secret=None, - secure=True, - host=None, - port=None, - api_version=None, - region=DEFAULT_REGION, - **kwargs, - ): - if region not in API_ENDPOINTS: - raise ValueError("Invalid region: %s" % (region)) - - self.selected_region = API_ENDPOINTS[region] - - super().__init__( - key=key, - secret=secret, - secure=secure, - host=host, - port=port, - api_version=api_version, - region=region, - **kwargs, - ) diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py index 82605099da..52e743cf50 100644 --- a/libcloud/compute/providers.py +++ b/libcloud/compute/providers.py @@ -31,88 +31,59 @@ __all__ = ["Provider", "DRIVERS", "get_driver"] DRIVERS = { + Provider.ABIQUO: ("libcloud.compute.drivers.abiquo", "AbiquoNodeDriver"), + Provider.ALIYUN_ECS: ("libcloud.compute.drivers.ecs", "ECSDriver"), + Provider.AURORACOMPUTE: ( + "libcloud.compute.drivers.auroracompute", + "AuroraComputeNodeDriver", + ), Provider.AZURE: ("libcloud.compute.drivers.azure", "AzureNodeDriver"), Provider.AZURE_ARM: ("libcloud.compute.drivers.azure_arm", "AzureNodeDriver"), + Provider.BRIGHTBOX: ("libcloud.compute.drivers.brightbox", "BrightboxNodeDriver"), + Provider.CLOUDSCALE: ("libcloud.compute.drivers.cloudscale", "CloudscaleNodeDriver"), + Provider.CLOUDSIGMA: ("libcloud.compute.drivers.cloudsigma", "CloudSigmaNodeDriver"), + Provider.CLOUDSTACK: ("libcloud.compute.drivers.cloudstack", "CloudStackNodeDriver"), + Provider.DIGITAL_OCEAN: ("libcloud.compute.drivers.digitalocean", "DigitalOceanNodeDriver"), Provider.DUMMY: ("libcloud.compute.drivers.dummy", "DummyNodeDriver"), Provider.EC2: ("libcloud.compute.drivers.ec2", "EC2NodeDriver"), - Provider.CLOUDSIGMA: ( - "libcloud.compute.drivers.cloudsigma", - "CloudSigmaNodeDriver", - ), + Provider.EQUINIXMETAL: ("libcloud.compute.drivers.equinixmetal", "EquinixMetalNodeDriver"), + Provider.EUCALYPTUS: ("libcloud.compute.drivers.ec2", "EucNodeDriver"), + Provider.EXOSCALE: ("libcloud.compute.drivers.exoscale", "ExoscaleNodeDriver"), + Provider.GANDI: ("libcloud.compute.drivers.gandi", "GandiNodeDriver"), Provider.GCE: ("libcloud.compute.drivers.gce", "GCENodeDriver"), + Provider.GIG_G8: ("libcloud.compute.drivers.gig_g8", "G8NodeDriver"), + Provider.GRIDSCALE: ("libcloud.compute.drivers.gridscale", "GridscaleNodeDriver"), + Provider.IKOULA: ("libcloud.compute.drivers.ikoula", "IkoulaNodeDriver"), + Provider.KAMATERA: ("libcloud.compute.drivers.kamatera", "KamateraNodeDriver"), + Provider.KTUCLOUD: ("libcloud.compute.drivers.ktucloud", "KTUCloudNodeDriver"), + Provider.KUBEVIRT: ("libcloud.compute.drivers.kubevirt", "KubeVirtNodeDriver"), + Provider.LIBVIRT: ("libcloud.compute.drivers.libvirt_driver", "LibvirtNodeDriver"), + Provider.LINODE: ("libcloud.compute.drivers.linode", "LinodeNodeDriver"), + Provider.MAXIHOST: ("libcloud.compute.drivers.maxihost", "MaxihostNodeDriver"), + Provider.NIMBUS: ("libcloud.compute.drivers.ec2", "NimbusNodeDriver"), + Provider.NTTA: ("libcloud.compute.drivers.ntta", "NTTAmericaNodeDriver"), + Provider.NTTCIS: ("libcloud.compute.drivers.nttcis", "NttCisNodeDriver"), + Provider.ONAPP: ("libcloud.compute.drivers.onapp", "OnAppNodeDriver"), + Provider.OPENNEBULA: ("libcloud.compute.drivers.opennebula", "OpenNebulaNodeDriver"), + Provider.OPENSTACK: ("libcloud.compute.drivers.openstack", "OpenStackNodeDriver"), + Provider.OUTSCALE: ("libcloud.compute.drivers.outscale", "OutscaleNodeDriver"), + Provider.OUTSCALE_INC: ("libcloud.compute.drivers.ec2", "OutscaleINCNodeDriver"), + Provider.OUTSCALE_SAS: ("libcloud.compute.drivers.ec2", "OutscaleSASNodeDriver"), + Provider.OVH: ("libcloud.compute.drivers.ovh", "OvhNodeDriver"), Provider.RACKSPACE: ("libcloud.compute.drivers.rackspace", "RackspaceNodeDriver"), Provider.RACKSPACE_FIRST_GEN: ( "libcloud.compute.drivers.rackspace", "RackspaceFirstGenNodeDriver", ), - Provider.VPSNET: ("libcloud.compute.drivers.vpsnet", "VPSNetNodeDriver"), - Provider.LINODE: ("libcloud.compute.drivers.linode", "LinodeNodeDriver"), - Provider.RIMUHOSTING: ( - "libcloud.compute.drivers.rimuhosting", - "RimuHostingNodeDriver", - ), - Provider.EUCALYPTUS: ("libcloud.compute.drivers.ec2", "EucNodeDriver"), - Provider.OPENNEBULA: ( - "libcloud.compute.drivers.opennebula", - "OpenNebulaNodeDriver", - ), - Provider.BRIGHTBOX: ("libcloud.compute.drivers.brightbox", "BrightboxNodeDriver"), - Provider.NIMBUS: ("libcloud.compute.drivers.ec2", "NimbusNodeDriver"), - Provider.GANDI: ("libcloud.compute.drivers.gandi", "GandiNodeDriver"), - Provider.DIMENSIONDATA: ( - "libcloud.compute.drivers.dimensiondata", - "DimensionDataNodeDriver", - ), - Provider.OPENSTACK: ("libcloud.compute.drivers.openstack", "OpenStackNodeDriver"), - Provider.VCLOUD: ("libcloud.compute.drivers.vcloud", "VCloudNodeDriver"), + Provider.RIMUHOSTING: ("libcloud.compute.drivers.rimuhosting", "RimuHostingNodeDriver"), + Provider.SCALEWAY: ("libcloud.compute.drivers.scaleway", "ScalewayNodeDriver"), Provider.TERREMARK: ("libcloud.compute.drivers.vcloud", "TerremarkDriver"), - Provider.CLOUDSTACK: ( - "libcloud.compute.drivers.cloudstack", - "CloudStackNodeDriver", - ), - Provider.LIBVIRT: ("libcloud.compute.drivers.libvirt_driver", "LibvirtNodeDriver"), + Provider.UPCLOUD: ("libcloud.compute.drivers.upcloud", "UpcloudDriver"), Provider.VCL: ("libcloud.compute.drivers.vcl", "VCLNodeDriver"), - Provider.KTUCLOUD: ("libcloud.compute.drivers.ktucloud", "KTUCloudNodeDriver"), - Provider.ABIQUO: ("libcloud.compute.drivers.abiquo", "AbiquoNodeDriver"), - Provider.DIGITAL_OCEAN: ( - "libcloud.compute.drivers.digitalocean", - "DigitalOceanNodeDriver", - ), - Provider.EXOSCALE: ("libcloud.compute.drivers.exoscale", "ExoscaleNodeDriver"), - Provider.IKOULA: ("libcloud.compute.drivers.ikoula", "IkoulaNodeDriver"), - Provider.OUTSCALE_SAS: ("libcloud.compute.drivers.ec2", "OutscaleSASNodeDriver"), - Provider.OUTSCALE_INC: ("libcloud.compute.drivers.ec2", "OutscaleINCNodeDriver"), - Provider.OUTSCALE: ("libcloud.compute.drivers.outscale", "OutscaleNodeDriver"), + Provider.VCLOUD: ("libcloud.compute.drivers.vcloud", "VCloudNodeDriver"), + Provider.VPSNET: ("libcloud.compute.drivers.vpsnet", "VPSNetNodeDriver"), Provider.VSPHERE: ("libcloud.compute.drivers.vsphere", "VSphereNodeDriver"), Provider.VULTR: ("libcloud.compute.drivers.vultr", "VultrNodeDriver"), - Provider.AURORACOMPUTE: ( - "libcloud.compute.drivers.auroracompute", - "AuroraComputeNodeDriver", - ), - Provider.EQUINIXMETAL: ( - "libcloud.compute.drivers.equinixmetal", - "EquinixMetalNodeDriver", - ), - Provider.ONAPP: ("libcloud.compute.drivers.onapp", "OnAppNodeDriver"), - Provider.OVH: ("libcloud.compute.drivers.ovh", "OvhNodeDriver"), - Provider.INTERNETSOLUTIONS: ( - "libcloud.compute.drivers.internetsolutions", - "InternetSolutionsNodeDriver", - ), - Provider.NTTA: ("libcloud.compute.drivers.ntta", "NTTAmericaNodeDriver"), - Provider.ALIYUN_ECS: ("libcloud.compute.drivers.ecs", "ECSDriver"), - Provider.CLOUDSCALE: ( - "libcloud.compute.drivers.cloudscale", - "CloudscaleNodeDriver", - ), - Provider.UPCLOUD: ("libcloud.compute.drivers.upcloud", "UpcloudDriver"), - Provider.NTTCIS: ("libcloud.compute.drivers.nttcis", "NttCisNodeDriver"), - Provider.SCALEWAY: ("libcloud.compute.drivers.scaleway", "ScalewayNodeDriver"), - Provider.MAXIHOST: ("libcloud.compute.drivers.maxihost", "MaxihostNodeDriver"), - Provider.GRIDSCALE: ("libcloud.compute.drivers.gridscale", "GridscaleNodeDriver"), - Provider.KAMATERA: ("libcloud.compute.drivers.kamatera", "KamateraNodeDriver"), - Provider.KUBEVIRT: ("libcloud.compute.drivers.kubevirt", "KubeVirtNodeDriver"), - Provider.GIG_G8: ("libcloud.compute.drivers.gig_g8", "G8NodeDriver"), } diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py index 1ff5983c28..9bebe53890 100644 --- a/libcloud/compute/types.py +++ b/libcloud/compute/types.py @@ -51,10 +51,9 @@ class Provider(Type): :cvar AURORACOMPUTE: Aurora Compute driver. :cvar AZURE: Azure (classic) driver. :cvar AZURE_ARM: Azure Resource Manager (modern) driver. - :cvar CLOUDSIGMA: CloudSigma :cvar CLOUDSCALE: cloudscale.ch + :cvar CLOUDSIGMA: CloudSigma :cvar CLOUDSTACK: CloudStack - :cvar DIMENSIONDATA: Dimension Data Cloud :cvar EC2: Amazon AWS. :cvar EXOSCALE: Exoscale driver. :cvar GCE: Google Compute Engine @@ -86,20 +85,19 @@ class Provider(Type): :cvar VULTR: vultr driver. """ - AZURE = "azure" - AZURE_ARM = "azure_arm" - DUMMY = "dummy" ABIQUO = "abiquo" ALIYUN_ECS = "aliyun_ecs" AURORACOMPUTE = "aurora_compute" + AZURE = "azure" + AZURE_ARM = "azure_arm" BRIGHTBOX = "brightbox" CISCOCCS = "ciscoccs" CLOUDFRAMES = "cloudframes" - CLOUDSIGMA = "cloudsigma" CLOUDSCALE = "cloudscale" + CLOUDSIGMA = "cloudsigma" CLOUDSTACK = "cloudstack" DIGITAL_OCEAN = "digitalocean" - DIMENSIONDATA = "dimensiondata" + DUMMY = "dummy" EC2 = "ec2" EQUINIXMETAL = "equinixmetal" EUCALYPTUS = "eucalyptus" @@ -110,7 +108,6 @@ class Provider(Type): GRIDSCALE = "gridscale" IBM = "ibm" IKOULA = "ikoula" - INTERNETSOLUTIONS = "internetsolutions" KAMATERA = "kamatera" KTUCLOUD = "ktucloud" KUBEVIRT = "kubevirt" @@ -124,9 +121,9 @@ class Provider(Type): OPENNEBULA = "opennebula" OPENSTACK = "openstack" OPSOURCE = "opsource" + OUTSCALE = "outscale" OUTSCALE_INC = "outscale_inc" OUTSCALE_SAS = "outscale_sas" - OUTSCALE = "outscale" OVH = "ovh" RACKSPACE = "rackspace" RACKSPACE_FIRST_GEN = "rackspace_first_gen" @@ -152,20 +149,20 @@ class Provider(Type): RACKSPACE_NOVA_LON = "rackspace_nova_lon" RACKSPACE_NOVA_ORD = "rackspace_nova_ord" - EC2_US_EAST = "ec2_us_east" - EC2_US_EAST_OHIO = "ec2_us_east_ohio" - EC2_EU = "ec2_eu_west" # deprecated name - EC2_EU_WEST = "ec2_eu_west" - EC2_EU_WEST2 = "ec2_eu_west_london" - EC2_US_WEST = "ec2_us_west" - EC2_AP_SOUTHEAST = "ec2_ap_southeast" EC2_AP_NORTHEAST = "ec2_ap_northeast" EC2_AP_NORTHEAST1 = "ec2_ap_northeast_1" EC2_AP_NORTHEAST2 = "ec2_ap_northeast_2" - EC2_US_WEST_OREGON = "ec2_us_west_oregon" - EC2_SA_EAST = "ec2_sa_east" + EC2_AP_SOUTHEAST = "ec2_ap_southeast" EC2_AP_SOUTHEAST2 = "ec2_ap_southeast_2" EC2_CA_CENTRAL1 = "ec2_ca_central_1" + EC2_EU = "ec2_eu_west" # deprecated name + EC2_EU_WEST = "ec2_eu_west" + EC2_EU_WEST2 = "ec2_eu_west_london" + EC2_SA_EAST = "ec2_sa_east" + EC2_US_EAST = "ec2_us_east" + EC2_US_EAST_OHIO = "ec2_us_east_ohio" + EC2_US_WEST = "ec2_us_west" + EC2_US_WEST_OREGON = "ec2_us_west_oregon" CLOUDSIGMA_US = "cloudsigma_us" @@ -188,20 +185,20 @@ class Provider(Type): Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE, Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE, # AWS - Provider.EC2_US_EAST: Provider.EC2, - Provider.EC2_US_EAST_OHIO: Provider.EC2, + Provider.EC2_AP_NORTHEAST1: Provider.EC2, + Provider.EC2_AP_NORTHEAST2: Provider.EC2, + Provider.EC2_AP_NORTHEAST: Provider.EC2, + Provider.EC2_AP_SOUTHEAST2: Provider.EC2, + Provider.EC2_AP_SOUTHEAST: Provider.EC2, + Provider.EC2_CA_CENTRAL1: Provider.EC2, Provider.EC2_EU: Provider.EC2, - Provider.EC2_EU_WEST: Provider.EC2, Provider.EC2_EU_WEST2: Provider.EC2, + Provider.EC2_EU_WEST: Provider.EC2, + Provider.EC2_SA_EAST: Provider.EC2, + Provider.EC2_US_EAST: Provider.EC2, + Provider.EC2_US_EAST_OHIO: Provider.EC2, Provider.EC2_US_WEST: Provider.EC2, - Provider.EC2_AP_SOUTHEAST: Provider.EC2, - Provider.EC2_AP_SOUTHEAST2: Provider.EC2, - Provider.EC2_AP_NORTHEAST: Provider.EC2, - Provider.EC2_AP_NORTHEAST1: Provider.EC2, - Provider.EC2_AP_NORTHEAST2: Provider.EC2, Provider.EC2_US_WEST_OREGON: Provider.EC2, - Provider.EC2_SA_EAST: Provider.EC2, - Provider.EC2_CA_CENTRAL1: Provider.EC2, } diff --git a/libcloud/dns/providers.py b/libcloud/dns/providers.py index 7469275897..2f2461d4d6 100644 --- a/libcloud/dns/providers.py +++ b/libcloud/dns/providers.py @@ -29,34 +29,31 @@ DRIVERS = { Provider.DUMMY: ("libcloud.dns.drivers.dummy", "DummyDNSDriver"), - Provider.LINODE: ("libcloud.dns.drivers.linode", "LinodeDNSDriver"), - Provider.ZERIGO: ("libcloud.dns.drivers.zerigo", "ZerigoDNSDriver"), - Provider.RACKSPACE: ("libcloud.dns.drivers.rackspace", "RackspaceDNSDriver"), - Provider.ROUTE53: ("libcloud.dns.drivers.route53", "Route53DNSDriver"), + Provider.AURORADNS: ("libcloud.dns.drivers.auroradns", "AuroraDNSDriver"), + Provider.BUDDYNS: ("libcloud.dns.drivers.buddyns", "BuddyNSDNSDriver"), + Provider.CLOUDFLARE: ("libcloud.dns.drivers.cloudflare", "CloudFlareDNSDriver"), + Provider.DIGITAL_OCEAN: ("libcloud.dns.drivers.digitalocean", "DigitalOceanDNSDriver"), + Provider.DNSIMPLE: ("libcloud.dns.drivers.dnsimple", "DNSimpleDNSDriver"), + Provider.DURABLEDNS: ("libcloud.dns.drivers.durabledns", "DurableDNSDriver"), Provider.GANDI: ("libcloud.dns.drivers.gandi", "GandiDNSDriver"), Provider.GANDI_LIVE: ("libcloud.dns.drivers.gandi_live", "GandiLiveDNSDriver"), + Provider.GODADDY: ("libcloud.dns.drivers.godaddy", "GoDaddyDNSDriver"), Provider.GOOGLE: ("libcloud.dns.drivers.google", "GoogleDNSDriver"), - Provider.DIGITAL_OCEAN: ( - "libcloud.dns.drivers.digitalocean", - "DigitalOceanDNSDriver", - ), - Provider.WORLDWIDEDNS: ("libcloud.dns.drivers.worldwidedns", "WorldWideDNSDriver"), - Provider.DNSIMPLE: ("libcloud.dns.drivers.dnsimple", "DNSimpleDNSDriver"), - Provider.POINTDNS: ("libcloud.dns.drivers.pointdns", "PointDNSDriver"), - Provider.VULTR: ("libcloud.dns.drivers.vultr", "VultrDNSDriver"), + Provider.LINODE: ("libcloud.dns.drivers.linode", "LinodeDNSDriver"), Provider.LIQUIDWEB: ("libcloud.dns.drivers.liquidweb", "LiquidWebDNSDriver"), - Provider.ZONOMI: ("libcloud.dns.drivers.zonomi", "ZonomiDNSDriver"), - Provider.DURABLEDNS: ("libcloud.dns.drivers.durabledns", "DurableDNSDriver"), - Provider.AURORADNS: ("libcloud.dns.drivers.auroradns", "AuroraDNSDriver"), - Provider.GODADDY: ("libcloud.dns.drivers.godaddy", "GoDaddyDNSDriver"), - Provider.CLOUDFLARE: ("libcloud.dns.drivers.cloudflare", "CloudFlareDNSDriver"), + Provider.LUADNS: ("libcloud.dns.drivers.luadns", "LuadnsDNSDriver"), Provider.NFSN: ("libcloud.dns.drivers.nfsn", "NFSNDNSDriver"), Provider.NSONE: ("libcloud.dns.drivers.nsone", "NsOneDNSDriver"), - Provider.LUADNS: ("libcloud.dns.drivers.luadns", "LuadnsDNSDriver"), - Provider.BUDDYNS: ("libcloud.dns.drivers.buddyns", "BuddyNSDNSDriver"), - Provider.POWERDNS: ("libcloud.dns.drivers.powerdns", "PowerDNSDriver"), Provider.ONAPP: ("libcloud.dns.drivers.onapp", "OnAppDNSDriver"), + Provider.POINTDNS: ("libcloud.dns.drivers.pointdns", "PointDNSDriver"), + Provider.POWERDNS: ("libcloud.dns.drivers.powerdns", "PowerDNSDriver"), + Provider.RACKSPACE: ("libcloud.dns.drivers.rackspace", "RackspaceDNSDriver"), Provider.RCODEZERO: ("libcloud.dns.drivers.rcodezero", "RcodeZeroDNSDriver"), + Provider.ROUTE53: ("libcloud.dns.drivers.route53", "Route53DNSDriver"), + Provider.VULTR: ("libcloud.dns.drivers.vultr", "VultrDNSDriver"), + Provider.WORLDWIDEDNS: ("libcloud.dns.drivers.worldwidedns", "WorldWideDNSDriver"), + Provider.ZERIGO: ("libcloud.dns.drivers.zerigo", "ZerigoDNSDriver"), + Provider.ZONOMI: ("libcloud.dns.drivers.zonomi", "ZonomiDNSDriver"), # Deprecated Provider.RACKSPACE_US: ("libcloud.dns.drivers.rackspace", "RackspaceUSDNSDriver"), Provider.RACKSPACE_UK: ("libcloud.dns.drivers.rackspace", "RackspaceUKDNSDriver"), diff --git a/libcloud/loadbalancer/drivers/dimensiondata.py b/libcloud/loadbalancer/drivers/dimensiondata.py deleted file mode 100644 index 997ffb4b9e..0000000000 --- a/libcloud/loadbalancer/drivers/dimensiondata.py +++ /dev/null @@ -1,1143 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance withv -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.utils.py3 import ET -from libcloud.utils.xml import findall, findtext, fixxpath -from libcloud.utils.misc import reverse_dict -from libcloud.loadbalancer.base import Driver, Member, Algorithm, LoadBalancer -from libcloud.loadbalancer.types import State, Provider -from libcloud.common.dimensiondata import ( - TYPES_URN, - API_ENDPOINTS, - DEFAULT_REGION, - DimensionDataPool, - DimensionDataVIPNode, - DimensionDataConnection, - DimensionDataPoolMember, - DimensionDataDefaultiRule, - DimensionDataVirtualListener, - DimensionDataPersistenceProfile, - DimensionDataDefaultHealthMonitor, - DimensionDataVirtualListenerCompatibility, -) - - -class DimensionDataLBDriver(Driver): - """ - DimensionData node driver. - """ - - selected_region = None - connectionCls = DimensionDataConnection - name = "Dimension Data Load Balancer" - website = "https://cloud.dimensiondata.com/" - type = Provider.DIMENSIONDATA - api_version = 1.0 - - network_domain_id = None - - _VALUE_TO_ALGORITHM_MAP = { - "ROUND_ROBIN": Algorithm.ROUND_ROBIN, - "LEAST_CONNECTIONS": Algorithm.LEAST_CONNECTIONS, - "SHORTEST_RESPONSE": Algorithm.SHORTEST_RESPONSE, - "PERSISTENT_IP": Algorithm.PERSISTENT_IP, - } - _ALGORITHM_TO_VALUE_MAP = reverse_dict(_VALUE_TO_ALGORITHM_MAP) - - _VALUE_TO_STATE_MAP = { - "NORMAL": State.RUNNING, - "PENDING_ADD": State.PENDING, - "PENDING_CHANGE": State.PENDING, - "PENDING_DELETE": State.PENDING, - "FAILED_ADD": State.ERROR, - "FAILED_CHANGE": State.ERROR, - "FAILED_DELETE": State.ERROR, - "REQUIRES_SUPPORT": State.ERROR, - } - - def __init__( - self, - key, - secret=None, - secure=True, - host=None, - port=None, - api_version=None, - region=DEFAULT_REGION, - **kwargs, - ): - if region not in API_ENDPOINTS and host is None: - raise ValueError("Invalid region: %s, no host specified" % (region)) - if region is not None: - self.selected_region = API_ENDPOINTS[region] - - super().__init__( - key=key, - secret=secret, - secure=secure, - host=host, - port=port, - api_version=api_version, - region=region, - **kwargs, - ) - - def _ex_connection_class_kwargs(self): - """ - Add the region to the kwargs before the connection is instantiated - """ - - kwargs = super()._ex_connection_class_kwargs() - kwargs["region"] = self.selected_region - return kwargs - - def create_balancer( - self, - name, - port=None, - protocol=None, - algorithm=None, - members=None, - ex_listener_ip_address=None, - ): - """ - Create a new load balancer instance - - :param name: Name of the new load balancer (required) - :type name: ``str`` - - :param port: An integer in the range of 1-65535. If not supplied, - it will be taken to mean 'Any Port' - :type port: ``int`` - - :param protocol: Loadbalancer protocol, defaults to http. - :type protocol: ``str`` - - :param members: list of Members to attach to balancer (optional) - :type members: ``list`` of :class:`Member` - - :param algorithm: Load balancing algorithm, defaults to ROUND_ROBIN. - :type algorithm: :class:`.Algorithm` - - :param ex_listener_ip_address: Must be a valid IPv4 in dot-decimal - notation (x.x.x.x). - :type ex_listener_ip_address: ``str`` - - :rtype: :class:`LoadBalancer` - """ - network_domain_id = self.network_domain_id - if protocol is None: - protocol = "http" - if algorithm is None: - algorithm = Algorithm.ROUND_ROBIN - - # Create a pool first - pool = self.ex_create_pool( - network_domain_id=network_domain_id, - name=name, - ex_description=None, - balancer_method=self._ALGORITHM_TO_VALUE_MAP[algorithm], - ) - - # Attach the members to the pool as nodes - if members is not None: - for member in members: - node = self.ex_create_node( - network_domain_id=network_domain_id, - name=member.ip, - ip=member.ip, - ex_description=None, - ) - self.ex_create_pool_member(pool=pool, node=node, port=port) - - # Create the virtual listener (balancer) - listener = self.ex_create_virtual_listener( - network_domain_id=network_domain_id, - name=name, - ex_description=name, - port=port, - pool=pool, - listener_ip_address=ex_listener_ip_address, - ) - - return LoadBalancer( - id=listener.id, - name=listener.name, - state=State.RUNNING, - ip=listener.ip, - port=port, - driver=self, - extra={ - "pool_id": pool.id, - "network_domain_id": network_domain_id, - "listener_ip_address": ex_listener_ip_address, - }, - ) - - def list_balancers(self, ex_network_domain_id=None): - """ - List all loadbalancers inside a geography or in given network. - - In Dimension Data terminology these are known as virtual listeners - - :param ex_network_domain_id: UUID of Network Domain - if not None returns only balancers in the given network - if None then returns all pools for the organization - :type ex_network_domain_id: ``str`` - - :rtype: ``list`` of :class:`LoadBalancer` - """ - params = None - if ex_network_domain_id is not None: - params = {"networkDomainId": ex_network_domain_id} - - return self._to_balancers( - self.connection.request_with_orgId_api_2( - "networkDomainVip/virtualListener", params=params - ).object - ) - - def get_balancer(self, balancer_id): - """ - Return a :class:`LoadBalancer` object. - - :param balancer_id: id of a load balancer you want to fetch - :type balancer_id: ``str`` - - :rtype: :class:`LoadBalancer` - """ - - bal = self.connection.request_with_orgId_api_2( - "networkDomainVip/virtualListener/%s" % balancer_id - ).object - return self._to_balancer(bal) - - def list_protocols(self): - """ - Return a list of supported protocols. - - Since all protocols are support by Dimension Data, this is a list - of common protocols. - - :rtype: ``list`` of ``str`` - """ - return ["http", "https", "tcp", "udp", "ftp", "smtp"] - - def balancer_list_members(self, balancer): - """ - Return list of members attached to balancer. - - In Dimension Data terminology these are the members of the pools - within a virtual listener. - - :param balancer: LoadBalancer which should be used - :type balancer: :class:`LoadBalancer` - - :rtype: ``list`` of :class:`Member` - """ - pool_members = self.ex_get_pool_members(balancer.extra["pool_id"]) - members = [] - for pool_member in pool_members: - members.append( - Member( - id=pool_member.id, - ip=pool_member.ip, - port=pool_member.port, - balancer=balancer, - extra=None, - ) - ) - return members - - def balancer_attach_member(self, balancer, member): - """ - Attach a member to balancer - - :param balancer: LoadBalancer which should be used - :type balancer: :class:`LoadBalancer` - - :param member: Member to join to the balancer - :type member: :class:`Member` - - :return: Member after joining the balancer. - :rtype: :class:`Member` - """ - node = self.ex_create_node( - network_domain_id=balancer.extra["network_domain_id"], - name="Member." + member.ip, - ip=member.ip, - ex_description="", - ) - if node is False: - return False - pool = self.ex_get_pool(balancer.extra["pool_id"]) - pool_member = self.ex_create_pool_member(pool=pool, node=node, port=member.port) - member.id = pool_member.id - return member - - def balancer_detach_member(self, balancer, member): - """ - Detach member from balancer - - :param balancer: LoadBalancer which should be used - :type balancer: :class:`LoadBalancer` - - :param member: Member which should be used - :type member: :class:`Member` - - :return: ``True`` if member detach was successful, otherwise ``False``. - :rtype: ``bool`` - """ - create_pool_m = ET.Element("removePoolMember", {"xmlns": TYPES_URN, "id": member.id}) - - result = self.connection.request_with_orgId_api_2( - "networkDomainVip/removePoolMember", - method="POST", - data=ET.tostring(create_pool_m), - ).object - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def destroy_balancer(self, balancer): - """ - Destroy a load balancer (virtual listener) - - :param balancer: LoadBalancer which should be used - :type balancer: :class:`LoadBalancer` - - :return: ``True`` if the destroy was successful, otherwise ``False``. - :rtype: ``bool`` - """ - delete_listener = ET.Element( - "deleteVirtualListener", {"xmlns": TYPES_URN, "id": balancer.id} - ) - - result = self.connection.request_with_orgId_api_2( - "networkDomainVip/deleteVirtualListener", - method="POST", - data=ET.tostring(delete_listener), - ).object - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_set_current_network_domain(self, network_domain_id): - """ - Set the network domain (part of the network) of the driver - - :param network_domain_id: ID of the pool (required) - :type network_domain_id: ``str`` - """ - self.network_domain_id = network_domain_id - - def ex_get_current_network_domain(self): - """ - Get the current network domain ID of the driver. - - :return: ID of the network domain - :rtype: ``str`` - """ - return self.network_domain_id - - def ex_create_pool_member(self, pool, node, port=None): - """ - Create a new member in an existing pool from an existing node - - :param pool: Instance of ``DimensionDataPool`` (required) - :type pool: ``DimensionDataPool`` - - :param node: Instance of ``DimensionDataVIPNode`` (required) - :type node: ``DimensionDataVIPNode`` - - :param port: Port the the service will listen on - :type port: ``str`` - - :return: The node member, instance of ``DimensionDataPoolMember`` - :rtype: ``DimensionDataPoolMember`` - """ - create_pool_m = ET.Element("addPoolMember", {"xmlns": TYPES_URN}) - ET.SubElement(create_pool_m, "poolId").text = pool.id - ET.SubElement(create_pool_m, "nodeId").text = node.id - if port is not None: - ET.SubElement(create_pool_m, "port").text = str(port) - ET.SubElement(create_pool_m, "status").text = "ENABLED" - - response = self.connection.request_with_orgId_api_2( - "networkDomainVip/addPoolMember", - method="POST", - data=ET.tostring(create_pool_m), - ).object - - member_id = None - node_name = None - for info in findall(response, "info", TYPES_URN): - if info.get("name") == "poolMemberId": - member_id = info.get("value") - if info.get("name") == "nodeName": - node_name = info.get("value") - - return DimensionDataPoolMember( - id=member_id, - name=node_name, - status=State.RUNNING, - ip=node.ip, - port=port, - node_id=node.id, - ) - - def ex_create_node( - self, - network_domain_id, - name, - ip, - ex_description, - connection_limit=25000, - connection_rate_limit=2000, - ): - """ - Create a new node - - :param network_domain_id: Network Domain ID (required) - :type name: ``str`` - - :param name: name of the node (required) - :type name: ``str`` - - :param ip: IPv4 address of the node (required) - :type ip: ``str`` - - :param ex_description: Description of the node (required) - :type ex_description: ``str`` - - :param connection_limit: Maximum number - of concurrent connections per sec - :type connection_limit: ``int`` - - :param connection_rate_limit: Maximum number of concurrent sessions - :type connection_rate_limit: ``int`` - - :return: Instance of ``DimensionDataVIPNode`` - :rtype: ``DimensionDataVIPNode`` - """ - create_node_elm = ET.Element("createNode", {"xmlns": TYPES_URN}) - ET.SubElement(create_node_elm, "networkDomainId").text = network_domain_id - ET.SubElement(create_node_elm, "name").text = name - ET.SubElement(create_node_elm, "description").text = str(ex_description) - ET.SubElement(create_node_elm, "ipv4Address").text = ip - ET.SubElement(create_node_elm, "status").text = "ENABLED" - ET.SubElement(create_node_elm, "connectionLimit").text = str(connection_limit) - ET.SubElement(create_node_elm, "connectionRateLimit").text = str(connection_rate_limit) - - response = self.connection.request_with_orgId_api_2( - action="networkDomainVip/createNode", - method="POST", - data=ET.tostring(create_node_elm), - ).object - - node_id = None - node_name = None - for info in findall(response, "info", TYPES_URN): - if info.get("name") == "nodeId": - node_id = info.get("value") - if info.get("name") == "name": - node_name = info.get("value") - return DimensionDataVIPNode(id=node_id, name=node_name, status=State.RUNNING, ip=ip) - - def ex_update_node(self, node): - """ - Update the properties of a node - - :param pool: The instance of ``DimensionDataNode`` to update - :type pool: ``DimensionDataNode`` - - :return: The instance of ``DimensionDataNode`` - :rtype: ``DimensionDataNode`` - """ - create_node_elm = ET.Element("editNode", {"xmlns": TYPES_URN}) - ET.SubElement(create_node_elm, "connectionLimit").text = str(node.connection_limit) - ET.SubElement(create_node_elm, "connectionRateLimit").text = str(node.connection_rate_limit) - - self.connection.request_with_orgId_api_2( - action="networkDomainVip/createNode", - method="POST", - data=ET.tostring(create_node_elm), - ).object - return node - - def ex_set_node_state(self, node, enabled): - """ - Change the state of a node (enable/disable) - - :param pool: The instance of ``DimensionDataNode`` to update - :type pool: ``DimensionDataNode`` - - :param enabled: The target state of the node - :type enabled: ``bool`` - - :return: The instance of ``DimensionDataNode`` - :rtype: ``DimensionDataNode`` - """ - create_node_elm = ET.Element("editNode", {"xmlns": TYPES_URN}) - ET.SubElement(create_node_elm, "status").text = "ENABLED" if enabled is True else "DISABLED" - - self.connection.request_with_orgId_api_2( - action="networkDomainVip/editNode", - method="POST", - data=ET.tostring(create_node_elm), - ).object - return node - - def ex_create_pool( - self, - network_domain_id, - name, - balancer_method, - ex_description, - health_monitors=None, - service_down_action="NONE", - slow_ramp_time=30, - ): - """ - Create a new pool - - :param network_domain_id: Network Domain ID (required) - :type name: ``str`` - - :param name: name of the node (required) - :type name: ``str`` - - :param balancer_method: The load balancer algorithm (required) - :type balancer_method: ``str`` - - :param ex_description: Description of the node (required) - :type ex_description: ``str`` - - :param health_monitors: A list of health monitors to use for the pool. - :type health_monitors: ``list`` of - :class:`DimensionDataDefaultHealthMonitor` - - :param service_down_action: What to do when node - is unavailable NONE, DROP or RESELECT - :type service_down_action: ``str`` - - :param slow_ramp_time: Number of seconds to stagger ramp up of nodes - :type slow_ramp_time: ``int`` - - :return: Instance of ``DimensionDataPool`` - :rtype: ``DimensionDataPool`` - """ - # Names cannot contain spaces. - name.replace(" ", "_") - create_node_elm = ET.Element("createPool", {"xmlns": TYPES_URN}) - ET.SubElement(create_node_elm, "networkDomainId").text = network_domain_id - ET.SubElement(create_node_elm, "name").text = name - ET.SubElement(create_node_elm, "description").text = str(ex_description) - ET.SubElement(create_node_elm, "loadBalanceMethod").text = str(balancer_method) - - if health_monitors is not None: - for monitor in health_monitors: - ET.SubElement(create_node_elm, "healthMonitorId").text = str(monitor.id) - - ET.SubElement(create_node_elm, "serviceDownAction").text = service_down_action - ET.SubElement(create_node_elm, "slowRampTime").text = str(slow_ramp_time) - - response = self.connection.request_with_orgId_api_2( - action="networkDomainVip/createPool", - method="POST", - data=ET.tostring(create_node_elm), - ).object - - pool_id = None - for info in findall(response, "info", TYPES_URN): - if info.get("name") == "poolId": - pool_id = info.get("value") - - return DimensionDataPool( - id=pool_id, - name=name, - description=ex_description, - status=State.RUNNING, - load_balance_method=str(balancer_method), - health_monitor_id=None, - service_down_action=service_down_action, - slow_ramp_time=str(slow_ramp_time), - ) - - def ex_create_virtual_listener( - self, - network_domain_id, - name, - ex_description, - port=None, - pool=None, - listener_ip_address=None, - persistence_profile=None, - fallback_persistence_profile=None, - irule=None, - protocol="TCP", - connection_limit=25000, - connection_rate_limit=2000, - source_port_preservation="PRESERVE", - ): - """ - Create a new virtual listener (load balancer) - - :param network_domain_id: Network Domain ID (required) - :type name: ``str`` - - :param name: name of the listener (required) - :type name: ``str`` - - :param ex_description: Description of the node (required) - :type ex_description: ``str`` - - :param port: An integer in the range of 1-65535. If not supplied, - it will be taken to mean 'Any Port' - :type port: ``int`` - - :param pool: The pool to use for the listener - :type pool: :class:`DimensionDataPool` - - :param listener_ip_address: The IPv4 Address of the virtual listener - :type listener_ip_address: ``str`` - - :param persistence_profile: Persistence profile - :type persistence_profile: :class:`DimensionDataPersistenceProfile` - - :param fallback_persistence_profile: Fallback persistence profile - :type fallback_persistence_profile: - :class:`DimensionDataPersistenceProfile` - - :param irule: The iRule to apply - :type irule: :class:`DimensionDataDefaultiRule` - - :param protocol: For STANDARD type, ANY, TCP or UDP - for PERFORMANCE_LAYER_4 choice of ANY, TCP, UDP, HTTP - :type protocol: ``str`` - - :param connection_limit: Maximum number - of concurrent connections per sec - :type connection_limit: ``int`` - - :param connection_rate_limit: Maximum number of concurrent sessions - :type connection_rate_limit: ``int`` - - :param source_port_preservation: Choice of PRESERVE, - PRESERVE_STRICT or CHANGE - :type source_port_preservation: ``str`` - - :return: Instance of the listener - :rtype: ``DimensionDataVirtualListener`` - """ - if (port == 80) or (port == 443): - listener_type = "PERFORMANCE_LAYER_4" - else: - listener_type = "STANDARD" - - create_node_elm = ET.Element("createVirtualListener", {"xmlns": TYPES_URN}) - ET.SubElement(create_node_elm, "networkDomainId").text = network_domain_id - ET.SubElement(create_node_elm, "name").text = name - ET.SubElement(create_node_elm, "description").text = str(ex_description) - ET.SubElement(create_node_elm, "type").text = listener_type - ET.SubElement(create_node_elm, "protocol").text = protocol - if listener_ip_address is not None: - ET.SubElement(create_node_elm, "listenerIpAddress").text = str(listener_ip_address) - if port is not None: - ET.SubElement(create_node_elm, "port").text = str(port) - ET.SubElement(create_node_elm, "enabled").text = "true" - ET.SubElement(create_node_elm, "connectionLimit").text = str(connection_limit) - ET.SubElement(create_node_elm, "connectionRateLimit").text = str(connection_rate_limit) - ET.SubElement(create_node_elm, "sourcePortPreservation").text = source_port_preservation - if pool is not None: - ET.SubElement(create_node_elm, "poolId").text = pool.id - if persistence_profile is not None: - ET.SubElement(create_node_elm, "persistenceProfileId").text = persistence_profile.id - if fallback_persistence_profile is not None: - ET.SubElement(create_node_elm, "fallbackPersistenceProfileId").text = ( - fallback_persistence_profile.id - ) - if irule is not None: - ET.SubElement(create_node_elm, "iruleId").text = irule.id - - response = self.connection.request_with_orgId_api_2( - action="networkDomainVip/createVirtualListener", - method="POST", - data=ET.tostring(create_node_elm), - ).object - - virtual_listener_id = None - virtual_listener_ip = None - for info in findall(response, "info", TYPES_URN): - if info.get("name") == "virtualListenerId": - virtual_listener_id = info.get("value") - if info.get("name") == "listenerIpAddress": - virtual_listener_ip = info.get("value") - - return DimensionDataVirtualListener( - id=virtual_listener_id, - name=name, - ip=virtual_listener_ip, - status=State.RUNNING, - ) - - def ex_get_pools(self, ex_network_domain_id=None): - """ - Get all of the pools inside the current geography or - in given network. - - :param ex_network_domain_id: UUID of Network Domain - if not None returns only balancers in the given network - if None then returns all pools for the organization - :type ex_network_domain_id: ``str`` - - :return: Returns a ``list`` of type ``DimensionDataPool`` - :rtype: ``list`` of ``DimensionDataPool`` - """ - params = None - - if ex_network_domain_id is not None: - params = {"networkDomainId": ex_network_domain_id} - - pools = self.connection.request_with_orgId_api_2( - "networkDomainVip/pool", params=params - ).object - - return self._to_pools(pools) - - def ex_get_pool(self, pool_id): - """ - Get a specific pool inside the current geography - - :param pool_id: The identifier of the pool - :type pool_id: ``str`` - - :return: Returns an instance of ``DimensionDataPool`` - :rtype: ``DimensionDataPool`` - """ - pool = self.connection.request_with_orgId_api_2("networkDomainVip/pool/%s" % pool_id).object - return self._to_pool(pool) - - def ex_update_pool(self, pool): - """ - Update the properties of an existing pool - only method, serviceDownAction and slowRampTime are updated - - :param pool: The instance of ``DimensionDataPool`` to update - :type pool: ``DimensionDataPool`` - - :return: ``True`` for success, ``False`` for failure - :rtype: ``bool`` - """ - create_node_elm = ET.Element("editPool", {"xmlns": TYPES_URN}) - - ET.SubElement(create_node_elm, "loadBalanceMethod").text = str(pool.load_balance_method) - ET.SubElement(create_node_elm, "serviceDownAction").text = pool.service_down_action - ET.SubElement(create_node_elm, "slowRampTime").text = str(pool.slow_ramp_time) - - response = self.connection.request_with_orgId_api_2( - action="networkDomainVip/editPool", - method="POST", - data=ET.tostring(create_node_elm), - ).object - response_code = findtext(response, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_destroy_pool(self, pool): - """ - Destroy an existing pool - - :param pool: The instance of ``DimensionDataPool`` to destroy - :type pool: ``DimensionDataPool`` - - :return: ``True`` for success, ``False`` for failure - :rtype: ``bool`` - """ - destroy_request = ET.Element("deletePool", {"xmlns": TYPES_URN, "id": pool.id}) - - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/deletePool", - method="POST", - data=ET.tostring(destroy_request), - ).object - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_get_pool_members(self, pool_id): - """ - Get the members of a pool - - :param pool: The instance of a pool - :type pool: ``DimensionDataPool`` - - :return: Returns an ``list`` of ``DimensionDataPoolMember`` - :rtype: ``list`` of ``DimensionDataPoolMember`` - """ - members = self.connection.request_with_orgId_api_2( - "networkDomainVip/poolMember?poolId=%s" % pool_id - ).object - return self._to_members(members) - - def ex_get_pool_member(self, pool_member_id): - """ - Get a specific member of a pool - - :param pool: The id of a pool member - :type pool: ``str`` - - :return: Returns an instance of ``DimensionDataPoolMember`` - :rtype: ``DimensionDataPoolMember`` - """ - member = self.connection.request_with_orgId_api_2( - "networkDomainVip/poolMember/%s" % pool_member_id - ).object - return self._to_member(member) - - def ex_set_pool_member_state(self, member, enabled=True): - request = ET.Element("editPoolMember", {"xmlns": TYPES_URN, "id": member.id}) - state = "ENABLED" if enabled is True else "DISABLED" - ET.SubElement(request, "status").text = state - - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/editPoolMember", - method="POST", - data=ET.tostring(request), - ).object - - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_destroy_pool_member(self, member, destroy_node=False): - """ - Destroy a specific member of a pool - - :param pool: The instance of a pool member - :type pool: ``DimensionDataPoolMember`` - - :param destroy_node: Also destroy the associated node - :type destroy_node: ``bool`` - - :return: ``True`` for success, ``False`` for failure - :rtype: ``bool`` - """ - # remove the pool member - destroy_request = ET.Element("removePoolMember", {"xmlns": TYPES_URN, "id": member.id}) - - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/removePoolMember", - method="POST", - data=ET.tostring(destroy_request), - ).object - - if member.node_id is not None and destroy_node is True: - return self.ex_destroy_node(member.node_id) - else: - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_get_nodes(self, ex_network_domain_id=None): - """ - Get the nodes within this geography or in given network. - - :param ex_network_domain_id: UUID of Network Domain - if not None returns only balancers in the given network - if None then returns all pools for the organization - :type ex_network_domain_id: ``str`` - - :return: Returns an ``list`` of ``DimensionDataVIPNode`` - :rtype: ``list`` of ``DimensionDataVIPNode`` - """ - params = None - if ex_network_domain_id is not None: - params = {"networkDomainId": ex_network_domain_id} - - nodes = self.connection.request_with_orgId_api_2( - "networkDomainVip/node", params=params - ).object - return self._to_nodes(nodes) - - def ex_get_node(self, node_id): - """ - Get the node specified by node_id - - :return: Returns an instance of ``DimensionDataVIPNode`` - :rtype: Instance of ``DimensionDataVIPNode`` - """ - nodes = self.connection.request_with_orgId_api_2( - "networkDomainVip/node/%s" % node_id - ).object - return self._to_node(nodes) - - def ex_destroy_node(self, node_id): - """ - Destroy a specific node - - :param node_id: The ID of of a ``DimensionDataVIPNode`` - :type node_id: ``str`` - - :return: ``True`` for success, ``False`` for failure - :rtype: ``bool`` - """ - # Destroy the node - destroy_request = ET.Element("deleteNode", {"xmlns": TYPES_URN, "id": node_id}) - - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/deleteNode", - method="POST", - data=ET.tostring(destroy_request), - ).object - response_code = findtext(result, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def ex_wait_for_state(self, state, func, poll_interval=2, timeout=60, *args, **kwargs): - """ - Wait for the function which returns a instance - with field status to match - - Keep polling func until one of the desired states is matched - - :param state: Either the desired state (`str`) or a `list` of states - :type state: ``str`` or ``list`` - - :param func: The function to call, e.g. ex_get_vlan - :type func: ``function`` - - :param poll_interval: The number of seconds to wait between checks - :type poll_interval: `int` - - :param timeout: The total number of seconds to wait to reach a state - :type timeout: `int` - - :param args: The arguments for func - :type args: Positional arguments - - :param kwargs: The arguments for func - :type kwargs: Keyword arguments - """ - return self.connection.wait_for_state(state, func, poll_interval, timeout, *args, **kwargs) - - def ex_get_default_health_monitors(self, network_domain_id): - """ - Get the default health monitors available for a network domain - - :param network_domain_id: The ID of of a ``DimensionDataNetworkDomain`` - :type network_domain_id: ``str`` - - :rtype: `list` of :class:`DimensionDataDefaultHealthMonitor` - """ - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/defaultHealthMonitor", - params={"networkDomainId": network_domain_id}, - method="GET", - ).object - return self._to_health_monitors(result) - - def ex_get_default_persistence_profiles(self, network_domain_id): - """ - Get the default persistence profiles available for a network domain - - :param network_domain_id: The ID of of a ``DimensionDataNetworkDomain`` - :type network_domain_id: ``str`` - - :rtype: `list` of :class:`DimensionDataPersistenceProfile` - """ - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/defaultPersistenceProfile", - params={"networkDomainId": network_domain_id}, - method="GET", - ).object - return self._to_persistence_profiles(result) - - def ex_get_default_irules(self, network_domain_id): - """ - Get the default iRules available for a network domain - - :param network_domain_id: The ID of of a ``DimensionDataNetworkDomain`` - :type network_domain_id: ``str`` - - :rtype: `list` of :class:`DimensionDataDefaultiRule` - """ - result = self.connection.request_with_orgId_api_2( - action="networkDomainVip/defaultIrule", - params={"networkDomainId": network_domain_id}, - method="GET", - ).object - return self._to_irules(result) - - def _to_irules(self, object): - irules = [] - matches = object.findall(fixxpath("defaultIrule", TYPES_URN)) - for element in matches: - irules.append(self._to_irule(element)) - return irules - - def _to_irule(self, element): - compatible = [] - matches = element.findall(fixxpath("virtualListenerCompatibility", TYPES_URN)) - for match_element in matches: - compatible.append( - DimensionDataVirtualListenerCompatibility( - type=match_element.get("type"), - protocol=match_element.get("protocol", None), - ) - ) - irule_element = element.find(fixxpath("irule", TYPES_URN)) - return DimensionDataDefaultiRule( - id=irule_element.get("id"), - name=irule_element.get("name"), - compatible_listeners=compatible, - ) - - def _to_persistence_profiles(self, object): - profiles = [] - matches = object.findall(fixxpath("defaultPersistenceProfile", TYPES_URN)) - for element in matches: - profiles.append(self._to_persistence_profile(element)) - return profiles - - def _to_persistence_profile(self, element): - compatible = [] - matches = element.findall(fixxpath("virtualListenerCompatibility", TYPES_URN)) - for match_element in matches: - compatible.append( - DimensionDataVirtualListenerCompatibility( - type=match_element.get("type"), - protocol=match_element.get("protocol", None), - ) - ) - - return DimensionDataPersistenceProfile( - id=element.get("id"), - fallback_compatible=bool(element.get("fallbackCompatible") == "true"), - name=findtext(element, "name", TYPES_URN), - compatible_listeners=compatible, - ) - - def _to_health_monitors(self, object): - monitors = [] - matches = object.findall(fixxpath("defaultHealthMonitor", TYPES_URN)) - for element in matches: - monitors.append(self._to_health_monitor(element)) - return monitors - - def _to_health_monitor(self, element): - return DimensionDataDefaultHealthMonitor( - id=element.get("id"), - name=findtext(element, "name", TYPES_URN), - node_compatible=bool(findtext(element, "nodeCompatible", TYPES_URN) == "true"), - pool_compatible=bool(findtext(element, "poolCompatible", TYPES_URN) == "true"), - ) - - def _to_nodes(self, object): - nodes = [] - for element in object.findall(fixxpath("node", TYPES_URN)): - nodes.append(self._to_node(element)) - - return nodes - - def _to_node(self, element): - ipaddress = findtext(element, "ipv4Address", TYPES_URN) - if ipaddress is None: - ipaddress = findtext(element, "ipv6Address", TYPES_URN) - - name = findtext(element, "name", TYPES_URN) - - node = DimensionDataVIPNode( - id=element.get("id"), - name=name, - status=self._VALUE_TO_STATE_MAP.get( - findtext(element, "state", TYPES_URN), State.UNKNOWN - ), - connection_rate_limit=findtext(element, "connectionRateLimit", TYPES_URN), - connection_limit=findtext(element, "connectionLimit", TYPES_URN), - ip=ipaddress, - ) - - return node - - def _to_balancers(self, object): - loadbalancers = [] - for element in object.findall(fixxpath("virtualListener", TYPES_URN)): - loadbalancers.append(self._to_balancer(element)) - - return loadbalancers - - def _to_balancer(self, element): - ipaddress = findtext(element, "listenerIpAddress", TYPES_URN) - name = findtext(element, "name", TYPES_URN) - port = findtext(element, "port", TYPES_URN) - extra = {} - - pool_element = element.find(fixxpath("pool", TYPES_URN)) - if pool_element is None: - extra["pool_id"] = None - - else: - extra["pool_id"] = pool_element.get("id") - - extra["network_domain_id"] = findtext(element, "networkDomainId", TYPES_URN) - - balancer = LoadBalancer( - id=element.get("id"), - name=name, - state=self._VALUE_TO_STATE_MAP.get( - findtext(element, "state", TYPES_URN), State.UNKNOWN - ), - ip=ipaddress, - port=port, - driver=self.connection.driver, - extra=extra, - ) - - return balancer - - def _to_members(self, object): - members = [] - for element in object.findall(fixxpath("poolMember", TYPES_URN)): - members.append(self._to_member(element)) - - return members - - def _to_member(self, element): - port = findtext(element, "port", TYPES_URN) - if port is not None: - port = int(port) - pool_member = DimensionDataPoolMember( - id=element.get("id"), - name=element.find(fixxpath("node", TYPES_URN)).get("name"), - status=findtext(element, "state", TYPES_URN), - node_id=element.find(fixxpath("node", TYPES_URN)).get("id"), - ip=element.find(fixxpath("node", TYPES_URN)).get("ipAddress"), - port=port, - ) - return pool_member - - def _to_pools(self, object): - pools = [] - for element in object.findall(fixxpath("pool", TYPES_URN)): - pools.append(self._to_pool(element)) - - return pools - - def _to_pool(self, element): - pool = DimensionDataPool( - id=element.get("id"), - name=findtext(element, "name", TYPES_URN), - status=findtext(element, "state", TYPES_URN), - description=findtext(element, "description", TYPES_URN), - load_balance_method=findtext(element, "loadBalanceMethod", TYPES_URN), - health_monitor_id=findtext(element, "healthMonitorId", TYPES_URN), - service_down_action=findtext(element, "serviceDownAction", TYPES_URN), - slow_ramp_time=findtext(element, "slowRampTime", TYPES_URN), - ) - return pool diff --git a/libcloud/loadbalancer/providers.py b/libcloud/loadbalancer/providers.py index c88f59c5e8..cb42630e45 100644 --- a/libcloud/loadbalancer/providers.py +++ b/libcloud/loadbalancer/providers.py @@ -40,10 +40,6 @@ "CloudStackLBDriver", ), Provider.GCE: ("libcloud.loadbalancer.drivers.gce", "GCELBDriver"), - Provider.DIMENSIONDATA: ( - "libcloud.loadbalancer.drivers.dimensiondata", - "DimensionDataLBDriver", - ), Provider.ALIYUN_SLB: ("libcloud.loadbalancer.drivers.slb", "SLBDriver"), Provider.NTTCIS: ("libcloud.loadbalancer.drivers.nttcis", "NttCisLBDriver"), } diff --git a/libcloud/loadbalancer/types.py b/libcloud/loadbalancer/types.py index e8b46b2720..4508af11f1 100644 --- a/libcloud/loadbalancer/types.py +++ b/libcloud/loadbalancer/types.py @@ -46,7 +46,6 @@ class Provider: ALIYUN_SLB = "aliyun_slb" BRIGHTBOX = "brightbox" CLOUDSTACK = "cloudstack" - DIMENSIONDATA = "dimensiondata" ELB = "elb" GCE = "gce" NINEFOLD = "ninefold" diff --git a/libcloud/storage/types.py b/libcloud/storage/types.py index 41d524f99d..f5d6a60317 100644 --- a/libcloud/storage/types.py +++ b/libcloud/storage/types.py @@ -50,26 +50,26 @@ class Provider: :cvar NINEFOLD: Ninefold :cvar OPENSTACK_SWIFT: OpenStack Swift driver :cvar S3: Amazon S3 US - :cvar S3_AP_NORTHEAST: Amazon S3 Asia North East (Tokyo) :cvar S3_AP_NORTHEAST1: Amazon S3 Asia North East (Tokyo) :cvar S3_AP_NORTHEAST2: Amazon S3 Asia North East (Seoul) + :cvar S3_AP_NORTHEAST: Amazon S3 Asia North East (Tokyo) :cvar S3_AP_SOUTH: Amazon S3 Asia South (Mumbai) - :cvar S3_AP_SOUTHEAST: Amazon S3 Asia South East (Singapore) :cvar S3_AP_SOUTHEAST2: Amazon S3 Asia South East 2 (Sydney) + :cvar S3_AP_SOUTHEAST: Amazon S3 Asia South East (Singapore) :cvar S3_CA_CENTRAL: Amazon S3 Canada (Central) :cvar S3_CN_NORTH: Amazon S3 CN North (Beijing) - :cvar S3_EU_WEST: Amazon S3 EU West (Ireland) - :cvar S3_EU_WEST2: Amazon S3 EU West 2 (London) - :cvar S3_EU_WEST3: Amazon S3 EU West 3 (Paris) :cvar S3_EU_CENTRAL: Amazon S3 EU Central (Frankfurt) :cvar S3_EU_NORTH1: Amazon S3 EU North 1 (Stockholm) + :cvar S3_EU_WEST2: Amazon S3 EU West 2 (London) + :cvar S3_EU_WEST3: Amazon S3 EU West 3 (Paris) + :cvar S3_EU_WEST: Amazon S3 EU West (Ireland) + :cvar S3_RGW: S3 RGW + :cvar S3_RGW_OUTSCALE: OUTSCALE S3 RGW :cvar S3_SA_EAST: Amazon S3 South America East (Sao Paulo) :cvar S3_US_EAST2: Amazon S3 US East 2 (Ohio) + :cvar S3_US_GOV_WEST: Amazon S3 GovCloud (US) :cvar S3_US_WEST: Amazon S3 US West (Northern California) :cvar S3_US_WEST_OREGON: Amazon S3 US West 2 (Oregon) - :cvar S3_US_GOV_WEST: Amazon S3 GovCloud (US) - :cvar S3_RGW: S3 RGW - :cvar S3_RGW_OUTSCALE: OUTSCALE S3 RGW """ DUMMY = "dummy" @@ -82,9 +82,11 @@ class Provider: GOOGLE_STORAGE = "google_storage" KTUCLOUD = "ktucloud" LOCAL = "local" + MINIO = "minio" NIMBUS = "nimbus" NINEFOLD = "ninefold" OPENSTACK_SWIFT = "openstack_swift" + OVH = "ovh" S3 = "s3" S3_AP_NORTHEAST = "s3_ap_northeast" S3_AP_NORTHEAST1 = "s3_ap_northeast_1" @@ -95,21 +97,19 @@ class Provider: S3_CA_CENTRAL = "s3_ca_central" S3_CN_NORTH = "s3_cn_north" S3_CN_NORTHWEST = "s3_cn_northwest" + S3_EU_CENTRAL = "s3_eu_central" + S3_EU_NORTH1 = "s3_eu_north_1" S3_EU_WEST = "s3_eu_west" S3_EU_WEST2 = "s3_eu_west_2" S3_EU_WEST3 = "s3_eu_west_3" - S3_EU_CENTRAL = "s3_eu_central" - S3_EU_NORTH1 = "s3_eu_north_1" + S3_RGW = "s3_rgw" + S3_RGW_OUTSCALE = "s3_rgw_outscale" S3_SA_EAST = "s3_sa_east" S3_US_EAST2 = "s3_us_east_2" + S3_US_GOV_WEST = "s3_us_gov_west" S3_US_WEST = "s3_us_west" S3_US_WEST_OREGON = "s3_us_west_oregon" - S3_US_GOV_WEST = "s3_us_gov_west" - S3_RGW = "s3_rgw" - S3_RGW_OUTSCALE = "s3_rgw_outscale" - MINIO = "minio" SCALEWAY = "scaleway" - OVH = "ovh" # Deprecated CLOUDFILES_US = "cloudfiles_us" diff --git a/libcloud/test/backup/test_dimensiondata_v2_3.py b/libcloud/test/backup/test_dimensiondata_v2_3.py deleted file mode 100644 index 46110ed7d7..0000000000 --- a/libcloud/test/backup/test_dimensiondata_v2_3.py +++ /dev/null @@ -1,530 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sys - -from libcloud.test import MockHttp, unittest -from libcloud.utils.py3 import ET, httplib -from libcloud.backup.base import BackupTargetJob -from libcloud.common.types import InvalidCredsError -from libcloud.test.secrets import DIMENSIONDATA_PARAMS -from libcloud.test.file_fixtures import BackupFileFixtures -from libcloud.common.dimensiondata import DimensionDataAPIException -from libcloud.backup.drivers.dimensiondata import DEFAULT_BACKUP_PLAN -from libcloud.backup.drivers.dimensiondata import DimensionDataBackupDriver as DimensionData - - -class DimensionData_v2_3_Tests(unittest.TestCase): - def setUp(self): - DimensionData.connectionCls.active_api_version = "2.3" - DimensionData.connectionCls.conn_class = DimensionDataMockHttp - DimensionDataMockHttp.type = None - self.driver = DimensionData(*DIMENSIONDATA_PARAMS) - - def test_invalid_region(self): - with self.assertRaises(ValueError): - self.driver = DimensionData(*DIMENSIONDATA_PARAMS, region="blah") - - def test_invalid_creds(self): - DimensionDataMockHttp.type = "UNAUTHORIZED" - with self.assertRaises(InvalidCredsError): - self.driver.list_targets() - - def test_list_targets(self): - targets = self.driver.list_targets() - self.assertEqual(len(targets), 2) - self.assertEqual(targets[0].id, "5579f3a7-4c32-4cf5-8a7e-b45c36a35c10") - self.assertEqual(targets[0].address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(targets[0].extra["servicePlan"], "Enterprise") - - def test_create_target(self): - target = self.driver.create_target( - "name", - "e75ead52-692f-4314-8725-c8a4f4d13a87", - extra={"servicePlan": "Enterprise"}, - ) - self.assertEqual(target.id, "ee7c4b64-f7af-4a4f-8384-be362273530f") - self.assertEqual(target.address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(target.extra["servicePlan"], "Enterprise") - - def test_create_target_DEFAULT(self): - DimensionDataMockHttp.type = "DEFAULT" - target = self.driver.create_target("name", "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(target.id, "ee7c4b64-f7af-4a4f-8384-be362273530f") - self.assertEqual(target.address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - - def test_create_target_EXISTS(self): - DimensionDataMockHttp.type = "EXISTS" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.create_target( - "name", - "e75ead52-692f-4314-8725-c8a4f4d13a87", - extra={"servicePlan": "Enterprise"}, - ) - self.assertEqual(context.exception.code, "ERROR") - self.assertEqual( - context.exception.msg, - "Cloud backup for this server is already enabled or being enabled (state: NORMAL).", - ) - - def test_update_target(self): - target = self.driver.list_targets()[0] - extra = {"servicePlan": "Essentials"} - new_target = self.driver.update_target(target, extra=extra) - self.assertEqual(new_target.extra["servicePlan"], "Essentials") - - def test_update_target_DEFAULT(self): - DimensionDataMockHttp.type = "DEFAULT" - target = "e75ead52-692f-4314-8725-c8a4f4d13a87" - self.driver.update_target(target) - - def test_update_target_STR(self): - target = "e75ead52-692f-4314-8725-c8a4f4d13a87" - extra = {"servicePlan": "Essentials"} - new_target = self.driver.update_target(target, extra=extra) - self.assertEqual(new_target.extra["servicePlan"], "Essentials") - - def test_delete_target(self): - target = self.driver.list_targets()[0] - self.assertTrue(self.driver.delete_target(target)) - - def test_ex_add_client_to_target(self): - target = self.driver.list_targets()[0] - client = self.driver.ex_list_available_client_types(target)[0] - storage_policy = self.driver.ex_list_available_storage_policies(target)[0] - schedule_policy = self.driver.ex_list_available_schedule_policies(target)[0] - self.assertTrue( - self.driver.ex_add_client_to_target( - target, - client, - storage_policy, - schedule_policy, - "ON_FAILURE", - "nobody@example.com", - ) - ) - - def test_ex_add_client_to_target_STR(self): - self.assertTrue( - self.driver.ex_add_client_to_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "FA.Linux", - "14 Day Storage Policy", - "12AM - 6AM", - "ON_FAILURE", - "nobody@example.com", - ) - ) - - def test_ex_get_backup_details_for_target(self): - target = self.driver.list_targets()[0] - response = self.driver.ex_get_backup_details_for_target(target) - self.assertEqual(response.service_plan, "Enterprise") - client = response.clients[0] - self.assertEqual(client.id, "30b1ff76-c76d-4d7c-b39d-3b72be0384c8") - self.assertEqual(client.type.type, "FA.Linux") - self.assertEqual(client.running_job.progress, 5) - self.assertTrue(isinstance(client.running_job, BackupTargetJob)) - self.assertEqual(len(client.alert.notify_list), 2) - self.assertTrue(isinstance(client.alert.notify_list, list)) - - def test_ex_get_backup_details_for_target_NOBACKUP(self): - target = self.driver.list_targets()[0].address - DimensionDataMockHttp.type = "NOBACKUP" - response = self.driver.ex_get_backup_details_for_target(target) - self.assertTrue(response is None) - - def test_ex_cancel_target_job(self): - target = self.driver.list_targets()[0] - response = self.driver.ex_get_backup_details_for_target(target) - client = response.clients[0] - self.assertTrue(isinstance(client.running_job, BackupTargetJob)) - success = client.running_job.cancel() - self.assertTrue(success) - - def test_ex_cancel_target_job_with_extras(self): - success = self.driver.cancel_target_job( - None, - ex_client="30b1ff76_c76d_4d7c_b39d_3b72be0384c8", - ex_target="e75ead52_692f_4314_8725_c8a4f4d13a87", - ) - self.assertTrue(success) - - def test_ex_cancel_target_job_FAIL(self): - DimensionDataMockHttp.type = "FAIL" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.cancel_target_job( - None, - ex_client="30b1ff76_c76d_4d7c_b39d_3b72be0384c8", - ex_target="e75ead52_692f_4314_8725_c8a4f4d13a87", - ) - self.assertEqual(context.exception.code, "ERROR") - - """Test a backup info for a target that does not have a client""" - - def test_ex_get_backup_details_for_target_NO_CLIENT(self): - DimensionDataMockHttp.type = "NOCLIENT" - response = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ) - self.assertEqual(response.service_plan, "Essentials") - self.assertEqual(len(response.clients), 0) - - """Test a backup details that has a client, but no alerting or running jobs""" - - def test_ex_get_backup_details_for_target_NO_JOB_OR_ALERT(self): - DimensionDataMockHttp.type = "NOJOB" - response = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314_8725-c8a4f4d13a87" - ) - self.assertEqual(response.service_plan, "Enterprise") - self.assertTrue(isinstance(response.clients, list)) - self.assertEqual(len(response.clients), 1) - client = response.clients[0] - self.assertEqual(client.id, "30b1ff76-c76d-4d7c-b39d-3b72be0384c8") - self.assertEqual(client.type.type, "FA.Linux") - self.assertIsNone(client.running_job) - self.assertIsNone(client.alert) - - """Test getting backup info for a server that doesn't exist""" - - def test_ex_get_backup_details_for_target_DISABLED(self): - DimensionDataMockHttp.type = "DISABLED" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.ex_get_backup_details_for_target("e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(context.exception.code, "ERROR") - self.assertEqual( - context.exception.msg, - "Server e75ead52-692f-4314-8725-c8a4f4d13a87 has not been provisioned for backup", - ) - - def test_ex_list_available_client_types(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_client_types(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].type, "FA.Linux") - self.assertEqual(answer[0].is_file_system, True) - self.assertEqual(answer[0].description, "Linux File system") - - def test_ex_list_available_storage_policies(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_storage_policies(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].name, "30 Day Storage Policy + Secondary Copy") - self.assertEqual(answer[0].retention_period, 30) - self.assertEqual(answer[0].secondary_location, "Primary") - - def test_ex_list_available_schedule_policies(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_schedule_policies(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].name, "12AM - 6AM") - self.assertEqual(answer[0].description, "Daily backup will start between 12AM - 6AM") - - def test_ex_remove_client_from_target(self): - target = self.driver.list_targets()[0] - client = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ).clients[0] - self.assertTrue(self.driver.ex_remove_client_from_target(target, client)) - - def test_ex_remove_client_from_target_STR(self): - self.assertTrue( - self.driver.ex_remove_client_from_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - ) - - def test_ex_remove_client_from_target_FAIL(self): - DimensionDataMockHttp.type = "FAIL" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.ex_remove_client_from_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - self.assertEqual(context.exception.code, "ERROR") - self.assertTrue( - "Backup Client is currently performing another operation" in context.exception.msg - ) - - def test_priv_target_to_target_address(self): - target = self.driver.list_targets()[0] - self.assertEqual( - self.driver._target_to_target_address(target), - "e75ead52-692f-4314-8725-c8a4f4d13a87", - ) - - def test_priv_target_to_target_address_STR(self): - self.assertEqual( - self.driver._target_to_target_address("e75ead52-692f-4314-8725-c8a4f4d13a87"), - "e75ead52-692f-4314-8725-c8a4f4d13a87", - ) - - def test_priv_target_to_target_address_TYPEERROR(self): - with self.assertRaises(TypeError): - self.driver._target_to_target_address([1, 2, 3]) - - def test_priv_client_to_client_id(self): - client = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ).clients[0] - self.assertEqual( - self.driver._client_to_client_id(client), - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - - def test_priv_client_to_client_id_STR(self): - self.assertEqual( - self.driver._client_to_client_id("30b1ff76-c76d-4d7c-b39d-3b72be0384c8"), - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - - def test_priv_client_to_client_id_TYPEERROR(self): - with self.assertRaises(TypeError): - self.driver._client_to_client_id([1, 2, 3]) - - -class InvalidRequestError(Exception): - def __init__(self, tag): - super().__init__("Invalid Request - %s" % tag) - - -class DimensionDataMockHttp(MockHttp): - fixtures = BackupFileFixtures("dimensiondata") - - def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): - return (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED]) - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_EXISTS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_DEFAULT(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_FAIL(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_NOCLIENT(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_DISABLED(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_NOJOB(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOCLIENT( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOJOB( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DISABLED( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_type( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_type.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_storagePolicy( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_storagePolicy.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_schedulePolicy( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_schedulePolicy.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client( - self, method, url, body, headers - ): - if method == "POST": - body = self.fixtures.load("_backup_client_SUCCESS_PUT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - else: - raise ValueError("Unknown Method {}".format(method)) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_NOCLIENT( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_NOCLIENT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLED( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_DISABLED.xml") - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_NOJOB( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_NOJOB.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DEFAULT( - self, method, url, body, headers - ): - if method != "POST": - raise InvalidRequestError("Only POST is accepted for this test") - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != DEFAULT_BACKUP_PLAN: - raise InvalidRequestError( - "The default plan %s should have been passed in. Not %s" - % (DEFAULT_BACKUP_PLAN, service_plan) - ) - body = self.fixtures.load("_backup_ENABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup( - self, method, url, body, headers - ): - if method == "POST": - body = self.fixtures.load("_backup_ENABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - elif method == "GET": - if url.endswith("disable"): - body = self.fixtures.load("_backup_DISABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - body = self.fixtures.load("_backup_INFO.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - else: - raise ValueError("Unknown Method {}".format(method)) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOBACKUP( - self, method, url, body, headers - ): - assert method == "GET" - body = self.fixtures.load("server_server_NOBACKUP.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_EXISTS( - self, method, url, body, headers - ): - # only POSTs are implemented - # If we get any other method something has gone wrong - assert method == "POST" - body = self.fixtures.load("_backup_EXISTS.xml") - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_modify( - self, method, url, body, headers - ): - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != "Essentials": - raise InvalidRequestError("Expected Essentials backup plan in request") - body = self.fixtures.load("_backup_modify.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_modify_DEFAULT( - self, method, url, body, headers - ): - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != DEFAULT_BACKUP_PLAN: - raise InvalidRequestError("Expected %s backup plan in test" % DEFAULT_BACKUP_PLAN) - body = self.fixtures.load("_backup_modify.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8( - self, method, url, body, headers - ): - if url.endswith("disable"): - body = self.fixtures.load("_remove_backup_client.xml") - elif url.endswith("cancelJob"): - body = self.fixtures.load( - "" "_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_cancelJob.xml" - ) - else: - raise ValueError("Unknown URL: %s" % url) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_FAIL( - self, method, url, body, headers - ): - if url.endswith("disable"): - body = self.fixtures.load("_remove_backup_client_FAIL.xml") - elif url.endswith("cancelJob"): - body = self.fixtures.load( - "" "_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_cancelJob_FAIL.xml" - ) - else: - raise ValueError("Unknown URL: %s" % url) - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - -if __name__ == "__main__": - sys.exit(unittest.main()) diff --git a/libcloud/test/backup/test_dimensiondata_v2_4.py b/libcloud/test/backup/test_dimensiondata_v2_4.py deleted file mode 100644 index 2156c423a5..0000000000 --- a/libcloud/test/backup/test_dimensiondata_v2_4.py +++ /dev/null @@ -1,530 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sys - -from libcloud.test import MockHttp, unittest -from libcloud.utils.py3 import ET, httplib -from libcloud.backup.base import BackupTargetJob -from libcloud.common.types import InvalidCredsError -from libcloud.test.secrets import DIMENSIONDATA_PARAMS -from libcloud.test.file_fixtures import BackupFileFixtures -from libcloud.common.dimensiondata import DimensionDataAPIException -from libcloud.backup.drivers.dimensiondata import DEFAULT_BACKUP_PLAN -from libcloud.backup.drivers.dimensiondata import DimensionDataBackupDriver as DimensionData - - -class DimensionData_v2_4_Tests(unittest.TestCase): - def setUp(self): - DimensionData.connectionCls.active_api_version = "2.4" - DimensionData.connectionCls.conn_class = DimensionDataMockHttp - DimensionDataMockHttp.type = None - self.driver = DimensionData(*DIMENSIONDATA_PARAMS) - - def test_invalid_region(self): - with self.assertRaises(ValueError): - self.driver = DimensionData(*DIMENSIONDATA_PARAMS, region="blah") - - def test_invalid_creds(self): - DimensionDataMockHttp.type = "UNAUTHORIZED" - with self.assertRaises(InvalidCredsError): - self.driver.list_targets() - - def test_list_targets(self): - targets = self.driver.list_targets() - self.assertEqual(len(targets), 2) - self.assertEqual(targets[0].id, "5579f3a7-4c32-4cf5-8a7e-b45c36a35c10") - self.assertEqual(targets[0].address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(targets[0].extra["servicePlan"], "Enterprise") - - def test_create_target(self): - target = self.driver.create_target( - "name", - "e75ead52-692f-4314-8725-c8a4f4d13a87", - extra={"servicePlan": "Enterprise"}, - ) - self.assertEqual(target.id, "ee7c4b64-f7af-4a4f-8384-be362273530f") - self.assertEqual(target.address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(target.extra["servicePlan"], "Enterprise") - - def test_create_target_DEFAULT(self): - DimensionDataMockHttp.type = "DEFAULT" - target = self.driver.create_target("name", "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(target.id, "ee7c4b64-f7af-4a4f-8384-be362273530f") - self.assertEqual(target.address, "e75ead52-692f-4314-8725-c8a4f4d13a87") - - def test_create_target_EXISTS(self): - DimensionDataMockHttp.type = "EXISTS" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.create_target( - "name", - "e75ead52-692f-4314-8725-c8a4f4d13a87", - extra={"servicePlan": "Enterprise"}, - ) - self.assertEqual(context.exception.code, "ERROR") - self.assertEqual( - context.exception.msg, - "Cloud backup for this server is already enabled or being enabled (state: NORMAL).", - ) - - def test_update_target(self): - target = self.driver.list_targets()[0] - extra = {"servicePlan": "Essentials"} - new_target = self.driver.update_target(target, extra=extra) - self.assertEqual(new_target.extra["servicePlan"], "Essentials") - - def test_update_target_DEFAULT(self): - DimensionDataMockHttp.type = "DEFAULT" - target = "e75ead52-692f-4314-8725-c8a4f4d13a87" - self.driver.update_target(target) - - def test_update_target_STR(self): - target = "e75ead52-692f-4314-8725-c8a4f4d13a87" - extra = {"servicePlan": "Essentials"} - new_target = self.driver.update_target(target, extra=extra) - self.assertEqual(new_target.extra["servicePlan"], "Essentials") - - def test_delete_target(self): - target = self.driver.list_targets()[0] - self.assertTrue(self.driver.delete_target(target)) - - def test_ex_add_client_to_target(self): - target = self.driver.list_targets()[0] - client = self.driver.ex_list_available_client_types(target)[0] - storage_policy = self.driver.ex_list_available_storage_policies(target)[0] - schedule_policy = self.driver.ex_list_available_schedule_policies(target)[0] - self.assertTrue( - self.driver.ex_add_client_to_target( - target, - client, - storage_policy, - schedule_policy, - "ON_FAILURE", - "nobody@example.com", - ) - ) - - def test_ex_add_client_to_target_STR(self): - self.assertTrue( - self.driver.ex_add_client_to_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "FA.Linux", - "14 Day Storage Policy", - "12AM - 6AM", - "ON_FAILURE", - "nobody@example.com", - ) - ) - - def test_ex_get_backup_details_for_target(self): - target = self.driver.list_targets()[0] - response = self.driver.ex_get_backup_details_for_target(target) - self.assertEqual(response.service_plan, "Enterprise") - client = response.clients[0] - self.assertEqual(client.id, "30b1ff76-c76d-4d7c-b39d-3b72be0384c8") - self.assertEqual(client.type.type, "FA.Linux") - self.assertEqual(client.running_job.progress, 5) - self.assertTrue(isinstance(client.running_job, BackupTargetJob)) - self.assertEqual(len(client.alert.notify_list), 2) - self.assertTrue(isinstance(client.alert.notify_list, list)) - - def test_ex_get_backup_details_for_target_NOBACKUP(self): - target = self.driver.list_targets()[0].address - DimensionDataMockHttp.type = "NOBACKUP" - response = self.driver.ex_get_backup_details_for_target(target) - self.assertTrue(response is None) - - def test_ex_cancel_target_job(self): - target = self.driver.list_targets()[0] - response = self.driver.ex_get_backup_details_for_target(target) - client = response.clients[0] - self.assertTrue(isinstance(client.running_job, BackupTargetJob)) - success = client.running_job.cancel() - self.assertTrue(success) - - def test_ex_cancel_target_job_with_extras(self): - success = self.driver.cancel_target_job( - None, - ex_client="30b1ff76_c76d_4d7c_b39d_3b72be0384c8", - ex_target="e75ead52_692f_4314_8725_c8a4f4d13a87", - ) - self.assertTrue(success) - - def test_ex_cancel_target_job_FAIL(self): - DimensionDataMockHttp.type = "FAIL" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.cancel_target_job( - None, - ex_client="30b1ff76_c76d_4d7c_b39d_3b72be0384c8", - ex_target="e75ead52_692f_4314_8725_c8a4f4d13a87", - ) - self.assertEqual(context.exception.code, "ERROR") - - """Test a backup info for a target that does not have a client""" - - def test_ex_get_backup_details_for_target_NO_CLIENT(self): - DimensionDataMockHttp.type = "NOCLIENT" - response = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ) - self.assertEqual(response.service_plan, "Essentials") - self.assertEqual(len(response.clients), 0) - - """Test a backup details that has a client, but no alerting or running jobs""" - - def test_ex_get_backup_details_for_target_NO_JOB_OR_ALERT(self): - DimensionDataMockHttp.type = "NOJOB" - response = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314_8725-c8a4f4d13a87" - ) - self.assertEqual(response.service_plan, "Enterprise") - self.assertTrue(isinstance(response.clients, list)) - self.assertEqual(len(response.clients), 1) - client = response.clients[0] - self.assertEqual(client.id, "30b1ff76-c76d-4d7c-b39d-3b72be0384c8") - self.assertEqual(client.type.type, "FA.Linux") - self.assertIsNone(client.running_job) - self.assertIsNone(client.alert) - - """Test getting backup info for a server that doesn't exist""" - - def test_ex_get_backup_details_for_target_DISABLED(self): - DimensionDataMockHttp.type = "DISABLED" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.ex_get_backup_details_for_target("e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(context.exception.code, "ERROR") - self.assertEqual( - context.exception.msg, - "Server e75ead52-692f-4314-8725-c8a4f4d13a87 has not been provisioned for backup", - ) - - def test_ex_list_available_client_types(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_client_types(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].type, "FA.Linux") - self.assertEqual(answer[0].is_file_system, True) - self.assertEqual(answer[0].description, "Linux File system") - - def test_ex_list_available_storage_policies(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_storage_policies(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].name, "30 Day Storage Policy + Secondary Copy") - self.assertEqual(answer[0].retention_period, 30) - self.assertEqual(answer[0].secondary_location, "Primary") - - def test_ex_list_available_schedule_policies(self): - target = self.driver.list_targets()[0] - answer = self.driver.ex_list_available_schedule_policies(target) - self.assertEqual(len(answer), 1) - self.assertEqual(answer[0].name, "12AM - 6AM") - self.assertEqual(answer[0].description, "Daily backup will start between 12AM - 6AM") - - def test_ex_remove_client_from_target(self): - target = self.driver.list_targets()[0] - client = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ).clients[0] - self.assertTrue(self.driver.ex_remove_client_from_target(target, client)) - - def test_ex_remove_client_from_target_STR(self): - self.assertTrue( - self.driver.ex_remove_client_from_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - ) - - def test_ex_remove_client_from_target_FAIL(self): - DimensionDataMockHttp.type = "FAIL" - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.ex_remove_client_from_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87", - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - self.assertEqual(context.exception.code, "ERROR") - self.assertTrue( - "Backup Client is currently performing another operation" in context.exception.msg - ) - - def test_priv_target_to_target_address(self): - target = self.driver.list_targets()[0] - self.assertEqual( - self.driver._target_to_target_address(target), - "e75ead52-692f-4314-8725-c8a4f4d13a87", - ) - - def test_priv_target_to_target_address_STR(self): - self.assertEqual( - self.driver._target_to_target_address("e75ead52-692f-4314-8725-c8a4f4d13a87"), - "e75ead52-692f-4314-8725-c8a4f4d13a87", - ) - - def test_priv_target_to_target_address_TYPEERROR(self): - with self.assertRaises(TypeError): - self.driver._target_to_target_address([1, 2, 3]) - - def test_priv_client_to_client_id(self): - client = self.driver.ex_get_backup_details_for_target( - "e75ead52-692f-4314-8725-c8a4f4d13a87" - ).clients[0] - self.assertEqual( - self.driver._client_to_client_id(client), - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - - def test_priv_client_to_client_id_STR(self): - self.assertEqual( - self.driver._client_to_client_id("30b1ff76-c76d-4d7c-b39d-3b72be0384c8"), - "30b1ff76-c76d-4d7c-b39d-3b72be0384c8", - ) - - def test_priv_client_to_client_id_TYPEERROR(self): - with self.assertRaises(TypeError): - self.driver._client_to_client_id([1, 2, 3]) - - -class InvalidRequestError(Exception): - def __init__(self, tag): - super().__init__("Invalid Request - %s" % tag) - - -class DimensionDataMockHttp(MockHttp): - fixtures = BackupFileFixtures("dimensiondata") - - def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): - return (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED]) - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_EXISTS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_DEFAULT(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_FAIL(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_NOCLIENT(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_DISABLED(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_NOJOB(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOCLIENT( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOJOB( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DISABLED( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_type( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_type.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_storagePolicy( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_storagePolicy.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_schedulePolicy( - self, method, url, body, headers - ): - body = self.fixtures.load("_backup_client_schedulePolicy.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client( - self, method, url, body, headers - ): - if method == "POST": - body = self.fixtures.load("_backup_client_SUCCESS_PUT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - else: - raise ValueError("Unknown Method {}".format(method)) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_NOCLIENT( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_NOCLIENT.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLED( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_DISABLED.xml") - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_NOJOB( - self, method, url, body, headers - ): - # only gets here are implemented - # If we get any other method something has gone wrong - assert method == "GET" - body = self.fixtures.load("_backup_INFO_NOJOB.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DEFAULT( - self, method, url, body, headers - ): - if method != "POST": - raise InvalidRequestError("Only POST is accepted for this test") - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != DEFAULT_BACKUP_PLAN: - raise InvalidRequestError( - "The default plan %s should have been passed in. Not %s" - % (DEFAULT_BACKUP_PLAN, service_plan) - ) - body = self.fixtures.load("_backup_ENABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup( - self, method, url, body, headers - ): - if method == "POST": - body = self.fixtures.load("_backup_ENABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - elif method == "GET": - if url.endswith("disable"): - body = self.fixtures.load("_backup_DISABLE.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - body = self.fixtures.load("_backup_INFO.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - else: - raise ValueError("Unknown Method {}".format(method)) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOBACKUP( - self, method, url, body, headers - ): - assert method == "GET" - body = self.fixtures.load("server_server_NOBACKUP.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_EXISTS( - self, method, url, body, headers - ): - # only POSTs are implemented - # If we get any other method something has gone wrong - assert method == "POST" - body = self.fixtures.load("_backup_EXISTS.xml") - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_modify( - self, method, url, body, headers - ): - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != "Essentials": - raise InvalidRequestError("Expected Essentials backup plan in request") - body = self.fixtures.load("_backup_modify.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_modify_DEFAULT( - self, method, url, body, headers - ): - request = ET.fromstring(body) - service_plan = request.get("servicePlan") - if service_plan != DEFAULT_BACKUP_PLAN: - raise InvalidRequestError("Expected %s backup plan in test" % DEFAULT_BACKUP_PLAN) - body = self.fixtures.load("_backup_modify.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8( - self, method, url, body, headers - ): - if url.endswith("disable"): - body = self.fixtures.load("_remove_backup_client.xml") - elif url.endswith("cancelJob"): - body = self.fixtures.load( - "" "_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_cancelJob.xml" - ) - else: - raise ValueError("Unknown URL: %s" % url) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_FAIL( - self, method, url, body, headers - ): - if url.endswith("disable"): - body = self.fixtures.load("_remove_backup_client_FAIL.xml") - elif url.endswith("cancelJob"): - body = self.fixtures.load( - "" "_backup_client_30b1ff76_c76d_4d7c_b39d_3b72be0384c8_cancelJob_FAIL.xml" - ) - else: - raise ValueError("Unknown URL: %s" % url) - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - -if __name__ == "__main__": - sys.exit(unittest.main()) diff --git a/libcloud/test/compute/test_dimensiondata_v2_3.py b/libcloud/test/compute/test_dimensiondata_v2_3.py index 56edbefbe4..23b93f8793 100644 --- a/libcloud/test/compute/test_dimensiondata_v2_3.py +++ b/libcloud/test/compute/test_dimensiondata_v2_3.py @@ -44,7 +44,7 @@ from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver as DimensionData -class DimensionData_v2_3_Tests(unittest.TestCase, TestCaseMixin): +class DimensionData_v2_3_TestMixin(TestCaseMixin): def setUp(self): DimensionData.connectionCls.active_api_version = "2.3" DimensionData.connectionCls.conn_class = DimensionDataMockHttp diff --git a/libcloud/test/compute/test_dimensiondata_v2_4.py b/libcloud/test/compute/test_dimensiondata_v2_4.py deleted file mode 100644 index 0462420da4..0000000000 --- a/libcloud/test/compute/test_dimensiondata_v2_4.py +++ /dev/null @@ -1,3940 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sys -from types import GeneratorType - -from libcloud.test import MockHttp, unittest -from libcloud.utils.py3 import ET, httplib -from libcloud.utils.xml import findall, findtext, fixxpath -from libcloud.common.types import InvalidCredsError -from libcloud.compute.base import Node, NodeLocation, NodeAuthPassword -from libcloud.test.secrets import DIMENSIONDATA_PARAMS -from libcloud.test.file_fixtures import ComputeFileFixtures -from libcloud.common.dimensiondata import ( - TYPES_URN, - DimensionDataTag, - DimensionDataPort, - DimensionDataTagKey, - DimensionDataPortList, - DimensionDataIpAddress, - DimensionDataServerDisk, - NetworkDomainServicePlan, - DimensionDataAPIException, - DimensionDataChildPortList, - DimensionDataIpAddressList, - DimensionDataServerVMWareTools, - DimensionDataChildIpAddressList, - DimensionDataServerCpuSpecification, -) -from libcloud.compute.drivers.dimensiondata import DimensionDataNic -from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver as DimensionData - - -class DimensionData_v2_4_Tests(unittest.TestCase): - def setUp(self): - DimensionData.connectionCls.active_api_version = "2.4" - DimensionData.connectionCls.conn_class = DimensionDataMockHttp - DimensionDataMockHttp.type = None - self.driver = DimensionData(*DIMENSIONDATA_PARAMS) - - def test_invalid_region(self): - with self.assertRaises(ValueError): - DimensionData(*DIMENSIONDATA_PARAMS, region="blah") - - def test_invalid_creds(self): - DimensionDataMockHttp.type = "UNAUTHORIZED" - with self.assertRaises(InvalidCredsError): - self.driver.list_nodes() - - def test_get_account_details(self): - DimensionDataMockHttp.type = None - ret = self.driver.connection.get_account_details() - self.assertEqual(ret.full_name, "Test User") - self.assertEqual(ret.first_name, "Test") - self.assertEqual(ret.email, "test@example.com") - - def test_list_locations_response(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_locations() - self.assertEqual(len(ret), 5) - first_loc = ret[0] - self.assertEqual(first_loc.id, "NA3") - self.assertEqual(first_loc.name, "US - West") - self.assertEqual(first_loc.country, "US") - - def test_list_nodes_response(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_nodes() - self.assertEqual(len(ret), 7) - - def test_node_extras(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_nodes() - self.assertTrue(isinstance(ret[0].extra["vmWareTools"], DimensionDataServerVMWareTools)) - self.assertTrue(isinstance(ret[0].extra["cpu"], DimensionDataServerCpuSpecification)) - self.assertTrue(isinstance(ret[0].extra["disks"], list)) - self.assertTrue(isinstance(ret[0].extra["disks"][0], DimensionDataServerDisk)) - self.assertEqual(ret[0].extra["disks"][0].size_gb, 10) - self.assertTrue(isinstance(ret[1].extra["disks"], list)) - self.assertTrue(isinstance(ret[1].extra["disks"][0], DimensionDataServerDisk)) - self.assertEqual(ret[1].extra["disks"][0].size_gb, 10) - - def test_server_states(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_nodes() - self.assertTrue(ret[0].state == "running") - self.assertTrue(ret[1].state == "starting") - self.assertTrue(ret[2].state == "stopping") - self.assertTrue(ret[3].state == "reconfiguring") - self.assertTrue(ret[4].state == "running") - self.assertTrue(ret[5].state == "terminated") - self.assertTrue(ret[6].state == "stopped") - self.assertEqual(len(ret), 7) - - def test_list_nodes_response_PAGINATED(self): - DimensionDataMockHttp.type = "PAGINATED" - ret = self.driver.list_nodes() - self.assertEqual(len(ret), 9) - - def test_paginated_mcp2_call_EMPTY(self): - # cache org - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "EMPTY" - node_list_generator = self.driver.connection.paginated_request_with_orgId_api_2( - "server/server" - ) - empty_node_list = [] - - for node_list in node_list_generator: - empty_node_list.extend(node_list) - self.assertTrue(len(empty_node_list) == 0) - - def test_paginated_mcp2_call_PAGED_THEN_EMPTY(self): - # cache org - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "PAGED_THEN_EMPTY" - node_list_generator = self.driver.connection.paginated_request_with_orgId_api_2( - "server/server" - ) - final_node_list = [] - - for node_list in node_list_generator: - final_node_list.extend(node_list) - self.assertTrue(len(final_node_list) == 2) - - def test_paginated_mcp2_call_with_page_size(self): - # cache org - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "PAGESIZE50" - node_list_generator = self.driver.connection.paginated_request_with_orgId_api_2( - "server/server", page_size=50 - ) - self.assertTrue(isinstance(node_list_generator, GeneratorType)) - - # We're making sure here the filters make it to the URL - # See _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS for asserts - def test_list_nodes_response_strings_ALLFILTERS(self): - DimensionDataMockHttp.type = "ALLFILTERS" - ret = self.driver.list_nodes( - ex_location="fake_loc", - ex_name="fake_name", - ex_ipv6="fake_ipv6", - ex_ipv4="fake_ipv4", - ex_vlan="fake_vlan", - ex_image="fake_image", - ex_deployed=True, - ex_started=True, - ex_state="fake_state", - ex_network="fake_network", - ex_network_domain="fake_network_domain", - ) - self.assertTrue(isinstance(ret, list)) - self.assertEqual(len(ret), 7) - - node = ret[3] - self.assertTrue(isinstance(node.extra["disks"], list)) - self.assertTrue(isinstance(node.extra["disks"][0], DimensionDataServerDisk)) - self.assertEqual(node.size.id, "1") - self.assertEqual(node.image.id, "3ebf3c0f-90fe-4a8b-8585-6e65b316592c") - self.assertEqual(node.image.name, "WIN2008S/32") - disk = node.extra["disks"][0] - self.assertEqual(disk.id, "c2e1f199-116e-4dbc-9960-68720b832b0a") - self.assertEqual(disk.scsi_id, 0) - self.assertEqual(disk.size_gb, 50) - self.assertEqual(disk.speed, "STANDARD") - self.assertEqual(disk.state, "NORMAL") - - def test_list_nodes_response_LOCATION(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_locations() - first_loc = ret[0] - ret = self.driver.list_nodes(ex_location=first_loc) - - for node in ret: - self.assertEqual(node.extra["datacenterId"], "NA3") - - def test_list_nodes_response_LOCATION_STR(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_nodes(ex_location="NA3") - - for node in ret: - self.assertEqual(node.extra["datacenterId"], "NA3") - - def test_list_sizes_response(self): - DimensionDataMockHttp.type = None - ret = self.driver.list_sizes() - self.assertEqual(len(ret), 1) - size = ret[0] - self.assertEqual(size.name, "default") - - def test_reboot_node_response(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = node.reboot() - self.assertTrue(ret is True) - - def test_reboot_node_response_INPROGRESS(self): - DimensionDataMockHttp.type = "INPROGRESS" - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - with self.assertRaises(DimensionDataAPIException): - node.reboot() - - def test_destroy_node_response(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = node.destroy() - self.assertTrue(ret is True) - - def test_destroy_node_response_RESOURCE_BUSY(self): - DimensionDataMockHttp.type = "INPROGRESS" - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - with self.assertRaises(DimensionDataAPIException): - node.destroy() - - def test_list_images(self): - images = self.driver.list_images() - self.assertEqual(len(images), 3) - self.assertEqual(images[0].name, "RedHat 6 64-bit 2 CPU") - self.assertEqual(images[0].id, "c14b1a46-2428-44c1-9c1a-b20e6418d08c") - self.assertEqual(images[0].extra["location"].id, "NA9") - self.assertEqual(images[0].extra["cpu"].cpu_count, 2) - self.assertEqual(images[0].extra["OS_displayName"], "REDHAT6/64") - - def test_clean_failed_deployment_response_with_node(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_clean_failed_deployment(node) - self.assertTrue(ret is True) - - def test_clean_failed_deployment_response_with_node_id(self): - node = "e75ead52-692f-4314-8725-c8a4f4d13a87" - ret = self.driver.ex_clean_failed_deployment(node) - self.assertTrue(ret is True) - - def test_ex_list_customer_images(self): - images = self.driver.ex_list_customer_images() - self.assertEqual(len(images), 3) - self.assertEqual(images[0].name, "ImportedCustomerImage") - self.assertEqual(images[0].id, "5234e5c7-01de-4411-8b6e-baeb8d91cf5d") - self.assertEqual(images[0].extra["location"].id, "NA9") - self.assertEqual(images[0].extra["cpu"].cpu_count, 4) - self.assertEqual(images[0].extra["OS_displayName"], "REDHAT6/64") - - def test_create_mcp1_node_optional_param(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - network = self.driver.ex_list_networks()[0] - cpu_spec = DimensionDataServerCpuSpecification( - cpu_count="4", cores_per_socket="2", performance="STANDARD" - ) - disks = [DimensionDataServerDisk(scsi_id="0", speed="HIGHPERFORMANCE")] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ex_memory_gb=8, - ex_disks=disks, - ex_cpu_specification=cpu_spec, - ex_primary_dns="10.0.0.5", - ex_secondary_dns="10.0.0.6", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_mcp1_node_response_no_pass_random_gen(self): - image = self.driver.list_images()[0] - network = self.driver.ex_list_networks()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=None, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - self.assertTrue("password" in node.extra) - - def test_create_mcp1_node_response_no_pass_customer_windows(self): - image = self.driver.ex_list_customer_images()[1] - network = self.driver.ex_list_networks()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=None, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - self.assertTrue("password" in node.extra) - - def test_create_mcp1_node_response_no_pass_customer_windows_STR(self): - image = self.driver.ex_list_customer_images()[1].id - network = self.driver.ex_list_networks()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=None, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - self.assertTrue("password" in node.extra) - - def test_create_mcp1_node_response_no_pass_customer_linux(self): - image = self.driver.ex_list_customer_images()[0] - network = self.driver.ex_list_networks()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=None, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - self.assertTrue("password" not in node.extra) - - def test_create_mcp1_node_response_no_pass_customer_linux_STR(self): - image = self.driver.ex_list_customer_images()[0].id - network = self.driver.ex_list_networks()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=None, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - self.assertTrue("password" not in node.extra) - - def test_create_mcp1_node_response_STR(self): - rootPw = "pass123" - image = self.driver.list_images()[0].id - network = self.driver.ex_list_networks()[0].id - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network=network, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_response_network_domain(self): - rootPw = NodeAuthPassword("pass123") - location = self.driver.ex_get_location_by_id("NA9") - image = self.driver.list_images(location=location)[0] - network_domain = self.driver.ex_list_network_domains(location=location)[0] - vlan = self.driver.ex_list_vlans(location=location)[0] - cpu = DimensionDataServerCpuSpecification( - cpu_count=4, cores_per_socket=1, performance="HIGHPERFORMANCE" - ) - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain=network_domain, - ex_vlan=vlan, - ex_is_started=False, - ex_cpu_specification=cpu, - ex_memory_gb=4, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_response_network_domain_STR(self): - rootPw = NodeAuthPassword("pass123") - location = self.driver.ex_get_location_by_id("NA9") - image = self.driver.list_images(location=location)[0] - network_domain = self.driver.ex_list_network_domains(location=location)[0].id - vlan = self.driver.ex_list_vlans(location=location)[0].id - cpu = DimensionDataServerCpuSpecification( - cpu_count=4, cores_per_socket=1, performance="HIGHPERFORMANCE" - ) - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain=network_domain, - ex_vlan=vlan, - ex_is_started=False, - ex_cpu_specification=cpu, - ex_memory_gb=4, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_mcp1_node_no_network(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(InvalidRequestError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network=None, - ex_is_started=False, - ) - - def test_create_node_mcp1_ipv4(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network="fakenetwork", - ex_primary_ipv4="10.0.0.1", - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_mcp1_network(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network="fakenetwork", - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_mcp2_vlan(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_vlan="fakevlan", - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_mcp2_ipv4(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_ipv4="10.0.0.1", - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_network_domain_no_vlan_or_ipv4(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fake_network_domain", - ex_is_started=False, - ) - - def test_create_node_response(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_primary_nic_vlan="fakevlan", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_ms_time_zone(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_primary_nic_vlan="fakevlan", - ex_microsoft_time_zone="040", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_ambigious_mcps_fail(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_network="fakenetwork", - ex_primary_nic_vlan="fakevlan", - ) - - def test_create_node_no_network_domain_fail(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, name="test3", image=image, auth=rootPw, ex_primary_nic_vlan="fakevlan" - ) - - def test_create_node_no_primary_nic_fail(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ) - - def test_create_node_primary_vlan_nic(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_primary_nic_vlan="fakevlan", - ex_primary_nic_network_adapter="v1000", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_primary_ipv4(self): - rootPw = "pass123" - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_both_primary_nic_and_vlan_fail(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test3", - image=image, - auth=rootPw, - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_primary_nic_vlan="fakevlan", - ) - - def test_create_node_cpu_specification(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - cpu_spec = DimensionDataServerCpuSpecification( - cpu_count="4", cores_per_socket="2", performance="STANDARD" - ) - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_is_started=False, - ex_cpu_specification=cpu_spec, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_memory(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_is_started=False, - ex_memory_gb=8, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_disks(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - disks = [DimensionDataServerDisk(scsi_id="0", speed="HIGHPERFORMANCE")] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_is_started=False, - ex_disks=disks, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_disks_fail(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - disks = "blah" - with self.assertRaises(TypeError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_is_started=False, - ex_disks=disks, - ) - - def test_create_node_ipv4_gateway(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_is_started=False, - ex_ipv4_gateway="10.2.2.2", - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_network_domain_no_vlan_no_ipv4_fail(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fake_network_domain", - ex_is_started=False, - ) - - def test_create_node_mcp2_additional_nics_legacy(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - additional_vlans = ["fakevlan1", "fakevlan2"] - additional_ipv4 = ["10.0.0.2", "10.0.0.3"] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_ipv4="10.0.0.1", - ex_additional_nics_vlan=additional_vlans, - ex_additional_nics_ipv4=additional_ipv4, - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_bad_additional_nics_ipv4(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(TypeError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fake_network_domain", - ex_vlan="fake_vlan", - ex_additional_nics_ipv4="badstring", - ex_is_started=False, - ) - - def test_create_node_additional_nics(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - nic1 = DimensionDataNic(vlan="fake_vlan", network_adapter_name="v1000") - nic2 = DimensionDataNic(private_ip_v4="10.1.1.2", network_adapter_name="v1000") - additional_nics = [nic1, nic2] - - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_additional_nics=additional_nics, - ex_is_started=False, - ) - - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_create_node_additional_nics_vlan_ipv4_coexist_fail(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - nic1 = DimensionDataNic( - private_ip_v4="10.1.1.1", vlan="fake_vlan", network_adapter_name="v1000" - ) - nic2 = DimensionDataNic( - private_ip_v4="10.1.1.2", vlan="fake_vlan2", network_adapter_name="v1000" - ) - additional_nics = [nic1, nic2] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_additional_nics=additional_nics, - ex_is_started=False, - ) - - def test_create_node_additional_nics_invalid_input_fail(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - additional_nics = "blah" - with self.assertRaises(TypeError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_additional_nics=additional_nics, - ex_is_started=False, - ) - - def test_create_node_additional_nics_vlan_ipv4_not_exist_fail(self): - root_pw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - nic1 = DimensionDataNic(network_adapter_name="v1000") - nic2 = DimensionDataNic(network_adapter_name="v1000") - additional_nics = [nic1, nic2] - with self.assertRaises(ValueError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=root_pw, - ex_description="test2 node", - ex_network_domain="fakenetworkdomain", - ex_primary_nic_private_ipv4="10.0.0.1", - ex_additional_nics=additional_nics, - ex_is_started=False, - ) - - def test_create_node_bad_additional_nics_vlan(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - with self.assertRaises(TypeError): - self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test2 node", - ex_network_domain="fake_network_domain", - ex_vlan="fake_vlan", - ex_additional_nics_vlan="badstring", - ex_is_started=False, - ) - - def test_create_node_mcp2_indicate_dns(self): - rootPw = NodeAuthPassword("pass123") - image = self.driver.list_images()[0] - node = self.driver.create_node( - size=None, - name="test2", - image=image, - auth=rootPw, - ex_description="test node dns", - ex_network_domain="fakenetworkdomain", - ex_primary_ipv4="10.0.0.1", - ex_primary_dns="8.8.8.8", - ex_secondary_dns="8.8.4.4", - ex_is_started=False, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - self.assertEqual(node.extra["status"].action, "DEPLOY_SERVER") - - def test_ex_shutdown_graceful(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_shutdown_graceful(node) - self.assertTrue(ret is True) - - def test_ex_shutdown_graceful_INPROGRESS(self): - DimensionDataMockHttp.type = "INPROGRESS" - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_shutdown_graceful(node) - - def test_ex_start_node(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_start_node(node) - self.assertTrue(ret is True) - - def test_ex_start_node_INPROGRESS(self): - DimensionDataMockHttp.type = "INPROGRESS" - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_start_node(node) - - def test_ex_power_off(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_power_off(node) - self.assertTrue(ret is True) - - def test_ex_update_vm_tools(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_update_vm_tools(node) - self.assertTrue(ret is True) - - def test_ex_power_off_INPROGRESS(self): - DimensionDataMockHttp.type = "INPROGRESS" - node = Node( - id="11", - name=None, - state="STOPPING", - public_ips=None, - private_ips=None, - driver=self.driver, - ) - - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_power_off(node) - - def test_ex_reset(self): - node = Node( - id="11", - name=None, - state=None, - public_ips=None, - private_ips=None, - driver=self.driver, - ) - ret = self.driver.ex_reset(node) - self.assertTrue(ret is True) - - def test_ex_attach_node_to_vlan(self): - node = self.driver.ex_get_node_by_id("e75ead52-692f-4314-8725-c8a4f4d13a87") - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - ret = self.driver.ex_attach_node_to_vlan(node, vlan) - self.assertTrue(ret is True) - - def test_ex_destroy_nic(self): - node = self.driver.ex_destroy_nic("a202e51b-41c0-4cfc-add0-b1c62fc0ecf6") - self.assertTrue(node) - - def test_list_networks(self): - nets = self.driver.list_networks() - self.assertEqual(nets[0].name, "test-net1") - self.assertTrue(isinstance(nets[0].location, NodeLocation)) - - def test_ex_create_network(self): - location = self.driver.ex_get_location_by_id("NA9") - net = self.driver.ex_create_network(location, "Test Network", "test") - self.assertEqual(net.id, "208e3a8e-9d2f-11e2-b29c-001517c4643e") - self.assertEqual(net.name, "Test Network") - - def test_ex_create_network_NO_DESCRIPTION(self): - location = self.driver.ex_get_location_by_id("NA9") - net = self.driver.ex_create_network(location, "Test Network") - self.assertEqual(net.id, "208e3a8e-9d2f-11e2-b29c-001517c4643e") - self.assertEqual(net.name, "Test Network") - - def test_ex_delete_network(self): - net = self.driver.ex_list_networks()[0] - result = self.driver.ex_delete_network(net) - self.assertTrue(result) - - def test_ex_rename_network(self): - net = self.driver.ex_list_networks()[0] - result = self.driver.ex_rename_network(net, "barry") - self.assertTrue(result) - - def test_ex_create_network_domain(self): - location = self.driver.ex_get_location_by_id("NA9") - plan = NetworkDomainServicePlan.ADVANCED - net = self.driver.ex_create_network_domain( - location=location, name="test", description="test", service_plan=plan - ) - self.assertEqual(net.name, "test") - self.assertTrue(net.id, "f14a871f-9a25-470c-aef8-51e13202e1aa") - - def test_ex_create_network_domain_NO_DESCRIPTION(self): - location = self.driver.ex_get_location_by_id("NA9") - plan = NetworkDomainServicePlan.ADVANCED - net = self.driver.ex_create_network_domain( - location=location, name="test", service_plan=plan - ) - self.assertEqual(net.name, "test") - self.assertTrue(net.id, "f14a871f-9a25-470c-aef8-51e13202e1aa") - - def test_ex_get_network_domain(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - self.assertEqual(net.id, "8cdfd607-f429-4df6-9352-162cfc0891be") - self.assertEqual(net.description, "test2") - self.assertEqual(net.name, "test") - - def test_ex_update_network_domain(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - net.name = "new name" - net2 = self.driver.ex_update_network_domain(net) - self.assertEqual(net2.name, "new name") - - def test_ex_delete_network_domain(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - result = self.driver.ex_delete_network_domain(net) - self.assertTrue(result) - - def test_ex_list_networks(self): - nets = self.driver.ex_list_networks() - self.assertEqual(nets[0].name, "test-net1") - self.assertTrue(isinstance(nets[0].location, NodeLocation)) - - def test_ex_list_network_domains(self): - nets = self.driver.ex_list_network_domains() - self.assertEqual(nets[0].name, "Aurora") - self.assertTrue(isinstance(nets[0].location, NodeLocation)) - - def test_ex_list_network_domains_ALLFILTERS(self): - DimensionDataMockHttp.type = "ALLFILTERS" - nets = self.driver.ex_list_network_domains( - location="fake_location", - name="fake_name", - service_plan="fake_plan", - state="fake_state", - ) - self.assertEqual(nets[0].name, "Aurora") - self.assertTrue(isinstance(nets[0].location, NodeLocation)) - - def test_ex_list_vlans(self): - vlans = self.driver.ex_list_vlans() - self.assertEqual(vlans[0].name, "Primary") - - def test_ex_list_vlans_ALLFILTERS(self): - DimensionDataMockHttp.type = "ALLFILTERS" - vlans = self.driver.ex_list_vlans( - location="fake_location", - network_domain="fake_network_domain", - name="fake_name", - ipv4_address="fake_ipv4", - ipv6_address="fake_ipv6", - state="fake_state", - ) - self.assertEqual(vlans[0].name, "Primary") - - def test_ex_create_vlan( - self, - ): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - vlan = self.driver.ex_create_vlan( - network_domain=net, - name="test", - private_ipv4_base_address="10.3.4.0", - private_ipv4_prefix_size="24", - description="test vlan", - ) - self.assertEqual(vlan.id, "0e56433f-d808-4669-821d-812769517ff8") - - def test_ex_create_vlan_NO_DESCRIPTION( - self, - ): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - vlan = self.driver.ex_create_vlan( - network_domain=net, - name="test", - private_ipv4_base_address="10.3.4.0", - private_ipv4_prefix_size="24", - ) - self.assertEqual(vlan.id, "0e56433f-d808-4669-821d-812769517ff8") - - def test_ex_get_vlan(self): - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - self.assertEqual(vlan.id, "0e56433f-d808-4669-821d-812769517ff8") - self.assertEqual(vlan.description, "test2") - self.assertEqual(vlan.status, "NORMAL") - self.assertEqual(vlan.name, "Production VLAN") - self.assertEqual(vlan.private_ipv4_range_address, "10.0.3.0") - self.assertEqual(vlan.private_ipv4_range_size, 24) - self.assertEqual(vlan.ipv6_range_size, 64) - self.assertEqual(vlan.ipv6_range_address, "2607:f480:1111:1153:0:0:0:0") - self.assertEqual(vlan.ipv4_gateway, "10.0.3.1") - self.assertEqual(vlan.ipv6_gateway, "2607:f480:1111:1153:0:0:0:1") - - def test_ex_wait_for_state(self): - self.driver.ex_wait_for_state( - "NORMAL", - self.driver.ex_get_vlan, - vlan_id="0e56433f-d808-4669-821d-812769517ff8", - poll_interval=0.1, - ) - - def test_ex_wait_for_state_NODE(self): - self.driver.ex_wait_for_state( - "running", - self.driver.ex_get_node_by_id, - id="e75ead52-692f-4314-8725-c8a4f4d13a87", - poll_interval=0.1, - ) - - def test_ex_wait_for_state_FAIL(self): - with self.assertRaises(DimensionDataAPIException) as context: - self.driver.ex_wait_for_state( - "starting", - self.driver.ex_get_node_by_id, - id="e75ead52-692f-4314-8725-c8a4f4d13a87", - poll_interval=0.1, - timeout=0.1, - ) - self.assertEqual(context.exception.code, "running") - self.assertTrue("timed out" in context.exception.msg) - - def test_ex_update_vlan(self): - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - vlan.name = "new name" - vlan2 = self.driver.ex_update_vlan(vlan) - self.assertEqual(vlan2.name, "new name") - - def test_ex_delete_vlan(self): - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - result = self.driver.ex_delete_vlan(vlan) - self.assertTrue(result) - - def test_ex_expand_vlan(self): - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - vlan.private_ipv4_range_size = "23" - vlan = self.driver.ex_expand_vlan(vlan) - self.assertEqual(vlan.private_ipv4_range_size, "23") - - def test_ex_add_public_ip_block_to_network_domain(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - block = self.driver.ex_add_public_ip_block_to_network_domain(net) - self.assertEqual(block.id, "9945dc4a-bdce-11e4-8c14-b8ca3a5d9ef8") - - def test_ex_list_public_ip_blocks(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - blocks = self.driver.ex_list_public_ip_blocks(net) - self.assertEqual(blocks[0].base_ip, "168.128.4.18") - self.assertEqual(blocks[0].size, "2") - self.assertEqual(blocks[0].id, "9945dc4a-bdce-11e4-8c14-b8ca3a5d9ef8") - self.assertEqual(blocks[0].location.id, "NA9") - self.assertEqual(blocks[0].network_domain.id, net.id) - - def test_ex_get_public_ip_block(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - block = self.driver.ex_get_public_ip_block("9945dc4a-bdce-11e4-8c14-b8ca3a5d9ef8") - self.assertEqual(block.base_ip, "168.128.4.18") - self.assertEqual(block.size, "2") - self.assertEqual(block.id, "9945dc4a-bdce-11e4-8c14-b8ca3a5d9ef8") - self.assertEqual(block.location.id, "NA9") - self.assertEqual(block.network_domain.id, net.id) - - def test_ex_delete_public_ip_block(self): - block = self.driver.ex_get_public_ip_block("9945dc4a-bdce-11e4-8c14-b8ca3a5d9ef8") - result = self.driver.ex_delete_public_ip_block(block) - self.assertTrue(result) - - def test_ex_list_firewall_rules(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - self.assertEqual(rules[0].id, "756cba02-b0bc-48f4-aea5-9445870b6148") - self.assertEqual(rules[0].network_domain.id, "8cdfd607-f429-4df6-9352-162cfc0891be") - self.assertEqual(rules[0].name, "CCDEFAULT.BlockOutboundMailIPv4") - self.assertEqual(rules[0].action, "DROP") - self.assertEqual(rules[0].ip_version, "IPV4") - self.assertEqual(rules[0].protocol, "TCP") - self.assertEqual(rules[0].source.ip_address, "ANY") - self.assertTrue(rules[0].source.any_ip) - self.assertTrue(rules[0].destination.any_ip) - - def test_ex_create_firewall_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - rule = self.driver.ex_create_firewall_rule(net, rules[0], "FIRST") - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_with_specific_source_ip(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - specific_source_ip_rule = list(filter(lambda x: x.name == "SpecificSourceIP", rules))[0] - rule = self.driver.ex_create_firewall_rule(net, specific_source_ip_rule, "FIRST") - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_with_source_ip(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - specific_source_ip_rule = list(filter(lambda x: x.name == "SpecificSourceIP", rules))[0] - specific_source_ip_rule.source.any_ip = False - specific_source_ip_rule.source.ip_address = "10.0.0.1" - specific_source_ip_rule.source.ip_prefix_size = "15" - rule = self.driver.ex_create_firewall_rule(net, specific_source_ip_rule, "FIRST") - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_with_any_ip(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - specific_source_ip_rule = list(filter(lambda x: x.name == "SpecificSourceIP", rules))[0] - specific_source_ip_rule.source.any_ip = True - rule = self.driver.ex_create_firewall_rule(net, specific_source_ip_rule, "FIRST") - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_ip_prefix_size(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_list_firewall_rules(net)[0] - rule.source.address_list_id = None - rule.source.any_ip = False - rule.source.ip_address = "10.2.1.1" - rule.source.ip_prefix_size = "10" - rule.destination.address_list_id = None - rule.destination.any_ip = False - rule.destination.ip_address = "10.0.0.1" - rule.destination.ip_prefix_size = "20" - self.driver.ex_create_firewall_rule(net, rule, "LAST") - - def test_ex_create_firewall_rule_address_list(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_list_firewall_rules(net)[0] - rule.source.address_list_id = "12345" - rule.destination.address_list_id = "12345" - self.driver.ex_create_firewall_rule(net, rule, "LAST") - - def test_ex_create_firewall_rule_port_list(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_list_firewall_rules(net)[0] - rule.source.port_list_id = "12345" - rule.destination.port_list_id = "12345" - self.driver.ex_create_firewall_rule(net, rule, "LAST") - - def test_ex_create_firewall_rule_port(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_list_firewall_rules(net)[0] - rule.source.port_list_id = None - rule.source.port_begin = "8000" - rule.source.port_end = "8005" - rule.destination.port_list_id = None - rule.destination.port_begin = "7000" - rule.destination.port_end = "7005" - self.driver.ex_create_firewall_rule(net, rule, "LAST") - - def test_ex_create_firewall_rule_ALL_VALUES(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - - for rule in rules: - self.driver.ex_create_firewall_rule(net, rule, "LAST") - - def test_ex_create_firewall_rule_WITH_POSITION_RULE(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - rule = self.driver.ex_create_firewall_rule(net, rules[-2], "BEFORE", rules[-1]) - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_WITH_POSITION_RULE_STR(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - rule = self.driver.ex_create_firewall_rule( - net, rules[-2], "BEFORE", "RULE_WITH_SOURCE_AND_DEST" - ) - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_create_firewall_rule_FAIL_POSITION(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - with self.assertRaises(ValueError): - self.driver.ex_create_firewall_rule(net, rules[0], "BEFORE") - - def test_ex_create_firewall_rule_FAIL_POSITION_WITH_RULE(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_firewall_rules(net) - with self.assertRaises(ValueError): - self.driver.ex_create_firewall_rule(net, rules[0], "LAST", "RULE_WITH_SOURCE_AND_DEST") - - def test_ex_get_firewall_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - self.assertEqual(rule.id, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - - def test_ex_set_firewall_rule_state(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - result = self.driver.ex_set_firewall_rule_state(rule, False) - self.assertTrue(result) - - def test_ex_delete_firewall_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - result = self.driver.ex_delete_firewall_rule(rule) - self.assertTrue(result) - - def test_ex_edit_firewall_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.source.any_ip = True - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_source_ipaddresslist(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.source.address_list_id = "802abc9f-45a7-4efb-9d5a-810082368222" - rule.source.any_ip = False - rule.source.ip_address = "10.0.0.1" - rule.source.ip_prefix_size = 10 - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_destination_ipaddresslist(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.destination.address_list_id = "802abc9f-45a7-4efb-9d5a-810082368222" - rule.destination.any_ip = False - rule.destination.ip_address = "10.0.0.1" - rule.destination.ip_prefix_size = 10 - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_destination_ipaddress(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.source.address_list_id = None - rule.source.any_ip = False - rule.source.ip_address = "10.0.0.1" - rule.source.ip_prefix_size = "10" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_source_ipaddress(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.destination.address_list_id = None - rule.destination.any_ip = False - rule.destination.ip_address = "10.0.0.1" - rule.destination.ip_prefix_size = "10" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_with_relative_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - placement_rule = self.driver.ex_list_firewall_rules(network_domain=net)[-1] - result = self.driver.ex_edit_firewall_rule( - rule=rule, position="BEFORE", relative_rule_for_position=placement_rule - ) - self.assertTrue(result) - - def test_ex_edit_firewall_rule_with_relative_rule_by_name(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - placement_rule = self.driver.ex_list_firewall_rules(network_domain=net)[-1] - result = self.driver.ex_edit_firewall_rule( - rule=rule, position="BEFORE", relative_rule_for_position=placement_rule.name - ) - self.assertTrue(result) - - def test_ex_edit_firewall_rule_source_portlist(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.source.port_list_id = "802abc9f-45a7-4efb-9d5a-810082368222" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_source_port(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.source.port_list_id = None - rule.source.port_begin = "3" - rule.source.port_end = "10" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_destination_portlist(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.destination.port_list_id = "802abc9f-45a7-4efb-9d5a-810082368222" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_destination_port(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - rule.destination.port_list_id = None - rule.destination.port_begin = "3" - rule.destination.port_end = "10" - result = self.driver.ex_edit_firewall_rule(rule=rule, position="LAST") - self.assertTrue(result) - - def test_ex_edit_firewall_rule_invalid_position_fail(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - with self.assertRaises(ValueError): - self.driver.ex_edit_firewall_rule(rule=rule, position="BEFORE") - - def test_ex_edit_firewall_rule_invalid_position_relative_rule_fail(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_firewall_rule(net, "d0a20f59-77b9-4f28-a63b-e58496b73a6c") - relative_rule = self.driver.ex_list_firewall_rules(network_domain=net)[-1] - with self.assertRaises(ValueError): - self.driver.ex_edit_firewall_rule( - rule=rule, position="FIRST", relative_rule_for_position=relative_rule - ) - - def test_ex_create_nat_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_create_nat_rule(net, "1.2.3.4", "4.3.2.1") - self.assertEqual(rule.id, "d31c2db0-be6b-4d50-8744-9a7a534b5fba") - - def test_ex_list_nat_rules(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rules = self.driver.ex_list_nat_rules(net) - self.assertEqual(rules[0].id, "2187a636-7ebb-49a1-a2ff-5d617f496dce") - self.assertEqual(rules[0].internal_ip, "10.0.0.15") - self.assertEqual(rules[0].external_ip, "165.180.12.18") - - def test_ex_get_nat_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_nat_rule(net, "2187a636-7ebb-49a1-a2ff-5d617f496dce") - self.assertEqual(rule.id, "2187a636-7ebb-49a1-a2ff-5d617f496dce") - self.assertEqual(rule.internal_ip, "10.0.0.16") - self.assertEqual(rule.external_ip, "165.180.12.19") - - def test_ex_delete_nat_rule(self): - net = self.driver.ex_get_network_domain("8cdfd607-f429-4df6-9352-162cfc0891be") - rule = self.driver.ex_get_nat_rule(net, "2187a636-7ebb-49a1-a2ff-5d617f496dce") - result = self.driver.ex_delete_nat_rule(rule) - self.assertTrue(result) - - def test_ex_enable_monitoring(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_enable_monitoring(node, "ADVANCED") - self.assertTrue(result) - - def test_ex_disable_monitoring(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_disable_monitoring(node) - self.assertTrue(result) - - def test_ex_change_monitoring_plan(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_update_monitoring_plan(node, "ESSENTIALS") - self.assertTrue(result) - - def test_ex_add_storage_to_node(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_add_storage_to_node(node, 30, "PERFORMANCE") - self.assertTrue(result) - - def test_ex_remove_storage_from_node(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_remove_storage_from_node(node, 0) - self.assertTrue(result) - - def test_ex_change_storage_speed(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_change_storage_speed(node, 1, "PERFORMANCE") - self.assertTrue(result) - - def test_ex_change_storage_size(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_change_storage_size(node, 1, 100) - self.assertTrue(result) - - def test_ex_clone_node_to_image(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_clone_node_to_image(node, "my image", "a description") - self.assertTrue(result) - - def test_ex_update_node(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_update_node(node, "my new name", "a description", 2, 4048) - self.assertTrue(result) - - def test_ex_reconfigure_node(self): - node = self.driver.list_nodes()[0] - result = self.driver.ex_reconfigure_node(node, 4, 4, 1, "HIGHPERFORMANCE") - self.assertTrue(result) - - def test_ex_get_location_by_id(self): - location = self.driver.ex_get_location_by_id("NA9") - self.assertTrue(location.id, "NA9") - - def test_ex_get_location_by_id_NO_LOCATION(self): - location = self.driver.ex_get_location_by_id(None) - self.assertIsNone(location) - - def test_ex_get_base_image_by_id(self): - image_id = self.driver.list_images()[0].id - image = self.driver.ex_get_base_image_by_id(image_id) - self.assertEqual(image.extra["OS_type"], "UNIX") - - def test_ex_get_customer_image_by_id(self): - image_id = self.driver.ex_list_customer_images()[1].id - image = self.driver.ex_get_customer_image_by_id(image_id) - self.assertEqual(image.extra["OS_type"], "WINDOWS") - - def test_ex_get_image_by_id_base_img(self): - image_id = self.driver.list_images()[1].id - image = self.driver.ex_get_base_image_by_id(image_id) - self.assertEqual(image.extra["OS_type"], "WINDOWS") - - def test_ex_get_image_by_id_customer_img(self): - image_id = self.driver.ex_list_customer_images()[0].id - image = self.driver.ex_get_customer_image_by_id(image_id) - self.assertEqual(image.extra["OS_type"], "UNIX") - - def test_ex_get_image_by_id_customer_FAIL(self): - image_id = "FAKE_IMAGE_ID" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_get_base_image_by_id(image_id) - - def test_ex_create_anti_affinity_rule(self): - node_list = self.driver.list_nodes() - success = self.driver.ex_create_anti_affinity_rule([node_list[0], node_list[1]]) - self.assertTrue(success) - - def test_ex_create_anti_affinity_rule_TUPLE(self): - node_list = self.driver.list_nodes() - success = self.driver.ex_create_anti_affinity_rule((node_list[0], node_list[1])) - self.assertTrue(success) - - def test_ex_create_anti_affinity_rule_TUPLE_STR(self): - node_list = self.driver.list_nodes() - success = self.driver.ex_create_anti_affinity_rule((node_list[0].id, node_list[1].id)) - self.assertTrue(success) - - def test_ex_create_anti_affinity_rule_FAIL_STR(self): - node_list = "string" - with self.assertRaises(TypeError): - self.driver.ex_create_anti_affinity_rule(node_list) - - def test_ex_create_anti_affinity_rule_FAIL_EXISTING(self): - node_list = self.driver.list_nodes() - DimensionDataMockHttp.type = "FAIL_EXISTING" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_create_anti_affinity_rule((node_list[0], node_list[1])) - - def test_ex_delete_anti_affinity_rule(self): - net_domain = self.driver.ex_list_network_domains()[0] - rule = self.driver.ex_list_anti_affinity_rules(network_domain=net_domain)[0] - success = self.driver.ex_delete_anti_affinity_rule(rule) - self.assertTrue(success) - - def test_ex_delete_anti_affinity_rule_STR(self): - net_domain = self.driver.ex_list_network_domains()[0] - rule = self.driver.ex_list_anti_affinity_rules(network_domain=net_domain)[0] - success = self.driver.ex_delete_anti_affinity_rule(rule.id) - self.assertTrue(success) - - def test_ex_delete_anti_affinity_rule_FAIL(self): - net_domain = self.driver.ex_list_network_domains()[0] - rule = self.driver.ex_list_anti_affinity_rules(network_domain=net_domain)[0] - DimensionDataMockHttp.type = "FAIL" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_delete_anti_affinity_rule(rule) - - def test_ex_list_anti_affinity_rules_NETWORK_DOMAIN(self): - net_domain = self.driver.ex_list_network_domains()[0] - rules = self.driver.ex_list_anti_affinity_rules(network_domain=net_domain) - self.assertTrue(isinstance(rules, list)) - self.assertEqual(len(rules), 2) - self.assertTrue(isinstance(rules[0].id, str)) - self.assertTrue(isinstance(rules[0].node_list, list)) - - def test_ex_list_anti_affinity_rules_NETWORK(self): - network = self.driver.list_networks()[0] - rules = self.driver.ex_list_anti_affinity_rules(network=network) - self.assertTrue(isinstance(rules, list)) - self.assertEqual(len(rules), 2) - self.assertTrue(isinstance(rules[0].id, str)) - self.assertTrue(isinstance(rules[0].node_list, list)) - - def test_ex_list_anti_affinity_rules_NODE(self): - node = self.driver.list_nodes()[0] - rules = self.driver.ex_list_anti_affinity_rules(node=node) - self.assertTrue(isinstance(rules, list)) - self.assertEqual(len(rules), 2) - self.assertTrue(isinstance(rules[0].id, str)) - self.assertTrue(isinstance(rules[0].node_list, list)) - - def test_ex_list_anti_affinity_rules_PAGINATED(self): - net_domain = self.driver.ex_list_network_domains()[0] - DimensionDataMockHttp.type = "PAGINATED" - rules = self.driver.ex_list_anti_affinity_rules(network_domain=net_domain) - self.assertTrue(isinstance(rules, list)) - self.assertEqual(len(rules), 4) - self.assertTrue(isinstance(rules[0].id, str)) - self.assertTrue(isinstance(rules[0].node_list, list)) - - def test_ex_list_anti_affinity_rules_ALLFILTERS(self): - net_domain = self.driver.ex_list_network_domains()[0] - DimensionDataMockHttp.type = "ALLFILTERS" - rules = self.driver.ex_list_anti_affinity_rules( - network_domain=net_domain, filter_id="FAKE_ID", filter_state="FAKE_STATE" - ) - self.assertTrue(isinstance(rules, list)) - self.assertEqual(len(rules), 2) - self.assertTrue(isinstance(rules[0].id, str)) - self.assertTrue(isinstance(rules[0].node_list, list)) - - def test_ex_list_anti_affinity_rules_BAD_ARGS(self): - with self.assertRaises(ValueError): - self.driver.ex_list_anti_affinity_rules( - network="fake_network", network_domain="fake_network_domain" - ) - - def test_ex_create_tag_key(self): - success = self.driver.ex_create_tag_key("MyTestKey") - self.assertTrue(success) - - def test_ex_create_tag_key_ALLPARAMS(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "ALLPARAMS" - success = self.driver.ex_create_tag_key( - "MyTestKey", - description="Test Key Desc.", - value_required=False, - display_on_report=False, - ) - self.assertTrue(success) - - def test_ex_create_tag_key_BADREQUEST(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "BADREQUEST" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_create_tag_key("MyTestKey") - - def test_ex_list_tag_keys(self): - tag_keys = self.driver.ex_list_tag_keys() - self.assertTrue(isinstance(tag_keys, list)) - self.assertTrue(isinstance(tag_keys[0], DimensionDataTagKey)) - self.assertTrue(isinstance(tag_keys[0].id, str)) - - def test_ex_list_tag_keys_ALLFILTERS(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "ALLFILTERS" - self.driver.ex_list_tag_keys( - id="fake_id", - name="fake_name", - value_required=False, - display_on_report=False, - ) - - def test_ex_get_tag_by_id(self): - tag = self.driver.ex_get_tag_key_by_id("d047c609-93d7-4bc5-8fc9-732c85840075") - self.assertTrue(isinstance(tag, DimensionDataTagKey)) - - def test_ex_get_tag_by_id_NOEXIST(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "NOEXIST" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_get_tag_key_by_id("d047c609-93d7-4bc5-8fc9-732c85840075") - - def test_ex_get_tag_by_name(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "SINGLE" - tag = self.driver.ex_get_tag_key_by_name("LibcloudTest") - self.assertTrue(isinstance(tag, DimensionDataTagKey)) - - def test_ex_get_tag_by_name_NOEXIST(self): - with self.assertRaises(ValueError): - self.driver.ex_get_tag_key_by_name("LibcloudTest") - - def test_ex_modify_tag_key_NAME(self): - tag_key = self.driver.ex_list_tag_keys()[0] - DimensionDataMockHttp.type = "NAME" - success = self.driver.ex_modify_tag_key(tag_key, name="NewName") - self.assertTrue(success) - - def test_ex_modify_tag_key_NOTNAME(self): - tag_key = self.driver.ex_list_tag_keys()[0] - DimensionDataMockHttp.type = "NOTNAME" - success = self.driver.ex_modify_tag_key( - tag_key, description="NewDesc", value_required=False, display_on_report=True - ) - self.assertTrue(success) - - def test_ex_modify_tag_key_NOCHANGE(self): - tag_key = self.driver.ex_list_tag_keys()[0] - DimensionDataMockHttp.type = "NOCHANGE" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_modify_tag_key(tag_key) - - def test_ex_remove_tag_key(self): - tag_key = self.driver.ex_list_tag_keys()[0] - success = self.driver.ex_remove_tag_key(tag_key) - self.assertTrue(success) - - def test_ex_remove_tag_key_NOEXIST(self): - tag_key = self.driver.ex_list_tag_keys()[0] - DimensionDataMockHttp.type = "NOEXIST" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_remove_tag_key(tag_key) - - def test_ex_apply_tag_to_asset(self): - node = self.driver.list_nodes()[0] - success = self.driver.ex_apply_tag_to_asset(node, "TagKeyName", "FakeValue") - self.assertTrue(success) - - def test_ex_apply_tag_to_asset_NOVALUE(self): - node = self.driver.list_nodes()[0] - DimensionDataMockHttp.type = "NOVALUE" - success = self.driver.ex_apply_tag_to_asset(node, "TagKeyName") - self.assertTrue(success) - - def test_ex_apply_tag_to_asset_NOTAGKEY(self): - node = self.driver.list_nodes()[0] - DimensionDataMockHttp.type = "NOTAGKEY" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_apply_tag_to_asset(node, "TagKeyNam") - - def test_ex_apply_tag_to_asset_BADASSETTYPE(self): - network = self.driver.list_networks()[0] - DimensionDataMockHttp.type = "NOTAGKEY" - with self.assertRaises(TypeError): - self.driver.ex_apply_tag_to_asset(network, "TagKeyNam") - - def test_ex_remove_tag_from_asset(self): - node = self.driver.list_nodes()[0] - success = self.driver.ex_remove_tag_from_asset(node, "TagKeyName") - self.assertTrue(success) - - def test_ex_remove_tag_from_asset_NOTAG(self): - node = self.driver.list_nodes()[0] - DimensionDataMockHttp.type = "NOTAG" - with self.assertRaises(DimensionDataAPIException): - self.driver.ex_remove_tag_from_asset(node, "TagKeyNam") - - def test_ex_list_tags(self): - tags = self.driver.ex_list_tags() - self.assertTrue(isinstance(tags, list)) - self.assertTrue(isinstance(tags[0], DimensionDataTag)) - self.assertTrue(len(tags) == 3) - - def test_ex_list_tags_ALLPARAMS(self): - self.driver.connection._get_orgId() - DimensionDataMockHttp.type = "ALLPARAMS" - tags = self.driver.ex_list_tags( - asset_id="fake_asset_id", - asset_type="fake_asset_type", - location="fake_location", - tag_key_name="fake_tag_key_name", - tag_key_id="fake_tag_key_id", - value="fake_value", - value_required=False, - display_on_report=False, - ) - self.assertTrue(isinstance(tags, list)) - self.assertTrue(isinstance(tags[0], DimensionDataTag)) - self.assertTrue(len(tags) == 3) - - def test_priv_location_to_location_id(self): - location = self.driver.ex_get_location_by_id("NA9") - self.assertEqual(self.driver._location_to_location_id(location), "NA9") - - def test_priv_location_to_location_id_STR(self): - self.assertEqual(self.driver._location_to_location_id("NA9"), "NA9") - - def test_priv_location_to_location_id_TYPEERROR(self): - with self.assertRaises(TypeError): - self.driver._location_to_location_id([1, 2, 3]) - - def test_priv_image_needs_auth_os_img(self): - image = self.driver.list_images()[1] - self.assertTrue(self.driver._image_needs_auth(image)) - - def test_priv_image_needs_auth_os_img_STR(self): - image = self.driver.list_images()[1].id - self.assertTrue(self.driver._image_needs_auth(image)) - - def test_priv_image_needs_auth_cust_img_windows(self): - image = self.driver.ex_list_customer_images()[1] - self.assertTrue(self.driver._image_needs_auth(image)) - - def test_priv_image_needs_auth_cust_img_windows_STR(self): - image = self.driver.ex_list_customer_images()[1].id - self.assertTrue(self.driver._image_needs_auth(image)) - - def test_priv_image_needs_auth_cust_img_linux(self): - image = self.driver.ex_list_customer_images()[0] - self.assertTrue(not self.driver._image_needs_auth(image)) - - def test_priv_image_needs_auth_cust_img_linux_STR(self): - image = self.driver.ex_list_customer_images()[0].id - self.assertTrue(not self.driver._image_needs_auth(image)) - - def test_summary_usage_report(self): - report = self.driver.ex_summary_usage_report("2016-06-01", "2016-06-30") - report_content = report - self.assertEqual(len(report_content), 13) - self.assertEqual(len(report_content[0]), 6) - - def test_detailed_usage_report(self): - report = self.driver.ex_detailed_usage_report("2016-06-01", "2016-06-30") - report_content = report - self.assertEqual(len(report_content), 42) - self.assertEqual(len(report_content[0]), 4) - - def test_audit_log_report(self): - report = self.driver.ex_audit_log_report("2016-06-01", "2016-06-30") - report_content = report - self.assertEqual(len(report_content), 25) - self.assertEqual(report_content[2][2], "OEC_SYSTEM") - - def test_ex_list_ip_address_list(self): - net_domain = self.driver.ex_list_network_domains()[0] - ip_list = self.driver.ex_list_ip_address_list(ex_network_domain=net_domain) - self.assertTrue(isinstance(ip_list, list)) - self.assertEqual(len(ip_list), 4) - self.assertTrue(isinstance(ip_list[0].name, str)) - self.assertTrue(isinstance(ip_list[0].description, str)) - self.assertTrue(isinstance(ip_list[0].ip_version, str)) - self.assertTrue(isinstance(ip_list[0].state, str)) - self.assertTrue(isinstance(ip_list[0].create_time, str)) - self.assertTrue(isinstance(ip_list[0].child_ip_address_lists, list)) - self.assertEqual(len(ip_list[1].child_ip_address_lists), 1) - self.assertTrue(isinstance(ip_list[1].child_ip_address_lists[0].name, str)) - - def test_ex_get_ip_address_list(self): - net_domain = self.driver.ex_list_network_domains()[0] - DimensionDataMockHttp.type = "FILTERBYNAME" - ip_list = self.driver.ex_get_ip_address_list( - ex_network_domain=net_domain.id, - ex_ip_address_list_name="Test_IP_Address_List_3", - ) - self.assertTrue(isinstance(ip_list, list)) - self.assertEqual(len(ip_list), 1) - self.assertTrue(isinstance(ip_list[0].name, str)) - self.assertTrue(isinstance(ip_list[0].description, str)) - self.assertTrue(isinstance(ip_list[0].ip_version, str)) - self.assertTrue(isinstance(ip_list[0].state, str)) - self.assertTrue(isinstance(ip_list[0].create_time, str)) - ips = ip_list[0].ip_address_collection - self.assertEqual(len(ips), 3) - self.assertTrue(isinstance(ips[0].begin, str)) - self.assertTrue(isinstance(ips[0].prefix_size, str)) - self.assertTrue(isinstance(ips[2].end, str)) - - def test_ex_create_ip_address_list_FAIL(self): - net_domain = self.driver.ex_list_network_domains()[0] - - with self.assertRaises(TypeError): - self.driver.ex_create_ip_address_list(ex_network_domain=net_domain.id) - - def test_ex_create_ip_address_list(self): - name = "Test_IP_Address_List_3" - description = "Test Description" - ip_version = "IPV4" - child_ip_address_list_id = "0291ef78-4059-4bc1-b433-3f6ad698dc41" - child_ip_address_list = DimensionDataChildIpAddressList( - id=child_ip_address_list_id, name="test_child_ip_addr_list" - ) - net_domain = self.driver.ex_list_network_domains()[0] - ip_address_1 = DimensionDataIpAddress(begin="190.2.2.100") - ip_address_2 = DimensionDataIpAddress(begin="190.2.2.106", end="190.2.2.108") - ip_address_3 = DimensionDataIpAddress(begin="190.2.2.0", prefix_size="24") - ip_address_collection = [ip_address_1, ip_address_2, ip_address_3] - - # Create IP Address List - success = self.driver.ex_create_ip_address_list( - ex_network_domain=net_domain, - name=name, - ip_version=ip_version, - description=description, - ip_address_collection=ip_address_collection, - child_ip_address_list=child_ip_address_list, - ) - - self.assertTrue(success) - - def test_ex_create_ip_address_list_STR(self): - name = "Test_IP_Address_List_3" - description = "Test Description" - ip_version = "IPV4" - child_ip_address_list_id = "0291ef78-4059-4bc1-b433-3f6ad698dc41" - net_domain = self.driver.ex_list_network_domains()[0] - ip_address_1 = DimensionDataIpAddress(begin="190.2.2.100") - ip_address_2 = DimensionDataIpAddress(begin="190.2.2.106", end="190.2.2.108") - ip_address_3 = DimensionDataIpAddress(begin="190.2.2.0", prefix_size="24") - ip_address_collection = [ip_address_1, ip_address_2, ip_address_3] - - # Create IP Address List - success = self.driver.ex_create_ip_address_list( - ex_network_domain=net_domain.id, - name=name, - ip_version=ip_version, - description=description, - ip_address_collection=ip_address_collection, - child_ip_address_list=child_ip_address_list_id, - ) - - self.assertTrue(success) - - def test_ex_edit_ip_address_list(self): - ip_address_1 = DimensionDataIpAddress(begin="190.2.2.111") - ip_address_collection = [ip_address_1] - - child_ip_address_list = DimensionDataChildIpAddressList( - id="2221ef78-4059-4bc1-b433-3f6ad698dc41", - name="test_child_ip_address_list edited", - ) - - ip_address_list = DimensionDataIpAddressList( - id="1111ef78-4059-4bc1-b433-3f6ad698d111", - name="test ip address list edited", - ip_version="IPv4", - description="test", - ip_address_collection=ip_address_collection, - child_ip_address_lists=child_ip_address_list, - state="NORMAL", - create_time="2015-09-29T02:49:45", - ) - - success = self.driver.ex_edit_ip_address_list( - ex_ip_address_list=ip_address_list, - description="test ip address list", - ip_address_collection=ip_address_collection, - child_ip_address_lists=child_ip_address_list, - ) - - self.assertTrue(success) - - def test_ex_edit_ip_address_list_STR(self): - ip_address_1 = DimensionDataIpAddress(begin="190.2.2.111") - ip_address_collection = [ip_address_1] - - child_ip_address_list = DimensionDataChildIpAddressList( - id="2221ef78-4059-4bc1-b433-3f6ad698dc41", - name="test_child_ip_address_list edited", - ) - - success = self.driver.ex_edit_ip_address_list( - ex_ip_address_list="84e34850-595d- 436e-a885-7cd37edb24a4", - description="test ip address list", - ip_address_collection=ip_address_collection, - child_ip_address_lists=child_ip_address_list, - ) - - self.assertTrue(success) - - def test_ex_delete_ip_address_list(self): - child_ip_address_list = DimensionDataChildIpAddressList( - id="2221ef78-4059-4bc1-b433-3f6ad698dc41", - name="test_child_ip_address_list edited", - ) - - ip_address_list = DimensionDataIpAddressList( - id="1111ef78-4059-4bc1-b433-3f6ad698d111", - name="test ip address list edited", - ip_version="IPv4", - description="test", - ip_address_collection=None, - child_ip_address_lists=child_ip_address_list, - state="NORMAL", - create_time="2015-09-29T02:49:45", - ) - - success = self.driver.ex_delete_ip_address_list(ex_ip_address_list=ip_address_list) - self.assertTrue(success) - - def test_ex_delete_ip_address_list_STR(self): - success = self.driver.ex_delete_ip_address_list( - ex_ip_address_list="111ef78-4059-4bc1-b433-3f6ad698d111" - ) - self.assertTrue(success) - - def test_ex_list_portlist(self): - net_domain = self.driver.ex_list_network_domains()[0] - portlist = self.driver.ex_list_portlist(ex_network_domain=net_domain) - self.assertTrue(isinstance(portlist, list)) - self.assertEqual(len(portlist), 3) - self.assertTrue(isinstance(portlist[0].name, str)) - self.assertTrue(isinstance(portlist[0].description, str)) - self.assertTrue(isinstance(portlist[0].state, str)) - self.assertTrue(isinstance(portlist[0].port_collection, list)) - self.assertTrue(isinstance(portlist[0].port_collection[0].begin, str)) - self.assertTrue(isinstance(portlist[0].port_collection[0].end, str)) - self.assertTrue(isinstance(portlist[0].child_portlist_list, list)) - self.assertTrue(isinstance(portlist[0].child_portlist_list[0].id, str)) - self.assertTrue(isinstance(portlist[0].child_portlist_list[0].name, str)) - self.assertTrue(isinstance(portlist[0].create_time, str)) - - def test_ex_get_port_list(self): - net_domain = self.driver.ex_list_network_domains()[0] - - portlist_id = self.driver.ex_list_portlist(ex_network_domain=net_domain)[0].id - - portlist = self.driver.ex_get_portlist(ex_portlist_id=portlist_id) - self.assertTrue(isinstance(portlist, DimensionDataPortList)) - - self.assertTrue(isinstance(portlist.name, str)) - self.assertTrue(isinstance(portlist.description, str)) - self.assertTrue(isinstance(portlist.state, str)) - self.assertTrue(isinstance(portlist.port_collection, list)) - self.assertTrue(isinstance(portlist.port_collection[0].begin, str)) - self.assertTrue(isinstance(portlist.port_collection[0].end, str)) - self.assertTrue(isinstance(portlist.child_portlist_list, list)) - self.assertTrue(isinstance(portlist.child_portlist_list[0].id, str)) - self.assertTrue(isinstance(portlist.child_portlist_list[0].name, str)) - self.assertTrue(isinstance(portlist.create_time, str)) - - def test_ex_get_portlist_STR(self): - net_domain = self.driver.ex_list_network_domains()[0] - - portlist = self.driver.ex_list_portlist(ex_network_domain=net_domain)[0] - - port_list = self.driver.ex_get_portlist(ex_portlist_id=portlist.id) - self.assertTrue(isinstance(port_list, DimensionDataPortList)) - - self.assertTrue(isinstance(port_list.name, str)) - self.assertTrue(isinstance(port_list.description, str)) - self.assertTrue(isinstance(port_list.state, str)) - self.assertTrue(isinstance(port_list.port_collection, list)) - self.assertTrue(isinstance(port_list.port_collection[0].begin, str)) - self.assertTrue(isinstance(port_list.port_collection[0].end, str)) - self.assertTrue(isinstance(port_list.child_portlist_list, list)) - self.assertTrue(isinstance(port_list.child_portlist_list[0].id, str)) - self.assertTrue(isinstance(port_list.child_portlist_list[0].name, str)) - self.assertTrue(isinstance(port_list.create_time, str)) - - def test_ex_create_portlist_NOCHILDPORTLIST(self): - name = "Test_Port_List" - description = "Test Description" - - net_domain = self.driver.ex_list_network_domains()[0] - - port_1 = DimensionDataPort(begin="8080") - port_2 = DimensionDataIpAddress(begin="8899", end="9023") - port_collection = [port_1, port_2] - - # Create IP Address List - success = self.driver.ex_create_portlist( - ex_network_domain=net_domain, - name=name, - description=description, - port_collection=port_collection, - ) - - self.assertTrue(success) - - def test_ex_create_portlist(self): - name = "Test_Port_List" - description = "Test Description" - - net_domain = self.driver.ex_list_network_domains()[0] - - port_1 = DimensionDataPort(begin="8080") - port_2 = DimensionDataIpAddress(begin="8899", end="9023") - port_collection = [port_1, port_2] - - child_port_1 = DimensionDataChildPortList( - id="333174a2-ae74-4658-9e56-50fc90e086cf", name="test port 1" - ) - child_port_2 = DimensionDataChildPortList( - id="311174a2-ae74-4658-9e56-50fc90e04444", name="test port 2" - ) - child_ports = [child_port_1, child_port_2] - - # Create IP Address List - success = self.driver.ex_create_portlist( - ex_network_domain=net_domain, - name=name, - description=description, - port_collection=port_collection, - child_portlist_list=child_ports, - ) - - self.assertTrue(success) - - def test_ex_create_portlist_STR(self): - name = "Test_Port_List" - description = "Test Description" - - net_domain = self.driver.ex_list_network_domains()[0] - - port_1 = DimensionDataPort(begin="8080") - port_2 = DimensionDataIpAddress(begin="8899", end="9023") - port_collection = [port_1, port_2] - - child_port_1 = DimensionDataChildPortList( - id="333174a2-ae74-4658-9e56-50fc90e086cf", name="test port 1" - ) - child_port_2 = DimensionDataChildPortList( - id="311174a2-ae74-4658-9e56-50fc90e04444", name="test port 2" - ) - child_ports_ids = [child_port_1.id, child_port_2.id] - - # Create IP Address List - success = self.driver.ex_create_portlist( - ex_network_domain=net_domain.id, - name=name, - description=description, - port_collection=port_collection, - child_portlist_list=child_ports_ids, - ) - - self.assertTrue(success) - - def test_ex_edit_portlist(self): - net_domain = self.driver.ex_list_network_domains()[0] - portlist = self.driver.ex_list_portlist(net_domain)[0] - - description = "Test Description" - - port_1 = DimensionDataPort(begin="8080") - port_2 = DimensionDataIpAddress(begin="8899", end="9023") - port_collection = [port_1, port_2] - - child_port_1 = DimensionDataChildPortList( - id="333174a2-ae74-4658-9e56-50fc90e086cf", name="test port 1" - ) - child_port_2 = DimensionDataChildPortList( - id="311174a2-ae74-4658-9e56-50fc90e04444", name="test port 2" - ) - child_ports = [child_port_1.id, child_port_2.id] - - # Create IP Address List - success = self.driver.ex_edit_portlist( - ex_portlist=portlist, - description=description, - port_collection=port_collection, - child_portlist_list=child_ports, - ) - self.assertTrue(success) - - def test_ex_edit_portlist_STR(self): - portlist_id = "484174a2-ae74-4658-9e56-50fc90e086cf" - description = "Test Description" - - port_1 = DimensionDataPort(begin="8080") - port_2 = DimensionDataIpAddress(begin="8899", end="9023") - port_collection = [port_1, port_2] - - child_port_1 = DimensionDataChildPortList( - id="333174a2-ae74-4658-9e56-50fc90e086cf", name="test port 1" - ) - child_port_2 = DimensionDataChildPortList( - id="311174a2-ae74-4658-9e56-50fc90e04444", name="test port 2" - ) - child_ports_ids = [child_port_1.id, child_port_2.id] - - # Create IP Address List - success = self.driver.ex_edit_portlist( - ex_portlist=portlist_id, - description=description, - port_collection=port_collection, - child_portlist_list=child_ports_ids, - ) - self.assertTrue(success) - - def test_ex_delete_portlist(self): - net_domain = self.driver.ex_list_network_domains()[0] - portlist = self.driver.ex_list_portlist(net_domain)[0] - - success = self.driver.ex_delete_portlist(ex_portlist=portlist) - self.assertTrue(success) - - def test_ex_delete_portlist_STR(self): - net_domain = self.driver.ex_list_network_domains()[0] - portlist = self.driver.ex_list_portlist(net_domain)[0] - - success = self.driver.ex_delete_portlist(ex_portlist=portlist.id) - self.assertTrue(success) - - def test_import_image(self): - tag_dictionaries = {"tagkey1_name": "dev test", "tagkey2_name": None} - success = self.driver.import_image( - ovf_package_name="aTestGocToNGoc2_export2.mf", - name="Libcloud NGOCImage_New 2", - description="test", - cluster_id="QA1_N2_VMWARE_1-01", - is_guest_os_customization="false", - tagkey_name_value_dictionaries=tag_dictionaries, - ) - self.assertTrue(success) - - def test_import_image_error_too_many_choice(self): - tag_dictionaries = {"tagkey1_name": "dev test", "tagkey2_name": None} - - with self.assertRaises(ValueError): - self.driver.import_image( - ovf_package_name="aTestGocToNGoc2_export2.mf", - name="Libcloud NGOCImage_New 2", - description="test", - cluster_id="QA1_N2_VMWARE_1-01", - datacenter_id="QA1_N1_VMWARE_1", - is_guest_os_customization="false", - tagkey_name_value_dictionaries=tag_dictionaries, - ) - - def test_import_image_error_missing_choice(self): - tag_dictionaries = {"tagkey1_name": "dev test", "tagkey2_name": None} - - with self.assertRaises(ValueError): - self.driver.import_image( - ovf_package_name="aTestGocToNGoc2_export2.mf", - name="Libcloud NGOCImage_New 2", - description="test", - cluster_id=None, - datacenter_id=None, - is_guest_os_customization="false", - tagkey_name_value_dictionaries=tag_dictionaries, - ) - - def test_exchange_nic_vlans(self): - success = self.driver.ex_exchange_nic_vlans( - nic_id_1="a4b4b42b-ccb5-416f-b052-ce7cb7fdff12", - nic_id_2="b39d09b8-ea65-424a-8fa6-c6f5a98afc69", - ) - self.assertTrue(success) - - def test_change_nic_network_adapter(self): - success = self.driver.ex_change_nic_network_adapter( - nic_id="0c55c269-20a5-4fec-8054-22a245a48fe4", network_adapter_name="E1000" - ) - self.assertTrue(success) - - def test_ex_create_node_uncustomized_mcp2_using_vlan(self): - # Get VLAN - vlan = self.driver.ex_get_vlan("0e56433f-d808-4669-821d-812769517ff8") - - # Create node using vlan instead of private IPv4 - node = self.driver.ex_create_node_uncustomized( - name="test_server_05", - image="fake_customer_image", - ex_network_domain="fakenetworkdomain", - ex_is_started=False, - 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=vlan, - ex_primary_nic_network_adapter=None, - ex_additional_nics=None, - ex_disks=None, - ex_tagid_value_pairs=None, - ex_tagname_value_pairs=None, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - - def test_ex_create_node_uncustomized_mcp2_using_ipv4(self): - node = self.driver.ex_create_node_uncustomized( - name="test_server_05", - image="fake_customer_image", - ex_network_domain="fakenetworkdomain", - ex_is_started=False, - ex_description=None, - ex_cluster_id=None, - ex_cpu_specification=None, - ex_memory_gb=None, - ex_primary_nic_private_ipv4="10.0.0.1", - 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, - ) - self.assertEqual(node.id, "e75ead52-692f-4314-8725-c8a4f4d13a87") - - -class InvalidRequestError(Exception): - def __init__(self, tag): - super().__init__("Invalid Request - %s" % tag) - - -class DimensionDataMockHttp(MockHttp): - fixtures = ComputeFileFixtures("dimensiondata") - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_report_usage( - self, method, url, body, headers - ): - body = self.fixtures.load("summary_usage_report.csv") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_report_usageDetailed( - self, method, url, body, headers - ): - body = self.fixtures.load("detailed_usage_report.csv") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_auditlog(self, method, url, body, headers): - body = self.fixtures.load("audit_log.csv") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): - return (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED]) - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_PAGINATED(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_ALLFILTERS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_base_image(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_base_image.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_base_imageWithDiskSpeed(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_base_imageWithDiskSpeed.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_pendingDeploy( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_pendingDeploy.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_datacenter(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_datacenter.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11(self, method, url, body, headers): - body = None - action = url.split("?")[-1] - - if action == "restart": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_restart.xml" - ) - elif action == "shutdown": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_shutdown.xml" - ) - elif action == "delete": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_delete.xml" - ) - elif action == "start": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_start.xml" - ) - elif action == "poweroff": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_poweroff.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_INPROGRESS( - self, method, url, body, headers - ): - body = None - action = url.split("?")[-1] - - if action == "restart": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_restart_INPROGRESS.xml" - ) - elif action == "shutdown": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_shutdown_INPROGRESS.xml" - ) - elif action == "delete": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_delete_INPROGRESS.xml" - ) - elif action == "start": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_start_INPROGRESS.xml" - ) - elif action == "poweroff": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_11_poweroff_INPROGRESS.xml" - ) - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server(self, method, url, body, headers): - body = self.fixtures.load("_oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkWithLocation( - self, method, url, body, headers - ): - if method == "POST": - request = ET.fromstring(body) - - if request.tag != "{http://oec.api.opsource.net/schemas/network}NewNetworkWithLocation": - raise InvalidRequestError(request.tag) - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkWithLocation.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkWithLocation_NA9( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkWithLocation.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_4bba37be_506f_11e3_b29c_001517c4643e( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_4bba37be_506f_11e3_b29c_001517c4643e.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1_changeSize( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1_changeSize.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1_changeSpeed( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1_changeSpeed.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1( - self, method, url, body, headers - ): - action = url.split("?")[-1] - - if action == "delete": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_disk_1.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87( - self, method, url, body, headers - ): - if method == "GET": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - if method == "POST": - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_POST.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_create.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_FAIL_EXISTING( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_create_FAIL.xml" - ) - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_07e3621a_a920_4a9a_943c_d8021f27f418( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_delete.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_07e3621a_a920_4a9a_943c_d8021f27f418_FAIL( - self, method, url, body, headers - ): - body = self.fixtures.load( - "oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_delete_FAIL.xml" - ) - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server(self, method, url, body, headers): - body = self.fixtures.load("server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_deleteServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer_INPROGRESS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_deleteServer_RESOURCEBUSY.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}rebootServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_rebootServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer_INPROGRESS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}rebootServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_rebootServer_RESOURCEBUSY.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server( - self, method, url, body, headers - ): - if url.endswith("datacenterId=NA3"): - body = self.fixtures.load("2_4/server_server_NA3.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - body = self.fixtures.load("2_4/server_server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGESIZE50( - self, method, url, body, headers - ): - if not url.endswith("pageSize=50"): - raise ValueError("pageSize is not set as expected") - body = self.fixtures.load("2_4/server_server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_EMPTY( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_paginated_empty.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGED_THEN_EMPTY( - self, method, url, body, headers - ): - if "pageNumber=2" in url: - body = self.fixtures.load("server_server_paginated_empty.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - else: - body = self.fixtures.load("2_4/server_server_paginated.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGINATED( - self, method, url, body, headers - ): - if "pageNumber=2" in url: - body = self.fixtures.load("2_4/server_server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - else: - body = self.fixtures.load("2_4/server_server_paginated.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGINATEDEMPTY( - self, method, url, body, headers - ): - body = self.fixtures.load("server_server_paginated_empty.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "datacenterId": - assert value == "fake_loc" - elif key == "networkId": - assert value == "fake_network" - elif key == "networkDomainId": - assert value == "fake_network_domain" - elif key == "vlanId": - assert value == "fake_vlan" - elif key == "ipv6": - assert value == "fake_ipv6" - elif key == "privateIpv4": - assert value == "fake_ipv4" - elif key == "name": - assert value == "fake_name" - elif key == "state": - assert value == "fake_state" - elif key == "started": - assert value == "True" - elif key == "deployed": - assert value == "True" - elif key == "sourceImageId": - assert value == "fake_image" - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("2_4/server_server.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule( - self, method, url, body, headers - ): - body = self.fixtures.load("server_antiAffinityRule_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_ALLFILTERS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "id": - assert value == "FAKE_ID" - elif key == "state": - assert value == "FAKE_STATE" - elif key == "pageSize": - assert value == "250" - elif key == "networkDomainId": - pass - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("server_antiAffinityRule_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_PAGINATED( - self, method, url, body, headers - ): - if "pageNumber=2" in url: - body = self.fixtures.load("server_antiAffinityRule_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - else: - body = self.fixtures.load("server_antiAffinityRule_list_PAGINATED.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter( - self, method, url, body, headers - ): - if url.endswith("id=NA9"): - body = self.fixtures.load("infrastructure_datacenter_NA9.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - body = self.fixtures.load("infrastructure_datacenter.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_ALLFILTERS( - self, method, url, body, headers - ): - if url.endswith("id=NA9"): - body = self.fixtures.load("infrastructure_datacenter_NA9.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - body = self.fixtures.load("infrastructure_datacenter.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_updateVmwareTools( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}updateVmwareTools": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_updateVmwareTools.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}startServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_startServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer_INPROGRESS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}startServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_startServer_INPROGRESS.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}shutdownServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_shutdownServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer_INPROGRESS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}shutdownServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_shutdownServer_INPROGRESS.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_resetServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}resetServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_resetServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}powerOffServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_powerOffServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer_INPROGRESS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}powerOffServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_powerOffServer_INPROGRESS.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_11_INPROGRESS( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/server_GetServer.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain( - self, method, url, body, headers - ): - body = self.fixtures.load("network_networkDomain.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_ALLFILTERS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "datacenterId": - assert value == "fake_location" - elif key == "type": - assert value == "fake_plan" - elif key == "name": - assert value == "fake_name" - elif key == "state": - assert value == "fake_state" - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("network_networkDomain.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan( - self, method, url, body, headers - ): - body = self.fixtures.load("network_vlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_ALLFILTERS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "datacenterId": - assert value == "fake_location" - elif key == "networkDomainId": - assert value == "fake_network_domain" - elif key == "ipv6Address": - assert value == "fake_ipv6" - elif key == "privateIpv4Address": - assert value == "fake_ipv4" - elif key == "name": - assert value == "fake_name" - elif key == "state": - assert value == "fake_state" - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("network_vlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deployServer": - raise InvalidRequestError(request.tag) - - # Make sure the we either have a network tag with an IP or networkId - # Or Network info with a primary nic that has privateip or vlanid - network = request.find(fixxpath("network", TYPES_URN)) - network_info = request.find(fixxpath("networkInfo", TYPES_URN)) - - if network is not None: - if network_info is not None: - raise InvalidRequestError("Request has both MCP1 and MCP2 values") - ipv4 = findtext(network, "privateIpv4", TYPES_URN) - networkId = findtext(network, "networkId", TYPES_URN) - - if ipv4 is None and networkId is None: - raise InvalidRequestError( - "Invalid request MCP1 requests need privateIpv4 or networkId" - ) - elif network_info is not None: - if network is not None: - raise InvalidRequestError("Request has both MCP1 and MCP2 values") - primary_nic = network_info.find(fixxpath("primaryNic", TYPES_URN)) - ipv4 = findtext(primary_nic, "privateIpv4", TYPES_URN) - vlanId = findtext(primary_nic, "vlanId", TYPES_URN) - - if ipv4 is None and vlanId is None: - raise InvalidRequestError( - "Invalid request MCP2 requests need privateIpv4 or vlanId" - ) - else: - raise InvalidRequestError( - "Invalid request, does not have network or network_info in XML" - ) - - body = self.fixtures.load("server_deployServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployNetworkDomain( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deployNetworkDomain": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deployNetworkDomain.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be( - self, method, url, body, headers - ): - body = self.fixtures.load("network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be_ALLFILTERS( - self, method, url, body, headers - ): - body = self.fixtures.load("network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editNetworkDomain( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}editNetworkDomain": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_editNetworkDomain.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNetworkDomain( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteNetworkDomain": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deleteNetworkDomain.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployVlan( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deployVlan": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deployVlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_0e56433f_d808_4669_821d_812769517ff8( - self, method, url, body, headers - ): - body = self.fixtures.load("network_vlan_0e56433f_d808_4669_821d_812769517ff8.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editVlan( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}editVlan": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_editVlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteVlan( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteVlan": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deleteVlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_expandVlan( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}expandVlan": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_expandVlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_addPublicIpBlock( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}addPublicIpBlock": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_addPublicIpBlock.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_4487241a_f0ca_11e3_9315_d4bed9b167ba( - self, method, url, body, headers - ): - body = self.fixtures.load("network_publicIpBlock_4487241a_f0ca_11e3_9315_d4bed9b167ba.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock( - self, method, url, body, headers - ): - body = self.fixtures.load("network_publicIpBlock.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8( - self, method, url, body, headers - ): - body = self.fixtures.load("network_publicIpBlock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_removePublicIpBlock( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}removePublicIpBlock": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_removePublicIpBlock.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule( - self, method, url, body, headers - ): - body = self.fixtures.load("network_firewallRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createFirewallRule( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}createFirewallRule": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_createFirewallRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule_d0a20f59_77b9_4f28_a63b_e58496b73a6c( - self, method, url, body, headers - ): - body = self.fixtures.load("network_firewallRule_d0a20f59_77b9_4f28_a63b_e58496b73a6c.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editFirewallRule( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}editFirewallRule": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_editFirewallRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteFirewallRule( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteFirewallRule": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deleteFirewallRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createNatRule( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}createNatRule": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_createNatRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule( - self, method, url, body, headers - ): - body = self.fixtures.load("network_natRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule_2187a636_7ebb_49a1_a2ff_5d617f496dce( - self, method, url, body, headers - ): - body = self.fixtures.load("network_natRule_2187a636_7ebb_49a1_a2ff_5d617f496dce.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNatRule( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteNatRule": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("network_deleteNatRule.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_addNic( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}addNic": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_addNic.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_removeNic( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}removeNic": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_removeNic.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_disableServerMonitoring( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}disableServerMonitoring": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_disableServerMonitoring.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_enableServerMonitoring( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}enableServerMonitoring": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_enableServerMonitoring.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeServerMonitoringPlan( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}changeServerMonitoringPlan": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_changeServerMonitoringPlan.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/image_osImage.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_c14b1a46_2428_44c1_9c1a_b20e6418d08c( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/image_osImage_c14b1a46_2428_44c1_9c1a_b20e6418d08c.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_6b4fb0c7_a57b_4f58_b59c_9958f94f971a( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/image_osImage_6b4fb0c7_a57b_4f58_b59c_9958f94f971a.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d( - self, method, url, body, headers - ): - body = self.fixtures.load("image_osImage_BAD_REQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c( - self, method, url, body, headers - ): - body = self.fixtures.load("image_osImage_BAD_REQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_FAKE_IMAGE_ID( - self, method, url, body, headers - ): - body = self.fixtures.load("image_osImage_BAD_REQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/image_customerImage.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d( - self, method, url, body, headers - ): - body = self.fixtures.load( - "2_4/image_customerImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c( - self, method, url, body, headers - ): - body = self.fixtures.load( - "2_4/image_customerImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c.xml" - ) - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_FAKE_IMAGE_ID( - self, method, url, body, headers - ): - body = self.fixtures.load("image_customerImage_BAD_REQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_reconfigureServer( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}reconfigureServer": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("server_reconfigureServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer( - self, method, url, body, headers - ): - body = self.fixtures.load("server_cleanServer.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_addDisk( - self, method, url, body, headers - ): - body = self.fixtures.load("server_addDisk.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_removeDisk( - self, method, url, body, headers - ): - body = self.fixtures.load("server_removeDisk.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_createTagKey( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}createTagKey": - raise InvalidRequestError(request.tag) - name = findtext(request, "name", TYPES_URN) - description = findtext(request, "description", TYPES_URN) - value_required = findtext(request, "valueRequired", TYPES_URN) - display_on_report = findtext(request, "displayOnReport", TYPES_URN) - - if name is None: - raise ValueError("Name must have a value in the request") - - if description is not None: - raise ValueError("Default description for a tag should be blank") - - if value_required is None or value_required != "true": - raise ValueError("Default valueRequired should be true") - - if display_on_report is None or display_on_report != "true": - raise ValueError("Default displayOnReport should be true") - - body = self.fixtures.load("tag_createTagKey.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_createTagKey_ALLPARAMS( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}createTagKey": - raise InvalidRequestError(request.tag) - name = findtext(request, "name", TYPES_URN) - description = findtext(request, "description", TYPES_URN) - value_required = findtext(request, "valueRequired", TYPES_URN) - display_on_report = findtext(request, "displayOnReport", TYPES_URN) - - if name is None: - raise ValueError("Name must have a value in the request") - - if description is None: - raise ValueError("Description should have a value") - - if value_required is None or value_required != "false": - raise ValueError("valueRequired should be false") - - if display_on_report is None or display_on_report != "false": - raise ValueError("displayOnReport should be false") - - body = self.fixtures.load("tag_createTagKey.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_createTagKey_BADREQUEST( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_createTagKey_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tagKey(self, method, url, body, headers): - body = self.fixtures.load("tag_tagKey_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tagKey_SINGLE( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_tagKey_list_SINGLE.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tagKey_ALLFILTERS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "id": - assert value == "fake_id" - elif key == "name": - assert value == "fake_name" - elif key == "valueRequired": - assert value == "false" - elif key == "displayOnReport": - assert value == "false" - elif key == "pageSize": - assert value == "250" - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("tag_tagKey_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tagKey_d047c609_93d7_4bc5_8fc9_732c85840075( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_tagKey_5ab77f5f_5aa9_426f_8459_4eab34e03d54.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tagKey_d047c609_93d7_4bc5_8fc9_732c85840075_NOEXIST( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_tagKey_5ab77f5f_5aa9_426f_8459_4eab34e03d54_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_editTagKey_NAME( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}editTagKey": - raise InvalidRequestError(request.tag) - name = findtext(request, "name", TYPES_URN) - description = findtext(request, "description", TYPES_URN) - value_required = findtext(request, "valueRequired", TYPES_URN) - display_on_report = findtext(request, "displayOnReport", TYPES_URN) - - if name is None: - raise ValueError("Name must have a value in the request") - - if description is not None: - raise ValueError("Description should be empty") - - if value_required is not None: - raise ValueError("valueRequired should be empty") - - if display_on_report is not None: - raise ValueError("displayOnReport should be empty") - body = self.fixtures.load("tag_editTagKey.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_editTagKey_NOTNAME( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}editTagKey": - raise InvalidRequestError(request.tag) - name = findtext(request, "name", TYPES_URN) - description = findtext(request, "description", TYPES_URN) - value_required = findtext(request, "valueRequired", TYPES_URN) - display_on_report = findtext(request, "displayOnReport", TYPES_URN) - - if name is not None: - raise ValueError("Name should be empty") - - if description is None: - raise ValueError("Description should not be empty") - - if value_required is None: - raise ValueError("valueRequired should not be empty") - - if display_on_report is None: - raise ValueError("displayOnReport should not be empty") - body = self.fixtures.load("tag_editTagKey.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_editTagKey_NOCHANGE( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_editTagKey_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_deleteTagKey( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}deleteTagKey": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("tag_deleteTagKey.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_deleteTagKey_NOEXIST( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_deleteTagKey_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_applyTags( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}applyTags": - raise InvalidRequestError(request.tag) - asset_type = findtext(request, "assetType", TYPES_URN) - asset_id = findtext(request, "assetId", TYPES_URN) - tag = request.find(fixxpath("tag", TYPES_URN)) - tag_key_name = findtext(tag, "tagKeyName", TYPES_URN) - value = findtext(tag, "value", TYPES_URN) - - if asset_type is None: - raise ValueError("assetType should not be empty") - - if asset_id is None: - raise ValueError("assetId should not be empty") - - if tag_key_name is None: - raise ValueError("tagKeyName should not be empty") - - if value is None: - raise ValueError("value should not be empty") - - body = self.fixtures.load("tag_applyTags.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_applyTags_NOVALUE( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}applyTags": - raise InvalidRequestError(request.tag) - asset_type = findtext(request, "assetType", TYPES_URN) - asset_id = findtext(request, "assetId", TYPES_URN) - tag = request.find(fixxpath("tag", TYPES_URN)) - tag_key_name = findtext(tag, "tagKeyName", TYPES_URN) - value = findtext(tag, "value", TYPES_URN) - - if asset_type is None: - raise ValueError("assetType should not be empty") - - if asset_id is None: - raise ValueError("assetId should not be empty") - - if tag_key_name is None: - raise ValueError("tagKeyName should not be empty") - - if value is not None: - raise ValueError("value should be empty") - - body = self.fixtures.load("tag_applyTags.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_applyTags_NOTAGKEY( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_applyTags_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_removeTags( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}removeTags": - raise InvalidRequestError(request.tag) - body = self.fixtures.load("tag_removeTag.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_removeTags_NOTAG( - self, method, url, body, headers - ): - body = self.fixtures.load("tag_removeTag_BADREQUEST.xml") - - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tag(self, method, url, body, headers): - body = self.fixtures.load("tag_tag_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_tag_tag_ALLPARAMS( - self, method, url, body, headers - ): - _, params = url.split("?") - parameters = params.split("&") - - for parameter in parameters: - key, value = parameter.split("=") - - if key == "assetId": - assert value == "fake_asset_id" - elif key == "assetType": - assert value == "fake_asset_type" - elif key == "valueRequired": - assert value == "false" - elif key == "displayOnReport": - assert value == "false" - elif key == "pageSize": - assert value == "250" - elif key == "datacenterId": - assert value == "fake_location" - elif key == "value": - assert value == "fake_value" - elif key == "tagKeyName": - assert value == "fake_tag_key_name" - elif key == "tagKeyId": - assert value == "fake_tag_key_id" - else: - raise ValueError("Could not find in url parameters {}:{}".format(key, value)) - body = self.fixtures.load("tag_tag_list.xml") - - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_ipAddressList( - self, method, url, body, headers - ): - body = self.fixtures.load("ip_address_lists.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_ipAddressList_FILTERBYNAME( - self, method, url, body, headers - ): - body = self.fixtures.load("ip_address_lists_FILTERBYNAME.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createIpAddressList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "createIpAddressList": - raise InvalidRequestError(request.tag) - - net_domain = findtext(request, "networkDomainId", TYPES_URN) - - if net_domain is None: - raise ValueError("Network Domain should not be empty") - - name = findtext(request, "name", TYPES_URN) - - if name is None: - raise ValueError("Name should not be empty") - - ip_version = findtext(request, "ipVersion", TYPES_URN) - - if ip_version is None: - raise ValueError("IP Version should not be empty") - - ip_address_col_required = findall(request, "ipAddress", TYPES_URN) - child_ip_address_required = findall(request, "childIpAddressListId", TYPES_URN) - - if 0 == len(ip_address_col_required) and 0 == len(child_ip_address_required): - raise ValueError( - "At least one ipAddress element or " - "one childIpAddressListId element must be " - "provided." - ) - - if ip_address_col_required[0].get("begin") is None: - raise ValueError("IP Address should not be empty") - - body = self.fixtures.load("ip_address_list_create.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editIpAddressList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "editIpAddressList": - raise InvalidRequestError(request.tag) - - ip_address_list = request.get("id") - - if ip_address_list is None: - raise ValueError("IpAddressList ID should not be empty") - - name = findtext(request, "name", TYPES_URN) - - if name is not None: - raise ValueError("Name should not exists in request") - - ip_version = findtext(request, "ipVersion", TYPES_URN) - - if ip_version is not None: - raise ValueError("IP Version should not exists in request") - - ip_address_col_required = findall(request, "ipAddress", TYPES_URN) - child_ip_address_required = findall(request, "childIpAddressListId", TYPES_URN) - - if 0 == len(ip_address_col_required) and 0 == len(child_ip_address_required): - raise ValueError( - "At least one ipAddress element or " - "one childIpAddressListId element must be " - "provided." - ) - - if ip_address_col_required[0].get("begin") is None: - raise ValueError("IP Address should not be empty") - - body = self.fixtures.load("ip_address_list_edit.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteIpAddressList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "deleteIpAddressList": - raise InvalidRequestError(request.tag) - - ip_address_list = request.get("id") - - if ip_address_list is None: - raise ValueError("IpAddressList ID should not be empty") - - body = self.fixtures.load("ip_address_list_delete.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_portList( - self, method, url, body, headers - ): - body = self.fixtures.load("port_list_lists.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_portList_c8c92ea3_2da8_4d51_8153_f39bec794d69( - self, method, url, body, headers - ): - body = self.fixtures.load("port_list_get.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createPortList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "createPortList": - raise InvalidRequestError(request.tag) - - net_domain = findtext(request, "networkDomainId", TYPES_URN) - - if net_domain is None: - raise ValueError("Network Domain should not be empty") - - ports_required = findall(request, "port", TYPES_URN) - child_port_list_required = findall(request, "childPortListId", TYPES_URN) - - if 0 == len(ports_required) and 0 == len(child_port_list_required): - raise ValueError( - "At least one port element or one " "childPortListId element must be provided" - ) - - if ports_required[0].get("begin") is None: - raise ValueError("PORT begin value should not be empty") - - body = self.fixtures.load("port_list_create.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editPortList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "editPortList": - raise InvalidRequestError(request.tag) - - ports_required = findall(request, "port", TYPES_URN) - child_port_list_required = findall(request, "childPortListId", TYPES_URN) - - if 0 == len(ports_required) and 0 == len(child_port_list_required): - raise ValueError( - "At least one port element or one " "childPortListId element must be provided" - ) - - if ports_required[0].get("begin") is None: - raise ValueError("PORT begin value should not be empty") - - body = self.fixtures.load("port_list_edit.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deletePortList( - self, method, url, body, headers - ): - request = ET.fromstring(body) - - if request.tag != "{urn:didata.com:api:cloud:types}" "deletePortList": - raise InvalidRequestError(request.tag) - - port_list = request.get("id") - - if port_list is None: - raise ValueError("Port List ID should not be empty") - - body = self.fixtures.load("ip_address_list_delete.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cloneServer( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/server_clone_response.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_importImage( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/import_image_response.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_exchangeNicVlans( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/exchange_nic_vlans_response.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeNetworkAdapter( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/change_nic_networkadapter_response.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployUncustomizedServer( - self, method, url, body, headers - ): - body = self.fixtures.load("2_4/deploy_customised_server.xml") - - return httplib.OK, body, {}, httplib.responses[httplib.OK] - - -if __name__ == "__main__": - sys.exit(unittest.main()) diff --git a/libcloud/test/compute/test_internetsolutions.py b/libcloud/test/compute/test_internetsolutions.py deleted file mode 100644 index e86a6293c8..0000000000 --- a/libcloud/test/compute/test_internetsolutions.py +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest - -from libcloud.compute.drivers.internetsolutions import InternetSolutionsNodeDriver -from libcloud.test.compute.test_dimensiondata_v2_3 import ( - DimensionDataMockHttp, - DimensionData_v2_3_Tests, -) - - -class InternetSolutionsNodeDriverTests(DimensionData_v2_3_Tests, unittest.TestCase): - def setUp(self): - InternetSolutionsNodeDriver.connectionCls.conn_class = DimensionDataMockHttp - InternetSolutionsNodeDriver.connectionCls.active_api_version = "2.3" - DimensionDataMockHttp.type = None - self.driver = InternetSolutionsNodeDriver("user", "password") diff --git a/libcloud/test/compute/test_ntta.py b/libcloud/test/compute/test_ntta.py index 39b305ab30..c0323bf701 100644 --- a/libcloud/test/compute/test_ntta.py +++ b/libcloud/test/compute/test_ntta.py @@ -18,11 +18,11 @@ from libcloud.compute.drivers.ntta import NTTAmericaNodeDriver from libcloud.test.compute.test_dimensiondata_v2_3 import ( DimensionDataMockHttp, - DimensionData_v2_3_Tests, + DimensionData_v2_3_TestMixin, ) -class NTTAmericaNodeDriverTests(DimensionData_v2_3_Tests, unittest.TestCase): +class NTTAmericaNodeDriverTests(DimensionData_v2_3_TestMixin, unittest.TestCase): def setUp(self): NTTAmericaNodeDriver.connectionCls.conn_class = DimensionDataMockHttp NTTAmericaNodeDriver.connectionCls.active_api_version = "2.3" diff --git a/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py b/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py deleted file mode 100644 index 5cdc2b2e13..0000000000 --- a/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py +++ /dev/null @@ -1,644 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import sys - -from libcloud.test import MockHttp, unittest -from libcloud.utils.py3 import httplib -from libcloud.common.types import InvalidCredsError -from libcloud.test.secrets import DIMENSIONDATA_PARAMS -from libcloud.loadbalancer.base import Member, Algorithm, LoadBalancer -from libcloud.loadbalancer.types import State -from libcloud.test.file_fixtures import LoadBalancerFileFixtures -from libcloud.common.dimensiondata import ( - DimensionDataPool, - DimensionDataVIPNode, - DimensionDataPoolMember, -) -from libcloud.loadbalancer.drivers.dimensiondata import DimensionDataLBDriver as DimensionData - - -class DimensionData_v2_3_Tests(unittest.TestCase): - def setUp(self): - DimensionData.connectionCls.active_api_version = "2.3" - DimensionData.connectionCls.conn_class = DimensionDataMockHttp - DimensionDataMockHttp.type = None - self.driver = DimensionData(*DIMENSIONDATA_PARAMS) - - def test_invalid_region(self): - with self.assertRaises(ValueError): - self.driver = DimensionData(*DIMENSIONDATA_PARAMS, region="blah") - - def test_invalid_creds(self): - DimensionDataMockHttp.type = "UNAUTHORIZED" - with self.assertRaises(InvalidCredsError): - self.driver.list_balancers() - - def test_create_balancer(self): - self.driver.ex_set_current_network_domain("1234") - members = [] - members.append(Member(id=None, ip="1.2.3.4", port=80)) - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ex_listener_ip_address="5.6.7.8", - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - self.assertEqual(balancer.extra["listener_ip_address"], "5.6.7.8") - - def test_create_balancer_with_defaults(self): - self.driver.ex_set_current_network_domain("1234") - - balancer = self.driver.create_balancer( - name="test", port=None, protocol=None, algorithm=None, members=None - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertIsNone(balancer.port) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_create_balancer_no_members(self): - self.driver.ex_set_current_network_domain("1234") - members = None - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_create_balancer_empty_members(self): - self.driver.ex_set_current_network_domain("1234") - members = [] - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_list_balancers(self): - bal = self.driver.list_balancers() - self.assertEqual(bal[0].name, "myProduction.Virtual.Listener") - self.assertEqual(bal[0].id, "6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal[0].port, "8899") - self.assertEqual(bal[0].ip, "165.180.12.22") - self.assertEqual(bal[0].state, State.RUNNING) - - def test_balancer_list_members(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - members = self.driver.balancer_list_members(balancer) - self.assertEqual(2, len(members)) - self.assertEqual(members[0].ip, "10.0.3.13") - self.assertEqual(members[0].id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(members[0].port, 9889) - - def test_balancer_attach_member(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member(id=None, ip="112.12.2.2", port=80, balancer=balancer, extra=None) - member = self.driver.balancer_attach_member(balancer, member) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - - def test_balancer_attach_member_without_port(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member(id=None, ip="112.12.2.2", port=None, balancer=balancer, extra=None) - member = self.driver.balancer_attach_member(balancer, member) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertIsNone(member.port) - - def test_balancer_detach_member(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member( - id="3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0", - ip="112.12.2.2", - port=80, - balancer=balancer, - extra=None, - ) - result = self.driver.balancer_detach_member(balancer, member) - self.assertEqual(result, True) - - def test_destroy_balancer(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - response = self.driver.destroy_balancer(balancer) - self.assertEqual(response, True) - - def test_set_get_network_domain_id(self): - self.driver.ex_set_current_network_domain("1234") - nwd = self.driver.ex_get_current_network_domain() - self.assertEqual(nwd, "1234") - - def test_ex_create_pool_member(self): - pool = DimensionDataPool( - id="4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ) - node = DimensionDataVIPNode(id="2344", name="test", status=State.RUNNING, ip="123.23.3.2") - member = self.driver.ex_create_pool_member(pool=pool, node=node, port=80) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.name, "10.0.3.13") - self.assertEqual(member.ip, "123.23.3.2") - - def test_ex_create_node(self): - node = self.driver.ex_create_node( - network_domain_id="12345", - name="test", - ip="123.12.32.2", - ex_description="", - connection_limit=25000, - connection_rate_limit=2000, - ) - self.assertEqual(node.name, "myProductionNode.1") - self.assertEqual(node.id, "9e6b496d-5261-4542-91aa-b50c7f569c54") - - def test_ex_create_pool( - self, - ): - pool = self.driver.ex_create_pool( - network_domain_id="1234", - name="test", - balancer_method="ROUND_ROBIN", - ex_description="test", - service_down_action="NONE", - slow_ramp_time=30, - ) - self.assertEqual(pool.id, "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(pool.name, "test") - self.assertEqual(pool.status, State.RUNNING) - - def test_ex_create_virtual_listener(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - port=80, - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_unusual_port(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - port=8900, - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_without_port(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_without_pool(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", name="test", ex_description="test" - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_get_balancer(self): - bal = self.driver.get_balancer("6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal.name, "myProduction.Virtual.Listener") - self.assertEqual(bal.id, "6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal.port, "8899") - self.assertEqual(bal.ip, "165.180.12.22") - self.assertEqual(bal.state, State.RUNNING) - - def test_list_protocols(self): - protocols = self.driver.list_protocols() - self.assertNotEqual(0, len(protocols)) - - def test_ex_get_nodes(self): - nodes = self.driver.ex_get_nodes() - self.assertEqual(2, len(nodes)) - self.assertEqual(nodes[0].name, "ProductionNode.1") - self.assertEqual(nodes[0].id, "34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(nodes[0].ip, "10.10.10.101") - - def test_ex_get_node(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(node.name, "ProductionNode.2") - self.assertEqual(node.id, "34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(node.ip, "10.10.10.101") - - def test_ex_update_node(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - node.connection_limit = "100" - result = self.driver.ex_update_node(node) - self.assertEqual(result.connection_limit, "100") - - def test_ex_destroy_node(self): - result = self.driver.ex_destroy_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertTrue(result) - - def test_ex_set_node_state(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - result = self.driver.ex_set_node_state(node, False) - self.assertEqual(result.connection_limit, "10000") - - def test_ex_get_pools(self): - pools = self.driver.ex_get_pools() - self.assertNotEqual(0, len(pools)) - self.assertEqual(pools[0].name, "myDevelopmentPool.1") - self.assertEqual(pools[0].id, "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - - def test_ex_get_pool(self): - pool = self.driver.ex_get_pool("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(pool.name, "myDevelopmentPool.1") - self.assertEqual(pool.id, "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - - def test_ex_update_pool(self): - pool = self.driver.ex_get_pool("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - pool.slow_ramp_time = "120" - result = self.driver.ex_update_pool(pool) - self.assertTrue(result) - - def test_ex_destroy_pool(self): - response = self.driver.ex_destroy_pool( - pool=DimensionDataPool( - id="4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ) - ) - self.assertTrue(response) - - def test_get_pool_members(self): - members = self.driver.ex_get_pool_members("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(2, len(members)) - self.assertEqual(members[0].id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(members[0].name, "10.0.3.13") - self.assertEqual(members[0].status, "NORMAL") - self.assertEqual(members[0].ip, "10.0.3.13") - self.assertEqual(members[0].port, 9889) - self.assertEqual(members[0].node_id, "3c207269-e75e-11e4-811f-005056806999") - - def test_get_pool_member(self): - member = self.driver.ex_get_pool_member("3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.name, "10.0.3.13") - self.assertEqual(member.status, "NORMAL") - self.assertEqual(member.ip, "10.0.3.13") - self.assertEqual(member.port, 9889) - - def test_set_pool_member_state(self): - member = self.driver.ex_get_pool_member("3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - result = self.driver.ex_set_pool_member_state(member, True) - self.assertTrue(result) - - def test_ex_destroy_pool_member(self): - response = self.driver.ex_destroy_pool_member( - member=DimensionDataPoolMember( - id="", - name="test", - status=State.RUNNING, - ip="1.2.3.4", - port=80, - node_id="3c207269-e75e-11e4-811f-005056806999", - ), - destroy_node=False, - ) - self.assertTrue(response) - - def test_ex_destroy_pool_member_with_node(self): - response = self.driver.ex_destroy_pool_member( - member=DimensionDataPoolMember( - id="", - name="test", - status=State.RUNNING, - ip="1.2.3.4", - port=80, - node_id="34de6ed6-46a4-4dae-a753-2f8d3840c6f9", - ), - destroy_node=True, - ) - self.assertTrue(response) - - def test_ex_get_default_health_monitors(self): - monitors = self.driver.ex_get_default_health_monitors( - "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7" - ) - self.assertEqual(len(monitors), 6) - self.assertEqual(monitors[0].id, "01683574-d487-11e4-811f-005056806999") - self.assertEqual(monitors[0].name, "CCDEFAULT.Http") - self.assertFalse(monitors[0].node_compatible) - self.assertTrue(monitors[0].pool_compatible) - - def test_ex_get_default_persistence_profiles(self): - profiles = self.driver.ex_get_default_persistence_profiles( - "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7" - ) - self.assertEqual(len(profiles), 4) - self.assertEqual(profiles[0].id, "a34ca024-f3db-11e4-b010-005056806999") - self.assertEqual(profiles[0].name, "CCDEFAULT.Cookie") - self.assertEqual(profiles[0].fallback_compatible, False) - self.assertEqual(len(profiles[0].compatible_listeners), 1) - self.assertEqual(profiles[0].compatible_listeners[0].type, "PERFORMANCE_LAYER_4") - - def test_ex_get_default_irules(self): - irules = self.driver.ex_get_default_irules("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(len(irules), 4) - self.assertEqual(irules[0].id, "2b20cb2c-ffdc-11e4-b010-005056806999") - self.assertEqual(irules[0].name, "CCDEFAULT.HttpsRedirect") - self.assertEqual(len(irules[0].compatible_listeners), 1) - self.assertEqual(irules[0].compatible_listeners[0].type, "PERFORMANCE_LAYER_4") - - -class DimensionDataMockHttp(MockHttp): - fixtures = LoadBalancerFileFixtures("dimensiondata") - - def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): - return (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED]) - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_virtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9( - self, method, url, body, headers - ): - body = self.fixtures.load( - "networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9.xml" - ) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_pool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_poolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0( - self, method, url, body, headers - ): - body = self.fixtures.load( - "networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0.xml" - ) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createPool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createPool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_addPoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_addPoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createVirtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_removePoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deleteVirtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deletePool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deleteNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_node.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editPool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editPoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultHealthMonitor.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultPersistenceProfile.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultIrule( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultIrule.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - -if __name__ == "__main__": - sys.exit(unittest.main()) diff --git a/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py b/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py deleted file mode 100644 index e8f02cc2fd..0000000000 --- a/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py +++ /dev/null @@ -1,644 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import sys - -from libcloud.test import MockHttp, unittest -from libcloud.utils.py3 import httplib -from libcloud.common.types import InvalidCredsError -from libcloud.test.secrets import DIMENSIONDATA_PARAMS -from libcloud.loadbalancer.base import Member, Algorithm, LoadBalancer -from libcloud.loadbalancer.types import State -from libcloud.test.file_fixtures import LoadBalancerFileFixtures -from libcloud.common.dimensiondata import ( - DimensionDataPool, - DimensionDataVIPNode, - DimensionDataPoolMember, -) -from libcloud.loadbalancer.drivers.dimensiondata import DimensionDataLBDriver as DimensionData - - -class DimensionData_v2_4_Tests(unittest.TestCase): - def setUp(self): - DimensionData.connectionCls.active_api_version = "2.4" - DimensionData.connectionCls.conn_class = DimensionDataMockHttp - DimensionDataMockHttp.type = None - self.driver = DimensionData(*DIMENSIONDATA_PARAMS) - - def test_invalid_region(self): - with self.assertRaises(ValueError): - self.driver = DimensionData(*DIMENSIONDATA_PARAMS, region="blah") - - def test_invalid_creds(self): - DimensionDataMockHttp.type = "UNAUTHORIZED" - with self.assertRaises(InvalidCredsError): - self.driver.list_balancers() - - def test_create_balancer(self): - self.driver.ex_set_current_network_domain("1234") - members = [] - members.append(Member(id=None, ip="1.2.3.4", port=80)) - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ex_listener_ip_address="5.6.7.8", - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - self.assertEqual(balancer.extra["listener_ip_address"], "5.6.7.8") - - def test_create_balancer_with_defaults(self): - self.driver.ex_set_current_network_domain("1234") - - balancer = self.driver.create_balancer( - name="test", port=None, protocol=None, algorithm=None, members=None - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertIsNone(balancer.port) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_create_balancer_no_members(self): - self.driver.ex_set_current_network_domain("1234") - members = None - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_create_balancer_empty_members(self): - self.driver.ex_set_current_network_domain("1234") - members = [] - - balancer = self.driver.create_balancer( - name="test", - port=80, - protocol="http", - algorithm=Algorithm.ROUND_ROBIN, - members=members, - ) - self.assertEqual(balancer.name, "test") - self.assertEqual(balancer.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(balancer.ip, "165.180.12.22") - self.assertEqual(balancer.port, 80) - self.assertEqual(balancer.extra["pool_id"], "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(balancer.extra["network_domain_id"], "1234") - - def test_list_balancers(self): - bal = self.driver.list_balancers() - self.assertEqual(bal[0].name, "myProduction.Virtual.Listener") - self.assertEqual(bal[0].id, "6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal[0].port, "8899") - self.assertEqual(bal[0].ip, "165.180.12.22") - self.assertEqual(bal[0].state, State.RUNNING) - - def test_balancer_list_members(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - members = self.driver.balancer_list_members(balancer) - self.assertEqual(2, len(members)) - self.assertEqual(members[0].ip, "10.0.3.13") - self.assertEqual(members[0].id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(members[0].port, 9889) - - def test_balancer_attach_member(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member(id=None, ip="112.12.2.2", port=80, balancer=balancer, extra=None) - member = self.driver.balancer_attach_member(balancer, member) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - - def test_balancer_attach_member_without_port(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member(id=None, ip="112.12.2.2", port=None, balancer=balancer, extra=None) - member = self.driver.balancer_attach_member(balancer, member) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertIsNone(member.port) - - def test_balancer_detach_member(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - member = Member( - id="3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0", - ip="112.12.2.2", - port=80, - balancer=balancer, - extra=None, - ) - result = self.driver.balancer_detach_member(balancer, member) - self.assertEqual(result, True) - - def test_destroy_balancer(self): - extra = { - "pool_id": "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - "network_domain_id": "1234", - } - balancer = LoadBalancer( - id="234", - name="test", - state=State.RUNNING, - ip="1.2.3.4", - port=1234, - driver=self.driver, - extra=extra, - ) - response = self.driver.destroy_balancer(balancer) - self.assertEqual(response, True) - - def test_set_get_network_domain_id(self): - self.driver.ex_set_current_network_domain("1234") - nwd = self.driver.ex_get_current_network_domain() - self.assertEqual(nwd, "1234") - - def test_ex_create_pool_member(self): - pool = DimensionDataPool( - id="4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ) - node = DimensionDataVIPNode(id="2344", name="test", status=State.RUNNING, ip="123.23.3.2") - member = self.driver.ex_create_pool_member(pool=pool, node=node, port=80) - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.name, "10.0.3.13") - self.assertEqual(member.ip, "123.23.3.2") - - def test_ex_create_node(self): - node = self.driver.ex_create_node( - network_domain_id="12345", - name="test", - ip="123.12.32.2", - ex_description="", - connection_limit=25000, - connection_rate_limit=2000, - ) - self.assertEqual(node.name, "myProductionNode.1") - self.assertEqual(node.id, "9e6b496d-5261-4542-91aa-b50c7f569c54") - - def test_ex_create_pool( - self, - ): - pool = self.driver.ex_create_pool( - network_domain_id="1234", - name="test", - balancer_method="ROUND_ROBIN", - ex_description="test", - service_down_action="NONE", - slow_ramp_time=30, - ) - self.assertEqual(pool.id, "9e6b496d-5261-4542-91aa-b50c7f569c54") - self.assertEqual(pool.name, "test") - self.assertEqual(pool.status, State.RUNNING) - - def test_ex_create_virtual_listener(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - port=80, - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_unusual_port(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - port=8900, - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_without_port(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", - name="test", - ex_description="test", - pool=DimensionDataPool( - id="1234", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ), - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_ex_create_virtual_listener_without_pool(self): - listener = self.driver.ex_create_virtual_listener( - network_domain_id="12345", name="test", ex_description="test" - ) - self.assertEqual(listener.id, "8334f461-0df0-42d5-97eb-f4678eb26bea") - self.assertEqual(listener.name, "test") - - def test_get_balancer(self): - bal = self.driver.get_balancer("6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal.name, "myProduction.Virtual.Listener") - self.assertEqual(bal.id, "6115469d-a8bb-445b-bb23-d23b5283f2b9") - self.assertEqual(bal.port, "8899") - self.assertEqual(bal.ip, "165.180.12.22") - self.assertEqual(bal.state, State.RUNNING) - - def test_list_protocols(self): - protocols = self.driver.list_protocols() - self.assertNotEqual(0, len(protocols)) - - def test_ex_get_nodes(self): - nodes = self.driver.ex_get_nodes() - self.assertEqual(2, len(nodes)) - self.assertEqual(nodes[0].name, "ProductionNode.1") - self.assertEqual(nodes[0].id, "34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(nodes[0].ip, "10.10.10.101") - - def test_ex_get_node(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(node.name, "ProductionNode.2") - self.assertEqual(node.id, "34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertEqual(node.ip, "10.10.10.101") - - def test_ex_update_node(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - node.connection_limit = "100" - result = self.driver.ex_update_node(node) - self.assertEqual(result.connection_limit, "100") - - def test_ex_destroy_node(self): - result = self.driver.ex_destroy_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - self.assertTrue(result) - - def test_ex_set_node_state(self): - node = self.driver.ex_get_node("34de6ed6-46a4-4dae-a753-2f8d3840c6f9") - result = self.driver.ex_set_node_state(node, False) - self.assertEqual(result.connection_limit, "10000") - - def test_ex_get_pools(self): - pools = self.driver.ex_get_pools() - self.assertNotEqual(0, len(pools)) - self.assertEqual(pools[0].name, "myDevelopmentPool.1") - self.assertEqual(pools[0].id, "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - - def test_ex_get_pool(self): - pool = self.driver.ex_get_pool("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(pool.name, "myDevelopmentPool.1") - self.assertEqual(pool.id, "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - - def test_ex_update_pool(self): - pool = self.driver.ex_get_pool("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - pool.slow_ramp_time = "120" - result = self.driver.ex_update_pool(pool) - self.assertTrue(result) - - def test_ex_destroy_pool(self): - response = self.driver.ex_destroy_pool( - pool=DimensionDataPool( - id="4d360b1f-bc2c-4ab7-9884-1f03ba2768f7", - name="test", - description="test", - status=State.RUNNING, - health_monitor_id=None, - load_balance_method=None, - service_down_action=None, - slow_ramp_time=None, - ) - ) - self.assertTrue(response) - - def test_get_pool_members(self): - members = self.driver.ex_get_pool_members("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(2, len(members)) - self.assertEqual(members[0].id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(members[0].name, "10.0.3.13") - self.assertEqual(members[0].status, "NORMAL") - self.assertEqual(members[0].ip, "10.0.3.13") - self.assertEqual(members[0].port, 9889) - self.assertEqual(members[0].node_id, "3c207269-e75e-11e4-811f-005056806999") - - def test_get_pool_member(self): - member = self.driver.ex_get_pool_member("3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.id, "3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - self.assertEqual(member.name, "10.0.3.13") - self.assertEqual(member.status, "NORMAL") - self.assertEqual(member.ip, "10.0.3.13") - self.assertEqual(member.port, 9889) - - def test_set_pool_member_state(self): - member = self.driver.ex_get_pool_member("3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0") - result = self.driver.ex_set_pool_member_state(member, True) - self.assertTrue(result) - - def test_ex_destroy_pool_member(self): - response = self.driver.ex_destroy_pool_member( - member=DimensionDataPoolMember( - id="", - name="test", - status=State.RUNNING, - ip="1.2.3.4", - port=80, - node_id="3c207269-e75e-11e4-811f-005056806999", - ), - destroy_node=False, - ) - self.assertTrue(response) - - def test_ex_destroy_pool_member_with_node(self): - response = self.driver.ex_destroy_pool_member( - member=DimensionDataPoolMember( - id="", - name="test", - status=State.RUNNING, - ip="1.2.3.4", - port=80, - node_id="34de6ed6-46a4-4dae-a753-2f8d3840c6f9", - ), - destroy_node=True, - ) - self.assertTrue(response) - - def test_ex_get_default_health_monitors(self): - monitors = self.driver.ex_get_default_health_monitors( - "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7" - ) - self.assertEqual(len(monitors), 6) - self.assertEqual(monitors[0].id, "01683574-d487-11e4-811f-005056806999") - self.assertEqual(monitors[0].name, "CCDEFAULT.Http") - self.assertFalse(monitors[0].node_compatible) - self.assertTrue(monitors[0].pool_compatible) - - def test_ex_get_default_persistence_profiles(self): - profiles = self.driver.ex_get_default_persistence_profiles( - "4d360b1f-bc2c-4ab7-9884-1f03ba2768f7" - ) - self.assertEqual(len(profiles), 4) - self.assertEqual(profiles[0].id, "a34ca024-f3db-11e4-b010-005056806999") - self.assertEqual(profiles[0].name, "CCDEFAULT.Cookie") - self.assertEqual(profiles[0].fallback_compatible, False) - self.assertEqual(len(profiles[0].compatible_listeners), 1) - self.assertEqual(profiles[0].compatible_listeners[0].type, "PERFORMANCE_LAYER_4") - - def test_ex_get_default_irules(self): - irules = self.driver.ex_get_default_irules("4d360b1f-bc2c-4ab7-9884-1f03ba2768f7") - self.assertEqual(len(irules), 4) - self.assertEqual(irules[0].id, "2b20cb2c-ffdc-11e4-b010-005056806999") - self.assertEqual(irules[0].name, "CCDEFAULT.HttpsRedirect") - self.assertEqual(len(irules[0].compatible_listeners), 1) - self.assertEqual(irules[0].compatible_listeners[0].type, "PERFORMANCE_LAYER_4") - - -class DimensionDataMockHttp(MockHttp): - fixtures = LoadBalancerFileFixtures("dimensiondata") - - def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): - return (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED]) - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load("oec_0_9_myaccount.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_virtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9( - self, method, url, body, headers - ): - body = self.fixtures.load( - "networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9.xml" - ) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_pool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_poolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0( - self, method, url, body, headers - ): - body = self.fixtures.load( - "networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0.xml" - ) - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createPool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createPool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_addPoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_addPoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_createVirtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_removePoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deleteVirtualListener.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deletePool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_deleteNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_node.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editNode( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editNode.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPool( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editPool.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_editPoolMember.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultHealthMonitor.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultPersistenceProfile.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultIrule( - self, method, url, body, headers - ): - body = self.fixtures.load("networkDomainVip_defaultIrule.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - -if __name__ == "__main__": - sys.exit(unittest.main()) diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist index 7715d08d20..848a576835 100644 --- a/libcloud/test/secrets.py-dist +++ b/libcloud/test/secrets.py-dist @@ -32,7 +32,6 @@ ONAPP_PARAMS = ('key') # OPENSTACK_PARAMS = ('user_name', 'api_key', secure_bool, 'host', port_int) OPENSTACK_PARAMS = ('user_name', 'api_key', False, 'host', 8774) OPENNEBULA_PARAMS = ('user', 'key') -DIMENSIONDATA_PARAMS = ('user', 'password') NTTCIS_PARAMS = ('user', 'password') OPSOURCE_PARAMS = ('user', 'password') OVH_PARAMS = ('application_key', 'application_secret', 'project_id', 'consumer_key') @@ -89,6 +88,7 @@ DNS_PARAMS_DURABLEDNS = ('api_user', 'api_key') DNS_PARAMS_GODADDY = ('customer-id', 'api_user', 'api_key') DNS_PARAMS_CLOUDFLARE = ('user@example.com', 'key') DNS_PARAMS_AURORADNS = ('apikey', 'secretkey') +DIMENSIONDATA_PARAMS = ('user', 'password') DNS_PARAMS_NSONE = ('key', ) DNS_PARAMS_LUADNS = ('user', 'key') DNS_PARAMS_BUDDYNS = ('key', )