You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2018/12/13 11:26:39 UTC
[30/45] libcloud git commit: finished tests and tox
finished tests and tox
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b8c4b9cc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b8c4b9cc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b8c4b9cc
Branch: refs/heads/trunk
Commit: b8c4b9cce09bcce9b46b6cde4be1b93379546a12
Parents: e18efb1
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 21 22:49:07 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 21 22:49:07 2018 -0500
----------------------------------------------------------------------
docs/drs/_supported_methods.rst | 4 +-
docs/drs/_supported_providers.rst | 2 +-
.../nttcis/create_ssl_offload_profile.py | 26 +++
.../nttcis/edit_ssl_offload_profile.py | 32 +++
.../loadbalancer/nttcis/import_ssl_cert.py | 33 +++
integration/requirements.txt | 1 +
libcloud/drs/drivers/nttcis.py | 50 ++---
libcloud/loadbalancer/drivers/nttcis.py | 214 +++++++++++++------
libcloud/test/drs/test_nttcis.py | 10 +-
.../nttcis/delete_ssl_certificate_chain.xml | 6 +
.../nttcis/delete_ssl_domain_certificate.xml | 6 +
.../nttcis/delete_ssl_offload_profile.xml | 6 +
libcloud/test/loadbalancer/test_nttcis.py | 208 +++++++++++++++---
tests/lib_create_test.py | 5 +-
tests/lib_edit_test.py | 21 ++
tox.ini | 2 +
16 files changed, 492 insertions(+), 134 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/docs/drs/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_methods.rst b/docs/drs/_supported_methods.rst
index ac74337..6e792fd 100644
--- a/docs/drs/_supported_methods.rst
+++ b/docs/drs/_supported_methods.rst
@@ -3,7 +3,7 @@
=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
Provider create_consistency_group list_consistency_groups get_consistency_group delete_consistency_group list_consistency_group_snapshots expand_journal start_failover_preview stop_failover_preview initiate_failover
=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
-`NTTC-CIS DRS Consistencty Groups`_ yes yes yes no yes no no no no
+`NTTC-CIS DRS Consistencty Groups`_ yes yes yes yes yes yes yes yes yes
=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
-.. _`NTTC-CIS DRS Consistencty Groups`: https://cloud.nttcis.com/
+.. _`NTTC-CIS DRS Consistencty Groups`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/docs/drs/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_providers.rst b/docs/drs/_supported_providers.rst
index d282e4a..16b893b 100644
--- a/docs/drs/_supported_providers.rst
+++ b/docs/drs/_supported_providers.rst
@@ -6,4 +6,4 @@ Provider Documentation Provider
`NTTC-CIS DRS Consistencty Groups`_ :doc:`Click </drs/drivers/nttcis>` NTTCIS single region driver :mod:`libcloud.drs.drivers.nttcis` :class:`NttCisDRSDriver`
=================================== ================================== ================= ==================== ================================== ========================
-.. _`NTTC-CIS DRS Consistencty Groups`: https://cloud.nttcis.com/
+.. _`NTTC-CIS DRS Consistencty Groups`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/docs/examples/loadbalancer/nttcis/create_ssl_offload_profile.py
----------------------------------------------------------------------
diff --git a/docs/examples/loadbalancer/nttcis/create_ssl_offload_profile.py b/docs/examples/loadbalancer/nttcis/create_ssl_offload_profile.py
new file mode 100644
index 0000000..05e6641
--- /dev/null
+++ b/docs/examples/loadbalancer/nttcis/create_ssl_offload_profile.py
@@ -0,0 +1,26 @@
+# Create an SSL Offload Profile
+
+import libcloud
+
+
+def create_ssl_profile(lbdriver):
+ # Identify the network domain to insert the profile into
+ net_domain_id = "6aafcf08-cb0b-432c-9c64-7371265db086"
+ name = "ssl_offload"
+ # Retrieve the domain certificate to be used int the profile
+ domain_cert = lbdriver.ex_list_ssl_domain_certs(name="alice")[0]
+ result = lbdriver.ex_create_ssl_offload_profile(
+ net_domain_id, name, domain_cert.id, ciphers="!ECDHE+AES-GCM:")
+ assert result is True
+
+
+def lbdriver():
+ cls = libcloud.get_driver(libcloud.DriverType.LOADBALANCER,
+ libcloud.DriverType.LOADBALANCER.NTTCIS)
+ driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
+ return driver
+
+
+if __name__ == "__main__":
+ lb = lbdriver()
+ create_ssl_profile(lb)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/docs/examples/loadbalancer/nttcis/edit_ssl_offload_profile.py
----------------------------------------------------------------------
diff --git a/docs/examples/loadbalancer/nttcis/edit_ssl_offload_profile.py b/docs/examples/loadbalancer/nttcis/edit_ssl_offload_profile.py
new file mode 100644
index 0000000..244d2ba
--- /dev/null
+++ b/docs/examples/loadbalancer/nttcis/edit_ssl_offload_profile.py
@@ -0,0 +1,32 @@
+# This script demonstrates how to edit a profile
+
+import libcloud
+
+
+def edit_ssl_offload_profile(lbdriver):
+ # Identify the wich profile by name to be edited
+ profile_name = "ssl_offload"
+ datacenter_id = "EU6"
+ profile = lbdriver.ex_list_ssl_offload_profiles(
+ name=profile_name, datacenter_id=datacenter_id)[0]
+ # All elements must be passed to the edit method that
+ # would be required in creating a profile as well as what currently exists
+ # such as the current ciphers, unless ciphers were to be changed.
+ # Here a new description is being added.
+ result = lbdriver.ex_edit_ssl_offload_profile(
+ profile.id, profile.name, profile.sslDomainCertificate.id,
+ ciphers=profile.ciphers,
+ description="A test edit of an offload profile")
+ assert result is True
+
+
+def lbdriver():
+ cls = libcloud.get_driver(libcloud.DriverType.LOADBALANCER,
+ libcloud.DriverType.LOADBALANCER.NTTCIS)
+ driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
+ return driver
+
+
+if __name__ == "__main__":
+ lb = lbdriver()
+ edit_ssl_offload_profile(lb)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/docs/examples/loadbalancer/nttcis/import_ssl_cert.py
----------------------------------------------------------------------
diff --git a/docs/examples/loadbalancer/nttcis/import_ssl_cert.py b/docs/examples/loadbalancer/nttcis/import_ssl_cert.py
new file mode 100644
index 0000000..6aadcd2
--- /dev/null
+++ b/docs/examples/loadbalancer/nttcis/import_ssl_cert.py
@@ -0,0 +1,33 @@
+# This example shows importing an SSL Domain Certificate
+
+import libcloud
+
+
+def insert_ssl(lbdriver, compute_driver):
+ net_dom_name = "sdk_test_1"
+ net_dom = compute_driver.ex_list_network_domains(name=net_dom_name)[0]
+ cert = '/home/mraful/client/bob.crt'
+ key = '/home/mraful/client/bob.key'
+ result = lbdriver.ex_import_ssl_domain_certificate(
+ net_dom.id, "bob", cert, key, description="test cert")
+ assert result is True
+
+
+def lbdriver():
+ cls = libcloud.get_driver(libcloud.DriverType.LOADBALANCER,
+ libcloud.DriverType.LOADBALANCER.NTTCIS)
+ driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
+ return driver
+
+
+def compute_driver():
+ cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
+ libcloud.DriverType.COMPUTE.NTTCIS)
+ driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
+ return driver
+
+
+if __name__ == "__main__":
+ lb = lbdriver()
+ cd = compute_driver()
+ insert_ssl(lb, cd)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/integration/requirements.txt
----------------------------------------------------------------------
diff --git a/integration/requirements.txt b/integration/requirements.txt
index 310dc0b..fded27b 100644
--- a/integration/requirements.txt
+++ b/integration/requirements.txt
@@ -1 +1,2 @@
bottle
+
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index f67ab5f..a94edde 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -1,5 +1,3 @@
-import re
-import functools
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import API_ENDPOINTS
@@ -61,14 +59,14 @@ class NttCisDRSDriver(DRSDriver):
:param name: Name of consistency group
:type name: ``str``
:param journal_size_gb: Journal size in GB
- :type journal_size_gb: ``str``
+ :type journal_size_gb: ``str``
:param source_server_id: Id of the server to copy
- :type source_server_id: ``str``
+ :type source_server_id: ``str``
:param target_server_id: Id of the server to receive the copy
- :type: ``str``
+ :type source_server_id: ``str``
:param description: (Optional) Description of consistency group
- :type: ``str``
- :return: :class: `NttCisConsistenccyGroup`
+ :type description: ``str``
+ :returns: :class: NttCisConsistenccyGroup
"""
consistency_group_elm = ET.Element('createConsistencyGroup',
@@ -92,21 +90,21 @@ class NttCisDRSDriver(DRSDriver):
return response_code in ['IN_PROGRESS', 'OK']
@get_params
- def list_consistency_groups(self, params):
+ def list_consistency_groups(self, params={}):
"""
Functions takes a named parameter that must be one of the following
:param params: A sequence of comma separated keyword arguments
and a value
- * target_data_center_id=
- * source_network_domain_id=
- * target_network_domain_id=
- * source_server_id=
- * target_server_id=
- * name=
- * state=
- * operation_status=
- * drs_infrastructure_status=
- :return: `list` of :class: `NttCisConsistencyGroup`
+ * target_data_center_id=
+ * source_network_domain_id=
+ * target_network_domain_id=
+ * source_server_id=
+ * target_server_id=
+ * name=
+ * state=
+ * operation_status=
+ * drs_infrastructure_status=
+ :returns: `list` of :class: `NttCisConsistencyGroup`
"""
response = self.connection.request_with_orgId_api_2(
@@ -118,9 +116,10 @@ class NttCisDRSDriver(DRSDriver):
"""
Retrieves a Consistency by it's id and is more efficient thatn listing
all consistency groups and filtering that result.
+
:param consistency_group_id: An id of a consistency group
:type consistency_group_id: ``str``
- :return: :class: `NttCisConsistencygroup`
+ :returns: :class: `NttCisConsistencygroup`
"""
response = self.connection.request_with_orgId_api_2(
"consistencyGroup/consistencyGroup/%s" % consistency_group_id
@@ -153,7 +152,7 @@ class NttCisDRSDriver(DRSDriver):
substitute time offset for Z, i.e,
-05:00
:type create_time_max: ``str``
- :return: `list` of :class" `NttCisSnapshots`
+ :returns: `list` of :class: `NttCisSnapshots`
"""
if create_time_min is None and create_time_max is None:
@@ -183,11 +182,12 @@ class NttCisDRSDriver(DRSDriver):
def expand_journal(self, consistency_group_id, size_gb):
"""
Expand the consistency group's journhal size in 100Gb increments
+
:param consistency_group_id: The consistency group's UUID
:type consistency_group_id: ``str``
:param size_gb: Gb in 100 Gb increments
:type size_gb: ``str``
- :return: ``bool``
+ :returns: ``bool``
"""
expand_elm = ET.Element("expandJournal", {"id": consistency_group_id,
@@ -209,7 +209,7 @@ class NttCisDRSDriver(DRSDriver):
:type consistency_group_id: ``str``
:param snapshot_id: Id of the Snapshot to preview
:type snapshot_id: ``str``
- :return: True/False
+ :returns: True/False
:rtype: ``bool``
"""
preview_elm = ET.Element("startPreviewSnapshot",
@@ -230,7 +230,7 @@ class NttCisDRSDriver(DRSDriver):
:param consistency_group_id: Consistency Group's Id
:type ``str``
- :return: True/False
+ :returns: True/False
:rtype: ``bool``
"""
preview_elm = ET.Element("stopPreviewSnapshot",
@@ -250,7 +250,7 @@ class NttCisDRSDriver(DRSDriver):
:param consistency_group_id: Consistency Group's Id to failover
:type consistency_group_id: ``str``
- :return: True/False
+ :returns: True/False
:rtype: ``bool``
"""
failover_elm = ET.Element("initiateFailover",
@@ -268,7 +268,7 @@ class NttCisDRSDriver(DRSDriver):
Delete's a Consistency Group
:param consistency_group_id: Id of Consistency Group to delete
- :type ``str``
+ :type consistency_group_id: ``str``
:return: True/False
:rtype: ``bool``
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 2dddf2e..316f918 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -31,7 +31,7 @@ from libcloud.common.nttcis import process_xml, get_params
from libcloud.utils.misc import reverse_dict
from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.loadbalancer.types import State
-from libcloud.loadbalancer.base import Algorithm, Driver,\
+from libcloud.loadbalancer.base import Algorithm, Driver, \
LoadBalancer, DEFAULT_ALGORITHM
from libcloud.loadbalancer.base import Member
from libcloud.loadbalancer.types import Provider
@@ -204,8 +204,8 @@ class NttCisLBDriver(Driver):
{'xmlns': TYPES_URN,
'id': virtual_listener.id,
'xmlns:xsi':
- "http://www.w3.org/2001/"
- "XMLSchema-instance"})
+ "http://www.w3.org/2001/"
+ "XMLSchema-instance"})
for k, v in kwargs.items():
if v is None:
ET.SubElement(edit_listener_elm, k, {'xsi:nil': 'true'})
@@ -758,31 +758,34 @@ class NttCisLBDriver(Driver):
status=State.RUNNING
)
- def ex_import_ssl_cert(self, network_domain_id, name, crt_file, key_file,
- description=None):
+ def ex_import_ssl_domain_certificate(self, network_domain_id,
+ name, crt_file, key_file,
+ description=None):
"""
Import an ssl cert for ssl offloading onto the the load balancer
+
:param network_domain_id: The Network Domain's Id.
- :type ``str``
+ :type network_domain_id: ``str``
:param name: The name of the ssl certificate
- :type ``str``
+ :type name: ``str``
:param crt_file: The complete path to the certificate file
- :type ``str``
+ :type crt_file: ``str``
:param key_file: The complete pathy to the key file
- :type ``str``
+ :type key_file: ``str``
:param description: (Optional) A description of the certificate
- :type ``str``
+ :type `description: `str``
:return: ``bool``
"""
c = OpenSSL.crypto.load_certificate(
OpenSSL.crypto.FILETYPE_PEM, open(crt_file).read())
- cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, c)\
- .decode(encoding='utf-8')
+ cert = OpenSSL.crypto.dump_certificate(
+ OpenSSL.crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
k = OpenSSL.crypto.load_privatekey(
OpenSSL.crypto.FILETYPE_PEM, open(key_file).read())
- key = OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, k)\
+ key = OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, k) \
.decode(encoding='utf-8')
- cert_elem = ET.Element("importSslDomainCertificate", {"xmlns": TYPES_URN})
+ cert_elem = ET.Element("importSslDomainCertificate",
+ {"xmlns": TYPES_URN})
ET.SubElement(cert_elem, "networkDomainId").text = network_domain_id
ET.SubElement(cert_elem, "name").text = name
if description is not None:
@@ -796,26 +799,47 @@ class NttCisLBDriver(Driver):
response_code = findtext(result, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
+ def ex_delete_ssl_domain_certificate(self, dom_cert_id):
+ """
+ Deletes an SSL domain certificate
+
+ :param dom_cert_id: Id of certificate to delete
+ :type dom_cert_id: ``str``
+ :return: ``bool``
+ """
+ del_dom_cert_elem = ET.Element("deleteSslDomainCertificate",
+ {"id": dom_cert_id,
+ "xmlns": TYPES_URN})
+ result = self.connection.request_with_orgId_api_2(
+ 'networkDomainVip/deleteSslDomainCertificate',
+ method='POST',
+ data=ET.tostring(del_dom_cert_elem)).object
+ response_code = findtext(result, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
def ex_import_ssl_cert_chain(self, network_domain_id, name,
chain_crt_file, description=None):
"""
- Import an ssl certificate chain for ssl offloading onto the the load balancer
+ Import an ssl certificate chain for ssl offloading onto
+ the the load balancer
+
:param network_domain_id: The Network Domain's Id.
- :type ``str``
+ :type network_domain_id: ``str``
:param name: The name of the ssl certificate chain
- :type ``str``
+ :type name: ``str``
:param chain_crt_file: The complete path to the certificate chain file
- :type ``str``
+ :type chain_crt_file: ``str``
:param description: (Optional) A description of the certificate chain
- :type ``str``
+ :type description: ``str``
:return: ``bool``
"""
c = OpenSSL.crypto.load_certificate(
OpenSSL.crypto.FILETYPE_PEM, open(chain_crt_file).read())
- cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, c)\
- .decode(encoding='utf-8')
- cert_chain_elem = ET.Element("importSslCertificateChain", {"xmlns": TYPES_URN})
- ET.SubElement(cert_chain_elem, "networkDomainId")\
+ cert = OpenSSL.crypto.dump_certificate(
+ OpenSSL.crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
+ cert_chain_elem = ET.Element("importSslCertificateChain",
+ {"xmlns": TYPES_URN})
+ ET.SubElement(cert_chain_elem, "networkDomainId") \
.text = network_domain_id
ET.SubElement(cert_chain_elem, "name").text = name
if description is not None:
@@ -828,6 +852,24 @@ class NttCisLBDriver(Driver):
response_code = findtext(result, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
+ def ex_delete_ssl_certificate_chain(self, cert_chain_id):
+ """
+ Deletes a certificate chain
+
+ :param cert_chain_id: Id of certificate chain to delete
+ :type cert_chain_id: ``str``
+ :return ``bool``
+ """
+ del_cert_chain_elem = ET.Element("deleteSslCertificateChain",
+ {"id": cert_chain_id,
+ "xmlns": TYPES_URN})
+ result = self.connection.request_with_orgId_api_2(
+ "networkDomainVip/deleteSslCertificateChain",
+ method="POST",
+ data=ET.tostring(del_cert_chain_elem)).object
+ response_code = findtext(result, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
def ex_create_ssl_offload_profile(self, netowrk_domain_id,
name, ssl_domain_cert_id,
description=None,
@@ -835,36 +877,40 @@ class NttCisLBDriver(Driver):
ssl_cert_chain_id=None):
"""
Creates an SSL Offload profile
+
:param network_domain_id: The network domain's Id
- :type ``str``
+ :type netowrk_domain_id: ``str``
:param name: Offload profile's name
- :type ``str``
+ :type name: ``str``
:param ssl_domain_cert_id: Certificate's Id
- :type ``str``
+ :type ssl_domain_cert_id: ``str``
:param description: (Optional) Profile's description
- :type ``str``
+ :type description: ``str``
:param ciphers: (Optional) The default cipher string is:
"MEDIUM:HIGH:!EXPORT:!ADH:!MD5:!RC4:!SSLv2:!SSLv3:
!ECDHE+AES-GCM:!ECDHE+AES:!ECDHE+3DES:!ECDHE_ECDSA:
!ECDH_RSA:!ECDH_ECDSA:@SPEED" It is possible to choose just a subset
of this string
- :type ``str``
+ :type ciphers: ``str``
:param ssl_cert_chain_id: (Optional) Bind the certificate
chain to the profile.
- :type ``str``
+ :type ssl_cert_chain_id: `str``
+ :returns: ``bool``
"""
ssl_offload_elem = ET.Element("createSslOffloadProfile",
{"xmlns": TYPES_URN})
- ET.SubElement(ssl_offload_elem, "networkDomainId").text = netowrk_domain_id
+ ET.SubElement(ssl_offload_elem, "networkDomainId")\
+ .text = netowrk_domain_id
ET.SubElement(ssl_offload_elem, "name").text = name
if description is not None:
- ET.SubElement(ssl_offload_elem, "description").text = description
+ ET.SubElement(ssl_offload_elem, "description")\
+ .text = description
if ciphers is not None:
ET.SubElement(ssl_offload_elem, "ciphers").text = ciphers
- ET.SubElement(ssl_offload_elem, "sslDomainCertificateId")\
+ ET.SubElement(ssl_offload_elem, "sslDomainCertificateId") \
.text = ssl_domain_cert_id
if ssl_cert_chain_id is not None:
- ET.SubElement(ssl_offload_elem, "sslCertificateChainId")\
+ ET.SubElement(ssl_offload_elem, "sslCertificateChainId") \
.text = ssl_cert_chain_id
result = self.connection.request_with_orgId_api_2(
"networkDomainVip/createSslOffloadProfile",
@@ -880,20 +926,21 @@ class NttCisLBDriver(Driver):
ssl_cert_chain_id=None):
"""
The function edits the ssl offload profile
+
:param profil_id: The id of the profile to be edited
- :type ``str``
+ :type profile_id: ``str``
:param name: The name of the profile, new name or previous name
- :type ``str``
+ :type name: ``str``
:param ssl_domain_cert_id: The certificate id to use, new or current
- :type ``str``
+ :type ssl_domain_cert_id: ``str``
:param description: (Optional) Profile's description
- :type ``str``
+ :type description: ``str``
:param ciphers: (Optional) String of acceptable ciphers to use
- :type ``str``
+ :type ciphers: ``str``
:param ssl_cert_chain_id: If using a certificate chain
or changing to a new one
- :type: ``str``
- :return: ``bool``
+ :type: ssl_cert_chain_id: ``str``
+ :returns: ``bool``
"""
ssl_offload_elem = ET.Element("editSslOffloadProfile",
{"xmlns": TYPES_URN, "id": profile_id})
@@ -914,6 +961,23 @@ class NttCisLBDriver(Driver):
response_code = findtext(result, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
+ def ex_delete_ssl_offload_profile(self, profile_id):
+ """
+ Delete an offload profile
+
+ :param profile_id: Id of profile to be deleted
+ :type profile_id: ``str``
+ :returns: ``bool``
+ """
+ del_profile_elem = ET.Element("deleteSslOffloadProfile",
+ {"id": profile_id, "xmlns": TYPES_URN})
+ result = self.connection.request_with_orgId_api_2(
+ "networkDomainVip/deleteSslOffloadProfile",
+ method="POST",
+ data=ET.tostring(del_profile_elem)).object
+ response_code = findtext(result, "responseCode", TYPES_URN)
+ return response_code in ["IN_PROGRESS", "OK"]
+
def ex_get_pools(self, ex_network_domain_id=None):
"""
Get all of the pools inside the current geography or
@@ -1010,7 +1074,7 @@ class NttCisLBDriver(Driver):
:param pool: The instance of a pool
:type pool: ``NttCisPool``
- :return: Returns an ``list`` of ``NttCisPoolMember``
+ :returns: Returns an ``list`` of ``NttCisPoolMember``
:rtype: ``list`` of ``NttCisPoolMember``
"""
members = self.connection \
@@ -1207,19 +1271,20 @@ class NttCisLBDriver(Driver):
return self._to_irules(result)
@get_params
- def ex_list_ssl_domain_certs(self, params):
+ def ex_list_ssl_domain_certs(self, params={}):
"""
Functions takes a named parameter that can be one or none of the
following
+
:param params: A sequence of comma separated keyword arguments
and a value
- * id=
- * network_domain_id=
- * name=
- * state=
- * create_time=
- * expiry_time=
- :return: `list` of :class: `NttCisDomaincertificate`
+ * id=
+ * network_domain_id=
+ * name=
+ * state=
+ * create_time=
+ * expiry_time=
+ :returns: `list` of :class: `NttCisDomaincertificate`
"""
result = self.connection.request_with_orgId_api_2(
action="networkDomainVip/sslDomainCertificate",
@@ -1231,8 +1296,10 @@ class NttCisLBDriver(Driver):
"""
Function gets the cert by id. Use this if only if the id
is already known
+
:param cert_id: The id of the specific cert
- :return: :class: `NttCisdomaincertificate
+ :type cert_id: ``str``
+ :returns: :class: `NttCisdomaincertificate
"""
result = self.connection.request_with_orgId_api_2(
action="networkDomainVip/sslDomainCertificate/%s" % cert_id,
@@ -1240,18 +1307,19 @@ class NttCisLBDriver(Driver):
return self._to_cert(result)
@get_params
- def ex_list_ssl_certificate_chains(self, params):
+ def ex_list_ssl_certificate_chains(self, params={}):
"""
Functions takes a named parameter that can be one or none of the
following to filter returned items
+
:param params: A sequence of comma separated keyword arguments
and a value
- * id=
- * network_domain_id=
- * name=
- * state=
- * create_time=
- * expiry_time=
+ * id=
+ * network_domain_id=
+ * name=
+ * state=
+ * create_time=
+ * expiry_time=
:return: `list` of :class: `NttCissslcertficiatechain`
"""
result = self.connection.request_with_orgId_api_2(
@@ -1273,22 +1341,23 @@ class NttCisLBDriver(Driver):
return self._to_certificate_chain(result)
@get_params
- def ex_list_ssl_offload_profiles(self, params):
+ def ex_list_ssl_offload_profiles(self, params={}):
"""
Functions takes a named parameter that can be one or none of the
following to filter returned items
+
:param params: A sequence of comma separated keyword arguments
and a value
- * id=
- * network_domain_id=
- * datacenter_id=
- * name=
- * state=
- * ssl_domain_certificate_id=
- * ssl_domain_certificate_name=
- * ssl_certificate_chain_id=
- * ssl_certificate_chain_name=
- * create_time=
+ * id=
+ * network_domain_id=
+ * datacenter_id=
+ * name=
+ * state=
+ * ssl_domain_certificate_id=
+ * ssl_domain_certificate_name=
+ * ssl_certificate_chain_id=
+ * ssl_certificate_chain_name=
+ * create_time=
:return: `list` of :class: `NttCisSslssloffloadprofile`
"""
result = self.connection.request_with_orgId_api_2(
@@ -1493,7 +1562,8 @@ class NttCisLBDriver(Driver):
def _to_certs(self, object):
certs = []
- for element in object.findall(fixxpath("sslDomainCertificate", TYPES_URN)):
+ for element in object.findall(fixxpath("sslDomainCertificate",
+ TYPES_URN)):
certs.append(self._to_cert(element))
return certs
@@ -1502,7 +1572,8 @@ class NttCisLBDriver(Driver):
def _to_certificate_chains(self, object):
cert_chains = []
- for element in object.findall(fixxpath("sslCertificateChain", TYPES_URN)):
+ for element in object.findall(fixxpath("sslCertificateChain",
+ TYPES_URN)):
cert_chains.append(self._to_certificate_chain(element))
return cert_chains
@@ -1511,7 +1582,8 @@ class NttCisLBDriver(Driver):
def _to_ssl_profiles(self, object):
profiles = []
- for element in object.findall(fixxpath("sslOffloadProfile", TYPES_URN)):
+ for element in object.findall(fixxpath("sslOffloadProfile",
+ TYPES_URN)):
profiles.append(self._to_ssl_profile(element))
return profiles
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index 566e1d1..0070a6d 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -1,18 +1,18 @@
import pytest
from libcloud.utils.py3 import httplib
+from libcloud.test import MockHttp
from libcloud.common.nttcis import NttCisAPIException
-from libcloud.drs.drivers.nttcis import NttCisDRSDriver as NttCis
-from libcloud.test import MockHttp, unittest
+from libcloud.drs.drivers.nttcis import NttCisDRSDriver
from libcloud.test.file_fixtures import DRSFileFixtures
from libcloud.test.secrets import NTTCIS_PARAMS
@pytest.fixture()
def driver():
- NttCis.connectionCls.active_api_version = "2.7"
- NttCis.connectionCls.conn_class = NttCisMockHttp
+ NttCisDRSDriver.connectionCls.active_api_version = "2.7"
+ NttCisDRSDriver.connectionCls.conn_class = NttCisMockHttp
NttCisMockHttp.type = None
- driver = NttCis(*NTTCIS_PARAMS)
+ driver = NttCisDRSDriver(*NTTCIS_PARAMS)
return driver
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_certificate_chain.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_certificate_chain.xml b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_certificate_chain.xml
new file mode 100644
index 0000000..3486f0e
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_certificate_chain.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181121T191226618+0100_ae13e9b2-6ac4-4da5-8bff-2e3b4377ec2f">
+ <operation>DELETE_SSL_CERTIFICATE_CHAIN</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Certificate Chain has been deleted.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_domain_certificate.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_domain_certificate.xml b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_domain_certificate.xml
new file mode 100644
index 0000000..657c5f3
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_domain_certificate.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181121T192344024+0100_06309e7f-c0bb-4034-b960-0b28ad694608">
+ <operation>DELETE_SSL_DOMAIN_CERTIFICATE</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Domain Certificate has been deleted.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_offload_profile.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_offload_profile.xml b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_offload_profile.xml
new file mode 100644
index 0000000..2edf1a6
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/delete_ssl_offload_profile.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181121T182526338+0100_e5bbb24b-7971-4273-9563-5faf0f7daed3">
+ <operation>DELETE_SSL_OFFLOAD_PROFILE</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Offload Profile has been deleted.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/libcloud/test/loadbalancer/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_nttcis.py b/libcloud/test/loadbalancer/test_nttcis.py
index 992b2d9..8a57a06 100644
--- a/libcloud/test/loadbalancer/test_nttcis.py
+++ b/libcloud/test/loadbalancer/test_nttcis.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
+import os
import pytest
from libcloud.utils.py3 import httplib
@@ -21,7 +22,7 @@ from libcloud.common.nttcis import NttCisVIPNode, NttCisPool
from libcloud.common.nttcis import NttCisPoolMember
from libcloud.common.nttcis import NttCisAPIException
from libcloud.loadbalancer.base import LoadBalancer, Member, Algorithm
-from libcloud.loadbalancer.drivers.nttcis import NttCisLBDriver as NttCis
+from libcloud.loadbalancer.drivers.nttcis import NttCisLBDriver
from libcloud.loadbalancer.types import State
from libcloud.test import MockHttp, unittest
@@ -32,16 +33,16 @@ from libcloud.test.secrets import NTTCIS_PARAMS
@pytest.fixture()
def driver():
- NttCis.connectionCls.active_api_version = "2.7"
- NttCis.connectionCls.conn_class = NttCisMockHttp
+ NttCisLBDriver.connectionCls.active_api_version = "2.7"
+ NttCisLBDriver.connectionCls.conn_class = NttCisMockHttp
NttCisMockHttp.type = None
- driver = NttCis(*NTTCIS_PARAMS)
+ driver = NttCisLBDriver(*NTTCIS_PARAMS)
return driver
def test_invalid_region(driver):
with pytest.raises(ValueError):
- driver = NttCis(*NTTCIS_PARAMS, region='blah')
+ driver = NttCisLBDriver(*NTTCIS_PARAMS, region='blah')
def test_invalid_creds(driver):
@@ -521,19 +522,19 @@ def test_ex_get_default_irules(driver):
def test_ex_insert_ssl_certificate(driver):
net_dom_id = "6aafcf08-cb0b-432c-9c64-7371265db086 "
- cert = 'fixtures/nttcis/alice.crt'
- key = 'fixtures/nttcis/alice.key'
- result = driver.ex_import_ssl_cert(net_dom_id, "alice", cert, key, description="test cert")
+ cert = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/loadbalancer/fixtures/nttcis/alice.crt"
+ key = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/loadbalancer/fixtures/nttcis/alice.key"
+ result = driver.ex_import_ssl_domain_certificate(net_dom_id, "alice", cert, key, description="test cert")
assert result is True
def test_ex_insert_ssl_certificate_FAIL(driver):
NttCisMockHttp.type = "FAIL"
net_dom_id = "6aafcf08-cb0b-432c-9c64-7371265db086 "
- cert = 'fixtures/nttcis/denis.crt'
- key = 'fixtures/nttcis/denis.key'
+ cert = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/loadbalancer/fixtures/nttcis/denis.crt"
+ key = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/loadbalancer/fixtures/nttcis/denis.key"
with pytest.raises(NttCisAPIException) as excinfo:
- result = driver.ex_import_ssl_cert(net_dom_id, "denis", cert, key, description="test cert")
+ result = driver.ex_import_ssl_domain_certificate(net_dom_id, "denis", cert, key, description="test cert")
assert excinfo.value.msg == "Data Center EU6 requires key length must be one of 512, 1024, 2048."
@@ -557,6 +558,46 @@ def test_ex_get_ssl_offload_profile(driver):
assert profile.name == "ssl_offload"
+def test_edit_ssl_offload_profile(driver):
+ profile_name = "ssl_offload"
+ datacenter_id = "EU6"
+ NttCisMockHttp.type = "LIST"
+ profile = driver.ex_list_ssl_offload_profiles(name=profile_name, datacenter_id=datacenter_id)[0]
+ NttCisMockHttp.type = None
+ result = driver.ex_edit_ssl_offload_profile(profile.id, profile.name,
+ profile.sslDomainCertificate.id,
+ ciphers=profile.ciphers,
+ description="A test edit of an offload profile")
+ assert result is True
+
+
+def test_delete_ssl_offload_profile(driver):
+ profile_name = "ssl_offload"
+ NttCisMockHttp.type = "LIST"
+ profile = driver.ex_list_ssl_offload_profiles(name=profile_name)[0]
+ NttCisMockHttp.type = None
+ result = driver.ex_delete_ssl_offload_profile(profile.id)
+ assert result is True
+
+
+def test_delete_ssl_certificate_chain(driver):
+ NttCisMockHttp.type = "LIST"
+ chain_name = "ted_carol"
+ cert_chain = driver.ex_list_ssl_certificate_chains(name=chain_name)[0]
+ NttCisMockHttp.type = None
+ result = driver.ex_delete_ssl_certificate_chain(cert_chain.id)
+ assert result is True
+
+
+def test_delete_ssl_domain_certificate(driver):
+ NttCisMockHttp.type = "LIST"
+ cert_name = "alice"
+ cert = driver.ex_list_ssl_domain_certs(name=cert_name)[0]
+ NttCisMockHttp.type = None
+ result = driver.ex_delete_ssl_domain_certificate(cert.id)
+ assert result is True
+
+
class NttCisMockHttp(MockHttp):
fixtures = LoadBalancerFileFixtures('nttcis')
@@ -576,12 +617,20 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load('oec_0_9_myaccount.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9(self, method, url, body, headers):
+ def _caas_2_7_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])
@@ -591,7 +640,11 @@ class NttCisMockHttp(MockHttp):
'networkDomainVip_pool.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7(self, method, url, body, headers):
+ def _caas_2_7_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])
@@ -601,7 +654,11 @@ class NttCisMockHttp(MockHttp):
'networkDomainVip_poolMember.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0(self, method, url, body, headers):
+ def _caas_2_7_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])
@@ -621,37 +678,62 @@ class NttCisMockHttp(MockHttp):
'networkDomainVip_addPoolMember.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode(self, method, url, body, headers):
+ def _caas_2_7_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_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9(self, method, url, body, headers):
+ def _caas_2_7_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])
@@ -666,17 +748,29 @@ class NttCisMockHttp(MockHttp):
'networkDomainVip_editPool.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor(self, method, url, body, headers):
+ def _caas_2_7_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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile(self, method, url, body, headers):
+ def _caas_2_7_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])
@@ -697,7 +791,8 @@ class NttCisMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_importSslDomainCertificate_FAIL(self,
- method, url,
+ method,
+ url,
body,
headers):
body = self.fixtures.load(
@@ -705,8 +800,29 @@ class NttCisMockHttp(MockHttp):
)
return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslDomainCertificate_LIST(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "ssl_cert_by_name.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslCertificateChain_LIST(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "ssl_list_cert_chain_by_name.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslDomainCertificate(self,
- method, url,
+ method,
+ url,
body,
headers):
body = self.fixtures.load(
@@ -744,6 +860,46 @@ class NttCisMockHttp(MockHttp):
)
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editSslOffloadProfile(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "edit_ssl_offload_profile.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteSslOffloadProfile(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "delete_ssl_offload_profile.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteSslCertificateChain(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "delete_ssl_certificate_chain.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteSslDomainCertificate(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "delete_ssl_domain_certificate.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
if __name__ == '__main__':
sys.exit(unittest.main())
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index 0fbec69..ff8f341 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -1,7 +1,4 @@
-from pprint import pprint
import pytest
-import libcloud
-
from libcloud.compute.drivers.nttcis import NttCisPort, NttCisIpAddress, NttCisPublicIpBlock, NttCisNatRule
from libcloud.common.nttcis import NttCisFirewallRule, NttCisVlan, NttCisFirewallAddress, NttCisAPIException
@@ -298,7 +295,7 @@ def test_insert_ssl(lbdriver, compute_driver):
net_dom = compute_driver.ex_list_network_domains(name=net_dom_name)[0]
cert = '/home/mraful/client/bob.crt'
key = '/home/mraful/client/bob.key'
- result = lbdriver.ex_import_ssl_cert(net_dom.id, "bob", cert, key, description="test cert")
+ result = lbdriver.ex_import_ssl_domain_certificate(net_dom.id, "bob", cert, key, description="test cert")
assert result is True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
index 8941630..a99d3cf 100644
--- a/tests/lib_edit_test.py
+++ b/tests/lib_edit_test.py
@@ -476,4 +476,25 @@ def test_edit_ssl_offload_profile(lbdriver):
profile.sslDomainCertificate.id,
ciphers=profile.ciphers,
description="A test edit of an offload profile")
+ assert result is True
+
+
+def test_delete_ssl_offload_profile(lbdriver):
+ profile_name = "ssl_offload"
+ profile = lbdriver.ex_list_ssl_offload_profiles(name=profile_name)[0]
+ result = lbdriver.ex_delete_ssl_offload_profile(profile.id)
+ assert result is True
+
+
+def test_delete_ssl_certificate_chain(lbdriver):
+ chain_name = "ted_carol"
+ cert_chain = lbdriver.ex_list_ssl_certificate_chains(name=chain_name)[0]
+ result = lbdriver.ex_delete_ssl_certificate_chain(cert_chain.id)
+ assert result is True
+
+
+def test_delete_ssl_domain_certificate(lbdriver):
+ cert_name = "alice"
+ cert = lbdriver.ex_list_ssl_domain_certs(name=cert_name)[0]
+ result = lbdriver.ex_delete_ssl_domain_certificate(cert.id)
assert result is True
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8c4b9cc/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 4b5990e..4dcc693 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,7 @@ passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
-r{toxinidir}/requirements-tests.txt
lockfile
+ pyopenssl
libvirt-python==4.0.0
py2.7: paramiko
commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
@@ -103,6 +104,7 @@ commands = python -m integration
[testenv:coverage]
deps =
-r{toxinidir}/requirements-tests.txt
+ pyopenssl
libvirt-python==4.0.0
lockfile
set-env =