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:10 UTC
[01/45] libcloud git commit: Added new code for xml parsing to
common/nttcis
Repository: libcloud
Updated Branches:
refs/heads/trunk 1a3ebe5d6 -> de159ec7b
Added new code for xml parsing to common/nttcis
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/067e93ec
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/067e93ec
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/067e93ec
Branch: refs/heads/trunk
Commit: 067e93ec71597d8d2d4aba171cdd60f272e8a65b
Parents: f63a13d
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Oct 4 07:56:57 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Oct 4 07:56:57 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 196 ++++++++++++++++++++++++++++++++++-------
1 file changed, 166 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/067e93ec/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 75bd875..aea3e41 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -17,6 +17,8 @@ Dimension Data Common Components
"""
from base64 import b64encode
from time import sleep
+from lxml import etree
+from io import BytesIO
# TODO: use disutils.version when Travis CI fixed the pylint issue with version
# from distutils.version import LooseVersion
from libcloud.utils.py3 import httplib
@@ -1933,8 +1935,150 @@ class NttCisNic(object):
##### Testing new concept below this line
-class XmlListConfig(list):
+attrs = {}
+
+
+def processor(mapping, name=None):
+ mapping = mapping
+
+ map_copy = deepcopy(mapping)
+
+ def add_items(key, value, name=None):
+ if name in attrs:
+ print(attrs)
+ attrs[name].update({key: value})
+ elif name is not None:
+ attrs[name] = value
+
+ else:
+ attrs.update({key: value})
+ if key in map_copy:
+ del map_copy[key]
+ elif key in map_copy[name]:
+ del map_copy[name][key]
+ if len(map_copy[name]) == 0:
+ del map_copy[name]
+
+ def handle_map(map, name):
+ tmp = {}
+ types = [type(x) for x in map.values()]
+ if XmlListConfig not in types and XmlDictConfig not in types and dict not in types:
+ return map
+
+ elif XmlListConfig in types:
+ result = handle_seq(map, name)
+ return result
+ else:
+ for k, v in map.items():
+ if isinstance(v, str):
+ tmp.update({k: v})
+ if isinstance(v, dict):
+ cls = build_class(k.capitalize(), v)
+ tmp.update({k: cls})
+ elif isinstance(v, XmlDictConfig):
+ cls = build_class(k.capitalize(), v)
+ return (k, cls)
+ return tmp
+
+ def handle_seq(seq, name):
+ tmp = {}
+ tmp_list = []
+ if isinstance(seq, list):
+ tmp = []
+ for _ in seq:
+ cls = build_class(name.capitalize(), _)
+ tmp.append(cls)
+ return tmp
+ for k, v in seq.items():
+ if isinstance(v, Mapping):
+ result1 = handle_map(v, k)
+ elif isinstance(v, MutableSequence):
+ for _ in v:
+ if isinstance(_, Mapping):
+ types = [type(x) for x in _.values()]
+ if XmlDictConfig in types:
+ result = handle_map(_, k)
+ if isinstance(result, tuple):
+ tmp.update({result[0]: result[1]})
+ else:
+ tmp.update({k: result})
+ else:
+ tmp_list = [build_class(k.capitalize(), i) for i in v]
+ tmp[k] = tmp_list
+ print()
+ elif isinstance(v, str):
+ tmp.update({k: v})
+ return tmp
+
+ def build_class(key, value):
+ klass = class_factory(key.capitalize(), value)
+ return klass(value)
+
+ def process(mapping, name):
+ for k1, v1 in mapping.items():
+ if isinstance(v1, Mapping):
+ types = [type(v) for v in v1.values()]
+ if MutableSequence not in types and dict not in types:
+ result = handle_map(v1, k1)
+ cls = build_class(k1.capitalize(), result)
+ add_items(k1, cls)
+ elif XmlListConfig in types:
+ result = handle_seq(v1, k1)
+ cls = build_class(list(v1)[0], result)
+ add_items(k1, cls)
+ elif dict in types:
+ result = handle_map(v1, k1)
+ cls = build_class(k1.capitalize(), result)
+ add_items(k1, cls, k1)
+ elif isinstance(v1, list):
+ tmp = {}
+ tmp1 = {}
+ tmp2 = {}
+ tmp2[k1] = []
+ for i, j in enumerate(v1):
+ if isinstance(j, dict):
+ key = list(j)[0]
+ result = handle_map(j, key)
+ tmp1[k1 + str(i)] = build_class(k1, result)
+ tmp2[k1].append(tmp1[k1 + str(i)])
+ if tmp2:
+ #cls = build_class(k1.capitalize(), tmp2)
+ add_items(k1, tmp2[k1], k1)
+ elif isinstance(v1, str):
+ add_items(k1, v1)
+
+
+
+
+ if len(map_copy) == 0:
+ return 1
+ #print(attrs)
+ return process(mapping, name)
+
+
+def class_factory(cls_name, attrs):
+
+ def __init__(self, *args, **kwargs):
+ for key in attrs:
+ setattr(self, key, attrs[key])
+
+ def __iter__(self):
+ for name in self.__dict__:
+ yield getattr(self, name)
+
+ def __repr__(self):
+ values = ', '.join('{}={!r}'.format(*i) for i in zip(self.__dict__, self))
+ return '{}({})'.format(self.__class__.__name__, values)
+
+ cls_attrs = dict(
+ __init__=__init__,
+ __iter__=__iter__,
+ __repr__=__repr__)
+
+ return type("NttCis{}".format(cls_name), (object,), cls_attrs)
+
+class XmlListConfig(list):
def __init__(self, elem_list):
for element in elem_list:
if element is not None:
@@ -1988,20 +2132,21 @@ class XmlDictConfig(dict):
# currently doing XML configuration files...
elif element.items():
# It is possible to have duplicate element tags. If so, convert to a dict of lists
- if element.tag in self:
+ if element.tag.split('}')[1] in self:
tmp_list = list()
tmp_dict = dict()
- if isinstance(self[element.tag], list):
- tmp_list.append(element.tag)
+ if isinstance(self[element.tag.split('}')[1]], list):
+ tmp_list.append(element.tag.split('}')[1])
else:
- for k, v in self[element.tag].items():
+ for k, v in self[element.tag.split('}')[1]].items():
if isinstance(k, XmlListConfig):
tmp_list.append(k)
else:
tmp_dict.update({k: v})
tmp_list.append(tmp_dict)
tmp_list.append(dict(element.items()))
- self[element.tag] = tmp_list
+ print()
+ self[element.tag.split('}')[1]] = tmp_list
else:
self.update({element.tag.split('}')[1]: dict(element.items())})
# finally, if there are no child tags and no attributes, extract
@@ -2010,28 +2155,19 @@ class XmlDictConfig(dict):
self.update({element.tag.split('}')[1]: element.text})
-class Generic:
- def __new__(cls, arg):
- if isinstance(arg, abc.Mapping):
- return super().__new__(cls)
- elif isinstance(arg, abc.MutableSequence):
- return [cls(item) for item in arg]
- else:
- return arg
-
- def __init__(self, mapping):
- self.__data = {}
- for key, value in mapping.items():
- if iskeyword(key):
- key += '_'
- self.__data[key] = value
-
- def __getattr__(self, name):
- if hasattr(self.__data, name):
- return getattr(self.__data, name)
- else:
- return Generic(self.__data[name])
+def process_xml(xml):
+ tree = etree.parse(BytesIO(xml))
+ root = tree.getroot()
+ elem = root.tag.split('}')[1].capitalize()
+ items = dict(root.items())
- def __repr__(self):
- values = ','.join("{}={!r}".format(k, v) for k,v in self.__data.items())
- return values
\ No newline at end of file
+ if 'pageNumber' in items:
+ converted_xml = XmlListConfig(root)
+ processor(converted_xml[0])
+ else:
+ converted_xml = XmlDictConfig(root)
+ processor(converted_xml)
+ klass = class_factory(elem.capitalize(), attrs)
+ cls = klass(attrs)
+
+ return cls
\ No newline at end of file
[27/45] libcloud git commit: Finished ssl import and list
Posted by an...@apache.org.
Finished ssl import and list
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/35131c86
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/35131c86
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/35131c86
Branch: refs/heads/trunk
Commit: 35131c86fdf0117a600c4e698112166ba4356be2
Parents: 9319bbb
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Nov 16 15:59:35 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Nov 16 15:59:35 2018 -0500
----------------------------------------------------------------------
libcloud/loadbalancer/drivers/nttcis.py | 39 ++++++++++++++++++++++++++--
tests/lib_list_test.py | 4 ++-
2 files changed, 40 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/35131c86/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index ee1bd53..690ecf8 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import OpenSSL.crypto
-
+import functools
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import NttCisPool
@@ -28,6 +28,7 @@ from libcloud.common.nttcis import NttCisDefaultiRule
from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
+from libcloud.common.nttcis import process_xml
from libcloud.utils.misc import reverse_dict
from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.loadbalancer.types import State
@@ -37,6 +38,26 @@ from libcloud.loadbalancer.base import Member
from libcloud.loadbalancer.types import Provider
+def get_params(func):
+ @functools.wraps(func)
+ def paramed(*args, **kwargs):
+
+ if kwargs:
+ for k, v in kwargs.items():
+ old_key = k
+ matches = re.findall(r'_(\w)', k)
+ for match in matches:
+ k = k.replace('_' + match, match.upper())
+ del kwargs[old_key]
+ kwargs[k] = v
+ params = kwargs
+ result = func(args[0], params)
+ else:
+ result = func(args[0])
+ return result
+ return paramed
+
+
class NttCisLBDriver(Driver):
"""
NttCis LB driver.
@@ -1072,8 +1093,13 @@ class NttCisLBDriver(Driver):
method='GET').object
return self._to_irules(result)
+ @get_params
def ex_list_ssl_domain_certs(self, params={}):
- pass
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslDomainCertificate",
+ params=params,
+ method="GET").object
+ return self._to_certs(result)
def _to_irules(self, object):
irules = []
@@ -1262,3 +1288,12 @@ class NttCisLBDriver(Driver):
slow_ramp_time=findtext(element, 'slowRampTime', TYPES_URN),
)
return pool
+
+ def _to_certs(self, object):
+ certs = []
+ for element in object.findall(fixxpath("sslDomainCertificate", TYPES_URN)):
+ certs.append(self._to_cert(element))
+ return certs
+
+ def _to_cert(self, el):
+ return process_xml(ET.tostring(el))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/35131c86/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index bf572e3..650984e 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -427,4 +427,6 @@ def test_get_snapshots_by_min(drsdriver):
def test_list_domain_certs(compute_driver, lbdriver):
- pass
\ No newline at end of file
+ certs = lbdriver.ex_list_ssl_domain_certs()
+ for cert in certs:
+ print(cert)
\ No newline at end of file
[36/45] libcloud git commit: Added more tests for mcp1.0 for greater
coverage
Posted by an...@apache.org.
Added more tests for mcp1.0 for greater coverage
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e23061f5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e23061f5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e23061f5
Branch: refs/heads/trunk
Commit: e23061f53a703cf22ef113d03061aed747bd4c74
Parents: aa6ad8f
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Nov 26 21:51:45 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Nov 26 21:51:45 2018 -0500
----------------------------------------------------------------------
libcloud/compute/drivers/nttcis.py | 2 +-
.../fixtures/nttcis/networkWithLocation.xml | 19 +++
libcloud/test/compute/test_nttcis.py | 135 +++++++++++++++++++
3 files changed, 155 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e23061f5/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 9810958..8f7deef 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -922,7 +922,7 @@ class NttCisNodeDriver(NodeDriver):
return self._to_networks(
self.connection
- .request_with_orgId_api_1('networkWithLocation%s' % url_ext)
+ .request_with_orgId_api_2('networkWithLocation%s' % url_ext)
.object)
def import_image(self, ovf_package_name, name,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e23061f5/libcloud/test/compute/fixtures/nttcis/networkWithLocation.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/networkWithLocation.xml b/libcloud/test/compute/fixtures/nttcis/networkWithLocation.xml
new file mode 100644
index 0000000..227def2
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/networkWithLocation.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns3:NetworkWithLocations xmlns:ns16="http://oec.api.opsource.net/schemas/reset" xmlns:ns14="http://oec.api.opsource.net/schemas/multigeo" xmlns:ns15="http://oec.api.opsource.net/schemas/support" xmlns:ns9="http://oec.api.opsource.net/schemas/directory" xmlns:ns5="http://oec.api.opsource.net/schemas/vip" xmlns:ns12="http://oec.api.opsource.net/schemas/admin" xmlns:ns13="http://oec.api.opsource.net/schemas/general" xmlns:ns6="http://oec.api.opsource.net/schemas/organization" xmlns:ns7="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns10="http://oec.api.opsource.net/schemas/storage" xmlns:ns8="http://oec.api.opsource.net/schemas/backup" xmlns:ns11="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns:ns2="http://oec.api.opsource.net/schemas/server" xmlns:ns1="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns4="http://oec.api.opsource.net/schemas/manualimport" xmlns:ns3="http://oec.api.opsource.net/schemas/network">
+ <ns3:network>
+ <ns3:id>4bba37be-506f-11e3-b29c-001517c4643e</ns3:id>
+ <ns3:name>test-net1</ns3:name>
+ <ns3:description>Test Network.</ns3:description>
+ <ns3:location>NA5</ns3:location>
+ <ns3:privateNet>10.192.176.0</ns3:privateNet>
+ <ns3:multicast>false</ns3:multicast>
+ </ns3:network>
+ <ns3:network>
+ <ns3:id>208e3a8e-9d2f-11e2-b29c-001517c4643e</ns3:id>
+ <ns3:name>Test Network</ns3:name>
+ <ns3:description>Network description</ns3:description>
+ <ns3:location>NA9</ns3:location>
+ <ns3:privateNet>10.172.74.0</ns3:privateNet>
+ <ns3:multicast>false</ns3:multicast>
+ </ns3:network>
+</ns3:NetworkWithLocations>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e23061f5/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index cff7094..7f894bd 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -9,6 +9,8 @@ from libcloud.common.types import InvalidCredsError
from libcloud.common.nttcis import NttCisAPIException, NetworkDomainServicePlan
from libcloud.common.nttcis import NttCisServerCpuSpecification, NttCisServerDisk, NttCisServerVMWareTools
from libcloud.common.nttcis import NttCisTag, NttCisTagKey
+from libcloud.common.nttcis import NttCisServerCpuSpecification
+from libcloud.common.nttcis import NttCisServerDisk
from libcloud.common.nttcis import NttCisIpAddress, \
NttCisIpAddressList, NttCisChildIpAddressList, \
NttCisPortList, NttCisPort, NttCisChildPortList
@@ -247,6 +249,134 @@ def test_ex_list_customer_images(driver):
assert images[0].extra['OS_displayName'] == 'REDHAT6/64'
+def test_create_mcp1_node_optional_param(driver):
+ root_pw = NodeAuthPassword('pass123')
+ image = driver.list_images()[0]
+ network = driver.ex_list_networks()[0]
+ cpu_spec = NttCisServerCpuSpecification(cpu_count='4',
+ cores_per_socket='2',
+ performance='STANDARD')
+ disks = [NttCisServerDisk(scsi_id='0', speed='HIGHPERFORMANCE')]
+ node = driver.create_node(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'
+ )
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+
+
+def test_create_mcp1_node_response_no_pass_random_gen(driver):
+ image = driver.list_images()[0]
+ network = driver.ex_list_networks()[0]
+ node = driver.create_node(name='test2', image=image, auth=None,
+ ex_description='test2 node',
+ ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+ assert 'password' in node.extra
+
+
+def test_create_mcp1_node_response_no_pass_customer_windows(driver):
+ image = driver.ex_list_customer_images()[1]
+ network = driver.ex_list_networks()[0]
+ node = driver.create_node(name='test2', image=image, auth=None,
+ ex_description='test2 node', ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+ assert 'password' in node.extra
+
+
+def test_create_mcp1_node_response_no_pass_customer_windows_STR(driver):
+ image = driver.ex_list_customer_images()[1].id
+ network = driver.ex_list_networks()[0]
+ node = driver.create_node(name='test2', image=image, auth=None,
+ ex_description='test2 node', ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+ assert 'password' in node.extra
+
+
+def test_create_mcp1_node_response_no_pass_customer_linux(driver):
+ image = driver.ex_list_customer_images()[0]
+ network = driver.ex_list_networks()[0]
+ node = driver.create_node(name='test2', image=image, auth=None,
+ ex_description='test2 node', ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+ assert 'password' not in node.extra
+
+
+def test_create_mcp1_node_response_no_pass_customer_linux_STR(driver):
+ image = driver.ex_list_customer_images()[0].id
+ network = driver.ex_list_networks()[0]
+ node = driver.create_node(name='test2', image=image, auth=None,
+ ex_description='test2 node', ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+ assert 'password' not in node.extra
+
+
+def test_create_mcp1_node_response_STR(driver):
+ rootPw = 'pass123'
+ image = driver.list_images()[0].id
+ network = driver.ex_list_networks()[0].id
+ node = driver.create_node(name='test2', image=image, auth=rootPw,
+ ex_description='test2 node', ex_network=network,
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+
+
+def test_create_mcp1_node_no_network(driver):
+ rootPw = NodeAuthPassword('pass123')
+ image = driver.list_images()[0]
+ with pytest.raises(InvalidRequestError):
+ driver.create_node(name='test2',
+ image=image,
+ auth=rootPw,
+ ex_description='test2 node',
+ ex_network=None,
+ ex_is_started=False)
+
+
+def test_create_node_mcp1_ipv4(driver):
+ rootPw = NodeAuthPassword('pass123')
+ image = driver.list_images()[0]
+ node = driver.create_node(name='test2',
+ image=image,
+ auth=rootPw,
+ ex_description='test2 node',
+ ex_network='fakenetwork',
+ ex_primary_ipv4='10.0.0.1',
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+
+
+def test_create_node_mcp1_network(driver):
+ rootPw = NodeAuthPassword('pass123')
+ image = driver.list_images()[0]
+ node = driver.create_node(name='test2',
+ image=image,
+ auth=rootPw,
+ ex_description='test2 node',
+ ex_network='fakenetwork',
+ ex_is_started=False)
+ assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+ assert node.extra['status'].action == 'DEPLOY_SERVER'
+
+
def test_create_node_response_network_domain(driver):
rootPw = NodeAuthPassword('pass123')
location = driver.ex_get_location_by_id('NA9')
@@ -1706,6 +1836,11 @@ 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_networkWithLocation(self, method, url, body, headers):
+ body = self.fixtures.load(
+ 'networkWithLocation.xml')
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server(self, method, url, body, headers):
body = self.fixtures.load(
'server.xml')
[11/45] libcloud git commit: Merge branch 'feature_drs' of
https://bitbucket.mcp-services.net/scm/devops/libcloud into dynamic
Posted by an...@apache.org.
Merge branch 'feature_drs' of https://bitbucket.mcp-services.net/scm/devops/libcloud into dynamic
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/82afeb4d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/82afeb4d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/82afeb4d
Branch: refs/heads/trunk
Commit: 82afeb4d2b49485525bafc408c87dc2a9e0785f6
Parents: 81d5736 88daff6
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Oct 30 16:12:30 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Oct 30 16:12:30 2018 -0400
----------------------------------------------------------------------
.gitignore | 2 +-
libcloud/drs/drivers/nttcis.py | 41 ++++
libcloud/utils/xml.py | 14 --
tests/conftest.py | 40 ++++
tests/lib_create_test.py | 262 +++++++++++++++++++++
tests/lib_edit_test.py | 457 ++++++++++++++++++++++++++++++++++++
tests/lib_list_test.py | 393 +++++++++++++++++++++++++++++++
tests/lib_misc_test.py | 10 +
tests/test_lib_list.py | 344 ---------------------------
9 files changed, 1204 insertions(+), 359 deletions(-)
----------------------------------------------------------------------
[02/45] libcloud git commit: added file test_lib_list.py
Posted by an...@apache.org.
added file test_lib_list.py
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fcd632ab
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fcd632ab
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fcd632ab
Branch: refs/heads/trunk
Commit: fcd632ab271ac6331927a3ec39bfa1de8bd3d784
Parents: 7ee8bf5
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 12:55:26 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 12:55:26 2018 -0400
----------------------------------------------------------------------
tests/test_lib_list.py | 344 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 344 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/fcd632ab/tests/test_lib_list.py
----------------------------------------------------------------------
diff --git a/tests/test_lib_list.py b/tests/test_lib_list.py
new file mode 100644
index 0000000..48550cd
--- /dev/null
+++ b/tests/test_lib_list.py
@@ -0,0 +1,344 @@
+import pytest
+import libcloud
+from libcloud import loadbalancer
+
+
+def test_list_node_all(compute_driver):
+ nodes = compute_driver.list_nodes()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ node.extra['scsi_controller'], node.extra['disks'], node.extra['memoryMb'],
+ node.extra['OS_displayName'], node.private_ips, node.extra['ipv6'], node.extra['window'])
+
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_location(compute_driver):
+ nodes = compute_driver.list_nodes(ex_location='EU6')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_name(compute_driver):
+ nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_ipv6(compute_driver):
+ nodes = compute_driver.list_nodes(ex_ipv6='2a00:47c0:111:1331:6140:e432:729b:eef6')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_ipv4(compute_driver):
+ nodes = compute_driver.list_nodes(ex_ipv4='10.1.1.6')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_images(compute_driver):
+ images = compute_driver.list_images(location='EU6')
+ print()
+ for image in images:
+ print(image.id, image.name)
+ assert isinstance(images, list) and len(images) > 0
+
+
+def test_list_os(compute_driver):
+ oss = compute_driver.ex_list_os(location='EU6')
+
+
+def test_list_node_by_image(compute_driver):
+ nodes = compute_driver.list_nodes(ex_image='81a36aa0-555c-4735-b965-4b64fcf0ac8f')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+"""
+ requires retrieving vlan Id first
+"""
+def test_list_node_vlan(compute_driver):
+ nodes = compute_driver.list_nodes(ex_vlan='eb05a24e-85a6-46e3-a7c9-f1765737476d')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+"""
+Libcloud docs say this works but it is not in our API docs
+def test_list_node_image(compute_driver):
+ nodes = compute_driver.list_nodes(ex_image='46096745-5a89-472b-9b3b-89a6a07bb60b')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+"""
+
+
+def test_list_node_started(compute_driver):
+ nodes = compute_driver.list_nodes(ex_started='true')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_deployed(compute_driver):
+ nodes = compute_driver.list_nodes(ex_deployed='true')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_state(compute_driver):
+ nodes = compute_driver.list_nodes(ex_state='NORMAL')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_network_domain_id(compute_driver):
+ nodes = compute_driver.list_nodes(ex_network_domain='6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_vlans(compute_driver):
+ vlans = compute_driver.ex_list_vlans()
+ print()
+ for vlan in vlans:
+ print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
+ vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
+ assert isinstance(vlans, list) and len(vlans) > 0
+
+
+def test_list_vlan(compute_driver):
+ vlan = compute_driver.ex_get_vlan('eb05a24e-85a6-46e3-a7c9-f1765737476d')
+ print()
+ print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
+ vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
+ assert vlan.name == 'sdk_vlan1'
+
+
+def test_list_datacenter_object_creation(compute_driver):
+ datacenter = compute_driver.ex_get_datacenter('EU6')
+
+
+def test_list_firewall_rules(compute_driver):
+ rules = compute_driver.ex_list_firewall_rules('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for rule in rules:
+ print("id {}, name {}, action {}. location {}, ip ver {}, protocol {}, any ip {}, ip {}, prefix {},"
+ " port range {} {} , src address {}, src port list {}, dest. any__ip {}, dest address {}, "
+ "dest prefix {}, dest port range {} {}, dest address list id {}"
+ ", dest port list id {}".format(
+ rule.id, rule.name, rule.action,
+ rule.location.name, rule.ip_version,
+ rule.protocol, rule.source.any_ip,
+ rule.source.ip_address,
+ rule.source.ip_prefix_size,
+ rule.source.port_begin, rule.source.port_end,
+ rule.source.address_list_id,
+ rule.source.port_list_id,
+ rule.destination.any_ip,
+ rule.destination.ip_address,
+ rule.destination.ip_prefix_size,
+ rule.destination.port_begin,
+ rule.destination.port_end,
+ rule.destination.address_list_id,
+ rule.destination.port_list_id,
+ ))
+
+
+def test_list_address_lists(compute_driver):
+ address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for address_list in address_lists:
+ print(address_list)
+ assert isinstance(address_lists, list) and len(address_lists) > 0
+
+
+def test_list_port_lists(compute_driver):
+ port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for portlist in port_lists:
+ print(portlist)
+ assert isinstance(port_lists, list) and len(port_lists) > 0
+
+
+def test_list_nat_rules(compute_driver):
+ nat_rules = compute_driver.ex_list_nat_rules(compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086'))
+ print()
+ for nat_rule in nat_rules:
+ print(nat_rule, nat_rule.external_ip, nat_rule.internal_ip)
+ assert isinstance(nat_rules, list) and len(nat_rules) > 0
+
+
+def test_list_balancers(lbdriver):
+ balancers = lbdriver.list_balancers(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for balancer in balancers:
+ print(balancer.id, balancer.ip, balancer.name, balancer.port)
+ assert isinstance(balancers, list)
+
+
+def test_get_listener(lbdriver):
+ listener = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
+ print()
+ print(listener.ip, listener.name, listener.port)
+ assert listener.ip == '168.128.13.127'
+
+
+def test_vip_nodes(lbdriver):
+ vips = lbdriver.ex_get_nodes("6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for vip in vips:
+ print(vip, vip.ip, vip.name)
+ assert isinstance(vips, list) and len(vips) > 0
+
+
+def test_list_lb_pools(lbdriver):
+ pools = lbdriver.ex_get_pools(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for pool in pools:
+ print(pool.id, pool.name, pool.description, pool.health_monitor_id, pool.load_balance_method, pool.slow_ramp_time, pool.status)
+ assert isinstance(pools, list)
+
+
+def test_list_lb_pool_members(lbdriver):
+ balancer = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
+ pool_members = lbdriver.balancer_list_members(balancer)
+ print()
+ for pool_member in pool_members:
+ print(pool_member)
+ assert isinstance(pool_members, list)
+
+
+def test_get_pool_member(lbdriver):
+ pool_member = lbdriver.ex_get_pool_member("9382e488-7f95-4db0-b2de-0b807aab825b")
+ print()
+ print(pool_member.ip, pool_member.port, pool_member.name)
+ assert pool_member.ip == '10.1.1.8'
+
+
+def test_get_node(lbdriver):
+ node = lbdriver.ex_get_node("5c647a74-d181-4ed8-82d3-55ae443a06dd")
+ print()
+ print(node.name, node.ip, node.connection_limit, node.connection_rate_limit)
+ assert isinstance(node, object)
+
+
+def test_list_snapshots(compute_driver):
+ snapshots = compute_driver.list_snapshots('web1')
+ for snapshot in snapshots:
+ print(snapshot)
+ assert 'expiry_time' in snapshot
+
+
+def test_list_nics(compute_driver):
+ result = compute_driver.ex_list_
+
+
+def test_list_vlans(compute_driver):
+ vlans = compute_driver.ex_list_vlans()
+ print(vlans)
+ assert isinstance(vlans, list)
+
+
+def test_list_anti_affinity_rules(compute_driver):
+ # Could use network domain or node but not both
+ # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
+ node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
+ anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
+ assert len(anti_affinity_rules) > 1
+
+
+def test_list_no_anti_affinity_rules(compute_driver):
+ # Could use network domain or node but not both
+ # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
+ node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
+ anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
+ assert len(anti_affinity_rules) == 0
+
+
+
+"""
+def test_list_sizes(compute_driver):
+ properties = compute_driver.list_locations()
+ for property in properties:
+ print(property)
+"""
+
+
+def test_images(compute_driver):
+ images = compute_driver.list_images()
+ print()
+ print(images)
+ assert isinstance(images, list) and len(images) > 0
+
+
+def test_list_public_ip_blocks(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ blocks = compute_driver.ex_list_public_ip_blocks(net_domain)
+ print(blocks)
+
+
+def test_list_private_ipv4_addresses_vlan(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ip_addresses = compute_driver.ex_list_reserved_ipv4(vlan=vlan)
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_private_ipv4_addresses_datacenter(compute_driver):
+ datacenter_id = 'EU8'
+ ip_addresses = compute_driver.ex_list_reserved_ipv4(datacenter_id=datacenter_id)
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_private_ipv4_addresses_all(compute_driver):
+ ip_addresses = compute_driver.ex_list_reserved_ipv4()
+ for ip_address in ip_addresses:
+ print(ip_address)
\ No newline at end of file
[15/45] libcloud git commit: commented out several classes in
common/nttcis module, added tests for get single cg
Posted by an...@apache.org.
commented out several classes in common/nttcis module, added tests for get single cg
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/62e0aafc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/62e0aafc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/62e0aafc
Branch: refs/heads/trunk
Commit: 62e0aafc21d70b5b58618118154ec37e70e725d9
Parents: 0346c30
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Nov 1 16:32:30 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Nov 1 16:32:30 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 51 ++++++++++++--------
libcloud/compute/drivers/nttcis.py | 35 +++++++-------
libcloud/drs/drivers/nttcis.py | 11 ++++-
.../fixtures/nttcis/get_consistency_group.xml | 27 +++++++++++
libcloud/test/drs/test_nttcis.py | 23 +++++++--
tests/lib_list_test.py | 9 +++-
6 files changed, 110 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 42866d1..390b85e 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -744,13 +744,13 @@ class NttCisPublicIpBlock(object):
self.status))
+"""
class NttCisServerCpuSpecification(object):
- """
+
A class that represents the specification of the CPU(s) for a
node
- """
+
def __init__(self, cpu_count, cores_per_socket, performance):
- """
Instantiate a new :class:`NttCisServerCpuSpecification`
:param cpu_count: The number of CPUs
@@ -762,7 +762,7 @@ class NttCisServerCpuSpecification(object):
:param performance: The performance type, e.g. HIGHPERFORMANCE
:type performance: ``str``
- """
+
self.cpu_count = cpu_count
self.cores_per_socket = cores_per_socket
self.performance = performance
@@ -772,32 +772,30 @@ class NttCisServerCpuSpecification(object):
'cpu_count=%s, cores_per_socket=%s, '
'performance=%s>')
% (self.cpu_count, self.cores_per_socket, self.performance))
-
-
+"""
+"""
class NttCisServerDisk(object):
- """
+
A class that represents the disk on a server
- """
- def __init__(self, id=None, scsi_id=None, size_gb=None, speed=None,
- state=None):
- """
+
+ def __init__(self, id=None, scsi_id=None, size_gb=None, speed=None, state=None):
Instantiate a new :class:`DimensionDataServerDisk`
-
+
:param id: The id of the disk
:type id: ``str``
-
+
:param scsi_id: Representation for scsi
:type scsi_id: ``int``
-
+
:param size_gb: Size of the disk
:type size_gb: ``int``
-
+
:param speed: Speed of the disk (i.e. STANDARD)
:type speed: ``str``
-
+
:param state: State of the disk (i.e. PENDING)
:type state: ``str``
- """
+
self.id = id
self.scsi_id = scsi_id
self.size_gb = size_gb
@@ -811,11 +809,11 @@ class NttCisServerDisk(object):
class NttCisScsiController(object):
- """
+
A class that represents the disk on a server
- """
+
def __init__(self, id, adapter_type, bus_number, state):
- """
+
Instantiate a new :class:`DimensionDataServerDisk`
:param id: The id of the controller
@@ -832,7 +830,7 @@ class NttCisScsiController(object):
:param state: State of the disk (i.e. PENDING)
:type state: ``str``
- """
+
self.id = id
self.adapter_type = adapter_type
self.bus_number = bus_number
@@ -842,6 +840,7 @@ class NttCisScsiController(object):
return (('<NttCisScsiController: '
'id=%s, adapter_type=%s, bus_number=%s, state=%s')
% (self.id, self.adapter_type, self.bus_number, self.state))
+"""
class NttCisServerVMWareTools(object):
@@ -1936,6 +1935,13 @@ attrs = {}
def processor(mapping, name=None):
+ """
+ Closure that keeps the deepcopy of the original dict
+ converted to XML current.
+ :param mapping: The converted XML to dict/lists
+ :param name: (Optional) what becomes the class name if provided
+ :return: Nothing
+ """
mapping = mapping
map_copy = deepcopy(mapping)
@@ -1948,6 +1954,7 @@ def processor(mapping, name=None):
else:
attrs.update({key: value})
+ # trim the copy of the mapping
if key in map_copy:
del map_copy[key]
elif key in map_copy[name]:
@@ -2082,6 +2089,8 @@ class XmlListConfig(list):
self.append(XmlDictConfig(element))
# treat like list
elif element[0].tag == element[1].tag:
+ # property refers to an element used repeatedly
+ # in the XML for data centers only
if 'property' in element.tag:
self.append({element.attrib.get('name'): element.attrib.get('value')})
else:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index a17286a..d8b4aa3 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -30,9 +30,9 @@ from libcloud.common.nttcis import (NttCisConnection,
from libcloud.common.nttcis import NttCisNetwork
from libcloud.common.nttcis import NttCisNetworkDomain
from libcloud.common.nttcis import NttCisVlan
-from libcloud.common.nttcis import NttCisServerCpuSpecification
-from libcloud.common.nttcis import NttCisServerDisk
-from libcloud.common.nttcis import NttCisScsiController
+#from libcloud.common.nttcis import NttCisServerCpuSpecification
+#from libcloud.common.nttcis import NttCisServerDisk
+#from libcloud.common.nttcis import NttCisScsiController
from libcloud.common.nttcis import NttCisServerVMWareTools
from libcloud.common.nttcis import NttCisPublicIpBlock
from libcloud.common.nttcis import NttCisFirewallRule
@@ -4850,21 +4850,22 @@ class NttCisNodeDriver(NodeDriver):
location_id = element.get('datacenterId')
location = list(filter(lambda x: x.id == location_id,
locations))[0]
+ return process_xml(ET.tostring(element))
- return NttCisFirewallRule(
- id=element.get('id'),
- network_domain=network_domain,
- name=findtext(element, 'name', TYPES_URN),
- action=findtext(element, 'action', TYPES_URN),
- ip_version=findtext(element, 'ipVersion', TYPES_URN),
- protocol=findtext(element, 'protocol', TYPES_URN),
- enabled=findtext(element, 'enabled', TYPES_URN),
- source=self._to_firewall_address(
- element.find(fixxpath('source', TYPES_URN))),
- destination=self._to_firewall_address(
- element.find(fixxpath('destination', TYPES_URN))),
- location=location,
- status=findtext(element, 'state', TYPES_URN))
+ #return NttCisFirewallRule(
+ # id=element.get('id'),
+ # network_domain=network_domain,
+ # name=findtext(element, 'name', TYPES_URN),
+ # action=findtext(element, 'action', TYPES_URN),
+ # ip_version=findtext(element, 'ipVersion', TYPES_URN),
+ # protocol=findtext(element, 'protocol', TYPES_URN),
+ # enabled=findtext(element, 'enabled', TYPES_URN),
+ # source=self._to_firewall_address(
+ # element.find(fixxpath('source', TYPES_URN))),
+ # destination=self._to_firewall_address(
+ # element.find(fixxpath('destination', TYPES_URN))),
+ # location=location,
+ # status=findtext(element, 'state', TYPES_URN))
def _to_firewall_address(self, element):
ip = element.find(fixxpath('ip', TYPES_URN))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 4ae2891..a2a66a4 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -97,9 +97,16 @@ class NttCisDRSDriver(Driver):
cgs = self._to_consistency_groups(response)
return cgs
+ def get_consistency_group(self, consistency_group_id):
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/consistencyGroup/%s" % consistency_group_id
+ ).object
+ cg = self._to_process(response)
+ return cg
+
def _to_consistency_groups(self, object):
cgs = findall(object, 'consistencyGroup', TYPES_URN)
- return [self._to_consistency_group(el) for el in cgs]
+ return [self._to_process(el) for el in cgs]
- def _to_consistency_group(self, element):
+ def _to_process(self, element):
return process_xml(ET.tostring(element))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
new file mode 100644
index 0000000..bcbe931
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5">
+ <name>sdk_test2_cg</name>
+ <description>A test consistency group</description>
+ <journal sizeGb="100" extentCount="1"/>
+ <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
+ <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
+ </source>
+ <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
+ <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
+ </target>
+ <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
+ <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
+ <name>src-sdk-test</name>
+ </sourceServer>
+ <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
+ <name>tgt-sdk-test</name>
+ </targetServer>
+ </serverPair>
+ <createTime>2018-10-31T16:02:05.000Z</createTime>
+ <operationStatus>DRS_MODE</operationStatus>
+ <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T19:40:01.000Z"/>
+ <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
+ <state>NORMAL</state>
+ </consistencyGroup>
+</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index c460c74..9e99d49 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -43,6 +43,11 @@ def test_list_consistency_groups(driver):
assert hasattr(cgs[0], 'serverPair')
+def test_get_consistency_group(driver):
+ cg = driver.get_consistency_group("3710c093-7dcc-4a21-bd07-af9f4d93b6b5")
+ assert cg.id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+
+
class NttCisMockHttp(MockHttp):
fixtures = DRSFileFixtures('nttcis')
@@ -66,9 +71,17 @@ class NttCisMockHttp(MockHttp):
return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup(self,
- method,
- url,
- body,
- headers):
+ method,
+ url,
+ body,
+ headers):
body = self.fixtures.load("list_consistency_groups.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_3710c093_7dcc_4a21_bd07_af9f4d93b6b5(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("get_consistency_group.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62e0aafc/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 5b519d7..77b50cd 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -394,4 +394,11 @@ def test_list_health_monitors(compute_driver, lbdriver):
def test_list_consistency_groups(drsdriver):
cgs = drsdriver.list_consistency_groups()
- return cgs
\ No newline at end of file
+ return cgs
+
+
+def test_get_consistency_group(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
+ cg = drsdriver.get_consistency_group(cg_id)
+ assert hasattr(cg, 'description')
\ No newline at end of file
[03/45] libcloud git commit: Merge branch 'drs' into feature_drs
hopefully get all changes while preserving the drs and tests directories
Posted by an...@apache.org.
Merge branch 'drs' into feature_drs hopefully get all changes while preserving the drs and tests directories
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/15ce000e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/15ce000e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/15ce000e
Branch: refs/heads/trunk
Commit: 15ce000e2791aea5984583739b74b38980a1d0a9
Parents: c7c0a48 fcd632a
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 13:06:45 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 13:06:45 2018 -0400
----------------------------------------------------------------------
tests/test_lib_list.py | 344 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 344 insertions(+)
----------------------------------------------------------------------
[26/45] libcloud git commit: Started ssl import and offload
Posted by an...@apache.org.
Started ssl import and offload
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9319bbbc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9319bbbc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9319bbbc
Branch: refs/heads/trunk
Commit: 9319bbbc334c62f26dfb57f9ae96466c7c134a82
Parents: 99b7bda
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Nov 16 15:15:49 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Nov 16 15:15:49 2018 -0500
----------------------------------------------------------------------
libcloud/common/base.py | 1 -
libcloud/loadbalancer/drivers/nttcis.py | 26 ++++++++++++++++++++
.../fixtures/nttcis/ssl_import_fail.xml | 6 +++++
.../fixtures/nttcis/ssl_import_success.xml | 7 ++++++
tests/lib_create_test.py | 9 +++++++
tests/lib_list_test.py | 7 ++++--
6 files changed, 53 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 17ca286..bcfa249 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -232,7 +232,6 @@ class XmlResponse(Response):
body=self.body,
driver=self.connection.driver)
return body
-
parse_error = parse_body
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 1348c65..ee1bd53 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -12,6 +12,7 @@
# 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 OpenSSL.crypto
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
@@ -757,6 +758,28 @@ class NttCisLBDriver(Driver):
status=State.RUNNING
)
+ def import_ssl_cert(self, network_domain_id, name, crt_file, key_file,
+ description=None):
+ 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')
+ k = OpenSSL.crypto.load_privatekey(
+ OpenSSL.crypto.FILETYPE_PEM, open(key_file).read())
+ key = OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, k).decode(encoding='utf-8')
+ 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:
+ ET.SubElement(cert_elem, "description").text = description
+ ET.SubElement(cert_elem, "key").text = key
+ ET.SubElement(cert_elem, "certificate").text = cert
+ result = self.connection.request_with_orgId_api_2(
+ 'networkDomainVip/importSslDomainCertificate',
+ method='POST',
+ data=ET.tostring(cert_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
@@ -1049,6 +1072,9 @@ class NttCisLBDriver(Driver):
method='GET').object
return self._to_irules(result)
+ def ex_list_ssl_domain_certs(self, params={}):
+ pass
+
def _to_irules(self, object):
irules = []
matches = object.findall(
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_fail.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_fail.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_fail.xml
new file mode 100644
index 0000000..f7cc0e3
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_fail.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181116T181425004+0100_b6be08f0-30ae-4acd-8f25-1d7a5ce3f42a">
+ <operation>IMPORT_SSL_DOMAIN_CERTIFICATE</operation>
+ <responseCode>CONFIGURATION_NOT_SUPPORTED</responseCode>
+ <message>Data Center EU6 requires key length must be one of 512, 1024, 2048.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_success.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_success.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_success.xml
new file mode 100644
index 0000000..3797d36
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_success.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181116T205220817+0100_5bbea1ac-0643-4c92-a67d-7258706ec9bf">
+ <operation>IMPORT_SSL_DOMAIN_CERTIFICATE</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Domain Certificate has been imported.</message>
+ <info name="sslDomainCertificateId" value="4d2e9792-c986-4f2b-80c9-39e457eed8e8"/>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index f2c8eeb..944cea0 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -291,3 +291,12 @@ def test_initiate_failover(drsdriver):
cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
result = drsdriver.initiate_failover(cg_id)
assert result is True
+
+
+def test_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/alice.crt'
+ key = '/home/mraful/client/alice.key'
+ result = lbdriver.import_ssl_cert(net_dom.id, "alice", cert, key, description="test cert")
+ assert result is True
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9319bbbc/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index c6395c4..bf572e3 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -200,7 +200,6 @@ def test_list_nat_rules(compute_driver):
def test_list_balancers(lbdriver):
balancers = lbdriver.list_balancers(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
for balancer in balancers:
print(balancer.id, balancer.ip, balancer.name, balancer.port)
assert isinstance(balancers, list)
@@ -424,4 +423,8 @@ def test_get_snapshots_by_min(drsdriver):
cg_id,
create_time_min="2018-11-07T00:00:00.000-05:00")
for snap in snaps.snapshot:
- print(snap)
\ No newline at end of file
+ print(snap)
+
+
+def test_list_domain_certs(compute_driver, lbdriver):
+ pass
\ No newline at end of file
[04/45] libcloud git commit: Added abstract Driver class in
drs/drivers/nttcis
Posted by an...@apache.org.
Added abstract Driver class in drs/drivers/nttcis
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/adcf3bdb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/adcf3bdb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/adcf3bdb
Branch: refs/heads/trunk
Commit: adcf3bdb938bc9093a0a0772cd71b02adfedb10c
Parents: 15ce000
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 16:08:44 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 16:08:44 2018 -0400
----------------------------------------------------------------------
.gitignore | 2 +-
libcloud/drs/__init__.py | 0
libcloud/drs/base.py | 194 ++++++++++++++++++++++++++++++++++
libcloud/drs/drivers/__init__.py | 18 ++++
libcloud/drs/drivers/nttcis.py | 39 +++++++
libcloud/drs/providers.py | 41 +++++++
libcloud/drs/types.py | 43 ++++++++
7 files changed, 336 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 28c95d5..7b71b9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,4 @@ pip-selfcheck.json
report.html
.pytest_cache
tests/
-drs/
+
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/__init__.py b/libcloud/drs/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/base.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/base.py b/libcloud/drs/base.py
new file mode 100644
index 0000000..157fe5a
--- /dev/null
+++ b/libcloud/drs/base.py
@@ -0,0 +1,194 @@
+
+# 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.common.base import ConnectionKey, BaseDriver
+from libcloud.common.types import LibcloudError
+
+
+class DRSConsistencyGroup(object):
+ """
+ Provide a common interface for handling DRS.
+ """
+
+ def __init__(self, id, name, description, journalSizeGB, serverPairSourceServerId, serverPairtargetServerId,
+ driver, extra=None):
+ """
+ :param id: Load balancer ID.
+ :type id: ``str``
+
+ :param name: Load balancer name.
+ :type name: ``str``
+
+ :param state: State this loadbalancer is in.
+ :type state: :class:`libcloud.loadbalancer.types.State`
+
+ :param ip: IP address of this loadbalancer.
+ :type ip: ``str``
+
+ :param port: Port of this loadbalancer.
+ :type port: ``int``
+
+ :param driver: Driver this loadbalancer belongs to.
+ :type driver: :class:`.Driver`
+
+ :param extra: Provider specific attributes. (optional)
+ :type extra: ``dict``
+ """
+ self.id = str(id) if id else None
+ self.name = name
+ self.description = description
+ self.journalSizeGB = journalSizeGB
+
+ self.serverPairSourceServerId = serverPairSourceServerId
+ self.serverPairtargetServerId = serverPairtargetServerId
+ self.driver = driver
+ self.extra = extra or {}
+
+
+class Driver(BaseDriver):
+ """
+ A base Driver class to derive from
+
+ This class is always subclassed by a specific driver.
+ """
+
+ name = None
+ website = None
+
+ connectionCls = ConnectionKey
+
+ def __init__(self, key, secret=None, secure=True, host=None,
+ port=None, **kwargs):
+ super(Driver, self).__init__(key=key, secret=secret, secure=secure,
+ host=host, port=port, **kwargs)
+
+ def create_consistency_group(self, name, journal_sz_gb,
+ source_server_id, target_server_id):
+ """
+ :param name: Name of the consistency group to create
+ :type name: ``str``
+ :param journal_sz_gb: Size in 10 Gb increments of the consistency
+ group's journal
+ :type journal_sz_gb: ``str``
+ :param source_server_id: The id of the server to copy from
+ :type source_server_id: ``str``
+ :param target_server_id: The id of the server to copy to
+ :type target_server_id: ``str``
+ :return: :class: `ConsistencyGroup`
+ """
+ raise NotImplementedError(
+ 'create_consistency_group not implemented for this driver')
+
+ def list_consistency_groups(self):
+ """
+ List all consistency groups
+
+ :rtype: ``list`` of :class:`ConsistencyGroup`
+ """
+ raise NotImplementedError(
+ 'list_consistency_groups not implemented for this driver')
+
+ def get_consistency_group(self, consistency_group_id):
+ """
+ Return a :class:`ConsistencyGroup` object.
+
+ :param consistency_group_id: id of a consistency group you want to fetch
+ :type consistency_group_id: ``str``
+
+ :rtype: :class:`ConsistencyGroup`
+ """
+
+ raise NotImplementedError(
+ 'get_consistency_group not implemented for this driver')
+
+ def delete_consistency_group(self, consistency_group_id):
+ """
+ Delete a consistency group
+
+ :param consistency_group_id: Id of consistency group to delete
+ :type consistency_group_id: ``str``
+
+ :return: ``True`` For successful deletion, otherwise ``False``.
+ :rtype: ``bool``
+ """
+
+ raise NotImplementedError(
+ 'delete_consistency_group not implemented for this driver')
+
+ def list_consistency_group_snapshots(self, consistency_group_id):
+ """
+ Return a list of consistency group snapshots.
+
+ :param consistency_group_id: id of a consistency group to fetch
+ snapshots from.
+ :type consistency_group_id: ``str``
+ :rtype: ``list``
+ """
+
+ raise NotImplementedError(
+ 'list_consistency_group_snapshots not implemented for this driver')
+
+ def expand_journal(self, consistency_group_id, size_gb):
+ """
+ :param consistency_group_id: consistency group's id with journal
+ to expand
+ :type consistency_group_id: ``str``
+ :param size_gb: Size in increments of 10 Gb to expand journal.
+ :return: ``True`` For successful deletion, otherwise ``False``.
+ :rtype: ``bool``
+ """
+
+ raise NotImplementedError(
+ 'expand_journal not implemented for this driver')
+
+ def start_failover_preview(self, consistency_group_id, snapshot_id):
+ """
+ :param consistency_group_id: consistency group's id with journal
+ to expand
+ :type consistency_group_id: ``str ``
+ :param snapshot_id: Snapshot Id to bring into preview mode.
+ :type snapshot_id: ``str``
+ :return: ``True`` For successful deletion, otherwise ``False``.
+ :rtype: ``bool``
+ """
+
+ raise NotImplementedError(
+ 'start_failover_preview not implemented for this driver')
+
+ def stop_failover_preview(self, consistency_group_id):
+ """
+ :param consistency_group_id: Consistency group id of consistency
+ group to brought out of
+ PREVIEWING_SNAHSHOT and into DRS_MODE.
+ :type consistency_group_id: ``str``
+ :return: ``True`` For successful deletion, otherwise ``False``.
+ :rtype: ``bool``
+ """
+
+ raise NotImplementedError(
+ 'stop_failover_preview not implemented for this driver')
+
+ def initiate_failover(self, consistency_group_id):
+ """
+ :param consistency_group_id: Consistency group id of consistency
+ group on which to initiate failover.
+ :type consistency_group_id: ``str``
+ :return: ``True`` For successful deletion, otherwise ``False``.
+ :rtype: ``bool``
+ """
+
+ raise NotImplementedError(
+ 'initiate_failover not implemented for this driver')
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/drivers/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/__init__.py b/libcloud/drs/drivers/__init__.py
new file mode 100644
index 0000000..f2f9f29
--- /dev/null
+++ b/libcloud/drs/drivers/__init__.py
@@ -0,0 +1,18 @@
+# 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.
+
+__all__ = [
+ 'nttcis'
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
new file mode 100644
index 0000000..3467277
--- /dev/null
+++ b/libcloud/drs/drivers/nttcis.py
@@ -0,0 +1,39 @@
+from libcloud.utils.py3 import ET
+from libcloud.common.nttcis import NttCisConnection
+from libcloud.common.nttcis import API_ENDPOINTS
+from libcloud.common.nttcis import DEFAULT_REGION
+from libcloud.drs.types import Provider
+from libcloud.drs.base import Driver
+from libcloud.common.types import LibcloudError
+
+
+class NttCisDRSDriver(Driver):
+ """
+ NttCis node driver.
+ """
+
+ selected_region = None
+ connectionCls = NttCisConnection
+ name = 'NTTC-CIS DRS Consistencty Groups'
+ website = 'https://cloud.nttcis.com/'
+ type = Provider.NTTCIS
+ 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(NttCisDRSDriver, self).__init__(key=key,
+ secret=secret,
+ secure=secure, host=host,
+ port=port,
+ api_version=api_version,
+ region=region,
+ **kwargs)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py
new file mode 100644
index 0000000..d214d17
--- /dev/null
+++ b/libcloud/drs/providers.py
@@ -0,0 +1,41 @@
+# 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.loadbalancer.types import Provider
+from libcloud.loadbalancer.types import OLD_CONSTANT_TO_NEW_MAPPING
+from libcloud.common.providers import get_driver as _get_provider_driver
+from libcloud.common.providers import set_driver as _set_provider_driver
+
+__all__ = [
+ "Provider",
+ "DRIVERS",
+ "get_driver",
+]
+
+DRIVERS = {
+ Provider.NTTCIS:
+ ('libcloud.drs.drivers.nttcis', 'NttCisDRSDriver'),
+}
+
+
+def get_driver(provider):
+ deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
+ return _get_provider_driver(drivers=DRIVERS, provider=provider,
+ deprecated_constants=deprecated_constants)
+
+
+def set_driver(provider, module, klass):
+ return _set_provider_driver(drivers=DRIVERS, provider=provider,
+ module=module, klass=klass)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/adcf3bdb/libcloud/drs/types.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/types.py b/libcloud/drs/types.py
new file mode 100644
index 0000000..b902f74
--- /dev/null
+++ b/libcloud/drs/types.py
@@ -0,0 +1,43 @@
+# 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.
+
+__all__ = [
+ "Provider",
+ "LibcloudDRSError",
+ "LibcloudDRSImmutableError",
+
+]
+
+from libcloud.common.types import LibcloudError
+
+
+class LibcloudDRSError(LibcloudError):
+ pass
+
+
+class LibcloudDRSImmutableError(LibcloudDRSError):
+ pass
+
+
+class Provider(object):
+ """
+ Defines for each of the supported providers
+
+ Non-Dummy drivers are sorted in alphabetical order. Please preserve this
+ ordering when adding new drivers.
+
+ :cvar ALIYUN_SLB: Aliyun SLB loadbalancer driver
+ """
+ NTTCIS = 'nttcis'
[33/45] libcloud git commit: added pyopenssl to travis-coverage in
tox.init and edited nttcis.rst in drs/drivers
Posted by an...@apache.org.
added pyopenssl to travis-coverage in tox.init and edited nttcis.rst in drs/drivers
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b58c770b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b58c770b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b58c770b
Branch: refs/heads/trunk
Commit: b58c770b229589f01177983f15fe188aa6a1c1ef
Parents: 97f4dd3
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Nov 22 00:08:51 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Nov 22 00:08:51 2018 -0500
----------------------------------------------------------------------
docs/drs/drivers/nttcis.rst | 2 +-
docs/loadbalancer/drivers/nttcis.rst | 3 +--
tox.ini | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b58c770b/docs/drs/drivers/nttcis.rst
----------------------------------------------------------------------
diff --git a/docs/drs/drivers/nttcis.rst b/docs/drs/drivers/nttcis.rst
index 6987929..accb00e 100644
--- a/docs/drs/drivers/nttcis.rst
+++ b/docs/drs/drivers/nttcis.rst
@@ -1,7 +1,7 @@
NttCis DRS Driver Documentation
===============================
-`NttC-Cis`_ offers disaster recovery services for Compute Services.
+NTT Communications Cloud Infrastructure Services offers disaster recovery services for Compute Services.
Instantiating the driver
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b58c770b/docs/loadbalancer/drivers/nttcis.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/drivers/nttcis.rst b/docs/loadbalancer/drivers/nttcis.rst
index 7bbd380..2f2531a 100644
--- a/docs/loadbalancer/drivers/nttcis.rst
+++ b/docs/loadbalancer/drivers/nttcis.rst
@@ -1,8 +1,7 @@
NTTC-CIS 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
+NTT Communications 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.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b58c770b/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 4dcc693..293ccf9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -115,6 +115,7 @@ commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
passenv = TOXENV CI TRAVIS TRAVIS_*
deps =
-r{toxinidir}/requirements-tests.txt
+ pyopenssl
libvirt-python==4.0.0
lockfile
set-env =
[19/45] libcloud git commit: Added documentation for drs via sphinx
and added tests for expand journal.
Posted by an...@apache.org.
Added documentation for drs via sphinx and added tests for expand journal.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/614b43d4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/614b43d4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/614b43d4
Branch: refs/heads/trunk
Commit: 614b43d47673d626909bfcf23c6c0f020cf232fa
Parents: 1935b5f
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 6 16:37:56 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 6 16:37:56 2018 -0500
----------------------------------------------------------------------
.../generate_provider_feature_matrix_table.py | 26 ++++
.../_supported_methods_block_storage.rst | 6 +
.../_supported_methods_image_management.rst | 6 +
.../_supported_methods_key_pair_management.rst | 6 +
docs/compute/_supported_methods_main.rst | 6 +
docs/compute/_supported_providers.rst | 127 ++++++++++---------
docs/dns/_supported_providers.rst | 2 +-
docs/drs/drivers/index.rst | 12 ++
docs/drs/drivers/nttcis.rst | 18 +++
docs/drs/index.rst | 15 +++
docs/drs/supported_providers.rst | 14 ++
docs/examples/drs/__init__.py | 0
docs/examples/drs/nttcis/__init__.py | 0
.../drs/nttcis/add_consistency_group.py | 26 ++++
docs/index.rst | 2 +
docs/loadbalancer/_supported_methods.rst | 2 +
docs/loadbalancer/_supported_providers.rst | 2 +
docs/storage/_supported_methods_cdn.rst | 4 +
docs/storage/_supported_methods_main.rst | 2 +
docs/storage/_supported_providers.rst | 2 +
libcloud/common/nttcis.py | 4 -
libcloud/compute/drivers/nttcis.py | 111 ++++++++++++++--
libcloud/drs/base.py | 4 +-
libcloud/drs/drivers/nttcis.py | 42 ++++--
libcloud/loadbalancer/drivers/nttcis.py | 1 +
libcloud/test/drs/fixtures/nttcis/expand_cg.xml | 6 +
libcloud/test/drs/test_nttcis.py | 19 +++
tests/lib_edit_test.py | 7 +
28 files changed, 380 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/contrib/generate_provider_feature_matrix_table.py
----------------------------------------------------------------------
diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index f492001..419baee 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -45,6 +45,11 @@ from libcloud.dns.providers import get_driver as get_dns_driver
from libcloud.dns.providers import DRIVERS as DNS_DRIVERS
from libcloud.dns.types import Provider as DNSProvider
+from libcloud.drs.base import DRSDriver
+from libcloud.drs.providers import get_driver as get_drs_driver
+from libcloud.drs.providers import DRIVERS as DRS_DRIVERS
+from libcloud.drs.types import Provider as DRSProvider
+
from libcloud.container.base import ContainerDriver
from libcloud.container.providers import get_driver as get_container_driver
from libcloud.container.providers import DRIVERS as CONTAINER_DRIVERS
@@ -89,6 +94,11 @@ BASE_API_METHODS = {
'dns': ['list_zones', 'list_records', 'iterate_zones', 'iterate_records',
'create_zone', 'update_zone', 'create_record', 'update_record',
'delete_zone', 'delete_record'],
+ 'drs': ['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'],
'container': ['install_image', 'list_images', 'deploy_container',
'get_container', 'start_container', 'stop_container',
'restart_container', 'destroy_container', 'list_containers',
@@ -169,6 +179,17 @@ FRIENDLY_METHODS_NAMES = {
'delete_zone': 'delete zone',
'delete_record': 'delete record'
},
+ 'drs': {
+ 'create_consistency_group': 'create_consistency_group',
+ 'list_consistency_groups': 'list_consistency_groups',
+ 'get_consistency_group': 'get_consistency_group',
+ 'delete_consistency_group': 'delete_consistency_group',
+ 'list_consistency_group_snapshots': 'list_consistency_group_snapshots',
+ 'expand_journal': 'expand_journal',
+ 'start_failover_preview': 'start_failover_preview',
+ 'stop_failover_preview': 'stop_failover_preview',
+ 'initiate_failover': 'initiate_failover'
+ },
'container': {
'install_image': 'install image',
'list_images': 'list images',
@@ -242,6 +263,11 @@ def generate_providers_table(api):
drivers = DNS_DRIVERS
provider = DNSProvider
get_driver_method = get_dns_driver
+ elif api == 'drs':
+ driver = DRSDriver
+ drivers = DRS_DRIVERS
+ provider = DRSProvider
+ get_driver_method = get_drs_driver
elif api == 'container':
driver = ContainerDriver
drivers = CONTAINER_DRIVERS
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/compute/_supported_methods_block_storage.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst
index bacdb08..fea231c 100644
--- a/docs/compute/_supported_methods_block_storage.rst
+++ b/docs/compute/_supported_methods_block_storage.rst
@@ -38,6 +38,7 @@ Provider list volumes create volume destroy volume
`NephoScale`_ 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
`1and1`_ no no no no no no no
`OpenNebula (v3.8)`_ yes yes yes yes yes no no
@@ -50,10 +51,12 @@ Provider list volumes create volume destroy volume
`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
`ServerLove`_ no no no no no no no
`skalicloud`_ no no no no no no no
`SoftLayer`_ no no no no no no no
`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
`Voxel VoxCLOUD`_ no no no no no no no
@@ -96,6 +99,7 @@ Provider list volumes create volume destroy volume
.. _`NephoScale`: http://www.nephoscale.com
.. _`Nimbus`: http://www.nimbusproject.org/
.. _`NTTAmerica`: http://www.nttamerica.com/
+.. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
.. _`OnApp`: http://onapp.com/
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
@@ -108,10 +112,12 @@ Provider list volumes create volume destroy volume
.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com
.. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com
.. _`RimuHosting`: http://rimuhosting.com/
+.. _`Scaleway`: https://www.scaleway.com/
.. _`ServerLove`: http://www.serverlove.com/
.. _`skalicloud`: http://www.skalicloud.com/
.. _`SoftLayer`: http://www.softlayer.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/
.. _`Voxel VoxCLOUD`: http://www.voxel.net/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/compute/_supported_methods_image_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_image_management.rst b/docs/compute/_supported_methods_image_management.rst
index a426a8c..0a4ec92 100644
--- a/docs/compute/_supported_methods_image_management.rst
+++ b/docs/compute/_supported_methods_image_management.rst
@@ -38,6 +38,7 @@ Provider list images get image create image delete
`NephoScale`_ yes no no no no
`Nimbus`_ yes yes yes yes yes
`NTTAmerica`_ yes no no no no
+`NTTC-CIS`_ yes no no no no
`OnApp`_ yes no no no no
`1and1`_ yes yes no no no
`OpenNebula (v3.8)`_ yes no no no no
@@ -50,10 +51,12 @@ Provider list images get image create image delete
`Rackspace Cloud (Next Gen)`_ yes yes yes yes no
`Rackspace Cloud (First Gen)`_ yes yes yes yes no
`RimuHosting`_ yes no no no no
+`Scaleway`_ yes yes yes yes no
`ServerLove`_ yes no no no no
`skalicloud`_ yes no no no no
`SoftLayer`_ yes yes no no no
`vCloud`_ yes no no no no
+`Upcloud`_ yes no no no no
`VCL`_ yes no no no no
`vCloud`_ yes no no no no
`Voxel VoxCLOUD`_ yes no no no no
@@ -96,6 +99,7 @@ Provider list images get image create image delete
.. _`NephoScale`: http://www.nephoscale.com
.. _`Nimbus`: http://www.nimbusproject.org/
.. _`NTTAmerica`: http://www.nttamerica.com/
+.. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
.. _`OnApp`: http://onapp.com/
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
@@ -108,10 +112,12 @@ Provider list images get image create image delete
.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com
.. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com
.. _`RimuHosting`: http://rimuhosting.com/
+.. _`Scaleway`: https://www.scaleway.com/
.. _`ServerLove`: http://www.serverlove.com/
.. _`skalicloud`: http://www.skalicloud.com/
.. _`SoftLayer`: http://www.softlayer.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/
.. _`Voxel VoxCLOUD`: http://www.voxel.net/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/compute/_supported_methods_key_pair_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst
index a3799f8..11bfe45 100644
--- a/docs/compute/_supported_methods_key_pair_management.rst
+++ b/docs/compute/_supported_methods_key_pair_management.rst
@@ -38,6 +38,7 @@ Provider list key pairs get key pair create key pai
`NephoScale`_ no no no 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
`1and1`_ no no no no no no
`OpenNebula (v3.8)`_ no no no no no no
@@ -50,10 +51,12 @@ Provider list key pairs get key pair create key pai
`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
`ServerLove`_ no no no no no no
`skalicloud`_ no no no no no no
`SoftLayer`_ yes yes yes 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
`Voxel VoxCLOUD`_ no no no no no no
@@ -96,6 +99,7 @@ Provider list key pairs get key pair create key pai
.. _`NephoScale`: http://www.nephoscale.com
.. _`Nimbus`: http://www.nimbusproject.org/
.. _`NTTAmerica`: http://www.nttamerica.com/
+.. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
.. _`OnApp`: http://onapp.com/
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
@@ -108,10 +112,12 @@ Provider list key pairs get key pair create key pai
.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com
.. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com
.. _`RimuHosting`: http://rimuhosting.com/
+.. _`Scaleway`: https://www.scaleway.com/
.. _`ServerLove`: http://www.serverlove.com/
.. _`skalicloud`: http://www.skalicloud.com/
.. _`SoftLayer`: http://www.softlayer.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/
.. _`Voxel VoxCLOUD`: http://www.voxel.net/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/compute/_supported_methods_main.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_main.rst b/docs/compute/_supported_methods_main.rst
index 4f0e0ca..325181e 100644
--- a/docs/compute/_supported_methods_main.rst
+++ b/docs/compute/_supported_methods_main.rst
@@ -38,6 +38,7 @@ Provider list nodes create node reboot node destroy
`NephoScale`_ yes yes yes yes yes yes yes
`Nimbus`_ yes yes yes yes yes yes yes
`NTTAmerica`_ yes yes yes yes yes yes yes
+`NTTC-CIS`_ yes yes yes yes yes yes yes
`OnApp`_ yes yes no yes yes no no
`1and1`_ yes yes yes yes yes yes no
`OpenNebula (v3.8)`_ yes yes yes yes yes yes no
@@ -50,10 +51,12 @@ Provider list nodes create node reboot node destroy
`Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yes yes
`Rackspace Cloud (First Gen)`_ yes yes yes yes yes yes yes
`RimuHosting`_ yes yes yes yes yes yes yes
+`Scaleway`_ yes yes yes yes yes yes no
`ServerLove`_ yes yes yes yes yes yes yes
`skalicloud`_ yes yes yes yes yes yes yes
`SoftLayer`_ yes yes yes yes yes yes yes
`vCloud`_ yes yes yes yes yes yes yes
+`Upcloud`_ yes yes yes yes yes yes yes
`VCL`_ yes yes no yes yes yes no
`vCloud`_ yes yes yes yes yes yes yes
`Voxel VoxCLOUD`_ yes yes yes yes yes yes no
@@ -96,6 +99,7 @@ Provider list nodes create node reboot node destroy
.. _`NephoScale`: http://www.nephoscale.com
.. _`Nimbus`: http://www.nimbusproject.org/
.. _`NTTAmerica`: http://www.nttamerica.com/
+.. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
.. _`OnApp`: http://onapp.com/
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
@@ -108,10 +112,12 @@ Provider list nodes create node reboot node destroy
.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com
.. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com
.. _`RimuHosting`: http://rimuhosting.com/
+.. _`Scaleway`: https://www.scaleway.com/
.. _`ServerLove`: http://www.serverlove.com/
.. _`skalicloud`: http://www.skalicloud.com/
.. _`SoftLayer`: http://www.softlayer.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/
.. _`Voxel VoxCLOUD`: http://www.voxel.net/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/compute/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index 2c0c8f8..bea6246 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -1,66 +1,68 @@
.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
-===================================== ================================================= =================== ================================================================================================================================================================================================== ================================================= ====================================
-Provider Documentation Provider Constant Supported Regions Module Class Name
-===================================== ================================================= =================== ================================================================================================================================================================================================== ================================================= ====================================
-`Abiquo`_ ABIQUO single region driver :mod:`libcloud.compute.drivers.abiquo` :class:`AbiquoNodeDriver`
-`Aliyun ECS`_ :doc:`Click </compute/drivers/aliyun_ecs>` ALIYUN_ECS single region driver :mod:`libcloud.compute.drivers.ecs` :class:`ECSDriver`
-`PCextreme AuroraCompute`_ :doc:`Click </compute/drivers/auroracompute>` AURORACOMPUTE single region driver :mod:`libcloud.compute.drivers.auroracompute` :class:`AuroraComputeNodeDriver`
-`Azure Virtual machines`_ :doc:`Click </compute/drivers/azure>` AZURE single region driver :mod:`libcloud.compute.drivers.azure` :class:`AzureNodeDriver`
-`Azure Virtual machines`_ :doc:`Click </compute/drivers/azure_arm>` AZURE_ARM single region driver :mod:`libcloud.compute.drivers.azure_arm` :class:`AzureNodeDriver`
-`Bluebox Blocks`_ BLUEBOX single region driver :mod:`libcloud.compute.drivers.bluebox` :class:`BlueboxNodeDriver`
-`Brightbox`_ BRIGHTBOX single region driver :mod:`libcloud.compute.drivers.brightbox` :class:`BrightboxNodeDriver`
-`BSNL`_ :doc:`Click </compute/drivers/bsnl>` BSNL single region driver :mod:`libcloud.compute.drivers.bsnl` :class:`BSNLNodeDriver`
-`Cloudscale`_ :doc:`Click </compute/drivers/cloudscale>` CLOUDSCALE single region driver :mod:`libcloud.compute.drivers.cloudscale` :class:`CloudscaleNodeDriver`
-`CloudSigma (API v2.0)`_ :doc:`Click </compute/drivers/cloudsigma>` CLOUDSIGMA single region driver :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaNodeDriver`
-`CloudStack`_ :doc:`Click </compute/drivers/cloudstack>` CLOUDSTACK single region driver :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
-`Cloudwatt`_ :doc:`Click </compute/drivers/cloudwatt>` CLOUDWATT single region driver :mod:`libcloud.compute.drivers.cloudwatt` :class:`CloudwattNodeDriver`
-`DigitalOcean`_ :doc:`Click </compute/drivers/digital_ocean>` DIGITAL_OCEAN single region driver :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver`
-`DimensionData`_ :doc:`Click </compute/drivers/dimensiondata>` DIMENSIONDATA single region driver :mod:`libcloud.compute.drivers.dimensiondata` :class:`DimensionDataNodeDriver`
-`Amazon EC2`_ :doc:`Click </compute/drivers/ec2>` EC2 ap-northeast-1, ap-northeast-2, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, eu-central-1, eu-west-1, eu-west-2, 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`
-`Enomaly Elastic Computing Platform`_ ECP single region driver :mod:`libcloud.compute.drivers.ecp` :class:`ECPNodeDriver`
-`ElasticHosts`_ ELASTICHOSTS single region driver :mod:`libcloud.compute.drivers.elastichosts` :class:`ElasticHostsNodeDriver`
-`Eucalyptus`_ EUCALYPTUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`EucNodeDriver`
-`Exoscale`_ :doc:`Click </compute/drivers/exoscale>` EXOSCALE single region driver :mod:`libcloud.compute.drivers.exoscale` :class:`ExoscaleNodeDriver`
-`Gandi`_ :doc:`Click </compute/drivers/gandi>` GANDI single region driver :mod:`libcloud.compute.drivers.gandi` :class:`GandiNodeDriver`
-`Google Compute Engine`_ :doc:`Click </compute/drivers/gce>` GCE single region driver :mod:`libcloud.compute.drivers.gce` :class:`GCENodeDriver`
-`GoGrid`_ GOGRID single region driver :mod:`libcloud.compute.drivers.gogrid` :class:`GoGridNodeDriver`
-`HostVirtual`_ HOSTVIRTUAL single region driver :mod:`libcloud.compute.drivers.hostvirtual` :class:`HostVirtualNodeDriver`
-`Ikoula`_ :doc:`Click </compute/drivers/ikoula>` IKOULA single region driver :mod:`libcloud.compute.drivers.ikoula` :class:`IkoulaNodeDriver`
-`Indosat`_ :doc:`Click </compute/drivers/indosat>` INDOSAT single region driver :mod:`libcloud.compute.drivers.indosat` :class:`IndosatNodeDriver`
-`InternetSolutions`_ :doc:`Click </compute/drivers/internetsolutions>` INTERNETSOLUTIONS single region driver :mod:`libcloud.compute.drivers.internetsolutions` :class:`InternetSolutionsNodeDriver`
-`Joyent`_ JOYENT single region driver :mod:`libcloud.compute.drivers.joyent` :class:`JoyentNodeDriver`
-`Kili Public Cloud`_ :doc:`Click </compute/drivers/kili>` KILI single region driver :mod:`libcloud.compute.drivers.kili` :class:`KiliCloudNodeDriver`
-`KTUCloud`_ KTUCLOUD single region driver :mod:`libcloud.compute.drivers.ktucloud` :class:`KTUCloudNodeDriver`
-`Libvirt`_ :doc:`Click </compute/drivers/libvirt>` LIBVIRT single region driver :mod:`libcloud.compute.drivers.libvirt_driver` :class:`LibvirtNodeDriver`
-`Linode`_ LINODE single region driver :mod:`libcloud.compute.drivers.linode` :class:`LinodeNodeDriver`
-`MedOne`_ :doc:`Click </compute/drivers/medone>` MEDONE single region driver :mod:`libcloud.compute.drivers.medone` :class:`MedOneNodeDriver`
-`NephoScale`_ NEPHOSCALE single region driver :mod:`libcloud.compute.drivers.nephoscale` :class:`NephoscaleNodeDriver`
-`Nimbus`_ :doc:`Click </compute/drivers/nimbus>` NIMBUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`NimbusNodeDriver`
-`NTTAmerica`_ :doc:`Click </compute/drivers/ntta>` NTTA single region driver :mod:`libcloud.compute.drivers.ntta` :class:`NTTAmericaNodeDriver`
-`NTTC-CIS`_ :doc:`Click </compute/drivers/nttcis>` NTTC single region driver :mod:`libcloud.compute.dirver.nttcis` :class:`NttCisNodeDriver`
-`OnApp`_ :doc:`Click </compute/drivers/onapp>` ONAPP single region driver :mod:`libcloud.compute.drivers.onapp` :class:`OnAppNodeDriver`
-`1and1`_ :doc:`Click </compute/drivers/oneandone>` ONEANDONE single region driver :mod:`libcloud.compute.drivers.oneandone` :class:`OneAndOneNodeDriver`
-`OpenNebula (v3.8)`_ OPENNEBULA single region driver :mod:`libcloud.compute.drivers.opennebula` :class:`OpenNebulaNodeDriver`
-`OpenStack`_ :doc:`Click </compute/drivers/openstack>` OPENSTACK single region driver :mod:`libcloud.compute.drivers.openstack` :class:`OpenStackNodeDriver`
-`Outscale INC`_ :doc:`Click </compute/drivers/outscale_inc>` OUTSCALE_INC single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleINCNodeDriver`
-`Outscale SAS`_ :doc:`Click </compute/drivers/outscale_sas>` OUTSCALE_SAS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleSASNodeDriver`
-`Ovh`_ :doc:`Click </compute/drivers/ovh>` OVH single region driver :mod:`libcloud.compute.drivers.ovh` :class:`OvhNodeDriver`
-`Packet`_ :doc:`Click </compute/drivers/packet>` PACKET single region driver :mod:`libcloud.compute.drivers.packet` :class:`PacketNodeDriver`
-`ProfitBricks`_ PROFIT_BRICKS single region driver :mod:`libcloud.compute.drivers.profitbricks` :class:`ProfitBricksNodeDriver`
-`Rackspace Cloud (Next Gen)`_ :doc:`Click </compute/drivers/rackspace>` RACKSPACE single region driver :mod:`libcloud.compute.drivers.rackspace` :class:`RackspaceNodeDriver`
-`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`
-`ServerLove`_ SERVERLOVE single region driver :mod:`libcloud.compute.drivers.serverlove` :class:`ServerLoveNodeDriver`
-`skalicloud`_ SKALICLOUD single region driver :mod:`libcloud.compute.drivers.skalicloud` :class:`SkaliCloudNodeDriver`
-`SoftLayer`_ SOFTLAYER single region driver :mod:`libcloud.compute.drivers.softlayer` :class:`SoftLayerNodeDriver`
-`vCloud`_ TERREMARK single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`TerremarkDriver`
-`VCL`_ VCL single region driver :mod:`libcloud.compute.drivers.vcl` :class:`VCLNodeDriver`
-`vCloud`_ :doc:`Click </compute/drivers/vcloud>` VCLOUD single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`VCloudNodeDriver`
-`Voxel VoxCLOUD`_ VOXEL single region driver :mod:`libcloud.compute.drivers.voxel` :class:`VoxelNodeDriver`
-`vps.net`_ VPSNET single region driver :mod:`libcloud.compute.drivers.vpsnet` :class:`VPSNetNodeDriver`
-`Vultr`_ :doc:`Click </compute/drivers/vultr>` VULTR single region driver :mod:`libcloud.compute.drivers.vultr` :class:`VultrNodeDriver`
-===================================== ================================================= =================== ================================================================================================================================================================================================== ================================================= ====================================
+===================================== ================================================= =================== ========================================================================================================================================================================================================================================================= ================================================= ====================================
+Provider Documentation Provider Constant Supported Regions Module Class Name
+===================================== ================================================= =================== ========================================================================================================================================================================================================================================================= ================================================= ====================================
+`Abiquo`_ ABIQUO single region driver :mod:`libcloud.compute.drivers.abiquo` :class:`AbiquoNodeDriver`
+`Aliyun ECS`_ :doc:`Click </compute/drivers/aliyun_ecs>` ALIYUN_ECS single region driver :mod:`libcloud.compute.drivers.ecs` :class:`ECSDriver`
+`PCextreme AuroraCompute`_ :doc:`Click </compute/drivers/auroracompute>` AURORACOMPUTE single region driver :mod:`libcloud.compute.drivers.auroracompute` :class:`AuroraComputeNodeDriver`
+`Azure Virtual machines`_ :doc:`Click </compute/drivers/azure>` AZURE single region driver :mod:`libcloud.compute.drivers.azure` :class:`AzureNodeDriver`
+`Azure Virtual machines`_ :doc:`Click </compute/drivers/azure_arm>` AZURE_ARM single region driver :mod:`libcloud.compute.drivers.azure_arm` :class:`AzureNodeDriver`
+`Bluebox Blocks`_ BLUEBOX single region driver :mod:`libcloud.compute.drivers.bluebox` :class:`BlueboxNodeDriver`
+`Brightbox`_ BRIGHTBOX single region driver :mod:`libcloud.compute.drivers.brightbox` :class:`BrightboxNodeDriver`
+`BSNL`_ :doc:`Click </compute/drivers/bsnl>` BSNL single region driver :mod:`libcloud.compute.drivers.bsnl` :class:`BSNLNodeDriver`
+`Cloudscale`_ :doc:`Click </compute/drivers/cloudscale>` CLOUDSCALE single region driver :mod:`libcloud.compute.drivers.cloudscale` :class:`CloudscaleNodeDriver`
+`CloudSigma (API v2.0)`_ :doc:`Click </compute/drivers/cloudsigma>` CLOUDSIGMA single region driver :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaNodeDriver`
+`CloudStack`_ :doc:`Click </compute/drivers/cloudstack>` CLOUDSTACK single region driver :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
+`Cloudwatt`_ :doc:`Click </compute/drivers/cloudwatt>` CLOUDWATT single region driver :mod:`libcloud.compute.drivers.cloudwatt` :class:`CloudwattNodeDriver`
+`DigitalOcean`_ :doc:`Click </compute/drivers/digital_ocean>` DIGITAL_OCEAN single region driver :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver`
+`DimensionData`_ :doc:`Click </compute/drivers/dimensiondata>` DIMENSIONDATA single region driver :mod:`libcloud.compute.drivers.dimensiondata` :class:`DimensionDataNodeDriver`
+`Amazon EC2`_ :doc:`Click </compute/drivers/ec2>` EC2 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-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`
+`Enomaly Elastic Computing Platform`_ ECP single region driver :mod:`libcloud.compute.drivers.ecp` :class:`ECPNodeDriver`
+`ElasticHosts`_ ELASTICHOSTS single region driver :mod:`libcloud.compute.drivers.elastichosts` :class:`ElasticHostsNodeDriver`
+`Eucalyptus`_ EUCALYPTUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`EucNodeDriver`
+`Exoscale`_ :doc:`Click </compute/drivers/exoscale>` EXOSCALE single region driver :mod:`libcloud.compute.drivers.exoscale` :class:`ExoscaleNodeDriver`
+`Gandi`_ :doc:`Click </compute/drivers/gandi>` GANDI single region driver :mod:`libcloud.compute.drivers.gandi` :class:`GandiNodeDriver`
+`Google Compute Engine`_ :doc:`Click </compute/drivers/gce>` GCE single region driver :mod:`libcloud.compute.drivers.gce` :class:`GCENodeDriver`
+`GoGrid`_ GOGRID single region driver :mod:`libcloud.compute.drivers.gogrid` :class:`GoGridNodeDriver`
+`HostVirtual`_ HOSTVIRTUAL single region driver :mod:`libcloud.compute.drivers.hostvirtual` :class:`HostVirtualNodeDriver`
+`Ikoula`_ :doc:`Click </compute/drivers/ikoula>` IKOULA single region driver :mod:`libcloud.compute.drivers.ikoula` :class:`IkoulaNodeDriver`
+`Indosat`_ :doc:`Click </compute/drivers/indosat>` INDOSAT single region driver :mod:`libcloud.compute.drivers.indosat` :class:`IndosatNodeDriver`
+`InternetSolutions`_ :doc:`Click </compute/drivers/internetsolutions>` INTERNETSOLUTIONS single region driver :mod:`libcloud.compute.drivers.internetsolutions` :class:`InternetSolutionsNodeDriver`
+`Joyent`_ JOYENT single region driver :mod:`libcloud.compute.drivers.joyent` :class:`JoyentNodeDriver`
+`Kili Public Cloud`_ :doc:`Click </compute/drivers/kili>` KILI single region driver :mod:`libcloud.compute.drivers.kili` :class:`KiliCloudNodeDriver`
+`KTUCloud`_ KTUCLOUD single region driver :mod:`libcloud.compute.drivers.ktucloud` :class:`KTUCloudNodeDriver`
+`Libvirt`_ :doc:`Click </compute/drivers/libvirt>` LIBVIRT single region driver :mod:`libcloud.compute.drivers.libvirt_driver` :class:`LibvirtNodeDriver`
+`Linode`_ LINODE single region driver :mod:`libcloud.compute.drivers.linode` :class:`LinodeNodeDriver`
+`MedOne`_ :doc:`Click </compute/drivers/medone>` MEDONE single region driver :mod:`libcloud.compute.drivers.medone` :class:`MedOneNodeDriver`
+`NephoScale`_ NEPHOSCALE single region driver :mod:`libcloud.compute.drivers.nephoscale` :class:`NephoscaleNodeDriver`
+`Nimbus`_ :doc:`Click </compute/drivers/nimbus>` NIMBUS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`NimbusNodeDriver`
+`NTTAmerica`_ :doc:`Click </compute/drivers/ntta>` NTTA single region driver :mod:`libcloud.compute.drivers.ntta` :class:`NTTAmericaNodeDriver`
+`NTTC-CIS`_ :doc:`Click </compute/drivers/nttcis>` NTTCIS single region driver :mod:`libcloud.compute.drivers.nttcis` :class:`NttCisNodeDriver`
+`OnApp`_ :doc:`Click </compute/drivers/onapp>` ONAPP single region driver :mod:`libcloud.compute.drivers.onapp` :class:`OnAppNodeDriver`
+`1and1`_ :doc:`Click </compute/drivers/oneandone>` ONEANDONE single region driver :mod:`libcloud.compute.drivers.oneandone` :class:`OneAndOneNodeDriver`
+`OpenNebula (v3.8)`_ OPENNEBULA single region driver :mod:`libcloud.compute.drivers.opennebula` :class:`OpenNebulaNodeDriver`
+`OpenStack`_ :doc:`Click </compute/drivers/openstack>` OPENSTACK single region driver :mod:`libcloud.compute.drivers.openstack` :class:`OpenStackNodeDriver`
+`Outscale INC`_ :doc:`Click </compute/drivers/outscale_inc>` OUTSCALE_INC single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleINCNodeDriver`
+`Outscale SAS`_ :doc:`Click </compute/drivers/outscale_sas>` OUTSCALE_SAS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleSASNodeDriver`
+`Ovh`_ :doc:`Click </compute/drivers/ovh>` OVH single region driver :mod:`libcloud.compute.drivers.ovh` :class:`OvhNodeDriver`
+`Packet`_ :doc:`Click </compute/drivers/packet>` PACKET single region driver :mod:`libcloud.compute.drivers.packet` :class:`PacketNodeDriver`
+`ProfitBricks`_ PROFIT_BRICKS single region driver :mod:`libcloud.compute.drivers.profitbricks` :class:`ProfitBricksNodeDriver`
+`Rackspace Cloud (Next Gen)`_ :doc:`Click </compute/drivers/rackspace>` RACKSPACE single region driver :mod:`libcloud.compute.drivers.rackspace` :class:`RackspaceNodeDriver`
+`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 </compute/drivers/scaleway>` SCALEWAY single region driver :mod:`libcloud.compute.drivers.scaleway` :class:`ScalewayNodeDriver`
+`ServerLove`_ SERVERLOVE single region driver :mod:`libcloud.compute.drivers.serverlove` :class:`ServerLoveNodeDriver`
+`skalicloud`_ SKALICLOUD single region driver :mod:`libcloud.compute.drivers.skalicloud` :class:`SkaliCloudNodeDriver`
+`SoftLayer`_ SOFTLAYER single region driver :mod:`libcloud.compute.drivers.softlayer` :class:`SoftLayerNodeDriver`
+`vCloud`_ TERREMARK single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`TerremarkDriver`
+`Upcloud`_ :doc:`Click </compute/drivers/upcloud>` 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 </compute/drivers/vcloud>` VCLOUD single region driver :mod:`libcloud.compute.drivers.vcloud` :class:`VCloudNodeDriver`
+`Voxel VoxCLOUD`_ VOXEL single region driver :mod:`libcloud.compute.drivers.voxel` :class:`VoxelNodeDriver`
+`vps.net`_ VPSNET single region driver :mod:`libcloud.compute.drivers.vpsnet` :class:`VPSNetNodeDriver`
+`Vultr`_ :doc:`Click </compute/drivers/vultr>` VULTR single region driver :mod:`libcloud.compute.drivers.vultr` :class:`VultrNodeDriver`
+===================================== ================================================= =================== ========================================================================================================================================================================================================================================================= ================================================= ====================================
.. _`Abiquo`: http://www.abiquo.com/
.. _`Aliyun ECS`: https://www.aliyun.com/product/ecs
@@ -97,6 +99,7 @@ Provider Documentation
.. _`NephoScale`: http://www.nephoscale.com
.. _`Nimbus`: http://www.nimbusproject.org/
.. _`NTTAmerica`: http://www.nttamerica.com/
+.. _`NTTC-CIS`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
.. _`OnApp`: http://onapp.com/
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
@@ -109,10 +112,12 @@ Provider Documentation
.. _`Rackspace Cloud (Next Gen)`: http://www.rackspace.com
.. _`Rackspace Cloud (First Gen)`: http://www.rackspace.com
.. _`RimuHosting`: http://rimuhosting.com/
+.. _`Scaleway`: https://www.scaleway.com/
.. _`ServerLove`: http://www.serverlove.com/
.. _`skalicloud`: http://www.skalicloud.com/
.. _`SoftLayer`: http://www.softlayer.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/
.. _`Voxel VoxCLOUD`: http://www.voxel.net/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/dns/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/dns/_supported_providers.rst b/docs/dns/_supported_providers.rst
index f9f2fd4..00a3237 100644
--- a/docs/dns/_supported_providers.rst
+++ b/docs/dns/_supported_providers.rst
@@ -11,7 +11,7 @@ Provider Documentation Provider Constant
`DurableDNS`_ :doc:`Click </dns/drivers/durabledns>` DURABLEDNS single region driver :mod:`libcloud.dns.drivers.durabledns` :class:`DurableDNSDriver`
`Gandi DNS`_ GANDI single region driver :mod:`libcloud.dns.drivers.gandi` :class:`GandiDNSDriver`
`GoDaddy DNS`_ :doc:`Click </dns/drivers/godaddy>` GODADDY single region driver :mod:`libcloud.dns.drivers.godaddy` :class:`GoDaddyDNSDriver`
-`Google DNS`_ GOOGLE single region driver :mod:`libcloud.dns.drivers.google` :class:`GoogleDNSDriver`
+`Google DNS`_ :doc:`Click </dns/drivers/google>` GOOGLE single region driver :mod:`libcloud.dns.drivers.google` :class:`GoogleDNSDriver`
`Host Virtual DNS`_ :doc:`Click </dns/drivers/hostvirtual>` HOSTVIRTUAL single region driver :mod:`libcloud.dns.drivers.hostvirtual` :class:`HostVirtualDNSDriver`
`Linode DNS`_ LINODE single region driver :mod:`libcloud.dns.drivers.linode` :class:`LinodeDNSDriver`
`Liquidweb DNS`_ :doc:`Click </dns/drivers/liquidweb>` LIQUIDWEB single region driver :mod:`libcloud.dns.drivers.liquidweb` :class:`LiquidWebDNSDriver`
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/drs/drivers/index.rst
----------------------------------------------------------------------
diff --git a/docs/drs/drivers/index.rst b/docs/drs/drivers/index.rst
new file mode 100644
index 0000000..5599158
--- /dev/null
+++ b/docs/drs/drivers/index.rst
@@ -0,0 +1,12 @@
+:orphan:
+
+DNS Drivers Documentation
+=========================
+
+This chapter includes links to driver (provider) specific documentation pages.
+
+.. toctree::
+ :glob:
+ :maxdepth: 1
+
+ *
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/drs/drivers/nttcis.rst
----------------------------------------------------------------------
diff --git a/docs/drs/drivers/nttcis.rst b/docs/drs/drivers/nttcis.rst
new file mode 100644
index 0000000..6987929
--- /dev/null
+++ b/docs/drs/drivers/nttcis.rst
@@ -0,0 +1,18 @@
+NttCis DRS Driver Documentation
+===============================
+
+`NttC-Cis`_ offers disaster recovery services for Compute Services.
+
+
+Instantiating the driver
+------------------------
+
+.. literalinclude:: /examples/drs/nttcis/add_consistency_group.py
+ :language: python
+
+API Docs
+--------
+
+.. autoclass:: libcloud.drs.drivers.nttcis.NttCisDRSDriver
+ :members:
+ :inherited-members:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/drs/index.rst
----------------------------------------------------------------------
diff --git a/docs/drs/index.rst b/docs/drs/index.rst
new file mode 100644
index 0000000..909b8ae
--- /dev/null
+++ b/docs/drs/index.rst
@@ -0,0 +1,15 @@
+DRS
+===
+
+.. note::
+
+ DRS API is available in Libcloud 2.4.0 and higher.
+
+DRS API allows you to manage disaster recovery as a separate service.
+
+Supported Providers
+-------------------
+
+For a list of supported providers see :doc:`supported providers page
+</drs/supported_providers>`.
+
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/drs/supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/drs/supported_providers.rst b/docs/drs/supported_providers.rst
new file mode 100644
index 0000000..e34e5eb
--- /dev/null
+++ b/docs/drs/supported_providers.rst
@@ -0,0 +1,14 @@
+:orphan:
+
+Supported Providers
+===================
+
+Provider Matrix
+---------------
+
+.. include:: _supported_providers.rst
+
+Supported Methods
+-----------------
+
+.. include:: _supported_methods.rst
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/examples/drs/__init__.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/__init__.py b/docs/examples/drs/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/examples/drs/nttcis/__init__.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/__init__.py b/docs/examples/drs/nttcis/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/examples/drs/nttcis/add_consistency_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/add_consistency_group.py b/docs/examples/drs/nttcis/add_consistency_group.py
new file mode 100644
index 0000000..68861e8
--- /dev/null
+++ b/docs/examples/drs/nttcis/add_consistency_group.py
@@ -0,0 +1,26 @@
+# This script creates a consistency group
+
+import libcloud
+
+
+def create_drs(compute_driver, drs_driver):
+ nodes = compute_driver.list_nodes(ex_name='src-sdk-test')
+ src_id = nodes[0].id
+ nodes = compute_driver.list_nodes(ex_name="tgt-sdk-test")
+ target_id = nodes[0].id
+ consistency_group_name = "sdk_test_cg"
+ journal_size_gb = "100"
+ result = drs_driver.create_consistency_group(
+ consistency_group_name, journal_size_gb, src_id, target_id, description="A test consistency group")
+ assert result is True
+
+
+def compute_driver():
+ cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
+ libcloud.DriverType.COMPUTE.NTTCIS)
+ computedriver = cls('my_user', 'my_pass', region='na')
+
+ cls = libcloud.get_driver(libcloud.DriverType.DRS,
+ libcloud.DriverType.DRS.NTTCIS)
+ drsdriver = cls('my_user', 'my_pass', region='na')
+ create_drs(computedriver, drsdriver)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index d44bc36..463abaa 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,6 +13,7 @@ Resource you can manage with Libcloud are divided in the following categories:
Rackspace CloudFiles
* :doc:`Load Balancers as a Service </loadbalancer/index>` - services such as Amazon Elastic Load Balancer and GoGrid LoadBalancers
* :doc:`DNS as a Service </dns/index>` - services such as Amazon Route 53 and Zerigo
+* :doc:`Disaster Recovery as a Service as a Service (DRS) </drs/index>` - services such as Amazon Route 53 and Zerigo
* :doc:`Container Services </container/index>` - container virtualization like Docker and Rkt as well as container based services
* :doc:`Backup as a Service </backup/index>` - services such as Amazon EBS and OpenStack Freezer
@@ -38,6 +39,7 @@ Main
storage/index
loadbalancer/index
dns/index
+ drs/index
container/index
backup/index
troubleshooting
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/loadbalancer/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/_supported_methods.rst b/docs/loadbalancer/_supported_methods.rst
index 7e34af7..ddc48f4 100644
--- a/docs/loadbalancer/_supported_methods.rst
+++ b/docs/loadbalancer/_supported_methods.rst
@@ -12,6 +12,7 @@ Provider create balancer list balancers list membe
`Google Compute Engine Load Balancer`_ yes yes yes yes yes yes
`GoGrid LB`_ yes yes yes yes yes no
`Ninefold LB`_ yes yes yes yes yes no
+`NTTC-CIS Load Balancer`_ yes yes yes yes yes no
`Rackspace LB`_ yes yes yes yes yes no
`Softlayer Load Balancing`_ no yes yes yes yes no
====================================== =============== ============== ============ ============= ============= ===================
@@ -25,5 +26,6 @@ Provider create balancer list balancers list membe
.. _`Google Compute Engine Load Balancer`: https://cloud.google.com/
.. _`GoGrid LB`: http://www.gogrid.com/
.. _`Ninefold LB`: http://ninefold.com/
+.. _`NTTC-CIS Load Balancer`: https://cloud.nttcis.com/
.. _`Rackspace LB`: http://www.rackspace.com/
.. _`Softlayer Load Balancing`: http://www.softlayer.com/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/loadbalancer/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/_supported_providers.rst b/docs/loadbalancer/_supported_providers.rst
index aea942c..d0f9c56 100644
--- a/docs/loadbalancer/_supported_providers.rst
+++ b/docs/loadbalancer/_supported_providers.rst
@@ -12,6 +12,7 @@ Provider Documentation
`Google Compute Engine Load Balancer`_ :doc:`Click </loadbalancer/drivers/gce>` GCE single region driver :mod:`libcloud.loadbalancer.drivers.gce` :class:`GCELBDriver`
`GoGrid LB`_ GOGRID single region driver :mod:`libcloud.loadbalancer.drivers.gogrid` :class:`GoGridLBDriver`
`Ninefold LB`_ NINEFOLD single region driver :mod:`libcloud.loadbalancer.drivers.ninefold` :class:`NinefoldLBDriver`
+`NTTC-CIS Load Balancer`_ :doc:`Click </loadbalancer/drivers/nttcis>` NTTCIS single region driver :mod:`libcloud.loadbalancer.drivers.nttcis` :class:`NttCisLBDriver`
`Rackspace LB`_ RACKSPACE dfw, hkg, iad, lon, ord, syd :mod:`libcloud.loadbalancer.drivers.rackspace` :class:`RackspaceLBDriver`
`Softlayer Load Balancing`_ SOFTLAYER single region driver :mod:`libcloud.loadbalancer.drivers.softlayer` :class:`SoftlayerLBDriver`
====================================== ================================================== ================= ============================ ================================================== ==============================
@@ -25,5 +26,6 @@ Provider Documentation
.. _`Google Compute Engine Load Balancer`: https://cloud.google.com/
.. _`GoGrid LB`: http://www.gogrid.com/
.. _`Ninefold LB`: http://ninefold.com/
+.. _`NTTC-CIS Load Balancer`: https://cloud.nttcis.com/
.. _`Rackspace LB`: http://www.rackspace.com/
.. _`Softlayer Load Balancing`: http://www.softlayer.com/
[44/45] libcloud git commit: Merge branch 'trunk' of
https://git-wip-us.apache.org/repos/asf/libcloud into feature_ssl_offload
Posted by an...@apache.org.
Merge branch 'trunk' of https://git-wip-us.apache.org/repos/asf/libcloud into feature_ssl_offload
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/efa8f97c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/efa8f97c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/efa8f97c
Branch: refs/heads/trunk
Commit: efa8f97c1871e53a491deef8b7f0fc3ffb5fff35
Parents: 9dcb4c9 1a3ebe5
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Dec 4 20:16:07 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Dec 4 20:16:07 2018 -0500
----------------------------------------------------------------------
CHANGES.rst | 72 ++-
docs/compute/drivers/openstack.rst | 4 +
libcloud/common/openstack.py | 3 +-
libcloud/common/openstack_identity.py | 2 +-
libcloud/compute/drivers/openstack.py | 590 ++++++++++++++++++-
libcloud/test/common/test_base_driver.py | 6 +-
libcloud/test/common/test_openstack_identity.py | 34 +-
libcloud/test/common/test_upcloud.py | 4 +-
.../compute/fixtures/openstack/_v2_0__auth.json | 22 +
.../openstack_identity/v3/v3_users_c.json | 14 +
.../openstack_v1.1/_v2_0__floatingip.json | 23 +
.../openstack_v1.1/_v2_0__floatingips.json | 52 ++
.../openstack_v1.1/_v2_0__networks_public.json | 64 ++
.../openstack_v1.1/_v2_0__security_group.json | 10 +
.../_v2_0__security_group_rule.json | 13 +
.../openstack_v1.1/_v2_0__security_groups.json | 29 +
.../openstack_v1.1/_v2_0__snapshot.json | 14 +
.../openstack_v1.1/_v2_0__snapshots.json | 46 ++
.../_v2_0__snapshots_paginate_start.json | 52 ++
.../fixtures/openstack_v1.1/_v2_0__subnet.json | 32 +
.../fixtures/openstack_v1.1/_v2_0__volume.json | 18 +
.../fixtures/openstack_v1.1/_v2_0__volumes.json | 44 ++
libcloud/test/compute/test_azure.py | 2 +-
libcloud/test/compute/test_cloudsigma_v2_0.py | 6 +-
libcloud/test/compute/test_gce.py | 4 +-
libcloud/test/compute/test_oneandone.py | 10 +-
libcloud/test/compute/test_opennebula.py | 142 ++---
libcloud/test/compute/test_openstack.py | 302 +++++++++-
libcloud/test/compute/test_vcloud.py | 2 +-
libcloud/test/dns/test_buddyns.py | 16 +-
libcloud/test/dns/test_cloudflare.py | 2 +-
libcloud/test/dns/test_dnspod.py | 10 +-
libcloud/test/dns/test_google.py | 2 +-
libcloud/test/dns/test_linode.py | 4 +-
libcloud/test/dns/test_liquidweb.py | 10 +-
libcloud/test/dns/test_luadns.py | 18 +-
libcloud/test/dns/test_nsone.py | 6 +-
libcloud/test/dns/test_pointdns.py | 8 +-
libcloud/test/dns/test_powerdns.py | 20 +-
libcloud/test/dns/test_vultr.py | 12 +-
libcloud/test/dns/test_zerigo.py | 8 +-
libcloud/test/dns/test_zonomi.py | 10 +-
.../loadbalancer/test_dimensiondata_v2_3.py | 4 +-
.../loadbalancer/test_dimensiondata_v2_4.py | 4 +-
libcloud/test/test_connection.py | 16 +-
libcloud/test/test_http.py | 2 +-
libcloud/test/test_init.py | 2 +-
47 files changed, 1548 insertions(+), 222 deletions(-)
----------------------------------------------------------------------
[12/45] libcloud git commit: can list cg groups
Posted by an...@apache.org.
can list cg groups
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f8c0da69
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f8c0da69
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f8c0da69
Branch: refs/heads/trunk
Commit: f8c0da694dc25bb3f2238a95e7d6968ecb6f9399
Parents: 82afeb4
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Oct 31 13:24:05 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Oct 31 13:24:05 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 1 -
libcloud/drs/drivers/nttcis.py | 15 +++++++++++++++
libcloud/test/drs_ineligible.xml | 6 ++++++
tests/lib_create_test.py | 20 ++++++++++++++++----
tests/lib_list_test.py | 6 ++++++
5 files changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c0da69/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 126530f..42866d1 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -2166,4 +2166,3 @@ def process_xml(xml):
cls = klass(attrs)
attrs = {}
return cls
-
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c0da69/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index ab5f0de..4ae2891 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -2,6 +2,7 @@ from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
+from libcloud.common.nttcis import process_xml
from libcloud.drs.types import Provider
from libcloud.drs.base import Driver
from libcloud.common.nttcis import TYPES_URN
@@ -88,3 +89,17 @@ class NttCisDRSDriver(Driver):
data=ET.tostring(consistency_group_elm)).object
response_code = findtext(response, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
+
+ def list_consistency_groups(self):
+ #params = {'networkDomainId': ex_network_domain_id}
+ response = self.connection.request_with_orgId_api_2(
+ 'consistencyGroup/consistencyGroup').object
+ cgs = self._to_consistency_groups(response)
+ return cgs
+
+ def _to_consistency_groups(self, object):
+ cgs = findall(object, 'consistencyGroup', TYPES_URN)
+ return [self._to_consistency_group(el) for el in cgs]
+
+ def _to_consistency_group(self, element):
+ return process_xml(ET.tostring(element))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c0da69/libcloud/test/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs_ineligible.xml b/libcloud/test/drs_ineligible.xml
new file mode 100644
index 0000000..a0ff44c
--- /dev/null
+++ b/libcloud/test/drs_ineligible.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
+ <operation>CREATE_CONSISTENCY_GROUP</operation>
+ <responseCode>INCOMPATIBLE_OPERATION</responseCode>
+ <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c0da69/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index a38f65b..aa0c7d0 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -245,18 +245,30 @@ def test_fail_create_drs(na_compute_driver, drsdriver):
src_id = nodes[0].id
nodes = na_compute_driver.list_nodes(ex_name="drs_test_2")
target_id = nodes[0].id
- with pytest.raises(NttCisAPIException)as excinfo:
+ with pytest.raises(NttCisAPIException) as excinfo:
result = drsdriver.create_consistency_group(
"sdk_cg", "100", src_id, target_id, description="A test consistency group")
exception_msg = excinfo.value.msg
assert exception_msg == 'DRS is not supported between source Data Center NA9 and target Data Center NA12.'
+def test_inelligble_drs(na_compute_driver, drsdriver):
+ nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
+ src_id = nodes[0].id
+ nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")
+ target_id = nodes[0].id
+ with pytest.raises(NttCisAPIException) as excinfo:
+ drsdriver.create_consistency_group(
+ "sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
+ exception_msg = excinfo.value.msg
+ assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.'
+
+
def test_create_drs(na_compute_driver, drsdriver):
- nodes = na_compute_driver.list_nodes(ex_name='Src-Test-VM01')
+ nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
src_id = nodes[0].id
- nodes = na_compute_driver.list_nodes(ex_name="Tgt-Test-VM01")
+ nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")
target_id = nodes[0].id
result = drsdriver.create_consistency_group(
- "sdk_test_cg", "100", src_id, target_id, description="A test consistency group")
+ "sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
assert result is True
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c0da69/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index de39a33..ac26e44 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -391,3 +391,9 @@ def test_list_health_monitors(compute_driver, lbdriver):
for monitor in monitors:
print(monitor)
+
+def test_list_consistency_groups(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ for cg in cgs:
+ print(vars(cg))
+ print()
\ No newline at end of file
[09/45] libcloud git commit: Test failed DRS creation not supported
between the selected data centers
Posted by an...@apache.org.
Test failed DRS creation not supported between the selected data centers
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/10c4a31b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/10c4a31b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/10c4a31b
Branch: refs/heads/trunk
Commit: 10c4a31b4ea9b9776ff8fd94553aa294ceb2a1d1
Parents: 62d9eb6
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Oct 29 13:41:24 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Oct 29 13:41:24 2018 -0400
----------------------------------------------------------------------
.gitignore | 2 +-
libcloud/drs/drivers/nttcis.py | 47 ++++
libcloud/utils/xml.py | 14 --
tests/conftest.py | 40 ++++
tests/lib_create_test.py | 252 ++++++++++++++++++++
tests/lib_edit_test.py | 452 ++++++++++++++++++++++++++++++++++++
tests/lib_list_test.py | 393 +++++++++++++++++++++++++++++++
tests/lib_misc_test.py | 10 +
tests/test_lib_list.py | 344 ---------------------------
9 files changed, 1195 insertions(+), 359 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7b71b9b..d5765e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,5 +31,5 @@ lib/
pip-selfcheck.json
report.html
.pytest_cache
-tests/
+
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 8d4cb37..e368560 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -4,6 +4,8 @@ from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
from libcloud.drs.types import Provider
from libcloud.drs.base import Driver
+from libcloud.common.nttcis import TYPES_URN
+from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.common.types import LibcloudError
@@ -47,3 +49,48 @@ class NttCisDRSDriver(Driver):
self)._ex_connection_class_kwargs()
kwargs['region'] = self.selected_region
return kwargs
+
+ def create_consistency_group(self, name, journal_size_gb ,
+ source_server_id, target_server_id,
+ description=None):
+ """
+ Create a consistency group
+
+ :param name: Name of consistency group
+ :type name: ``str``
+ :param journal_size_gb: Journal size in GB
+ :type journal_size_gb: ``str``
+ :param source_server_id: Id of the server to copy
+ :type source_server_id: ``str``
+ :param target_server_id: Id of the server to receive the copy
+ :type: ``str``
+ :param description: (Optional) Description of consistency group
+ :type: ``str``
+ :return: :class: `NttCisConsistenccyGroup`
+ """
+
+ consistency_group_elm = ET.Element('createConsistencyGroup',
+ {'xmlns': TYPES_URN})
+ ET.SubElement(consistency_group_elm, "name").text = name
+ if description is not None:
+ ET.SubElement(
+ consistency_group_elm,"description").text = description
+ ET.SubElement(
+ consistency_group_elm, "journalSizeGb").text = journal_size_gb
+ server_pair = ET.SubElement(consistency_group_elm, "serverPair")
+ ET.SubElement(
+ server_pair, "sourceServerId").text = source_server_id
+ ET.SubElement(
+ server_pair, "targetServerId").text = target_server_id
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/createConsistencyGroup",
+ method="POST",
+ data=ET.tostring(consistency_group_elm)).object
+ response_code = findtext(response, 'responseCode', TYPES_URN)
+ try:
+ assert response_code in ['IN_PROGRESS', 'OK']
+ except AssertionError:
+ return response_code
+ else:
+ info = findtext(response, "info", TYPES_URN)
+ print(info)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/libcloud/utils/xml.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/xml.py b/libcloud/utils/xml.py
index 3a34d84..55b82a6 100644
--- a/libcloud/utils/xml.py
+++ b/libcloud/utils/xml.py
@@ -47,17 +47,3 @@ def findattr(element, xpath, namespace=None):
def findall(element, xpath, namespace=None):
return element.findall(fixxpath(xpath=xpath, namespace=namespace))
-
-
-def return_all(parent_element):
- elem_dict = {}
- if parent_element.items():
- elem_dict.update(dict(parent_element.items()))
- for element in parent_element:
- if element.items():
- elem_dict.update(dict(element.items()))
- elif element.text:
- elem_dict.update({element.tag.split('}')[1]: element.text})
- else:
- elem_dict.update(element.attrib)
- return elem_dict
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/conftest.py
----------------------------------------------------------------------
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..077e463
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,40 @@
+import pytest
+import libcloud
+
+
+@pytest.fixture(scope="module")
+def compute_driver():
+ cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
+ libcloud.DriverType.COMPUTE.NTTCIS)
+ compute_driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
+ return compute_driver
+
+
+@pytest.fixture(scope="module")
+def lbdriver():
+ cd = libcloud.get_driver(libcloud.DriverType.COMPUTE,
+ libcloud.DriverType.COMPUTE.NTTCIS)
+ compute_driver = cd('mitchgeo-test', 'Snmpv2c!', region='eu')
+ net_domain_name = 'sdk_test_1'
+ net_domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain_id = [d for d in net_domains if d.name == net_domain_name][0].id
+ cls = libcloud.get_driver(libcloud.DriverType.LOADBALANCER,
+ libcloud.DriverType.LOADBALANCER.NTTCIS)
+ lbdriver = cls('mitchgeo-test', net_domain_id, 'Snmpv2c!', region='eu')
+ return lbdriver
+
+
+@pytest.fixture(scope="module")
+def na_compute_driver():
+ cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
+ libcloud.DriverType.COMPUTE.NTTCIS)
+ na_compute_driver = cls('mitchgeo-test', 'Snmpv2c!', region='na')
+ return na_compute_driver
+
+
+@pytest.fixture(scope="module")
+def drsdriver():
+ cls = libcloud.get_driver(libcloud.DriverType.DRS,
+ libcloud.DriverType.DRS.NTTCIS)
+ drsdriver = cls('mitchgeo-test', 'Snmpv2c!', region='na')
+ return drsdriver
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
new file mode 100644
index 0000000..0b345a8
--- /dev/null
+++ b/tests/lib_create_test.py
@@ -0,0 +1,252 @@
+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
+
+
+def test_deploy_vlan(compute_driver, vlan_name='sdk_test2', network_domain_name='sdk_test_1', base_ipv4_addr='10.1.2.0'):
+ # Default network size is 24 bits. Interval and polling times default to 2 and 60.
+ interval = 3
+ timeout = 60
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ result = compute_driver.ex_create_vlan(network_domain, vlan_name, base_ipv4_addr)
+ assert isinstance(result, NttCisVlan)
+ compute_driver.ex_wait_for_state('normal', compute_driver.ex_get_vlan, interval, timeout, result.id)
+ return result
+
+
+def test_deploy_vlan_2(compute_driver, vlan_name='sdk_test_3', network_domain_name='sdk_test_1',
+ base_ipv4_addr='10.2.0.0', private_ipv4_prefix_size=24):
+ # Default network size is 24 bits. Interval and polling times default to 2 and 60.
+ interval = 3
+ timeout = 60
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ result = compute_driver.ex_create_vlan(network_domain, vlan_name, base_ipv4_addr,
+ private_ipv4_prefix_size=private_ipv4_prefix_size)
+ assert isinstance(result, NttCisVlan)
+ compute_driver.ex_wait_for_state('normal', compute_driver.ex_get_vlan, interval, timeout, result.id)
+ return result
+
+
+def test_create_nat_rule(compute_driver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ result = compute_driver.ex_create_nat_rule(network_domain, '10.1.1.7', '168.128.13.126')
+ assert isinstance(result, NttCisNatRule)
+
+
+def test_deploy_server(compute_driver):
+ image_id = "81a36aa0-555c-4735-b965-4b64fcf0ac8f"
+ images = compute_driver.list_images(location='EU6')
+ image = [i for i in images if i.id == image_id]
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ psswd = 'Snmpv2c!'
+ vlan_name = "sdk_vlan1"
+ vlans = compute_driver.ex_list_vlans()
+ vlan = [v for v in vlans if v.name == vlan_name]
+ new_node = compute_driver.create_node("ubuntu", image[0], psswd, ex_description="auto_created_server",
+ ex_network_domain=net_domain[0], ex_primary_nic_vlan=vlan[0])
+ compute_driver.ex_wait_for_state('running', compute_driver.ex_get_node_by_id, 2, 300, new_node.id)
+ assert new_node.state == 'running'
+
+
+def test_delete_server(compute_driver):
+ server = compute_driver.list_nodes(ex_name="ubuntu")[0]
+ shut_result = compute_driver.ex_shutdown_graceful(server)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, server.id)
+ result = compute_driver.destroy_node(server)
+ assert result is True
+ compute_driver.ex_wait_for_state('terminated', compute_driver.ex_get_node_by_id, 2, 240, server.id)
+
+
+def test_deploy_firewall_rule_1(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ address_list_name = 'sdk_test_address_list'
+ address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
+ # using lambda with filter
+
+ # address_list = list(filter(lambda x: address_list_name, address_lists))
+ # address_list_id = address_list[0].id
+
+ # using list comprehension to filter
+
+ address_list = [a for a in address_lists if a.name == address_list_name]
+ address_list_id = address_list[0].id
+
+ port_list_name = 'sdk_test_port_list'
+ port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
+ port_list = [p for p in port_lists if p.name == port_list_name]
+ port_list_id = port_list[0].id
+ dest_firewall_address = NttCisFirewallAddress(address_list_id=address_list_id, port_list_id=port_list_id)
+ source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
+ rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_1', 'ACCEPT_DECISIVELY',
+ 'IPV4', 'TCP', source_firewall_address, dest_firewall_address, 'LAST')
+ print(rule)
+ assert isinstance(rule, NttCisFirewallRule)
+
+
+def test_deploy_firewall_rule_2(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
+ dest_firewall_address = NttCisFirewallAddress(ip_address='10.2.0.0', ip_prefix_size='16',
+ port_begin='8000', port_end='8080')
+
+ rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_2', 'ACCEPT_DECISIVELY',
+ 'IPV4', 'TCP', source_firewall_address, dest_firewall_address, 'LAST')
+ print(rule)
+ assert isinstance(rule, NttCisFirewallRule)
+
+
+def test_deploy_firewall_rule_3(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
+ dest_firewall_address = NttCisFirewallAddress(ip_address='10.2.0.0', ip_prefix_size='16',
+ port_begin='25')
+ rule_name = 'sdk_test_firewall_rule_2'
+ rules = compute_driver.ex_list_firewall_rules(net_domain[0])
+ rule = [rule for rule in rules if rule.name == rule_name]
+ relative_to = compute_driver.ex_get_firewall_rule(net_domain[0], rule[0].id)
+ rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_3', 'ACCEPT_DECISIVELY',
+ 'IPV4', 'TCP', source_firewall_address, dest_firewall_address,
+ 'BEFORE', position_relative_to_rule=relative_to)
+ print(rule)
+ assert isinstance(rule, NttCisFirewallRule)
+
+
+def test_create_port_list(compute_driver):
+ """
+ An optional named argument, child_portlist_list, which takes the id of an existing
+ port list to include in this port list.
+ """
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ port_list_name = 'sdk_test_port_list'
+ description = 'A test port list'
+ port_list = [NttCisPort(begin='8000', end='8080')]
+ result = compute_driver.ex_create_portlist(net_domain[0], port_list_name, description, port_list)
+ assert result is True
+
+
+def test_create_address_list(compute_driver):
+ """
+ An optional named argument, child_ip_address_list, which takes the id of an existing
+ port list to include in this port list.
+ """
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ address_list_name = 'sdk_test_address_list'
+ description = 'A test address list'
+ ip_version = 'IPV4'
+ # An optional prefix list can be specified as a named argument, prefix_size=
+ address_list = [NttCisIpAddress('10.2.0.1', end='10.2.0.11')]
+
+ result = compute_driver.ex_create_ip_address_list(net_domain[0], address_list_name,
+ description,
+ ip_version, address_list)
+ assert result is True
+
+
+def test_create_public_ip_block(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ ip_block = compute_driver.ex_add_public_ip_block_to_network_domain(net_domain)
+ assert isinstance(ip_block, NttCisPublicIpBlock)
+ print(ip_block)
+
+
+def test_create_private_ipv4_address(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ip = '10.1.1.20'
+ description = 'A test reserved ipv4 address'
+ result = compute_driver.ex_reserve_ip(vlan, ip, description)
+ assert result is True
+
+
+def test_create_ipv6_addresss(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ipv6 = '2a00:47c0:111:1331:7df0:9beb:43c9:5c'
+ result = compute_driver.ex_reserve_ip(vlan, ipv6)
+ assert result is True
+
+
+def test_import_customer_image(compute_driver):
+ package_name = "bitnami-couchdb-2.1.2-1-r35-linux-centos-7-x86_64.mf"
+ name = "bitnami-couchdb-2.1.2-1-r35-linux-centos-7-x86_64"
+ datacenter_id = 'EU6'
+ is_guest_os_customization = 'false'
+ result = compute_driver.import_image(package_name, name, datacenter_id=datacenter_id,
+ is_guest_os_customization=is_guest_os_customization)
+ assert result is True
+
+
+def test_create_load_balancer(lbdriver, compute_driver):
+ member1 = compute_driver.list_nodes(ex_name='web1')[0]
+ member2 = compute_driver.list_nodes(ex_name='web2')[0]
+ members = [member1, member2]
+ name = 'sdk_test_balancer'
+ port = '80'
+ listener_port = '8000'
+ protocol = 'TCP'
+ algorithm = 'LEAST_CONNECTIONS_MEMBER'
+ members = [m for m in members]
+ ex_listener_ip_address = "168.128.13.127"
+ lb = lbdriver.create_balancer(name, listener_port=listener_port, port=port, protocol=protocol,
+ algorithm=algorithm, members=members, optimization_profile='TCP',
+ ex_listener_ip_address=ex_listener_ip_address)
+
+
+def test_create_vip_node(compute_driver, lbdriver):
+ node_address = '10.1.1.7'
+ node_name = "web1"
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ node = lbdriver.ex_create_node(net_domain.id, node_name, node_address)
+ print(node)
+
+
+def test_add_pool_member(compute_driver, lbdriver):
+ pool_name = 'sdk_test_balancer'
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
+ pool = [p for p in pools if p.name == pool_name][0]
+ node = lbdriver.ex_get_node("eca8dac3-1417-4fdf-83c3-2b7b848ab171")
+ result = lbdriver.ex_create_pool_member(pool, node, port=80)
+ print(result)
+
+
+def test_create_server_monitor(compute_driver):
+ pass
+
+
+def test_fail_create_drs(na_compute_driver, drsdriver):
+ nodes = na_compute_driver.list_nodes(ex_name='drs_test_1')
+ src_id = nodes[0].id
+ nodes = na_compute_driver.list_nodes(ex_name="drs_test_2")
+ target_id = nodes[0].id
+ with pytest.raises(NttCisAPIException)as excinfo:
+ result = drsdriver.create_consistency_group(
+ "sdk_cg", "100", src_id, target_id, description="A test consistency group")
+ exception_msg = excinfo.value.msg
+ assert exception_msg == 'DRS is not supported between source Data Center NA9 and target Data Center NA12.'
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
new file mode 100644
index 0000000..32984ee
--- /dev/null
+++ b/tests/lib_edit_test.py
@@ -0,0 +1,452 @@
+import pytest
+import libcloud
+from libcloud import loadbalancer
+from libcloud.compute.drivers.nttcis import NttCisPort
+from libcloud.common.nttcis import NttCisIpAddress, NttCisVlan, NttCisVIPNode
+from tests.lib_create_test import test_deploy_vlan
+
+
+def test_disable_node_snapshot(compute_driver):
+ node = '040fefdb-78be-4b17-8ef9-86820bad67d9'
+ assert compute_driver.ex_disable_snapshots(node) is True
+
+
+def test_list_windows(compute_driver):
+ loc = 'EU6'
+ service_plan = 'ADVANCED'
+ windows = compute_driver.list_snapshot_windows(loc, service_plan)
+ for window in windows:
+ print(window)
+ assert 'day_of_week' in window
+
+
+def test_enable_snapshot(compute_driver):
+ """
+ This will enable a snapshot window and create an initial
+ snapshot when it has done so. A node object and a window id are required
+ :param compute_driver: The driver object for compute nodes.
+ :return: True or False
+ :rtype: ``bool``
+ """
+ window_id = 'ea646520-4272-11e8-838c-180373fb68df'
+ node = '040fefdb-78be-4b17-8ef9-86820bad67d9'
+ result = compute_driver.ex_enable_snapshots(node, window_id)
+ assert result is True
+
+
+def test_initiate_manual_snapshot_warn(compute_driver):
+ with pytest.raises(RuntimeError, match=r'Found more than one server Id .*'):
+ compute_driver.ex_initiate_manual_snapshot('sdk_server_1', 'dc637783-2bb2-4b92-838a-99a899b5e29b')
+
+
+def test_initiate_manual_snapshot(compute_driver):
+ compute_driver.ex_initiate_manual_snapshot('sdk_server_1', 'dc637783-2bb2-4b92-838a-99a899b5e29b')
+
+
+def test_shutdown_server_1(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
+ result = compute_driver.ex_shutdown_graceful(node)
+ assert result is True
+
+
+def test_start_server_1(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_shutdown_server_2(compute_driver):
+ nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
+ for node in nodes:
+ result = compute_driver.ex_shutdown_graceful(node)
+ assert result is True
+
+
+def test_start_server_2(compute_driver):
+ nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
+ for node in nodes:
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_edit_metadata(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
+ description = 'SDK Test server'
+ name = 'sdk_server_1'
+ result = compute_driver.ex_edit_metadata(node, name=name, description=description)
+ assert result is True
+
+
+def test_edit_metadata_fails(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
+ description = 'Test server'
+ ip_address = 'EU6 Ubuntu'
+ with pytest.raises(TypeError):
+ result = compute_driver.ex_edit_metadata(node, ip_address=ip_address, description=description)
+
+
+def test_reconfigure_node(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9')
+ cpu_performance = 'HIGHPERFORMANCE'
+ result = compute_driver.ex_reconfigure_node(node, cpu_performance=cpu_performance)
+ assert result is True
+
+
+def test_edit_vlan(compute_driver):
+ vlan = compute_driver.ex_list_vlans(name='sdk_test2')[0]
+ vlan.name = 'sdk_test_2'
+ vlan.description = "Second test Vlan"
+ result = compute_driver.ex_update_vlan(vlan)
+ assert isinstance(result, NttCisVlan)
+
+
+def test_expand_vlan(compute_driver):
+ vlan = compute_driver.ex_list_vlans(name='sdk_test_3')[0]
+ vlan.private_ipv4_range_size = '23'
+ result = compute_driver.ex_expand_vlan(vlan)
+ assert isinstance(result, NttCisVlan)
+
+
+def test_delete_vlan(compute_driver):
+ vlan = compute_driver.ex_list_vlans(name='sdk_test_3')[0]
+ result = compute_driver.ex_delete_vlan(vlan)
+ assert result is True
+
+
+def test_add_disk_by_node(compute_driver):
+ """
+ Speeds can be specified based on DataCenter
+ :param compute_driver: libcloud.DriverType.COMPUTE.NTTCIS
+ :return: NA
+ """
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_add_storage_to_node(20, node)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 180, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_add_disk_by_controller_id(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_add_storage_to_node(20, controller_id=node.extra['scsi_controller'][0].id)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 180, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_changing_diskspeed(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ disk_id = 'f8a01c24-4768-46be-af75-9fe877f8c588'
+ result = compute_driver.ex_change_storage_speed(disk_id, 'HIGHPERFORMANCE')
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_changing_diskspeed_iops(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ disk_id = 'f8a01c24-4768-46be-af75-9fe877f8c588'
+ result = compute_driver.ex_change_storage_speed(disk_id, 'PROVISIONEDIOPS', iops=60)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_add_scsi_controller(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ adapter_type = 'VMWARE_PARAVIRTUAL'
+ result = compute_driver.ex_add_scsi_controller_to_node(node.id, adapter_type)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_remove_scsi_controller(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_remove_scsi_controller('f1126751-c6d5-4d64-893c-8902b8481f90')
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_update_vmware_tools(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ result = compute_driver.ex_update_vm_tools(node)
+ assert result is True
+ compute_driver.ex_wait_for_state('running', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+
+
+def test_add_node_to_vlan(compute_driver):
+ vlan = test_deploy_vlan(compute_driver, "test_vlan_create", "6aafcf08-cb0b-432c-9c64-7371265db086", "10.0.2.0")
+ assert isinstance(vlan, NttCisVlan)
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_attach_node_to_vlan(node, vlan=vlan)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_remove_nic(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_disable_snapshots(node.id)
+ assert result is True
+ result = compute_driver.ex_destroy_nic("e9cdea1b-c4f2-4769-93a8-57e24248abdd")
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+""""
+No wayt to get nic id's via libcloud
+def test_exchange_nic_vlans(compute_driver):
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ print(node.extra)
+"""
+
+
+def test_change_nic_type(compute_driver):
+ nic_id = "7a27b2b1-7b20-404f-be53-4695023c2734"
+ nic_type = 'VMXNET3'
+ node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
+ shut_result = compute_driver.ex_shutdown_graceful(node)
+ assert shut_result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
+ result = compute_driver.ex_change_nic_network_adapter(nic_id, nic_type)
+ assert result is True
+ compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
+ result = compute_driver.ex_start_node(node)
+ assert result is True
+
+
+def test_edit_firewall_rule(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ rule_name = 'sdk_test_firewall_rule_2'
+ rules = compute_driver.ex_list_firewall_rules(net_domain[0])
+ rule = [rule for rule in rules if rule.name == rule_name]
+ rule[0].destination.port_end = None
+ result = compute_driver.ex_edit_firewall_rule(rule[0])
+ print(compute_driver.ex_get_firewall_rule(net_domain[0].id, rule[0].id))
+ assert result is True
+
+
+def test_delete_firewall_rule(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ rule_name = 'sdk_test_firewall_rule_2'
+ rules = compute_driver.ex_list_firewall_rules(net_domain[0])
+ rule = [rule for rule in rules if rule.name == rule_name]
+ result = compute_driver.ex_delete_firewall_rule(rule[0])
+ assert result is True
+
+
+def test_create_anti_affinity_rule(compute_driver):
+ server1 = compute_driver.ex_get_node_by_id("d0425097-202f-4bba-b268-c7a73b8da129")
+ server2 = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
+ servers = [server1, server2]
+ result = compute_driver.ex_create_anti_affinity_rule(servers)
+ assert isinstance(result, )
+
+
+def test_delete_anti_affinity_rule(compute_driver):
+ anti_affinity_rule = "40d83160-0fa2-418d-a73e-5f15fe1354fc"
+ result = compute_driver.ex_delete_anti_affinity_rule(anti_affinity_rule)
+ assert result is True
+
+
+def test_delete_port_list(compute_driver):
+ portlists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
+ port_list_to_delete = [plist for plist in portlists if plist.name == 'sdk_test_port_list']
+ result = compute_driver.ex_delete_portlist(port_list_to_delete[0])
+ assert result is True
+
+
+def test_edit_address_list(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ addr_list = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
+ assert addr_list[0].ip_version == 'IPV4'
+ ip_address_1 = NttCisIpAddress(begin='190.2.2.100')
+ ip_address_2 = NttCisIpAddress(begin='190.2.2.106', end='190.2.2.108')
+ ip_address_3 = NttCisIpAddress(begin='190.2.2.0', prefix_size='24')
+ ip_address_4 = NttCisIpAddress(begin='10.2.0.0', prefix_size='24')
+ ip_address_collection = [ip_address_1, ip_address_2, ip_address_3, ip_address_4]
+
+ result = compute_driver.ex_edit_ip_address_list("d32aa8d4-831b-4fd6-95da-c639768834f0",
+ ip_address_collection=ip_address_collection)
+ assert result is True
+
+
+def test_delete_public_ip_block(compute_driver):
+ block = compute_driver.ex_get_public_ip_block("813b87a8-18e1-11e5-8d4f-180373fb68df")
+ result = compute_driver.ex_delete_public_ip_block(block)
+ assert result is True
+
+
+def test_edit_address_list_2(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ # An ip address list object can be used as an argument or the id of the address list
+ addr_list = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
+
+ result = compute_driver.ex_edit_ip_address_list("d32aa8d4-831b-4fd6-95da-c639768834f0",
+ description='nil')
+ assert result is True
+
+
+def test_delete_address_list(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ addresslist_to_delete = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
+ print(addresslist_to_delete)
+
+
+def test_edit_port_list_1(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name]
+ port_list_name = 'sdk_test_port_list'
+ port_lists = compute_driver.ex_list_portlist(net_domain[0])
+ port_list = [port for port in port_lists if port.name == port_list_name][0]
+ port_collection = [NttCisPort(begin='8000', end='8080'), NttCisPort(begin='9000')]
+ result = compute_driver.ex_edit_portlist(port_list.id, port_collection=port_collection)
+ assert result is True
+
+
+def test_unreserve_ip_address(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ip = '2a00:47c0:111:1331:7df0:9beb:43c9:5c'
+ result = compute_driver.ex_unreserve_ip_addresses(vlan, ip)
+ assert result is True
+
+
+def test_list_locations(compute_driver):
+ locations = compute_driver.list_locations()
+ for location in locations:
+ print(location)
+
+
+def test_delete_nat_rule(compute_driver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ rule = compute_driver.ex_get_nat_rule(network_domain, '74f0897f-5536-4c17-84b0-d52b1fb3aea6')
+ result = compute_driver.ex_delete_nat_rule(rule)
+ assert result is True
+
+
+def test_update_health_monitor(compute_driver, lbdriver):
+ pool_name = 'sdk_test_balancer'
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
+ pool = [p for p in pools if p.name == pool_name][0]
+ pool.health_monitor_id = '9f79487a-1b6d-11e5-8d4f-180373fb68df'
+ result = lbdriver.ex_update_pool(pool)
+ assert result is True
+
+
+def test_update_node_monitor(compute_driver, lbdriver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
+ #pool = [p for p in pools if p.name == pool_name][0]
+ health_monitor_id = '9f79a126-1b6d-11e5-8d4f-180373fb68df'
+ for node in nodes:
+ node.health_monitor_id = health_monitor_id
+ result = lbdriver.ex_update_node(node)
+ assert isinstance(result, NttCisVIPNode)
+
+
+def test_remove_node(compute_driver, lbdriver):
+ node_name = 'web1'
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
+ node = [n for n in nodes if n.name == node_name][0]
+ pool_name = "sdk_test_balancer"
+ pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
+ pool = [p for p in pools if p.name == pool_name][0]
+ pool_members = lbdriver.ex_get_pool_members(pool.id)
+ pool_member = [pm for pm in pool_members if pm.node_id == node.id][0]
+ result = lbdriver.ex_destroy_pool_member(pool_member)
+ assert result is True
+
+
+def test_delete_node(compute_driver, lbdriver):
+ node_name = 'web1'
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
+ node = [n for n in nodes if n.name == node_name][0]
+ result = lbdriver.ex_destroy_node(node.id)
+ assert result is True
+
+
+def test_remove_pool(compute_driver, lbdriver):
+ listener_name = "sdk_test_balancer"
+ listeners = lbdriver.list_balancers(ex_network_domain_id=lbdriver.network_domain_id)
+ listener = [l for l in listeners if l.name == listener_name][0]
+ pool_id = None
+ result = lbdriver.ex_update_listener(listener, poolId=pool_id)
+ assert result is True
+
+
+def test_delete_pool(compute_driver, lbdriver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ pool_name = "sdk_test_balancer"
+ pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
+ pool = [p for p in pools if p.name == pool_name][0]
+ result = lbdriver.ex_destroy_pool(pool)
+ assert result is True
+
+
+def test_delete_listener(compute_driver, lbdriver):
+ listener_name = "sdk_test_balancer"
+ listeners = lbdriver.list_balancers(ex_network_domain_id=lbdriver.network_domain_id)
+ listener = [l for l in listeners if l.name == listener_name][0]
+ result = lbdriver.destroy_balancer(listener)
+ assert result is True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
new file mode 100644
index 0000000..de39a33
--- /dev/null
+++ b/tests/lib_list_test.py
@@ -0,0 +1,393 @@
+import pytest
+import libcloud
+from libcloud import loadbalancer
+
+
+def test_list_node_all(compute_driver):
+ nodes = compute_driver.list_nodes()
+ for node in nodes:
+ print(node)
+ #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ # node.extra['scsi_controller'], node.extra['disks'], node.extra['memoryMb'],
+ # node.extra['OS_displayName'], node.private_ips, node.extra['ipv6'], node.extra['window'])
+
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_location(compute_driver):
+ nodes = compute_driver.list_nodes(ex_location='EU6')
+ print()
+ for node in nodes:
+ print(node)
+ #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ # [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ # node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_name(compute_driver):
+ nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
+ print()
+ for node in nodes:
+ print(node)
+ #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ # [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ # node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_ipv6(compute_driver):
+ nodes = compute_driver.list_nodes(ex_ipv6='2a00:47c0:111:1331:6140:e432:729b:eef6')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_ipv4(compute_driver):
+ nodes = compute_driver.list_nodes(ex_ipv4='10.1.1.6')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_images(compute_driver):
+ images = compute_driver.list_images(location='EU6')
+ print()
+ for image in images:
+ print(image.id, image.name)
+ assert isinstance(images, list) and len(images) > 0
+
+
+def test_list_os(compute_driver):
+ oss = compute_driver.ex_list_os(location='EU6')
+
+
+def test_list_node_by_image(compute_driver):
+ nodes = compute_driver.list_nodes(ex_image='81a36aa0-555c-4735-b965-4b64fcf0ac8f')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+"""
+ requires retrieving vlan Id first
+"""
+
+def test_list_node_vlan(compute_driver):
+ nodes = compute_driver.list_nodes(ex_vlan='eb05a24e-85a6-46e3-a7c9-f1765737476d')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+"""
+Libcloud docs say this works but it is not in our API docs
+def test_list_node_image(compute_driver):
+ nodes = compute_driver.list_nodes(ex_image='46096745-5a89-472b-9b3b-89a6a07bb60b')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+"""
+
+
+def test_list_node_started(compute_driver):
+ nodes = compute_driver.list_nodes(ex_started='true')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_deployed(compute_driver):
+ nodes = compute_driver.list_nodes(ex_deployed='true')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_node_state(compute_driver):
+ nodes = compute_driver.list_nodes(ex_state='NORMAL')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_network_domain_id(compute_driver):
+ nodes = compute_driver.list_nodes(ex_network_domain='6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for node in nodes:
+ print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
+ [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
+ node.private_ips, node.extra['ipv6'])
+ assert isinstance(nodes, list) and len(nodes) > 0
+
+
+def test_list_vlans(compute_driver):
+ vlans = compute_driver.ex_list_vlans()
+ print()
+ for vlan in vlans:
+ print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
+ vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
+ assert isinstance(vlans, list) and len(vlans) > 0
+
+
+def test_list_vlan(compute_driver):
+ vlan = compute_driver.ex_get_vlan('eb05a24e-85a6-46e3-a7c9-f1765737476d')
+ print()
+ print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
+ vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
+ assert vlan.name == 'sdk_vlan1'
+
+
+def test_list_datacenter_object_creation(compute_driver):
+ datacenter = compute_driver.ex_get_datacenter('EU6')
+
+
+def test_list_firewall_rules(compute_driver):
+ rules = compute_driver.ex_list_firewall_rules('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for rule in rules:
+ print("id {}, name {}, action {}. location {}, ip ver {}, protocol {}, any ip {}, ip {}, prefix {},"
+ " port range {} {} , src address {}, src port list {}, dest. any__ip {}, dest address {}, "
+ "dest prefix {}, dest port range {} {}, dest address list id {}"
+ ", dest port list id {}".format(
+ rule.id, rule.name, rule.action,
+ rule.location.name, rule.ip_version,
+ rule.protocol, rule.source.any_ip,
+ rule.source.ip_address,
+ rule.source.ip_prefix_size,
+ rule.source.port_begin, rule.source.port_end,
+ rule.source.address_list_id,
+ rule.source.port_list_id,
+ rule.destination.any_ip,
+ rule.destination.ip_address,
+ rule.destination.ip_prefix_size,
+ rule.destination.port_begin,
+ rule.destination.port_end,
+ rule.destination.address_list_id,
+ rule.destination.port_list_id,
+ ))
+
+
+def test_list_address_lists(compute_driver):
+ address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for address_list in address_lists:
+ print(address_list)
+ assert isinstance(address_lists, list) and len(address_lists) > 0
+
+
+def test_list_port_lists(compute_driver):
+ port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
+ print()
+ for portlist in port_lists:
+ print(portlist)
+ assert isinstance(port_lists, list) and len(port_lists) > 0
+
+
+def test_list_nat_rules(compute_driver):
+ nat_rules = compute_driver.ex_list_nat_rules(compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086'))
+ print()
+ for nat_rule in nat_rules:
+ print(nat_rule, nat_rule.external_ip, nat_rule.internal_ip)
+ assert isinstance(nat_rules, list) and len(nat_rules) > 0
+
+
+def test_list_balancers(lbdriver):
+ balancers = lbdriver.list_balancers(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for balancer in balancers:
+ print(balancer.id, balancer.ip, balancer.name, balancer.port)
+ assert isinstance(balancers, list)
+
+
+def test_get_listener(lbdriver):
+ listener = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
+ print()
+ print(listener.ip, listener.name, listener.port)
+ assert listener.ip == '168.128.13.127'
+
+
+def test_vip_nodes(lbdriver):
+ vips = lbdriver.ex_get_nodes("6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for vip in vips:
+ print(vip, vip.ip, vip.name)
+ assert isinstance(vips, list) and len(vips) > 0
+
+
+def test_list_lb_pools(lbdriver):
+ pools = lbdriver.ex_get_pools(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
+ print()
+ for pool in pools:
+ print(pool.id, pool.name, pool.description, pool.health_monitor_id, pool.load_balance_method, pool.slow_ramp_time, pool.status)
+ assert isinstance(pools, list)
+
+
+def test_list_lb_pool_members(lbdriver):
+ balancer = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
+ pool_members = lbdriver.balancer_list_members(balancer)
+ print()
+ for pool_member in pool_members:
+ print(pool_member)
+ assert isinstance(pool_members, list)
+
+
+def test_get_pool_member(lbdriver):
+ pool_member = lbdriver.ex_get_pool_member("9382e488-7f95-4db0-b2de-0b807aab825b")
+ print()
+ print(pool_member.ip, pool_member.port, pool_member.name)
+ assert pool_member.ip == '10.1.1.8'
+
+
+def test_get_node(lbdriver):
+ node = lbdriver.ex_get_node("5c647a74-d181-4ed8-82d3-55ae443a06dd")
+ print()
+ print(node.name, node.ip, node.connection_limit, node.connection_rate_limit)
+ assert isinstance(node, object)
+
+
+def test_list_snapshots(compute_driver):
+ snapshots = compute_driver.list_snapshots('web1')
+ for snapshot in snapshots:
+ print(snapshot)
+ assert 'expiry_time' in snapshot
+
+
+def test_list_nics(compute_driver):
+ result = compute_driver.ex_list_
+
+
+def test_list_vlans(compute_driver):
+ vlans = compute_driver.ex_list_vlans()
+ print(vlans)
+ assert isinstance(vlans, list)
+
+
+def test_list_anti_affinity_rules(compute_driver):
+ # Could use network domain or node but not both
+ # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
+ node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
+ anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
+ assert len(anti_affinity_rules) > 1
+
+
+def test_list_no_anti_affinity_rules(compute_driver):
+ # Could use network domain or node but not both
+ # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
+ node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
+ anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
+ assert len(anti_affinity_rules) == 0
+
+
+def test_list_locations(compute_driver):
+ locations = compute_driver.list_locations()
+ for location in locations:
+ print(location)
+
+
+"""
+def test_list_sizes(compute_driver):
+ properties = compute_driver.list_locations()
+ for property in properties:
+ print(property)
+"""
+
+
+def test_images(compute_driver):
+ images = compute_driver.list_images()
+ print()
+ print(images)
+ assert isinstance(images, list) and len(images) > 0
+
+
+def test_list_public_ip_blocks(compute_driver):
+ domain_name = 'sdk_test_1'
+ domains = compute_driver.ex_list_network_domains(location='EU6')
+ net_domain = [d for d in domains if d.name == domain_name][0]
+ blocks = compute_driver.ex_list_public_ip_blocks(net_domain)
+ print(blocks)
+
+
+def test_list_private_ipv4_addresses_vlan(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ip_addresses = compute_driver.ex_list_reserved_ipv4(vlan=vlan)
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_private_ipv4_addresses_datacenter(compute_driver):
+ datacenter_id = 'EU8'
+ ip_addresses = compute_driver.ex_list_reserved_ipv4(datacenter_id=datacenter_id)
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_private_ipv4_addresses_all(compute_driver):
+ ip_addresses = compute_driver.ex_list_reserved_ipv4()
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_reserved_ipv6_address_vlan(compute_driver):
+ vlan_name = 'sdk_vlan1'
+ vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
+ ip_addresses = compute_driver.ex_list_reserved_ipv6(vlan=vlan)
+ for ip_address in ip_addresses:
+ print(ip_address)
+
+
+def test_list_nat_rules(compute_driver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ rules = compute_driver.ex_list_nat_rules(network_domain)
+ for rule in rules:
+ print(rule)
+
+
+def test_list_customer_images(compute_driver):
+ location = 'EU6'
+ images = compute_driver.ex_list_customer_images(location)
+ for image in images:
+ print(image, image.extra)
+
+
+def test_get_customer_image(compute_driver):
+ imagee_id = '84da095f-c8c7-4ace-9fb6-eceb1047027c'
+ image = compute_driver.ex_get_image_by_id(imagee_id)
+ print(image, image.extra)
+
+
+def test_list_health_monitors(compute_driver, lbdriver):
+ network_domain_name = "sdk_test_1"
+ network_domains = compute_driver.ex_list_network_domains(location='EU6')
+ network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
+ monitors = lbdriver.ex_get_default_health_monitors(network_domain)
+ for monitor in monitors:
+ print(monitor)
+
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/lib_misc_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_misc_test.py b/tests/lib_misc_test.py
new file mode 100644
index 0000000..d8be518
--- /dev/null
+++ b/tests/lib_misc_test.py
@@ -0,0 +1,10 @@
+import pytest
+import libcloud
+from libcloud import loadbalancer
+from libcloud.common.nttcis import NttCisAPIException
+
+
+def test_server_clone_to_image(compute_driver):
+ node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
+ result = compute_driver.ex_clone_node_to_image(node, 'sdk_test_image', image_description='A test image for libcloud')
+ assert result is True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/10c4a31b/tests/test_lib_list.py
----------------------------------------------------------------------
diff --git a/tests/test_lib_list.py b/tests/test_lib_list.py
deleted file mode 100644
index 48550cd..0000000
--- a/tests/test_lib_list.py
+++ /dev/null
@@ -1,344 +0,0 @@
-import pytest
-import libcloud
-from libcloud import loadbalancer
-
-
-def test_list_node_all(compute_driver):
- nodes = compute_driver.list_nodes()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- node.extra['scsi_controller'], node.extra['disks'], node.extra['memoryMb'],
- node.extra['OS_displayName'], node.private_ips, node.extra['ipv6'], node.extra['window'])
-
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_location(compute_driver):
- nodes = compute_driver.list_nodes(ex_location='EU6')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_name(compute_driver):
- nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_ipv6(compute_driver):
- nodes = compute_driver.list_nodes(ex_ipv6='2a00:47c0:111:1331:6140:e432:729b:eef6')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_ipv4(compute_driver):
- nodes = compute_driver.list_nodes(ex_ipv4='10.1.1.6')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_images(compute_driver):
- images = compute_driver.list_images(location='EU6')
- print()
- for image in images:
- print(image.id, image.name)
- assert isinstance(images, list) and len(images) > 0
-
-
-def test_list_os(compute_driver):
- oss = compute_driver.ex_list_os(location='EU6')
-
-
-def test_list_node_by_image(compute_driver):
- nodes = compute_driver.list_nodes(ex_image='81a36aa0-555c-4735-b965-4b64fcf0ac8f')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-"""
- requires retrieving vlan Id first
-"""
-def test_list_node_vlan(compute_driver):
- nodes = compute_driver.list_nodes(ex_vlan='eb05a24e-85a6-46e3-a7c9-f1765737476d')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-"""
-Libcloud docs say this works but it is not in our API docs
-def test_list_node_image(compute_driver):
- nodes = compute_driver.list_nodes(ex_image='46096745-5a89-472b-9b3b-89a6a07bb60b')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-"""
-
-
-def test_list_node_started(compute_driver):
- nodes = compute_driver.list_nodes(ex_started='true')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_deployed(compute_driver):
- nodes = compute_driver.list_nodes(ex_deployed='true')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_state(compute_driver):
- nodes = compute_driver.list_nodes(ex_state='NORMAL')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_network_domain_id(compute_driver):
- nodes = compute_driver.list_nodes(ex_network_domain='6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_vlans(compute_driver):
- vlans = compute_driver.ex_list_vlans()
- print()
- for vlan in vlans:
- print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
- vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
- assert isinstance(vlans, list) and len(vlans) > 0
-
-
-def test_list_vlan(compute_driver):
- vlan = compute_driver.ex_get_vlan('eb05a24e-85a6-46e3-a7c9-f1765737476d')
- print()
- print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
- vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
- assert vlan.name == 'sdk_vlan1'
-
-
-def test_list_datacenter_object_creation(compute_driver):
- datacenter = compute_driver.ex_get_datacenter('EU6')
-
-
-def test_list_firewall_rules(compute_driver):
- rules = compute_driver.ex_list_firewall_rules('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for rule in rules:
- print("id {}, name {}, action {}. location {}, ip ver {}, protocol {}, any ip {}, ip {}, prefix {},"
- " port range {} {} , src address {}, src port list {}, dest. any__ip {}, dest address {}, "
- "dest prefix {}, dest port range {} {}, dest address list id {}"
- ", dest port list id {}".format(
- rule.id, rule.name, rule.action,
- rule.location.name, rule.ip_version,
- rule.protocol, rule.source.any_ip,
- rule.source.ip_address,
- rule.source.ip_prefix_size,
- rule.source.port_begin, rule.source.port_end,
- rule.source.address_list_id,
- rule.source.port_list_id,
- rule.destination.any_ip,
- rule.destination.ip_address,
- rule.destination.ip_prefix_size,
- rule.destination.port_begin,
- rule.destination.port_end,
- rule.destination.address_list_id,
- rule.destination.port_list_id,
- ))
-
-
-def test_list_address_lists(compute_driver):
- address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for address_list in address_lists:
- print(address_list)
- assert isinstance(address_lists, list) and len(address_lists) > 0
-
-
-def test_list_port_lists(compute_driver):
- port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for portlist in port_lists:
- print(portlist)
- assert isinstance(port_lists, list) and len(port_lists) > 0
-
-
-def test_list_nat_rules(compute_driver):
- nat_rules = compute_driver.ex_list_nat_rules(compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086'))
- print()
- for nat_rule in nat_rules:
- print(nat_rule, nat_rule.external_ip, nat_rule.internal_ip)
- assert isinstance(nat_rules, list) and len(nat_rules) > 0
-
-
-def test_list_balancers(lbdriver):
- balancers = lbdriver.list_balancers(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
- for balancer in balancers:
- print(balancer.id, balancer.ip, balancer.name, balancer.port)
- assert isinstance(balancers, list)
-
-
-def test_get_listener(lbdriver):
- listener = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
- print()
- print(listener.ip, listener.name, listener.port)
- assert listener.ip == '168.128.13.127'
-
-
-def test_vip_nodes(lbdriver):
- vips = lbdriver.ex_get_nodes("6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
- for vip in vips:
- print(vip, vip.ip, vip.name)
- assert isinstance(vips, list) and len(vips) > 0
-
-
-def test_list_lb_pools(lbdriver):
- pools = lbdriver.ex_get_pools(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
- for pool in pools:
- print(pool.id, pool.name, pool.description, pool.health_monitor_id, pool.load_balance_method, pool.slow_ramp_time, pool.status)
- assert isinstance(pools, list)
-
-
-def test_list_lb_pool_members(lbdriver):
- balancer = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
- pool_members = lbdriver.balancer_list_members(balancer)
- print()
- for pool_member in pool_members:
- print(pool_member)
- assert isinstance(pool_members, list)
-
-
-def test_get_pool_member(lbdriver):
- pool_member = lbdriver.ex_get_pool_member("9382e488-7f95-4db0-b2de-0b807aab825b")
- print()
- print(pool_member.ip, pool_member.port, pool_member.name)
- assert pool_member.ip == '10.1.1.8'
-
-
-def test_get_node(lbdriver):
- node = lbdriver.ex_get_node("5c647a74-d181-4ed8-82d3-55ae443a06dd")
- print()
- print(node.name, node.ip, node.connection_limit, node.connection_rate_limit)
- assert isinstance(node, object)
-
-
-def test_list_snapshots(compute_driver):
- snapshots = compute_driver.list_snapshots('web1')
- for snapshot in snapshots:
- print(snapshot)
- assert 'expiry_time' in snapshot
-
-
-def test_list_nics(compute_driver):
- result = compute_driver.ex_list_
-
-
-def test_list_vlans(compute_driver):
- vlans = compute_driver.ex_list_vlans()
- print(vlans)
- assert isinstance(vlans, list)
-
-
-def test_list_anti_affinity_rules(compute_driver):
- # Could use network domain or node but not both
- # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
- node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
- anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
- assert len(anti_affinity_rules) > 1
-
-
-def test_list_no_anti_affinity_rules(compute_driver):
- # Could use network domain or node but not both
- # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
- node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
- anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
- assert len(anti_affinity_rules) == 0
-
-
-
-"""
-def test_list_sizes(compute_driver):
- properties = compute_driver.list_locations()
- for property in properties:
- print(property)
-"""
-
-
-def test_images(compute_driver):
- images = compute_driver.list_images()
- print()
- print(images)
- assert isinstance(images, list) and len(images) > 0
-
-
-def test_list_public_ip_blocks(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- blocks = compute_driver.ex_list_public_ip_blocks(net_domain)
- print(blocks)
-
-
-def test_list_private_ipv4_addresses_vlan(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ip_addresses = compute_driver.ex_list_reserved_ipv4(vlan=vlan)
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_private_ipv4_addresses_datacenter(compute_driver):
- datacenter_id = 'EU8'
- ip_addresses = compute_driver.ex_list_reserved_ipv4(datacenter_id=datacenter_id)
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_private_ipv4_addresses_all(compute_driver):
- ip_addresses = compute_driver.ex_list_reserved_ipv4()
- for ip_address in ip_addresses:
- print(ip_address)
\ No newline at end of file
[45/45] libcloud git commit: made pyopenssl optional Closes #1255
Posted by an...@apache.org.
made pyopenssl optional
Closes #1255
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/de159ec7
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/de159ec7
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/de159ec7
Branch: refs/heads/trunk
Commit: de159ec7b7693c321f12db8eca15656f387c18bc
Parents: efa8f97
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Dec 6 14:06:22 2018 -0500
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Dec 13 19:24:18 2018 +0800
----------------------------------------------------------------------
libcloud/loadbalancer/drivers/nttcis.py | 14 ++++++++++----
tox.ini | 4 +++-
2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/de159ec7/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 316f918..5d56e0c 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -12,7 +12,13 @@
# 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 OpenSSL.crypto
+try:
+ import OpenSSL
+ OpenSSL
+except ImportError:
+ raise ImportError('Missing "OpenSSL" dependency. You can install it '
+ 'using pip - pip install pyopenssl')
+from OpenSSL import crypto
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import NttCisPool
@@ -833,10 +839,10 @@ class NttCisLBDriver(Driver):
:type description: ``str``
:return: ``bool``
"""
- c = OpenSSL.crypto.load_certificate(
- OpenSSL.crypto.FILETYPE_PEM, open(chain_crt_file).read())
+ c = crypto.load_certificate(
+ crypto.FILETYPE_PEM, open(chain_crt_file).read())
cert = OpenSSL.crypto.dump_certificate(
- OpenSSL.crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
+ crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
cert_chain_elem = ET.Element("importSslCertificateChain",
{"xmlns": TYPES_URN})
ET.SubElement(cert_chain_elem, "networkDomainId") \
http://git-wip-us.apache.org/repos/asf/libcloud/blob/de159ec7/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 293ccf9..dbcad71 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,8 @@ envlist = py{2.7,pypy,pypy3,3.4,3.5,3.6,3.7},checks,lint,pylint,integration,cove
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
-r{toxinidir}/requirements-tests.txt
- lockfile
pyopenssl
+ lockfile
libvirt-python==4.0.0
py2.7: paramiko
commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
@@ -30,6 +30,7 @@ commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
[testenv:docs]
deps = pysphere
+ pyopenssl
backports.ssl_match_hostname
lockfile
rstcheck
@@ -45,6 +46,7 @@ commands = pip install sphinx~=1.6.0
# Note: We don't build API docs on Travis since it causes build failures because
# those API docs files are not included anywhere.
deps = pysphere
+ pyopenssl
backports.ssl_match_hostname
lockfile
rstcheck
[24/45] libcloud git commit: Merge branch 'trunk' of
https://git-wip-us.apache.org/repos/asf/libcloud into feature_drs
Posted by an...@apache.org.
Merge branch 'trunk' of https://git-wip-us.apache.org/repos/asf/libcloud into feature_drs
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/805a2726
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/805a2726
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/805a2726
Branch: refs/heads/trunk
Commit: 805a27262417e5a23597864c808c90c12fcc5306
Parents: bc4482a 3d40806
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 13 11:31:32 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 13 11:31:32 2018 -0500
----------------------------------------------------------------------
CHANGES.rst | 15 +++++++++++++++
doap_libcloud.rdf | 14 ++++++++++++++
docs/committer_guide.rst | 2 +-
docs/conf.py | 4 ++--
libcloud/__init__.py | 2 +-
libcloud/backup/providers.py | 2 --
libcloud/backup/types.py | 1 -
libcloud/common/openstack_identity.py | 2 +-
libcloud/compute/drivers/ec2.py | 14 +++++++++++---
libcloud/test/common/test_openstack_identity.py | 13 +++++++++++++
.../fixtures/openstack_identity/v3/v3_users_b.json | 17 +++++++++++++++++
libcloud/test/compute/test_ec2.py | 16 ++++++++++++++++
tox.ini | 6 ++++++
13 files changed, 97 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[14/45] libcloud git commit: added fixtures for drs ineligible error
and listing cg's and completed tests
Posted by an...@apache.org.
added fixtures for drs ineligible error and listing cg's and completed tests
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0346c30f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0346c30f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0346c30f
Branch: refs/heads/trunk
Commit: 0346c30f26764f7cb63b71e6c321eed7c0b22f22
Parents: c32aa10
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Nov 1 11:37:12 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Nov 1 11:37:12 2018 -0400
----------------------------------------------------------------------
libcloud/test/compute/test_nttcis.py | 2 +-
.../fixtures/nttcis/list_consistency_groups.xml | 25 ++++++++++++++
libcloud/test/drs/test_nttcis.py | 35 ++++++++++++++++----
3 files changed, 55 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/0346c30f/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index b223ea6..61a4756 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -798,7 +798,7 @@ def test_ex_list_network_domains_ALLFILTERS(driver):
def test_ex_list_vlans(driver):
vlans = driver.ex_list_vlans()
- assert vlans[0].name == "Primary"
+ assert vlans[0].name == "Primary"
def test_ex_list_vlans_ALLFILTERS(driver):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/0346c30f/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml b/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
new file mode 100644
index 0000000..8b1a936
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5">
+ <name>sdk_test2_cg</name>
+ <description>A test consistency group</description>
+ <journal sizeGb="100" extentCount="1"/>
+ <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
+ <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
+ </source>
+ <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
+ <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
+ </target>
+ <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
+ <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
+ <name>src-sdk-test</name>
+ </sourceServer>
+ <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
+ <name>tgt-sdk-test</name></targetServer></serverPair>
+ <createTime>2018-10-31T16:02:05.000Z</createTime>
+ <operationStatus>DRS_MODE</operationStatus>
+ <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T14:20:01.000Z"/>
+ <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
+ <state>NORMAL</state>
+ </consistencyGroup>
+</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/0346c30f/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index a90f9e2..c460c74 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -27,13 +27,20 @@ def driver():
def test_ineligible_server(driver):
- exception_msg = driver.create_consistency_group(
- "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4",
- "aee58575-38e2-495f-89d3-854e6a886411",
- description="A test consistency group")
+ NttCisMockHttp.type = 'INPROGRESS'
+ with pytest.raises(NttCisAPIException) as excinfo:
+ driver.create_consistency_group(
+ "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4",
+ "aee58575-38e2-495f-89d3-854e6a886411",
+ description="A test consistency group")
+ assert excinfo.value.msg == 'The drsEligible flag for target Server ' \
+ 'aee58575-38e2-495f-89d3-854e6a886411 must be set.'
- assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.'
+def test_list_consistency_groups(driver):
+ cgs = driver.list_consistency_groups()
+ assert isinstance(cgs, list)
+ assert hasattr(cgs[0], 'serverPair')
class NttCisMockHttp(MockHttp):
@@ -44,8 +51,24 @@ 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_consistencyGroup_createConsistencyGroup(self, method, url, body, headers):
+ 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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_INPROGRESS(self,
+ method,
+ url,
+ body,
+ headers):
body = self.fixtures.load(
'drs_ineligible.xml'
)
+ return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("list_consistency_groups.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
[37/45] libcloud git commit: Merge branch 'trunk' of
https://git-wip-us.apache.org/repos/asf/libcloud into feature_ssl_offload
Posted by an...@apache.org.
Merge branch 'trunk' of https://git-wip-us.apache.org/repos/asf/libcloud into feature_ssl_offload
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/321a9f24
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/321a9f24
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/321a9f24
Branch: refs/heads/trunk
Commit: 321a9f2492ad18c440d9431ba106cd5a187e1444
Parents: e23061f 080b343
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 27 10:30:15 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 27 10:30:15 2018 -0500
----------------------------------------------------------------------
CHANGES.rst | 15 +++++++
docs/_static/images/provider_logos/upcloud.png | Bin 20107 -> 10801 bytes
docs/compute/drivers/upcloud.rst | 14 ++++---
docs/container/utilities.rst | 3 ++
libcloud/compute/drivers/openstack.py | 4 ++
libcloud/container/utils/docker.py | 9 ++--
.../fixtures/openstack_v1.1/_os_snapshot.json | 11 +++++
.../openstack_v1.1/_os_snapshot_rackspace.json | 11 +++++
libcloud/test/compute/test_openstack.py | 41 +++++++++++++------
9 files changed, 87 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
[13/45] libcloud git commit: added directories and started files for
drs/test suite
Posted by an...@apache.org.
added directories and started files for drs/test suite
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c32aa104
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c32aa104
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c32aa104
Branch: refs/heads/trunk
Commit: c32aa10447c375a287f79aab2ba922cacf23bd25
Parents: f8c0da6
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Oct 31 17:14:03 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Oct 31 17:14:03 2018 -0400
----------------------------------------------------------------------
libcloud/test/drs/__init__.py | 0
.../test/drs/fixtures/nttcis/drs_ineligible.xml | 6 +++
.../drs/fixtures/nttcis/oec_0_9_myaccount.xml | 26 ++++++++++
libcloud/test/drs/test_nttcis.py | 51 ++++++++++++++++++++
libcloud/test/drs_ineligible.xml | 6 ---
libcloud/test/file_fixtures.py | 7 +++
tests/lib_create_test.py | 2 +-
tests/lib_list_test.py | 4 +-
8 files changed, 92 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/__init__.py b/libcloud/test/drs/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
new file mode 100644
index 0000000..a0ff44c
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
+ <operation>CREATE_CONSISTENCY_GROUP</operation>
+ <responseCode>INCOMPATIBLE_OPERATION</responseCode>
+ <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
new file mode 100644
index 0000000..4f3b132
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns3:Account xmlns="http://oec.api.opsource.net/schemas/server" xmlns:ns9="http://oec.api.opsource.net/schemas/reset" xmlns:ns5="http://oec.api.opsource.net/schemas/vip" xmlns:ns12="http://oec.api.opsource.net/schemas/general" xmlns:ns6="http://oec.api.opsource.net/schemas/imageimportexport" xmlns:ns13="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns10="http://oec.api.opsource.net/schemas/ipplan" xmlns:ns8="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns11="http://oec.api.opsource.net/schemas/storage" xmlns:ns2="http://oec.api.opsource.net/schemas/organization" xmlns:ns4="http://oec.api.opsource.net/schemas/network" xmlns:ns3="http://oec.api.opsource.net/schemas/directory">
+ <ns3:userName>testuser</ns3:userName>
+ <ns3:fullName>Test User</ns3:fullName>
+ <ns3:firstName>Test</ns3:firstName>
+ <ns3:lastName>User</ns3:lastName>
+ <ns3:emailAddress>test@example.com</ns3:emailAddress>
+ <ns3:orgId>8a8f6abc-2745-4d8a-9cbc-8dabe5a7d0e4</ns3:orgId>
+ <ns3:roles>
+ <ns3:role>
+ <ns3:name>create image</ns3:name>
+ </ns3:role>
+ <ns3:role>
+ <ns3:name>reports</ns3:name>
+ </ns3:role>
+ <ns3:role>
+ <ns3:name>server</ns3:name>
+ </ns3:role>
+ <ns3:role>
+ <ns3:name>primary administrator</ns3:name>
+ </ns3:role>
+ <ns3:role>
+ <ns3:name>network</ns3:name>
+ </ns3:role>
+ </ns3:roles>
+</ns3:Account>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
new file mode 100644
index 0000000..a90f9e2
--- /dev/null
+++ b/libcloud/test/drs/test_nttcis.py
@@ -0,0 +1,51 @@
+import pytest
+
+
+import sys
+from types import GeneratorType
+from libcloud.utils.py3 import httplib
+from libcloud.utils.py3 import ET
+from libcloud.common.types import InvalidCredsError
+from libcloud.common.nttcis import NttCisAPIException, NetworkDomainServicePlan
+from libcloud.common.nttcis import TYPES_URN
+from libcloud.drs.drivers.nttcis import NttCisDRSDriver as NttCis
+from libcloud.compute.drivers.nttcis import NttCisNic
+from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
+from libcloud.test import MockHttp, unittest
+from libcloud.test.file_fixtures import DRSFileFixtures
+from libcloud.test.secrets import NTTCIS_PARAMS
+from libcloud.utils.xml import fixxpath, findtext, findall
+
+
+@pytest.fixture()
+def driver():
+ NttCis.connectionCls.active_api_version = "2.7"
+ NttCis.connectionCls.conn_class = NttCisMockHttp
+ NttCisMockHttp.type = None
+ driver = NttCis(*NTTCIS_PARAMS)
+ return driver
+
+
+def test_ineligible_server(driver):
+ exception_msg = driver.create_consistency_group(
+ "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4",
+ "aee58575-38e2-495f-89d3-854e6a886411",
+ description="A test consistency group")
+
+
+ assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.'
+
+
+class NttCisMockHttp(MockHttp):
+
+ fixtures = DRSFileFixtures('nttcis')
+
+ 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 _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup(self, method, url, body, headers):
+ body = self.fixtures.load(
+ 'drs_ineligible.xml'
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs_ineligible.xml b/libcloud/test/drs_ineligible.xml
deleted file mode 100644
index a0ff44c..0000000
--- a/libcloud/test/drs_ineligible.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
- <operation>CREATE_CONSISTENCY_GROUP</operation>
- <responseCode>INCOMPATIBLE_OPERATION</responseCode>
- <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/file_fixtures.py
----------------------------------------------------------------------
diff --git a/libcloud/test/file_fixtures.py b/libcloud/test/file_fixtures.py
index 3d9bd32..185b3de 100644
--- a/libcloud/test/file_fixtures.py
+++ b/libcloud/test/file_fixtures.py
@@ -28,6 +28,7 @@ FIXTURES_ROOT = {
'storage': 'storage/fixtures',
'loadbalancer': 'loadbalancer/fixtures',
'dns': 'dns/fixtures',
+ 'drs': 'drs/fixtures',
'backup': 'backup/fixtures',
'openstack': 'compute/fixtures/openstack',
'container': 'container/fixtures'
@@ -80,6 +81,12 @@ class DNSFileFixtures(FileFixtures):
sub_dir=sub_dir)
+class DRSFileFixtures(FileFixtures):
+ def __init__(self, sub_dir=''):
+ super(DRSFileFixtures, self).__init__(fixtures_type='drs',
+ sub_dir=sub_dir)
+
+
class OpenStackFixtures(FileFixtures):
def __init__(self, sub_dir=''):
super(OpenStackFixtures, self).__init__(fixtures_type='openstack',
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index aa0c7d0..9dc28ff 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -252,7 +252,7 @@ def test_fail_create_drs(na_compute_driver, drsdriver):
assert exception_msg == 'DRS is not supported between source Data Center NA9 and target Data Center NA12.'
-def test_inelligble_drs(na_compute_driver, drsdriver):
+def test_ineligble_drs(na_compute_driver, drsdriver):
nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
src_id = nodes[0].id
nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index ac26e44..5b519d7 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -394,6 +394,4 @@ def test_list_health_monitors(compute_driver, lbdriver):
def test_list_consistency_groups(drsdriver):
cgs = drsdriver.list_consistency_groups()
- for cg in cgs:
- print(vars(cg))
- print()
\ No newline at end of file
+ return cgs
\ No newline at end of file
[07/45] libcloud git commit: removed dd prefix from region on tests
files
Posted by an...@apache.org.
removed dd prefix from region on tests files
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a88fb2fc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a88fb2fc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a88fb2fc
Branch: refs/heads/trunk
Commit: a88fb2fc13487b11949e6cf58a20073bb0d7eec6
Parents: 14a69ee
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 22:19:28 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 22:19:28 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 5 +++--
libcloud/compute/drivers/nttcis.py | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a88fb2fc/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index fd1976d..019aead 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -15,7 +15,8 @@
"""
NTTCIS Common Components
"""
-
+from copy import deepcopy
+from collections.abc import MutableSequence, Mapping
from base64 import b64encode
from time import sleep
from lxml import etree
@@ -1926,7 +1927,7 @@ class NttCisNic(object):
return ('<NttCisNic: private_ip_v4=%s, vlan=%s,'
'network_adapter_name=%s>'
% (self.private_ip_v4, self.vlan, self.network_adapter_name))
-<<<<<<< HEAD
+
##### Testing new concept below this line
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a88fb2fc/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 3a615f8..c1266d9 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -53,6 +53,7 @@ from libcloud.common.nttcis import NttCisTag
from libcloud.common.nttcis import API_ENDPOINTS, DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
from libcloud.common.nttcis import NETWORK_NS, GENERAL_NS
+from libcloud.common.nttcis import process_xml
from libcloud.utils.py3 import urlencode, ensure_string
from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.utils.py3 import basestring
@@ -5122,6 +5123,8 @@ class NttCisNodeDriver(NodeDriver):
return [self._to_node(el) for el in node_elements]
def _to_node(self, element):
+ return process_xml(element)
+ """
started = findtext(element, 'started', TYPES_URN)
status = self._to_status(element.find(fixxpath('progress', TYPES_URN)))
dd_state = findtext(element, 'state', TYPES_URN)
@@ -5227,7 +5230,7 @@ class NttCisNodeDriver(NodeDriver):
driver=self.connection.driver,
extra=extra)
return n
-
+ """
def _to_status(self, element):
if element is None:
return NttCisStatus()
[40/45] libcloud git commit: removed drs from provider feature matrix
Posted by an...@apache.org.
removed drs from provider feature matrix
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2b445cea
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2b445cea
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2b445cea
Branch: refs/heads/trunk
Commit: 2b445ceac7586d09507735435c6fccc938459b19
Parents: bbe90e5
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 28 22:17:31 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 28 22:17:31 2018 -0500
----------------------------------------------------------------------
.../generate_provider_feature_matrix_table.py | 21 -----
libcloud/base.py | 7 --
libcloud/compute/drivers/nttcis.py | 36 +++++----
.../fixtures/nttcis/create_preview_server.xml | 7 ++
.../nttcis/disable_server_snapshot_service.xml | 6 ++
.../nttcis/initiate_manual_snapshot.xml | 2 +-
.../fixtures/nttcis/list_server_snapshots.xml | 27 +++++++
.../fixtures/nttcis/manual_snapshot_server.xml | 26 +++++++
libcloud/test/compute/test_nttcis.py | 80 +++++++++++++++++++-
9 files changed, 166 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/contrib/generate_provider_feature_matrix_table.py
----------------------------------------------------------------------
diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index 419baee..4e6441f 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -45,11 +45,6 @@ from libcloud.dns.providers import get_driver as get_dns_driver
from libcloud.dns.providers import DRIVERS as DNS_DRIVERS
from libcloud.dns.types import Provider as DNSProvider
-from libcloud.drs.base import DRSDriver
-from libcloud.drs.providers import get_driver as get_drs_driver
-from libcloud.drs.providers import DRIVERS as DRS_DRIVERS
-from libcloud.drs.types import Provider as DRSProvider
-
from libcloud.container.base import ContainerDriver
from libcloud.container.providers import get_driver as get_container_driver
from libcloud.container.providers import DRIVERS as CONTAINER_DRIVERS
@@ -94,11 +89,6 @@ BASE_API_METHODS = {
'dns': ['list_zones', 'list_records', 'iterate_zones', 'iterate_records',
'create_zone', 'update_zone', 'create_record', 'update_record',
'delete_zone', 'delete_record'],
- 'drs': ['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'],
'container': ['install_image', 'list_images', 'deploy_container',
'get_container', 'start_container', 'stop_container',
'restart_container', 'destroy_container', 'list_containers',
@@ -179,17 +169,6 @@ FRIENDLY_METHODS_NAMES = {
'delete_zone': 'delete zone',
'delete_record': 'delete record'
},
- 'drs': {
- 'create_consistency_group': 'create_consistency_group',
- 'list_consistency_groups': 'list_consistency_groups',
- 'get_consistency_group': 'get_consistency_group',
- 'delete_consistency_group': 'delete_consistency_group',
- 'list_consistency_group_snapshots': 'list_consistency_group_snapshots',
- 'expand_journal': 'expand_journal',
- 'start_failover_preview': 'start_failover_preview',
- 'stop_failover_preview': 'stop_failover_preview',
- 'initiate_failover': 'initiate_failover'
- },
'container': {
'install_image': 'install image',
'list_images': 'list images',
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/base.py
----------------------------------------------------------------------
diff --git a/libcloud/base.py b/libcloud/base.py
index dead087..94e9f17 100644
--- a/libcloud/base.py
+++ b/libcloud/base.py
@@ -25,9 +25,6 @@ from libcloud.container.providers import get_driver as get_container_driver
from libcloud.dns.providers import Provider as DnsProvider
from libcloud.dns.providers import get_driver as get_dns_driver
-from libcloud.drs.providers import Provider as DrsProvider
-from libcloud.drs.providers import get_driver as get_drs_driver
-
from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider
from libcloud.loadbalancer.providers import get_driver as \
get_loadbalancer_driver
@@ -49,9 +46,6 @@ class DriverType(object):
""" DNS service provider driver """
DNS = DnsProvider
- """ DRS service provider driver """
- DRS = DrsProvider
-
""" Load balancer provider-driver """
LOADBALANCER = LoadBalancerProvider
@@ -64,7 +58,6 @@ DriverTypeFactoryMap = {
DriverType.COMPUTE: get_compute_driver,
DriverType.CONTAINER: get_container_driver,
DriverType.DNS: get_dns_driver,
- DriverType.DRS: get_drs_driver,
DriverType.LOADBALANCER: get_loadbalancer_driver,
DriverType.STORAGE: get_storage_driver
}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 8f7deef..8980051 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -1319,18 +1319,23 @@ class NttCisNodeDriver(NodeDriver):
response_code = findtext(result, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
- def list_snapshots(self, node):
+ def list_snapshots(self, node, page_size=None):
"""
- List snapshots of a server
+ List snapshots of a server. The list of snapshots can get large.
+ Therefore, page_size is optional to limit this if desired.
- :param node: Node nameof the node on which to enable snapshots.
- :type node: ``str``
-
- :rtype: ``list``
+ :param node: Node nameof the node on which to enable snapshots.
+ :type node: ``str``
+ :param page_size: (Optional) Limit the number of records returned
+ :return snapshots
+ :rtype: ``list`` of `dictionaries`
"""
params = {}
params['serverId'] = self.list_nodes(ex_name=node)[0].id
+ if page_size is not None:
+ params["pageSize"] = page_size
+
return self._to_snapshots(self.connection.request_with_orgId_api_2(
'snapshot/snapshot',
params=params).object)
@@ -1339,9 +1344,9 @@ class NttCisNodeDriver(NodeDriver):
"""
Get snapshot of a server by snapshot id.
- :param snapshot_id: ID of snapshot to retrieve.
- :type snapshot_id: ``str``
-
+ :param snapshot_id: ID of snapshot to retrieve.
+ :type snapshot_id: ``str``
+ :return a snapshot
:rtype: ``dict``
"""
@@ -1352,10 +1357,10 @@ class NttCisNodeDriver(NodeDriver):
"""
Disable snapshots on a server. This also deletes current snapshots.
- :param node: Node ID of the node on which to enable snapshots.
- :type node: ``str``
-
- :rtype: ``list``
+ :param node: Node ID of the node on which to enable snapshots.
+ :type node: ``str``
+ :return True or False
+ :rtype: ``bool``
"""
update_node = ET.Element('disableSnapshotService',
@@ -1481,9 +1486,8 @@ class NttCisNodeDriver(NodeDriver):
'snapshot/createSnapshotPreviewServer',
method='POST',
data=ET.tostring(create_preview)).object
- for info in findall(result, 'info', TYPES_URN):
- if info.get('name') == 'serverId':
- return info.get('value')
+ response_code = findtext(result, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
def ex_migrate_preview_server(self, preview_id):
migrate_preview = ET.Element('migrateSnapshotPreviewServer',
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
index e69de29..6715c64 100644
--- a/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
+++ b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181128T230815109+0100_29483e8f-e94d-4472-8c92-723b9068828d">
+ <operation>CREATE_SNAPSHOT_PREVIEW_SERVER</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Create Snapshot Preview Server has been accepted. Please use appropriate Get or List API for status.</message>
+ <info name="serverId" value="17bff533-1959-4d16-b0bc-cea6f4cd1bb6"/>
+</response>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
index e69de29..32f3eb8 100644
--- a/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
+++ b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181129T033624848+0100_8c78e514-872a-4bb9-bfb9-b02fb33a7713">
+ <operation>DISABLE_SNAPSHOT_SERVICE</operation>
+ <responseCode>OK</responseCode>
+ <message>Snapshot Service has been disabled.</message>
+</response>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
index 988342b..7c461ed 100644
--- a/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
+++ b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
@@ -4,4 +4,4 @@
<responseCode>IN_PROGRESS</responseCode>
<message>Request to Initiate Manual Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
<info name="manualSnapshotId" value="dd9a9e7e-2de7-4543-adef-bb1fda7ac030"/>
-</response>
\ No newline at end of file
+</response>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
index e69de29..0096857 100644
--- a/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
+++ b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<snapshots xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="43" pageSize="1">
+ <snapshot id="d11940a8-1455-43bf-a2de-b51a38c2aa94">
+ <startTime>2018-08-15T12:00:47.000Z</startTime>
+ <expiryTime>2019-08-15T12:00:47.000Z</expiryTime>
+ <type>SYSTEM</type>
+ <consistencyLevel>CRASH_CONSISTENT</consistencyLevel>
+ <indexState>INDEX_VALID</indexState>
+ <serverConfig>
+ <cluster id="EU6-01" name="Default Cluster"/>
+ <cpu count="2" speed="STANDARD" coresPerSocket="1"/>
+ <memoryGb>4</memoryGb>
+ <scsiController busNumber="0" id="3e27b3ff-f34c-4b50-abac-c4dbf17c46d3" adapterType="LSI_LOGIC_PARALLEL" state="NORMAL">
+ <disk scsiId="0" id="0bb10086-9691-4cd7-9ae3-914c79890250" sizeGb="20" speed="STANDARD" driveType="DISK" state="NORMAL"/>
+ </scsiController>
+ <networkInfo networkDomainId="6aafcf08-cb0b-432c-9c64-7371265db086" networkDomainName="sdk_test_1">
+ <primaryNic id="29ccc441-9972-41df-b918-b9c93a1b46e9" privateIpv4="10.1.1.6" ipv6="2a00:47c0:111:1331:6140:e432:729b:eef6" vlanId="eb05a24e-85a6-46e3-a7c9-f1765737476d" vlanName="sdk_vlan1" networkAdapter="VMXNET3" connected="true" key="4000" state="NORMAL"/>
+ </networkInfo>
+ <guest osCustomization="true">
+ <operatingSystem id="UBUNTU1664" displayName="UBUNTU16/64" family="UNIX"/>
+ </guest>
+ <virtualHardwareVersion>vmx-10</virtualHardwareVersion>
+ </serverConfig>
+ <state>NORMAL</state>
+ <createTime>2018-08-15T12:30:50.000Z</createTime>
+ </snapshot>
+</snapshots>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
index e69de29..0f3e7e5 100644
--- a/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
+++ b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="urn:didata.com:api:cloud:types" id="e1eb7d71-93c9-4b9c-807c-e05932dc8143" datacenterId="EU6">
+ <name>test</name>
+ <description>auto_created_server</description>
+ <cpu count="2" speed="STANDARD" coresPerSocket="1"/>
+ <memoryGb>4</memoryGb>
+ <scsiController state="NORMAL" id="f6a0a9b4-8e8e-4db4-84a3-6aed43f2a6ee" adapterType="LSI_LOGIC_PARALLEL" key="1000" busNumber="0">
+ <disk state="NORMAL" id="b96f35f3-ad63-489a-9e0e-a675cd1d1143" sizeGb="20" speed="STANDARD" scsiId="0"/>
+ </scsiController>
+ <networkInfo networkDomainId="6aafcf08-cb0b-432c-9c64-7371265db086">
+ <primaryNic id="8f2c0823-94f9-4ac7-a59d-d0ed292da7b0" privateIpv4="10.1.1.10" ipv6="2a00:47c0:111:1331:524d:5ca0:b59c:4220" vlanId="eb05a24e-85a6-46e3-a7c9-f1765737476d" vlanName="sdk_vlan1" networkAdapter="VMXNET3" connected="true" macAddress="00:50:56:bb:9b:d5" key="4000" state="NORMAL"/>
+ </networkInfo>
+ <snapshotService servicePlan="ADVANCED" state="NORMAL" manualSnapshotInProgress="false">
+ <window dayOfWeek="DAILY" startHour="12"/>
+ </snapshotService>
+ <source type="IMAGE_ID" value="81a36aa0-555c-4735-b965-4b64fcf0ac8f"/>
+ <createTime>2018-11-15T19:23:36.000Z</createTime>
+ <deployed>true</deployed>
+ <started>true</started>
+ <state>NORMAL</state>
+ <guest osCustomization="true">
+ <operatingSystem id="UBUNTU1664" displayName="UBUNTU16/64" family="UNIX" osUnitsGroupId="CANONICAL"/>
+ <vmTools type="OPEN_VM_TOOLS" versionStatus="UNMANAGED" runningStatus="RUNNING" apiVersion="10304"/>
+ </guest>
+ <virtualHardware version="vmx-10" upToDate="false"/>
+</server>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index 7f894bd..7f73473 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -186,6 +186,42 @@ def test_list_datacenter_snapshot_windows(driver):
assert isinstance(ret[0], dict)
+def test_list_snapshots(driver):
+ NttCisMockHttp.type = None
+ snapshots = driver.list_snapshots('sdk_server_1', page_size=1)
+ assert len(snapshots) == 1
+ assert snapshots[0]['id'] == "d11940a8-1455-43bf-a2de-b51a38c2aa94"
+
+
+def test_enable_snapshot_service(driver):
+ NttCisMockHttp.type = None
+ window_id = 'ea646520-4272-11e8-838c-180373fb68df'
+ node = 'e1eb7d71-93c9-4b9c-807c-e05932dc8143'
+ result = driver.ex_enable_snapshots(node, window_id)
+ assert result is True
+
+
+def test_initiate_manual_snapshot(driver):
+ NttCisMockHttp.type = None
+ result = driver.ex_initiate_manual_snapshot('test', 'e1eb7d71-93c9-4b9c-807c-e05932dc8143')
+ assert result is True
+
+
+def test_create_snapshot_preview_server(driver):
+ snapshot_id = "dd9a9e7e-2de7-4543-adef-bb1fda7ac030"
+ server_name = "test_snapshot"
+ start = "true"
+ nic_connected = "true"
+ result = driver.ex_create_snapshot_preview_server(
+ snapshot_id, server_name, start, nic_connected)
+ assert result is True
+
+
+def test_disable_node_snapshot(driver):
+ node = "e1eb7d71-93c9-4b9c-807c-e05932dc8143"
+ assert driver.ex_disable_snapshots(node) is True
+
+
def test_reboot_node_response(driver):
node = Node(id='11', name=None, state=None,
public_ips=None, private_ips=None, driver=driver)
@@ -3029,4 +3065,46 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load(
'deploy_customised_server.xml'
)
- return httplib.OK, body, {}, httplib.responses[httplib.OK]
\ No newline at end of file
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_snapshot(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "list_server_snapshots.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_enableSnapshotService(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "enable_snapshot_service.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_initiateManualSnapshot(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "initiate_manual_snapshot.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e1eb7d71_93c9_4b9c_807c_e05932dc8143(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "manual_snapshot_server.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_createSnapshotPreviewServer(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "create_preview_server.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_disableSnapshotService(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ "disable_server_snapshot_service.xml"
+ )
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
[30/45] libcloud git commit: finished tests and tox
Posted by an...@apache.org.
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 =
[41/45] libcloud git commit: removed referenece to DRSDriver in
feature_matrix
Posted by an...@apache.org.
removed referenece to DRSDriver in feature_matrix
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b0eee74f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b0eee74f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b0eee74f
Branch: refs/heads/trunk
Commit: b0eee74f8852af3cb93b3fb7e1b4830e925dcdd8
Parents: 2b445ce
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 28 22:44:00 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 28 22:44:00 2018 -0500
----------------------------------------------------------------------
contrib/generate_provider_feature_matrix_table.py | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b0eee74f/contrib/generate_provider_feature_matrix_table.py
----------------------------------------------------------------------
diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index 4e6441f..f492001 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -242,11 +242,6 @@ def generate_providers_table(api):
drivers = DNS_DRIVERS
provider = DNSProvider
get_driver_method = get_dns_driver
- elif api == 'drs':
- driver = DRSDriver
- drivers = DRS_DRIVERS
- provider = DRSProvider
- get_driver_method = get_drs_driver
elif api == 'container':
driver = ContainerDriver
drivers = CONTAINER_DRIVERS
[06/45] libcloud git commit: merged with drs
Posted by an...@apache.org.
merged with drs
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/14a69ee4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/14a69ee4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/14a69ee4
Branch: refs/heads/trunk
Commit: 14a69ee45c9141329922ef193480eba99ce4adc1
Parents: 067e93e 62d9eb6
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 22:04:46 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 22:04:46 2018 -0400
----------------------------------------------------------------------
.gitignore | 2 +
.pylintrc | 1 +
.travis.yml | 24 +-
CHANGES.rst | 78 +-
README.rst | 13 +-
contrib/scrap-ec2-sizes.py | 281 +
contrib/trigger_rtd_build.py | 9 +-
dist/hash-sign.sh | 147 -
dist/hash.py | 12 +
dist/release.sh | 3 +-
dist/sign.sh | 69 +
.../images/misc/azure_blobs_account_kind.png | Bin 0 -> 292732 bytes
.../misc/azure_blobs_manage_access_keys_1.png | Bin 64259 -> 223140 bytes
.../misc/azure_blobs_manage_access_keys_2.png | Bin 26247 -> 388303 bytes
docs/_static/images/provider_logos/ntt.png | Bin 0 -> 23017 bytes
docs/_static/images/provider_logos/scaleway.png | Bin 0 -> 11527 bytes
docs/committer_guide.rst | 10 +-
docs/compute/_supported_providers.rst | 3 +-
docs/compute/drivers/nttcis.rst | 89 +
docs/compute/drivers/openstack.rst | 10 +-
docs/compute/drivers/scaleway.rst | 30 +
docs/conf.py | 4 +-
.../Firewall_Create_Complex_Firewall_Rule.py | 77 +
.../nttcis/Firewall_Create_Simple_Rule.py | 28 +
.../nttcis/Nodes_Create_mcp2_Customized.py | 27 +
.../nttcis/Nodes_Create_mcp2_Uncustomised.py | 57 +
docs/examples/compute/nttcis/__init__.py | 0
docs/examples/compute/scaleway/create_node.py | 16 +
docs/examples/compute/scaleway/list_nodes.py | 9 +
docs/examples/compute/scaleway/list_volumes.py | 12 +
.../nttcis/LoadBalancer_create_members.py | 38 +
.../nttcis/Load_balancer_add_pool_mon.py | 42 +
docs/examples/loadbalancer/nttcis/__init__.py | 0
docs/loadbalancer/drivers/nttcis.rst | 65 +
docs/other/changes_in_2_0.rst | 2 +-
docs/storage/drivers/azure_blobs.rst | 12 +-
libcloud/backup/drivers/nttcis.py | 689 ---
libcloud/base.py | 7 +
libcloud/common/dimensiondata.py | 2 +-
libcloud/common/nttcis.py | 145 +-
libcloud/common/openstack.py | 2 +
libcloud/common/openstack_identity.py | 14 +
libcloud/compute/constants.py | 5431 ++++++++++++++++++
libcloud/compute/drivers/azure.py | 9 +-
libcloud/compute/drivers/digitalocean.py | 16 +
libcloud/compute/drivers/dimensiondata.py | 14 +-
libcloud/compute/drivers/ec2.py | 2124 +------
libcloud/compute/drivers/gce.py | 15 +-
libcloud/compute/drivers/nttcis.py | 657 ++-
libcloud/compute/drivers/openstack.py | 348 +-
libcloud/compute/drivers/scaleway.py | 663 +++
libcloud/compute/providers.py | 2 +
libcloud/compute/types.py | 1 +
libcloud/drs/__init__.py | 19 +
libcloud/drs/base.py | 160 +-
libcloud/drs/drivers/__init__.py | 18 +
libcloud/drs/drivers/nttcis.py | 42 +-
libcloud/drs/providers.py | 9 +-
libcloud/drs/types.py | 43 +
libcloud/http.py | 1 -
libcloud/loadbalancer/base.py | 19 +-
libcloud/loadbalancer/drivers/__init__.py | 3 +-
libcloud/loadbalancer/drivers/nttcis.py | 86 +-
libcloud/storage/drivers/azure_blobs.py | 29 +-
libcloud/storage/drivers/dummy.py | 2 -
libcloud/storage/drivers/s3.py | 18 +-
libcloud/storage/providers.py | 6 +-
libcloud/storage/types.py | 1 +
libcloud/test/__init__.py | 7 +-
libcloud/test/common/test_openstack_identity.py | 18 +-
.../fixtures/digitalocean_v2/list_node.json | 112 +
.../test/compute/fixtures/nttcis/audit_log.csv | 25 +
.../fixtures/nttcis/change_disk_size.xml | 6 +
.../fixtures/nttcis/change_disk_speed.xml | 6 +
.../change_nic_networkadapter_response.xml | 7 +
.../nttcis/datacenter_snapshotWindows.xml | 8 +
.../nttcis/deploy_customised_server.xml | 7 +
.../fixtures/nttcis/detailed_usage_report.csv | 42 +
.../nttcis/exchange_nic_vlans_response.xml | 8 +
.../fixtures/nttcis/image_customerImage.xml | 57 +
...age_2ffa36c8_1848_49eb_b4fa_9d908775f68c.xml | 19 +
...age_5234e5c7_01de_4411_8b6e_baeb8d91cf5d.xml | 19 +
.../compute/fixtures/nttcis/image_osImage.xml | 40 +
...age_6b4fb0c7_a57b_4f58_b59c_9958f94f971a.xml | 13 +
.../nttcis/image_osImage_BAD_REQUEST.xml | 6 +
...age_c14b1a46_2428_44c1_9c1a_b20e6418d08c.xml | 14 +
.../fixtures/nttcis/import_image_response.xml | 8 +
.../nttcis/infrastructure_datacenter.xml | 188 +
.../nttcis/infrastructure_datacenter_NA9.xml | 54 +
.../fixtures/nttcis/ip_address_list_create.xml | 9 +
.../fixtures/nttcis/ip_address_list_delete.xml | 10 +
.../fixtures/nttcis/ip_address_list_edit.xml | 10 +
.../fixtures/nttcis/ip_address_lists.xml | 46 +
.../nttcis/ip_address_lists_FILTERBYNAME.xml | 14 +
.../nttcis/network_addPublicIpBlock.xml | 7 +
.../nttcis/network_createFirewallRule.xml | 8 +
.../fixtures/nttcis/network_createNatRule.xml | 9 +
.../nttcis/network_deleteFirewallRule.xml | 8 +
.../fixtures/nttcis/network_deleteNatRule.xml | 8 +
.../nttcis/network_deleteNetworkDomain.xml | 8 +
.../fixtures/nttcis/network_deleteVlan.xml | 8 +
.../nttcis/network_deployNetworkDomain.xml | 8 +
.../fixtures/nttcis/network_deployVlan.xml | 9 +
.../nttcis/network_editFirewallRule.xml | 8 +
.../nttcis/network_editNetworkDomain.xml | 7 +
.../fixtures/nttcis/network_editVlan.xml | 7 +
.../fixtures/nttcis/network_expandVlan.xml | 8 +
.../fixtures/nttcis/network_firewallRule.xml | 35 +
...ule_d0a20f59_77b9_4f28_a63b_e58496b73a6c.xml | 18 +
.../compute/fixtures/nttcis/network_natRule.xml | 21 +
...ule_2187a636_7ebb_49a1_a2ff_5d617f496dce.xml | 9 +
.../fixtures/nttcis/network_networkDomain.xml | 43 +
...ain_8cdfd607_f429_4df6_9352_162cfc0891be.xml | 9 +
.../fixtures/nttcis/network_publicIpBlock.xml | 10 +
...ock_4487241a_f0ca_11e3_9315_d4bed9b167ba.xml | 8 +
...ock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8.xml | 8 +
.../nttcis/network_removePublicIpBlock.xml | 8 +
.../compute/fixtures/nttcis/network_vlan.xml | 25 +
...lan_0e56433f_d808_4669_821d_812769517ff8.xml | 14 +
.../fixtures/nttcis/oec_0_9_myaccount.xml | 26 +
.../fixtures/nttcis/port_list_create.xml | 9 +
.../fixtures/nttcis/port_list_delete.xml | 10 +
.../compute/fixtures/nttcis/port_list_edit.xml | 8 +
.../compute/fixtures/nttcis/port_list_get.xml | 15 +
.../compute/fixtures/nttcis/port_list_lists.xml | 38 +
.../fixtures/nttcis/report_usageMonitoring.xml | 8 +
.../fixtures/nttcis/server_GetServer.xml | 42 +
.../compute/fixtures/nttcis/server_addDisk.xml | 9 +
.../compute/fixtures/nttcis/server_addNic.xml | 9 +
.../nttcis/server_antiAffinityRule_list.xml | 42 +
.../server_antiAffinityRule_list_PAGINATED.xml | 42 +
.../server_changeServerMonitoringPlan.xml | 8 +
.../fixtures/nttcis/server_cleanServer.xml | 9 +
.../fixtures/nttcis/server_clone_response.xml | 9 +
.../nttcis/server_createAntiAffinityRule.xml | 6 +
.../server_createAntiAffinityRule_FAIL.xml | 8 +
.../nttcis/server_deleteAntiAffinityRule.xml | 7 +
.../server_deleteAntiAffinityRule_FAIL.xml | 8 +
.../fixtures/nttcis/server_deleteServer.xml | 9 +
.../nttcis/server_deleteServer_RESOURCEBUSY.xml | 8 +
.../fixtures/nttcis/server_deployServer.xml | 8 +
.../nttcis/server_disableServerMonitoring.xml | 8 +
.../nttcis/server_editServerMetadata.xml | 6 +
.../nttcis/server_enableServerMonitoring.xml | 8 +
.../fixtures/nttcis/server_powerOffServer.xml | 8 +
.../nttcis/server_powerOffServer_INPROGRESS.xml | 8 +
.../fixtures/nttcis/server_rebootServer.xml | 8 +
.../nttcis/server_rebootServer_RESOURCEBUSY.xml | 7 +
.../nttcis/server_reconfigureServer.xml | 5 +
.../fixtures/nttcis/server_removeDisk.xml | 6 +
.../fixtures/nttcis/server_removeNic.xml | 9 +
.../fixtures/nttcis/server_resetServer.xml | 8 +
.../compute/fixtures/nttcis/server_server.xml | 207 +
.../fixtures/nttcis/server_server_NA3.xml | 56 +
...ver_e75ead52_692f_4314_8725_c8a4f4d13a87.xml | 30 +
.../fixtures/nttcis/server_server_paginated.xml | 58 +
.../nttcis/server_server_paginated_empty.xml | 1 +
.../fixtures/nttcis/server_shutdownServer.xml | 8 +
.../nttcis/server_shutdownServer_INPROGRESS.xml | 8 +
.../fixtures/nttcis/server_startServer.xml | 8 +
.../nttcis/server_startServer_INPROGRESS.xml | 8 +
.../nttcis/server_updateVmwareTools.xml | 8 +
.../fixtures/nttcis/summary_usage_report.csv | 13 +
.../compute/fixtures/nttcis/tag_applyTags.xml | 6 +
.../nttcis/tag_applyTags_BADREQUEST.xml | 6 +
.../fixtures/nttcis/tag_createTagKey.xml | 7 +
.../nttcis/tag_createTagKey_BADREQUEST.xml | 6 +
.../fixtures/nttcis/tag_deleteTagKey.xml | 6 +
.../nttcis/tag_deleteTagKey_BADREQUEST.xml | 6 +
.../compute/fixtures/nttcis/tag_editTagKey.xml | 6 +
.../nttcis/tag_editTagKey_BADREQUEST.xml | 6 +
.../compute/fixtures/nttcis/tag_removeTag.xml | 6 +
.../nttcis/tag_removeTag_BADREQUEST.xml | 6 +
...Key_5ab77f5f_5aa9_426f_8459_4eab34e03d54.xml | 6 +
...f_5aa9_426f_8459_4eab34e03d54_BADREQUEST.xml | 6 +
.../compute/fixtures/nttcis/tag_tagKey_list.xml | 19 +
.../fixtures/nttcis/tag_tagKey_list_SINGLE.xml | 8 +
.../compute/fixtures/nttcis/tag_tag_list.xml | 36 +
.../compute/fixtures/openstack/_v2_0__auth.json | 22 +
.../fixtures/openstack_v1.1/_port_v2.json | 32 +
.../fixtures/openstack_v1.1/_ports_v2.json | 185 +
.../openstack_v1.1/_v2_0__networks.json | 64 +
.../openstack_v1.1/_v2_0__networks_POST.json | 33 +
.../fixtures/openstack_v1.1/_v2_0__subnets.json | 62 +
.../compute/fixtures/scaleway/create_image.json | 21 +
.../compute/fixtures/scaleway/create_node.json | 40 +
.../fixtures/scaleway/create_volume.json | 13 +
.../scaleway/create_volume_snapshot.json | 15 +
.../test/compute/fixtures/scaleway/error.json | 1 +
.../fixtures/scaleway/error_invalid_image.json | 1 +
.../compute/fixtures/scaleway/get_image.json | 21 +
.../fixtures/scaleway/list_availability.json | 13 +
.../compute/fixtures/scaleway/list_images.json | 42 +
.../compute/fixtures/scaleway/list_nodes.json | 74 +
.../fixtures/scaleway/list_nodes_empty.json | 3 +
.../compute/fixtures/scaleway/list_sizes.json | 76 +
.../scaleway/list_volume_snapshots.json | 30 +
.../compute/fixtures/scaleway/list_volumes.json | 26 +
.../fixtures/scaleway/list_volumes_empty.json | 3 +
.../compute/fixtures/scaleway/reboot_node.json | 9 +
.../compute/fixtures/scaleway/token_info.json | 14 +
.../compute/fixtures/scaleway/user_info.json | 15 +
libcloud/test/compute/test_digitalocean_v2.py | 12 +
libcloud/test/compute/test_ec2.py | 40 +-
libcloud/test/compute/test_nttcis.py | 2898 ++++++++++
libcloud/test/compute/test_openstack.py | 204 +-
libcloud/test/compute/test_scaleway.py | 334 ++
.../nttcis/networkDomainVip_addPoolMember.xml | 9 +
.../nttcis/networkDomainVip_createNode.xml | 8 +
.../nttcis/networkDomainVip_createPool.xml | 9 +
.../networkDomainVip_createVirtualListener.xml | 11 +
.../networkDomainVip_defaultHealthMonitor.xml | 35 +
.../nttcis/networkDomainVip_defaultIrule.xml | 47 +
...tworkDomainVip_defaultPersistenceProfile.xml | 47 +
.../nttcis/networkDomainVip_deleteNode.xml | 9 +
.../nttcis/networkDomainVip_deletePool.xml | 9 +
.../networkDomainVip_deleteVirtualListener.xml | 9 +
.../nttcis/networkDomainVip_editNode.xml | 8 +
.../nttcis/networkDomainVip_editPool.xml | 9 +
.../nttcis/networkDomainVip_editPoolMember.xml | 8 +
.../fixtures/nttcis/networkDomainVip_node.xml | 29 +
...ode_34de6ed6_46a4_4dae_a753_2f8d3840c6f9.xml | 13 +
.../fixtures/nttcis/networkDomainVip_pool.xml | 37 +
.../nttcis/networkDomainVip_poolMember.xml | 29 +
...ber_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0.xml | 13 +
...ool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7.xml | 17 +
.../networkDomainVip_removePoolMember.xml | 7 +
.../nttcis/networkDomainVip_virtualListener.xml | 51 +
...ner_6115469d_a8bb_445b_bb23_d23b5283f2b9.xml | 44 +
.../fixtures/nttcis/oec_0_9_myaccount.xml | 26 +
libcloud/test/loadbalancer/test_nttcis.py | 647 +++
libcloud/test/secrets.py-dist | 6 +-
libcloud/test/storage/test_azure_blobs.py | 4 +-
libcloud/test/storage/test_s3.py | 7 +-
libcloud/test/test_connection.py | 16 +
libcloud/test/test_utils.py | 8 +-
libcloud/utils/files.py | 4 +-
libcloud/utils/xml.py | 1 -
setup.cfg | 4 +
setup.py | 8 +-
tests/conftest.py | 21 -
tests/lib_create_test.py | 240 -
tests/lib_edit_test.py | 452 --
tests/lib_list_test.py | 390 --
tests/lib_misc_test.py | 10 -
tests/test_lib_list.py | 344 ++
tox.ini | 11 +-
247 files changed, 16170 insertions(+), 4579 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/14a69ee4/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --cc libcloud/common/nttcis.py
index aea3e41,aeb5fa1..fd1976d
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@@ -13,12 -13,11 +13,13 @@@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
- Dimension Data Common Components
+ NTTCIS Common Components
"""
+
from base64 import b64encode
from time import sleep
+from lxml import etree
+from io import BytesIO
# TODO: use disutils.version when Travis CI fixed the pylint issue with version
# from distutils.version import LooseVersion
from libcloud.utils.py3 import httplib
@@@ -1931,243 -1924,3 +1926,245 @@@ class NttCisNic(object)
return ('<NttCisNic: private_ip_v4=%s, vlan=%s,'
'network_adapter_name=%s>'
% (self.private_ip_v4, self.vlan, self.network_adapter_name))
++<<<<<<< HEAD
+
+
+##### Testing new concept below this line
+
+attrs = {}
+
+
+def processor(mapping, name=None):
+ mapping = mapping
+
+ map_copy = deepcopy(mapping)
+
+ def add_items(key, value, name=None):
+ if name in attrs:
+ print(attrs)
+ attrs[name].update({key: value})
+ elif name is not None:
+ attrs[name] = value
+
+ else:
+ attrs.update({key: value})
+ if key in map_copy:
+ del map_copy[key]
+ elif key in map_copy[name]:
+ del map_copy[name][key]
+ if len(map_copy[name]) == 0:
+ del map_copy[name]
+
+ def handle_map(map, name):
+ tmp = {}
+ types = [type(x) for x in map.values()]
+ if XmlListConfig not in types and XmlDictConfig not in types and dict not in types:
+ return map
+
+ elif XmlListConfig in types:
+ result = handle_seq(map, name)
+ return result
+ else:
+ for k, v in map.items():
+ if isinstance(v, str):
+ tmp.update({k: v})
+ if isinstance(v, dict):
+ cls = build_class(k.capitalize(), v)
+ tmp.update({k: cls})
+ elif isinstance(v, XmlDictConfig):
+ cls = build_class(k.capitalize(), v)
+ return (k, cls)
+ return tmp
+
+ def handle_seq(seq, name):
+ tmp = {}
+ tmp_list = []
+ if isinstance(seq, list):
+ tmp = []
+ for _ in seq:
+ cls = build_class(name.capitalize(), _)
+ tmp.append(cls)
+ return tmp
+ for k, v in seq.items():
+ if isinstance(v, Mapping):
+ result1 = handle_map(v, k)
+ elif isinstance(v, MutableSequence):
+ for _ in v:
+ if isinstance(_, Mapping):
+ types = [type(x) for x in _.values()]
+ if XmlDictConfig in types:
+ result = handle_map(_, k)
+ if isinstance(result, tuple):
+ tmp.update({result[0]: result[1]})
+ else:
+ tmp.update({k: result})
+ else:
+ tmp_list = [build_class(k.capitalize(), i) for i in v]
+ tmp[k] = tmp_list
+ print()
+ elif isinstance(v, str):
+ tmp.update({k: v})
+ return tmp
+
+ def build_class(key, value):
+ klass = class_factory(key.capitalize(), value)
+ return klass(value)
+
+ def process(mapping, name):
+ for k1, v1 in mapping.items():
+ if isinstance(v1, Mapping):
+ types = [type(v) for v in v1.values()]
+ if MutableSequence not in types and dict not in types:
+ result = handle_map(v1, k1)
+ cls = build_class(k1.capitalize(), result)
+ add_items(k1, cls)
+ elif XmlListConfig in types:
+ result = handle_seq(v1, k1)
+ cls = build_class(list(v1)[0], result)
+ add_items(k1, cls)
+ elif dict in types:
+ result = handle_map(v1, k1)
+ cls = build_class(k1.capitalize(), result)
+ add_items(k1, cls, k1)
+ elif isinstance(v1, list):
+ tmp = {}
+ tmp1 = {}
+ tmp2 = {}
+ tmp2[k1] = []
+ for i, j in enumerate(v1):
+ if isinstance(j, dict):
+ key = list(j)[0]
+ result = handle_map(j, key)
+ tmp1[k1 + str(i)] = build_class(k1, result)
+ tmp2[k1].append(tmp1[k1 + str(i)])
+ if tmp2:
+ #cls = build_class(k1.capitalize(), tmp2)
+ add_items(k1, tmp2[k1], k1)
+ elif isinstance(v1, str):
+ add_items(k1, v1)
+
+
+
+
+ if len(map_copy) == 0:
+ return 1
+ #print(attrs)
+ return process(mapping, name)
+
+
+def class_factory(cls_name, attrs):
+
+ def __init__(self, *args, **kwargs):
+ for key in attrs:
+ setattr(self, key, attrs[key])
+
+ def __iter__(self):
+ for name in self.__dict__:
+ yield getattr(self, name)
+
+ def __repr__(self):
+ values = ', '.join('{}={!r}'.format(*i) for i in zip(self.__dict__, self))
+ return '{}({})'.format(self.__class__.__name__, values)
+
+ cls_attrs = dict(
+ __init__=__init__,
+ __iter__=__iter__,
+ __repr__=__repr__)
+
+ return type("NttCis{}".format(cls_name), (object,), cls_attrs)
+
+
+class XmlListConfig(list):
+ def __init__(self, elem_list):
+ for element in elem_list:
+ if element is not None:
+ # treat like dict
+ #print(element.attrib, len(element))
+ if len(element) >= 0 or element[0].tag != element[1].tag:
+ self.append(XmlDictConfig(element))
+ # treat like list
+ elif element[0].tag == element[1].tag:
+ if 'property' in element.tag:
+ self.append({element.attrib.get('name'): element.attrib.get('value')})
+ else:
+ self.append(element.attrib)
+ elif element.text:
+ text = element.text.strip()
+ if text:
+ self.append(text)
+
+
+class XmlDictConfig(dict):
+
+ def __init__(self, parent_element):
+ if parent_element.items():
+ if 'property' in parent_element.tag:
+ self.update({parent_element.attrib.get('name'): parent_element.attrib.get('value')})
+ else:
+ self.update(dict(parent_element.items()))
+
+ for element in parent_element:
+ if len(element) > 0:
+ # treat like dict - we assume that if the first two tags
+ # in a series are different, then they are all different.
+ if len(element) == 1 or element[0].tag != element[1].tag:
+ elem_dict = XmlDictConfig(element)
+
+ # treat like list - we assume that if the first two tags
+ # in a series are the same, then the rest are the same.
+ else:
+ # here, we put the list in dictionary; the key is the
+ # tag name the list elements all share in common, and
+ # the value is the list itself
+ elem_dict = {element[0].tag.split('}')[1]: XmlListConfig(element)}
+
+ # if the tag has attributes, add those to the dict
+ if element.items():
+ elem_dict.update(dict(element.items()))
+ self.update({element.tag.split('}')[1]: elem_dict})
+ # this assumes that if you've got an attribute in a tag,
+ # you won't be having any text. This may or may not be a
+ # good idea -- time will tell. It works for the way we are
+ # currently doing XML configuration files...
+ elif element.items():
+ # It is possible to have duplicate element tags. If so, convert to a dict of lists
+ if element.tag.split('}')[1] in self:
+ tmp_list = list()
+ tmp_dict = dict()
+ if isinstance(self[element.tag.split('}')[1]], list):
+ tmp_list.append(element.tag.split('}')[1])
+ else:
+ for k, v in self[element.tag.split('}')[1]].items():
+ if isinstance(k, XmlListConfig):
+ tmp_list.append(k)
+ else:
+ tmp_dict.update({k: v})
+ tmp_list.append(tmp_dict)
+ tmp_list.append(dict(element.items()))
+ print()
+ self[element.tag.split('}')[1]] = tmp_list
+ else:
+ self.update({element.tag.split('}')[1]: dict(element.items())})
+ # finally, if there are no child tags and no attributes, extract
+ # the text
+ else:
+ self.update({element.tag.split('}')[1]: element.text})
+
+
+def process_xml(xml):
+ tree = etree.parse(BytesIO(xml))
+ root = tree.getroot()
+ elem = root.tag.split('}')[1].capitalize()
+ items = dict(root.items())
+
+ if 'pageNumber' in items:
+ converted_xml = XmlListConfig(root)
+ processor(converted_xml[0])
+ else:
+ converted_xml = XmlDictConfig(root)
+ processor(converted_xml)
+ klass = class_factory(elem.capitalize(), attrs)
+ cls = klass(attrs)
+
- return cls
++ return cls
++
[31/45] libcloud git commit: LIBCLOUD-1024 commit for pull request
Posted by an...@apache.org.
LIBCLOUD-1024 commit for pull request
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/44923b97
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/44923b97
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/44923b97
Branch: refs/heads/trunk
Commit: 44923b9762170b086b4a771bdee7667ba741bd95
Parents: b8c4b9c
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 21 23:30:55 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 21 23:30:55 2018 -0500
----------------------------------------------------------------------
tests/conftest.py | 40 ----
tests/lib_create_test.py | 315 --------------------------
tests/lib_edit_test.py | 500 ------------------------------------------
tests/lib_list_test.py | 469 ---------------------------------------
tests/lib_misc_test.py | 10 -
5 files changed, 1334 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/44923b97/tests/conftest.py
----------------------------------------------------------------------
diff --git a/tests/conftest.py b/tests/conftest.py
deleted file mode 100644
index 077e463..0000000
--- a/tests/conftest.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import pytest
-import libcloud
-
-
-@pytest.fixture(scope="module")
-def compute_driver():
- cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
- libcloud.DriverType.COMPUTE.NTTCIS)
- compute_driver = cls('mitchgeo-test', 'Snmpv2c!', region='eu')
- return compute_driver
-
-
-@pytest.fixture(scope="module")
-def lbdriver():
- cd = libcloud.get_driver(libcloud.DriverType.COMPUTE,
- libcloud.DriverType.COMPUTE.NTTCIS)
- compute_driver = cd('mitchgeo-test', 'Snmpv2c!', region='eu')
- net_domain_name = 'sdk_test_1'
- net_domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain_id = [d for d in net_domains if d.name == net_domain_name][0].id
- cls = libcloud.get_driver(libcloud.DriverType.LOADBALANCER,
- libcloud.DriverType.LOADBALANCER.NTTCIS)
- lbdriver = cls('mitchgeo-test', net_domain_id, 'Snmpv2c!', region='eu')
- return lbdriver
-
-
-@pytest.fixture(scope="module")
-def na_compute_driver():
- cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
- libcloud.DriverType.COMPUTE.NTTCIS)
- na_compute_driver = cls('mitchgeo-test', 'Snmpv2c!', region='na')
- return na_compute_driver
-
-
-@pytest.fixture(scope="module")
-def drsdriver():
- cls = libcloud.get_driver(libcloud.DriverType.DRS,
- libcloud.DriverType.DRS.NTTCIS)
- drsdriver = cls('mitchgeo-test', 'Snmpv2c!', region='na')
- return drsdriver
http://git-wip-us.apache.org/repos/asf/libcloud/blob/44923b97/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
deleted file mode 100644
index ff8f341..0000000
--- a/tests/lib_create_test.py
+++ /dev/null
@@ -1,315 +0,0 @@
-import pytest
-from libcloud.compute.drivers.nttcis import NttCisPort, NttCisIpAddress, NttCisPublicIpBlock, NttCisNatRule
-from libcloud.common.nttcis import NttCisFirewallRule, NttCisVlan, NttCisFirewallAddress, NttCisAPIException
-
-
-def test_deploy_vlan(compute_driver, vlan_name='sdk_test2', network_domain_name='sdk_test_1', base_ipv4_addr='10.1.2.0'):
- # Default network size is 24 bits. Interval and polling times default to 2 and 60.
- interval = 3
- timeout = 60
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- result = compute_driver.ex_create_vlan(network_domain, vlan_name, base_ipv4_addr)
- assert isinstance(result, NttCisVlan)
- compute_driver.ex_wait_for_state('normal', compute_driver.ex_get_vlan, interval, timeout, result.id)
- return result
-
-
-def test_deploy_vlan_2(compute_driver, vlan_name='sdk_test_3', network_domain_name='sdk_test_1',
- base_ipv4_addr='10.2.0.0', private_ipv4_prefix_size=24):
- # Default network size is 24 bits. Interval and polling times default to 2 and 60.
- interval = 3
- timeout = 60
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- result = compute_driver.ex_create_vlan(network_domain, vlan_name, base_ipv4_addr,
- private_ipv4_prefix_size=private_ipv4_prefix_size)
- assert isinstance(result, NttCisVlan)
- compute_driver.ex_wait_for_state('normal', compute_driver.ex_get_vlan, interval, timeout, result.id)
- return result
-
-
-def test_create_nat_rule(compute_driver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- result = compute_driver.ex_create_nat_rule(network_domain, '10.1.1.7', '168.128.13.126')
- assert isinstance(result, NttCisNatRule)
-
-
-def test_deploy_server(compute_driver):
- image_id = "81a36aa0-555c-4735-b965-4b64fcf0ac8f"
- images = compute_driver.list_images(location='EU6')
- image = [i for i in images if i.id == image_id]
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- psswd = 'Snmpv2c!'
- vlan_name = "sdk_vlan1"
- vlans = compute_driver.ex_list_vlans()
- vlan = [v for v in vlans if v.name == vlan_name]
- new_node = compute_driver.create_node("ubuntu", image[0], psswd, ex_description="auto_created_server",
- ex_network_domain=net_domain[0], ex_primary_nic_vlan=vlan[0])
- compute_driver.ex_wait_for_state('running', compute_driver.ex_get_node_by_id, 2, 300, new_node.id)
- assert new_node.state == 'running'
-
-
-def test_delete_server(compute_driver):
- server = compute_driver.list_nodes(ex_name="ubuntu")[0]
- shut_result = compute_driver.ex_shutdown_graceful(server)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, server.id)
- result = compute_driver.destroy_node(server)
- assert result is True
- compute_driver.ex_wait_for_state('terminated', compute_driver.ex_get_node_by_id, 2, 240, server.id)
-
-
-def test_deploy_firewall_rule_1(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- address_list_name = 'sdk_test_address_list'
- address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
- # using lambda with filter
-
- # address_list = list(filter(lambda x: address_list_name, address_lists))
- # address_list_id = address_list[0].id
-
- # using list comprehension to filter
-
- address_list = [a for a in address_lists if a.name == address_list_name]
- address_list_id = address_list[0].id
-
- port_list_name = 'sdk_test_port_list'
- port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
- port_list = [p for p in port_lists if p.name == port_list_name]
- port_list_id = port_list[0].id
- dest_firewall_address = NttCisFirewallAddress(address_list_id=address_list_id, port_list_id=port_list_id)
- source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
- rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_1', 'ACCEPT_DECISIVELY',
- 'IPV4', 'TCP', source_firewall_address, dest_firewall_address, 'LAST')
- print(rule)
- assert isinstance(rule, NttCisFirewallRule)
-
-
-def test_deploy_firewall_rule_2(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
- dest_firewall_address = NttCisFirewallAddress(ip_address='10.2.0.0', ip_prefix_size='16',
- port_begin='8000', port_end='8080')
-
- rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_2', 'ACCEPT_DECISIVELY',
- 'IPV4', 'TCP', source_firewall_address, dest_firewall_address, 'LAST')
- print(rule)
- assert isinstance(rule, NttCisFirewallRule)
-
-
-def test_deploy_firewall_rule_3(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- source_firewall_address = NttCisFirewallAddress(any_ip='ANY')
- dest_firewall_address = NttCisFirewallAddress(ip_address='10.2.0.0', ip_prefix_size='16',
- port_begin='25')
- rule_name = 'sdk_test_firewall_rule_2'
- rules = compute_driver.ex_list_firewall_rules(net_domain[0])
- rule = [rule for rule in rules if rule.name == rule_name]
- relative_to = compute_driver.ex_get_firewall_rule(net_domain[0], rule[0].id)
- rule = compute_driver.ex_create_firewall_rule(net_domain[0], 'sdk_test_firewall_rule_3', 'ACCEPT_DECISIVELY',
- 'IPV4', 'TCP', source_firewall_address, dest_firewall_address,
- 'BEFORE', position_relative_to_rule=relative_to)
- print(rule)
- assert isinstance(rule, NttCisFirewallRule)
-
-
-def test_create_port_list(compute_driver):
- """
- An optional named argument, child_portlist_list, which takes the id of an existing
- port list to include in this port list.
- """
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- port_list_name = 'sdk_test_port_list'
- description = 'A test port list'
- port_list = [NttCisPort(begin='8000', end='8080')]
- result = compute_driver.ex_create_portlist(net_domain[0], port_list_name, description, port_list)
- assert result is True
-
-
-def test_create_address_list(compute_driver):
- """
- An optional named argument, child_ip_address_list, which takes the id of an existing
- port list to include in this port list.
- """
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- address_list_name = 'sdk_test_address_list'
- description = 'A test address list'
- ip_version = 'IPV4'
- # An optional prefix list can be specified as a named argument, prefix_size=
- address_list = [NttCisIpAddress('10.2.0.1', end='10.2.0.11')]
-
- result = compute_driver.ex_create_ip_address_list(net_domain[0], address_list_name,
- description,
- ip_version, address_list)
- assert result is True
-
-
-def test_create_public_ip_block(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- ip_block = compute_driver.ex_add_public_ip_block_to_network_domain(net_domain)
- assert isinstance(ip_block, NttCisPublicIpBlock)
- print(ip_block)
-
-
-def test_create_private_ipv4_address(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ip = '10.1.1.20'
- description = 'A test reserved ipv4 address'
- result = compute_driver.ex_reserve_ip(vlan, ip, description)
- assert result is True
-
-
-def test_create_ipv6_addresss(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ipv6 = '2a00:47c0:111:1331:7df0:9beb:43c9:5c'
- result = compute_driver.ex_reserve_ip(vlan, ipv6)
- assert result is True
-
-
-def test_import_customer_image(compute_driver):
- package_name = "bitnami-couchdb-2.1.2-1-r35-linux-centos-7-x86_64.mf"
- name = "bitnami-couchdb-2.1.2-1-r35-linux-centos-7-x86_64"
- datacenter_id = 'EU6'
- is_guest_os_customization = 'false'
- result = compute_driver.import_image(package_name, name, datacenter_id=datacenter_id,
- is_guest_os_customization=is_guest_os_customization)
- assert result is True
-
-
-def test_create_load_balancer(lbdriver, compute_driver):
- member1 = compute_driver.list_nodes(ex_name='web1')[0]
- member2 = compute_driver.list_nodes(ex_name='web2')[0]
- members = [member1, member2]
- name = 'sdk_test_balancer'
- port = '80'
- listener_port = '8000'
- protocol = 'TCP'
- algorithm = 'LEAST_CONNECTIONS_MEMBER'
- members = [m for m in members]
- ex_listener_ip_address = "168.128.13.127"
- lb = lbdriver.create_balancer(name, listener_port=listener_port, port=port, protocol=protocol,
- algorithm=algorithm, members=members, optimization_profile='TCP',
- ex_listener_ip_address=ex_listener_ip_address)
-
-
-def test_create_vip_node(compute_driver, lbdriver):
- node_address = '10.1.1.7'
- node_name = "web1"
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- node = lbdriver.ex_create_node(net_domain.id, node_name, node_address)
- print(node)
-
-
-def test_add_pool_member(compute_driver, lbdriver):
- pool_name = 'sdk_test_balancer'
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
- pool = [p for p in pools if p.name == pool_name][0]
- node = lbdriver.ex_get_node("eca8dac3-1417-4fdf-83c3-2b7b848ab171")
- result = lbdriver.ex_create_pool_member(pool, node, port=80)
- print(result)
-
-
-def test_create_server_monitor(compute_driver):
- pass
-
-
-def test_fail_create_drs(na_compute_driver, drsdriver):
- nodes = na_compute_driver.list_nodes(ex_name='drs_test_1')
- src_id = nodes[0].id
- nodes = na_compute_driver.list_nodes(ex_name="drs_test_2")
- target_id = nodes[0].id
- with pytest.raises(NttCisAPIException) as excinfo:
- result = drsdriver.create_consistency_group(
- "sdk_cg", "100", src_id, target_id, description="A test consistency group")
- exception_msg = excinfo.value.msg
- assert exception_msg == 'DRS is not supported between source Data Center NA9 and target Data Center NA12.'
-
-
-def test_ineligble_drs(na_compute_driver, drsdriver):
- nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
- src_id = nodes[0].id
- nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")
- target_id = nodes[0].id
- with pytest.raises(NttCisAPIException) as excinfo:
- drsdriver.create_consistency_group(
- "sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
- exception_msg = excinfo.value.msg
- assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.'
-
-
-def test_create_drs(na_compute_driver, drsdriver):
- nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
- src_id = nodes[0].id
- nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")
- target_id = nodes[0].id
- result = drsdriver.create_consistency_group(
- "sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
- assert result is True
-
-
-def test_start_snapshot_preview(drsdriver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- snapshot_id = "87703"
- result = drsdriver.start_failover_preview(cg_id, snapshot_id)
- assert result is True
-
-
-def test_stop_snapshot_preivew(drsdriver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = drsdriver.stop_failover_preview(cg_id)
- assert result is True
-
-
-def test_initiate_failover(drsdriver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = drsdriver.initiate_failover(cg_id)
- assert result is True
-
-
-def test_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 test_insert_ssl_chain(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/chain.crt'
- result = lbdriver.ex_import_ssl_cert_chain(net_dom.id, "ted_carol", cert, description="test cert chain")
- assert result is True
-
-
-def test_create_ssl_profile(lbdriver):
- net_domain_id = "6aafcf08-cb0b-432c-9c64-7371265db086"
- name = "ssl_offload"
- 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
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/44923b97/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
deleted file mode 100644
index a99d3cf..0000000
--- a/tests/lib_edit_test.py
+++ /dev/null
@@ -1,500 +0,0 @@
-import pytest
-import libcloud
-from libcloud import loadbalancer
-from libcloud.compute.drivers.nttcis import NttCisPort
-from libcloud.common.nttcis import NttCisIpAddress, NttCisVlan, NttCisVIPNode
-from tests.lib_create_test import test_deploy_vlan
-
-
-def test_disable_node_snapshot(compute_driver):
- node = '040fefdb-78be-4b17-8ef9-86820bad67d9'
- assert compute_driver.ex_disable_snapshots(node) is True
-
-
-def test_list_windows(compute_driver):
- loc = 'EU6'
- service_plan = 'ADVANCED'
- windows = compute_driver.list_snapshot_windows(loc, service_plan)
- for window in windows:
- print(window)
- assert 'day_of_week' in window
-
-
-def test_enable_snapshot(compute_driver):
- """
- This will enable a snapshot window and create an initial
- snapshot when it has done so. A node object and a window id are required
- :param compute_driver: The driver object for compute nodes.
- :return: True or False
- :rtype: ``bool``
- """
- window_id = 'ea646520-4272-11e8-838c-180373fb68df'
- node = '040fefdb-78be-4b17-8ef9-86820bad67d9'
- result = compute_driver.ex_enable_snapshots(node, window_id)
- assert result is True
-
-
-def test_initiate_manual_snapshot_warn(compute_driver):
- with pytest.raises(RuntimeError, match=r'Found more than one server Id .*'):
- compute_driver.ex_initiate_manual_snapshot('sdk_server_1', 'dc637783-2bb2-4b92-838a-99a899b5e29b')
-
-
-def test_initiate_manual_snapshot(compute_driver):
- compute_driver.ex_initiate_manual_snapshot('sdk_server_1', 'dc637783-2bb2-4b92-838a-99a899b5e29b')
-
-
-def test_shutdown_server_1(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
- result = compute_driver.ex_shutdown_graceful(node)
- assert result is True
-
-
-def test_start_server_1(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_shutdown_server_2(compute_driver):
- nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
- for node in nodes:
- result = compute_driver.ex_shutdown_graceful(node)
- assert result is True
-
-
-def test_start_server_2(compute_driver):
- nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
- for node in nodes:
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_edit_metadata(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
- description = 'SDK Test server'
- name = 'sdk_server_1'
- result = compute_driver.ex_edit_metadata(node, name=name, description=description)
- assert result is True
-
-
-def test_edit_metadata_fails(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
- description = 'Test server'
- ip_address = 'EU6 Ubuntu'
- with pytest.raises(TypeError):
- result = compute_driver.ex_edit_metadata(node, ip_address=ip_address, description=description)
-
-
-def test_reconfigure_node(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9')
- cpu_performance = 'HIGHPERFORMANCE'
- result = compute_driver.ex_reconfigure_node(node, cpu_performance=cpu_performance)
- assert result is True
-
-
-def test_edit_vlan(compute_driver):
- vlan = compute_driver.ex_list_vlans(name='sdk_test2')[0]
- vlan.name = 'sdk_test_2'
- vlan.description = "Second test Vlan"
- result = compute_driver.ex_update_vlan(vlan)
- assert isinstance(result, NttCisVlan)
-
-
-def test_expand_vlan(compute_driver):
- vlan = compute_driver.ex_list_vlans(name='sdk_test_3')[0]
- vlan.private_ipv4_range_size = '23'
- result = compute_driver.ex_expand_vlan(vlan)
- assert isinstance(result, NttCisVlan)
-
-
-def test_delete_vlan(compute_driver):
- vlan = compute_driver.ex_list_vlans(name='sdk_test_3')[0]
- result = compute_driver.ex_delete_vlan(vlan)
- assert result is True
-
-
-def test_add_disk_by_node(compute_driver):
- """
- Speeds can be specified based on DataCenter
- :param compute_driver: libcloud.DriverType.COMPUTE.NTTCIS
- :return: NA
- """
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_add_storage_to_node(20, node)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 180, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_add_disk_by_controller_id(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_add_storage_to_node(20, controller_id=node.extra['scsi_controller'][0].id)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 180, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_changing_diskspeed(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- disk_id = 'f8a01c24-4768-46be-af75-9fe877f8c588'
- result = compute_driver.ex_change_storage_speed(disk_id, 'HIGHPERFORMANCE')
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_changing_diskspeed_iops(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- disk_id = 'f8a01c24-4768-46be-af75-9fe877f8c588'
- result = compute_driver.ex_change_storage_speed(disk_id, 'PROVISIONEDIOPS', iops=60)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_add_scsi_controller(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- adapter_type = 'VMWARE_PARAVIRTUAL'
- result = compute_driver.ex_add_scsi_controller_to_node(node.id, adapter_type)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_remove_scsi_controller(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_remove_scsi_controller('f1126751-c6d5-4d64-893c-8902b8481f90')
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_update_vmware_tools(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- result = compute_driver.ex_update_vm_tools(node)
- assert result is True
- compute_driver.ex_wait_for_state('running', compute_driver.ex_get_node_by_id, 2, 240, node.id)
-
-
-def test_add_node_to_vlan(compute_driver):
- vlan = test_deploy_vlan(compute_driver, "test_vlan_create", "6aafcf08-cb0b-432c-9c64-7371265db086", "10.0.2.0")
- assert isinstance(vlan, NttCisVlan)
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_attach_node_to_vlan(node, vlan=vlan)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_remove_nic(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_disable_snapshots(node.id)
- assert result is True
- result = compute_driver.ex_destroy_nic("e9cdea1b-c4f2-4769-93a8-57e24248abdd")
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-""""
-No wayt to get nic id's via libcloud
-def test_exchange_nic_vlans(compute_driver):
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- print(node.extra)
-"""
-
-
-def test_change_nic_type(compute_driver):
- nic_id = "7a27b2b1-7b20-404f-be53-4695023c2734"
- nic_type = 'VMXNET3'
- node = compute_driver.ex_get_node_by_id('803e5e00-b22a-450a-8827-066ff15ec977')
- shut_result = compute_driver.ex_shutdown_graceful(node)
- assert shut_result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 45, node.id)
- result = compute_driver.ex_change_nic_network_adapter(nic_id, nic_type)
- assert result is True
- compute_driver.ex_wait_for_state('stopped', compute_driver.ex_get_node_by_id, 2, 240, node.id)
- result = compute_driver.ex_start_node(node)
- assert result is True
-
-
-def test_edit_firewall_rule(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- rule_name = 'sdk_test_firewall_rule_2'
- rules = compute_driver.ex_list_firewall_rules(net_domain[0])
- rule = [rule for rule in rules if rule.name == rule_name]
- rule[0].destination.port_end = None
- result = compute_driver.ex_edit_firewall_rule(rule[0])
- print(compute_driver.ex_get_firewall_rule(net_domain[0].id, rule[0].id))
- assert result is True
-
-
-def test_delete_firewall_rule(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- rule_name = 'sdk_test_firewall_rule_2'
- rules = compute_driver.ex_list_firewall_rules(net_domain[0])
- rule = [rule for rule in rules if rule.name == rule_name]
- result = compute_driver.ex_delete_firewall_rule(rule[0])
- assert result is True
-
-
-def test_create_anti_affinity_rule(compute_driver):
- server1 = compute_driver.ex_get_node_by_id("d0425097-202f-4bba-b268-c7a73b8da129")
- server2 = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
- servers = [server1, server2]
- result = compute_driver.ex_create_anti_affinity_rule(servers)
- assert isinstance(result, )
-
-
-def test_delete_anti_affinity_rule(compute_driver):
- anti_affinity_rule = "40d83160-0fa2-418d-a73e-5f15fe1354fc"
- result = compute_driver.ex_delete_anti_affinity_rule(anti_affinity_rule)
- assert result is True
-
-
-def test_delete_port_list(compute_driver):
- portlists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
- port_list_to_delete = [plist for plist in portlists if plist.name == 'sdk_test_port_list']
- result = compute_driver.ex_delete_portlist(port_list_to_delete[0])
- assert result is True
-
-
-def test_edit_address_list(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- addr_list = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
- assert addr_list[0].ip_version == 'IPV4'
- ip_address_1 = NttCisIpAddress(begin='190.2.2.100')
- ip_address_2 = NttCisIpAddress(begin='190.2.2.106', end='190.2.2.108')
- ip_address_3 = NttCisIpAddress(begin='190.2.2.0', prefix_size='24')
- ip_address_4 = NttCisIpAddress(begin='10.2.0.0', prefix_size='24')
- ip_address_collection = [ip_address_1, ip_address_2, ip_address_3, ip_address_4]
-
- result = compute_driver.ex_edit_ip_address_list("d32aa8d4-831b-4fd6-95da-c639768834f0",
- ip_address_collection=ip_address_collection)
- assert result is True
-
-
-def test_delete_public_ip_block(compute_driver):
- block = compute_driver.ex_get_public_ip_block("813b87a8-18e1-11e5-8d4f-180373fb68df")
- result = compute_driver.ex_delete_public_ip_block(block)
- assert result is True
-
-
-def test_edit_address_list_2(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- # An ip address list object can be used as an argument or the id of the address list
- addr_list = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
-
- result = compute_driver.ex_edit_ip_address_list("d32aa8d4-831b-4fd6-95da-c639768834f0",
- description='nil')
- assert result is True
-
-
-def test_delete_address_list(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- addresslist_to_delete = compute_driver.ex_get_ip_address_list(net_domain, 'sdk_test_address_list')
- print(addresslist_to_delete)
-
-
-def test_edit_port_list_1(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name]
- port_list_name = 'sdk_test_port_list'
- port_lists = compute_driver.ex_list_portlist(net_domain[0])
- port_list = [port for port in port_lists if port.name == port_list_name][0]
- port_collection = [NttCisPort(begin='8000', end='8080'), NttCisPort(begin='9000')]
- result = compute_driver.ex_edit_portlist(port_list.id, port_collection=port_collection)
- assert result is True
-
-
-def test_unreserve_ip_address(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ip = '2a00:47c0:111:1331:7df0:9beb:43c9:5c'
- result = compute_driver.ex_unreserve_ip_addresses(vlan, ip)
- assert result is True
-
-
-def test_list_locations(compute_driver):
- locations = compute_driver.list_locations()
- for location in locations:
- print(location)
-
-
-def test_delete_nat_rule(compute_driver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- rule = compute_driver.ex_get_nat_rule(network_domain, '74f0897f-5536-4c17-84b0-d52b1fb3aea6')
- result = compute_driver.ex_delete_nat_rule(rule)
- assert result is True
-
-
-def test_update_health_monitor(compute_driver, lbdriver):
- pool_name = 'sdk_test_balancer'
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
- pool = [p for p in pools if p.name == pool_name][0]
- pool.health_monitor_id = '9f79487a-1b6d-11e5-8d4f-180373fb68df'
- result = lbdriver.ex_update_pool(pool)
- assert result is True
-
-
-def test_update_node_monitor(compute_driver, lbdriver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
- #pool = [p for p in pools if p.name == pool_name][0]
- health_monitor_id = '9f79a126-1b6d-11e5-8d4f-180373fb68df'
- for node in nodes:
- node.health_monitor_id = health_monitor_id
- result = lbdriver.ex_update_node(node)
- assert isinstance(result, NttCisVIPNode)
-
-
-def test_remove_node(compute_driver, lbdriver):
- node_name = 'web1'
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
- node = [n for n in nodes if n.name == node_name][0]
- pool_name = "sdk_test_balancer"
- pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
- pool = [p for p in pools if p.name == pool_name][0]
- pool_members = lbdriver.ex_get_pool_members(pool.id)
- pool_member = [pm for pm in pool_members if pm.node_id == node.id][0]
- result = lbdriver.ex_destroy_pool_member(pool_member)
- assert result is True
-
-
-def test_delete_node(compute_driver, lbdriver):
- node_name = 'web1'
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- nodes = lbdriver.ex_get_nodes(ex_network_domain_id=network_domain.id)
- node = [n for n in nodes if n.name == node_name][0]
- result = lbdriver.ex_destroy_node(node.id)
- assert result is True
-
-
-def test_remove_pool(compute_driver, lbdriver):
- listener_name = "sdk_test_balancer"
- listeners = lbdriver.list_balancers(ex_network_domain_id=lbdriver.network_domain_id)
- listener = [l for l in listeners if l.name == listener_name][0]
- pool_id = None
- result = lbdriver.ex_update_listener(listener, poolId=pool_id)
- assert result is True
-
-
-def test_delete_pool(compute_driver, lbdriver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- pool_name = "sdk_test_balancer"
- pools = lbdriver.ex_get_pools(ex_network_domain_id=network_domain.id)
- pool = [p for p in pools if p.name == pool_name][0]
- result = lbdriver.ex_destroy_pool(pool)
- assert result is True
-
-
-def test_delete_listener(compute_driver, lbdriver):
- listener_name = "sdk_test_balancer"
- listeners = lbdriver.list_balancers(ex_network_domain_id=lbdriver.network_domain_id)
- listener = [l for l in listeners if l.name == listener_name][0]
- result = lbdriver.destroy_balancer(listener)
- assert result is True
-
-
-def test_expand_journal(drsdriver):
- cgs = drsdriver.list_consistency_groups(name="sdk_test2_cg")
- cg_id = cgs[0].id
- expand_by = "100"
- result = drsdriver.expand_journal(cg_id, expand_by)
- assert result is True
-
-
-def test_delete_consistency_group(drsdriver):
- cg_name = "sdk_test2_cg"
- cg = drsdriver.list_consistency_groups(name=cg_name)
- cg_id = cg[0].id
- result = drsdriver.delete_consistency_group(cg_id)
- assert result is True
-
-
-def test_edit_ssl_offload_profile(lbdriver):
- profile_name = "ssl_offload"
- datacenter_id = "EU6"
- profile = lbdriver.ex_list_ssl_offload_profiles(name=profile_name, datacenter_id=datacenter_id)[0]
- 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 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/44923b97/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
deleted file mode 100644
index f79fc33..0000000
--- a/tests/lib_list_test.py
+++ /dev/null
@@ -1,469 +0,0 @@
-import pytest
-import libcloud
-from libcloud import loadbalancer
-
-
-def test_list_node_all(compute_driver):
- nodes = compute_driver.list_nodes()
- for node in nodes:
- print(node)
- #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- # node.extra['scsi_controller'], node.extra['disks'], node.extra['memoryMb'],
- # node.extra['OS_displayName'], node.private_ips, node.extra['ipv6'], node.extra['window'])
-
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_location(compute_driver):
- nodes = compute_driver.list_nodes(ex_location='EU6')
- print()
- for node in nodes:
- print(node)
- #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- # [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- # node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_name(compute_driver):
- nodes = compute_driver.list_nodes(ex_name='sdk_server_1')
- print()
- for node in nodes:
- print(node)
- #print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- # [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- # node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_ipv6(compute_driver):
- nodes = compute_driver.list_nodes(ex_ipv6='2a00:47c0:111:1331:6140:e432:729b:eef6')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_ipv4(compute_driver):
- nodes = compute_driver.list_nodes(ex_ipv4='10.1.1.6')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_images(compute_driver):
- images = compute_driver.list_images(location='EU6')
- print()
- for image in images:
- print(image.id, image.name)
- assert isinstance(images, list) and len(images) > 0
-
-
-def test_list_os(compute_driver):
- oss = compute_driver.ex_list_os(location='EU6')
-
-
-def test_list_node_by_image(compute_driver):
- nodes = compute_driver.list_nodes(ex_image='81a36aa0-555c-4735-b965-4b64fcf0ac8f')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-"""
- requires retrieving vlan Id first
-"""
-
-
-def test_list_node_vlan(compute_driver):
- nodes = compute_driver.list_nodes(ex_vlan='eb05a24e-85a6-46e3-a7c9-f1765737476d')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-"""
-Libcloud docs say this works but it is not in our API docs
-def test_list_node_image(compute_driver):
- nodes = compute_driver.list_nodes(ex_image='46096745-5a89-472b-9b3b-89a6a07bb60b')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-"""
-
-
-def test_list_node_started(compute_driver):
- nodes = compute_driver.list_nodes(ex_started='true')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_deployed(compute_driver):
- nodes = compute_driver.list_nodes(ex_deployed='true')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_node_state(compute_driver):
- nodes = compute_driver.list_nodes(ex_state='NORMAL')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_network_domain_id(compute_driver):
- nodes = compute_driver.list_nodes(ex_network_domain='6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for node in nodes:
- print(node.extra['networkDomainId'], node.extra['datacenterId'], node.uuid, node.state, node.name, node.extra['cpu'],
- [disk for disk in node.extra['disks']], node.extra['memoryMb'], node.extra['OS_displayName'],
- node.private_ips, node.extra['ipv6'])
- assert isinstance(nodes, list) and len(nodes) > 0
-
-
-def test_list_vlans(compute_driver):
- vlans = compute_driver.ex_list_vlans()
- print()
- for vlan in vlans:
- print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
- vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
- assert isinstance(vlans, list) and len(vlans) > 0
-
-
-def test_list_vlan(compute_driver):
- vlan = compute_driver.ex_get_vlan('eb05a24e-85a6-46e3-a7c9-f1765737476d')
- print()
- print(vlan.id, vlan.name, vlan.location.id, vlan.ipv4_gateway, vlan.ipv6_gateway, vlan.ipv6_range_address, vlan.ipv6_range_size,
- vlan.private_ipv4_range_address, vlan.private_ipv4_range_size, vlan.status)
- assert vlan.name == 'sdk_vlan1'
-
-
-def test_list_datacenter_object_creation(compute_driver):
- datacenter = compute_driver.ex_get_datacenter('EU6')
-
-
-def test_list_firewall_rules(compute_driver):
- rules = compute_driver.ex_list_firewall_rules('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for rule in rules:
- print(rule)
-
-
-def test_list_address_lists(compute_driver):
- address_lists = compute_driver.ex_list_ip_address_list('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for address_list in address_lists:
- print(address_list)
- assert isinstance(address_lists, list) and len(address_lists) > 0
-
-
-def test_list_port_lists(compute_driver):
- port_lists = compute_driver.ex_list_portlist('6aafcf08-cb0b-432c-9c64-7371265db086')
- print()
- for portlist in port_lists:
- print(portlist)
- assert isinstance(port_lists, list) and len(port_lists) > 0
-
-
-def test_list_nat_rules(compute_driver):
- nat_rules = compute_driver.ex_list_nat_rules(compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086'))
- print()
- for nat_rule in nat_rules:
- print(nat_rule, nat_rule.external_ip, nat_rule.internal_ip)
- assert isinstance(nat_rules, list) and len(nat_rules) > 0
-
-
-def test_list_balancers(lbdriver):
- balancers = lbdriver.list_balancers(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
- for balancer in balancers:
- print(balancer.id, balancer.ip, balancer.name, balancer.port)
- assert isinstance(balancers, list)
-
-
-def test_get_listener(lbdriver):
- listener = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
- print()
- print(listener.ip, listener.name, listener.port)
- assert listener.ip == '168.128.13.127'
-
-
-def test_vip_nodes(lbdriver):
- vips = lbdriver.ex_get_nodes("6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
- for vip in vips:
- print(vip, vip.ip, vip.name)
- assert isinstance(vips, list) and len(vips) > 0
-
-
-def test_list_lb_pools(lbdriver):
- pools = lbdriver.ex_get_pools(ex_network_domain_id="6aafcf08-cb0b-432c-9c64-7371265db086")
- print()
- for pool in pools:
- print(pool.id, pool.name, pool.description, pool.health_monitor_id, pool.load_balance_method, pool.slow_ramp_time, pool.status)
- assert isinstance(pools, list)
-
-
-def test_list_lb_pool_members(lbdriver):
- balancer = lbdriver.get_balancer("59abe126-2bba-48ac-8616-1aba51aabac5")
- pool_members = lbdriver.balancer_list_members(balancer)
- print()
- for pool_member in pool_members:
- print(pool_member)
- assert isinstance(pool_members, list)
-
-
-def test_get_pool_member(lbdriver):
- pool_member = lbdriver.ex_get_pool_member("9382e488-7f95-4db0-b2de-0b807aab825b")
- print()
- print(pool_member.ip, pool_member.port, pool_member.name)
- assert pool_member.ip == '10.1.1.8'
-
-
-def test_get_node(lbdriver):
- node = lbdriver.ex_get_node("5c647a74-d181-4ed8-82d3-55ae443a06dd")
- print()
- print(node.name, node.ip, node.connection_limit, node.connection_rate_limit)
- assert isinstance(node, object)
-
-
-def test_list_snapshots(compute_driver):
- snapshots = compute_driver.list_snapshots('web1')
- for snapshot in snapshots:
- print(snapshot)
- assert 'expiry_time' in snapshot
-
-
-def test_list_nics(compute_driver):
- result = compute_driver.ex_list_
-
-
-def test_list_vlans(compute_driver):
- vlans = compute_driver.ex_list_vlans()
- print(vlans)
- assert isinstance(vlans, list)
-
-
-def test_list_anti_affinity_rules(compute_driver):
- # Could use network domain or node but not both
- # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
- node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
- anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
- assert len(anti_affinity_rules) > 1
-
-
-def test_list_no_anti_affinity_rules(compute_driver):
- # Could use network domain or node but not both
- # net_domain = compute_driver.ex_get_network_domain('6aafcf08-cb0b-432c-9c64-7371265db086')
- node = compute_driver.ex_get_node_by_id("803e5e00-b22a-450a-8827-066ff15ec977")
- anti_affinity_rules = compute_driver.ex_list_anti_affinity_rules(node=node)
- assert len(anti_affinity_rules) == 0
-
-
-def test_list_locations(compute_driver):
- locations = compute_driver.list_locations()
- for location in locations:
- print(location)
-
-
-"""
-def test_list_sizes(compute_driver):
- properties = compute_driver.list_locations()
- for property in properties:
- print(property)
-"""
-
-
-def test_images(compute_driver):
- images = compute_driver.list_images()
- print()
- print(images)
- assert isinstance(images, list) and len(images) > 0
-
-
-def test_list_public_ip_blocks(compute_driver):
- domain_name = 'sdk_test_1'
- domains = compute_driver.ex_list_network_domains(location='EU6')
- net_domain = [d for d in domains if d.name == domain_name][0]
- blocks = compute_driver.ex_list_public_ip_blocks(net_domain)
- print(blocks)
-
-
-def test_list_private_ipv4_addresses_vlan(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ip_addresses = compute_driver.ex_list_reserved_ipv4(vlan=vlan)
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_private_ipv4_addresses_datacenter(compute_driver):
- datacenter_id = 'EU8'
- ip_addresses = compute_driver.ex_list_reserved_ipv4(datacenter_id=datacenter_id)
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_private_ipv4_addresses_all(compute_driver):
- ip_addresses = compute_driver.ex_list_reserved_ipv4()
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_reserved_ipv6_address_vlan(compute_driver):
- vlan_name = 'sdk_vlan1'
- vlan = compute_driver.ex_list_vlans(name=vlan_name)[0]
- ip_addresses = compute_driver.ex_list_reserved_ipv6(vlan=vlan)
- for ip_address in ip_addresses:
- print(ip_address)
-
-
-def test_list_nat_rules(compute_driver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- rules = compute_driver.ex_list_nat_rules(network_domain)
- for rule in rules:
- print(rule)
-
-
-def test_list_customer_images(compute_driver):
- location = 'EU6'
- images = compute_driver.ex_list_customer_images(location)
- for image in images:
- print(image, image.extra)
-
-
-def test_get_customer_image(compute_driver):
- imagee_id = '84da095f-c8c7-4ace-9fb6-eceb1047027c'
- image = compute_driver.ex_get_image_by_id(imagee_id)
- print(image, image.extra)
-
-
-def test_list_health_monitors(compute_driver, lbdriver):
- network_domain_name = "sdk_test_1"
- network_domains = compute_driver.ex_list_network_domains(location='EU6')
- network_domain = [nd for nd in network_domains if nd.name == network_domain_name][0]
- monitors = lbdriver.ex_get_default_health_monitors(network_domain)
- for monitor in monitors:
- print(monitor)
-
-
-def test_list_consistency_groups(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- for cg in cgs:
- print(cg.name)
-
-
-def test_list_cg_by_src_net_domain(drsdriver):
- nd = "f9d6a249-c922-4fa1-9f0f-de5b452c4026"
- cgs = drsdriver.list_consistency_groups(source_network_domain_id=nd)
- assert cgs[0].name == "sdk_test2_cg"
-
-
-def test_list_cg_by_name(drsdriver):
- name = "sdk_test2_cg"
- cg = drsdriver.list_consistency_groups(name=name)
- assert cg[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
-
-
-def test_get_consistency_group_by_id(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
- cg = drsdriver.get_consistency_group(cg_id)
- assert hasattr(cg, 'description')
-
-
-def test_get_snapshots(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
- snaps = drsdriver.list_consistency_group_snapshots(cg_id)
- assert hasattr(snaps, 'journalUsageGb')
-
-
-def test_get_snapshots_by_min_max(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
- snaps = drsdriver.list_consistency_group_snapshots(
- cg_id,
- create_time_min="2018-11-06T00:00:00.000Z",
- create_time_max="2018-11-07T00:00:00.000Z")
- for snap in snaps.snapshot:
- print(snap)
-
-
-def test_get_snapshots_by_min(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
- snaps = drsdriver.list_consistency_group_snapshots(
- cg_id,
- create_time_min="2018-11-07T00:00:00.000-05:00")
- for snap in snaps.snapshot:
- print(snap)
-
-
-def test_list_domain_certs(lbdriver):
- certs = lbdriver.ex_list_ssl_domain_certs()
- for cert in certs:
- print(cert)
-
-
-def test_list_domain_certs_by_name(lbdriver):
- certs = lbdriver.ex_list_ssl_domain_certs(name="alice")
- for cert in certs:
- print(cert)
-
-
-def test_get_domain_cert(lbdriver):
- cert_id = "352146be-0d6a-40cf-b935-808ab504a868"
- cert = lbdriver.ex_get_ssl_domain_cert(cert_id)
- print(cert.name)
-
-
-def test_list_certificate_chains(lbdriver):
- cert_name = "ted_carol"
- certs = lbdriver.ex_list_certificate_chains(name=cert_name)
- for cert in certs:
- print(cert)
-
-
-def test_get_certificate_chain(lbdriver):
- chain_id = "dc5a4235-2f1b-47e1-b6dd-455938a3377b"
- cert_chain = lbdriver.ex_get_ssl_certificate_chain(chain_id)
- print(cert_chain.name)
-
-
-def test_list_ssl_offload_profiles(lbdriver):
- profiles = lbdriver.ex_list_ssl_offload_profiles()
- for profile in profiles:
- print(profile)
-
-
-def test_get_ssl_offload_profile(lbdriver):
- profile_id = "b1d3b5a7-75d7-4c44-a2b7-5bfa773dec63"
- profile = lbdriver.ex_get_ssl_offload_profile(profile_id)
- print(profile.name, profile.createTime, profile.state)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/44923b97/tests/lib_misc_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_misc_test.py b/tests/lib_misc_test.py
deleted file mode 100644
index d8be518..0000000
--- a/tests/lib_misc_test.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import pytest
-import libcloud
-from libcloud import loadbalancer
-from libcloud.common.nttcis import NttCisAPIException
-
-
-def test_server_clone_to_image(compute_driver):
- node = compute_driver.ex_get_node_by_id('040fefdb-78be-4b17-8ef9-86820bad67d9 ')
- result = compute_driver.ex_clone_node_to_image(node, 'sdk_test_image', image_description='A test image for libcloud')
- assert result is True
[05/45] libcloud git commit: the drs driver does function
Posted by an...@apache.org.
the drs driver does function
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/62d9eb66
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/62d9eb66
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/62d9eb66
Branch: refs/heads/trunk
Commit: 62d9eb667e51c65d9b73d516275f000890e8ade0
Parents: adcf3bd
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 21:55:58 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 21:55:58 2018 -0400
----------------------------------------------------------------------
libcloud/base.py | 7 +++++++
libcloud/drs/__init__.py | 19 +++++++++++++++++++
libcloud/drs/drivers/nttcis.py | 10 ++++++++++
libcloud/drs/providers.py | 9 ++++-----
4 files changed, 40 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/base.py
----------------------------------------------------------------------
diff --git a/libcloud/base.py b/libcloud/base.py
index 94e9f17..dead087 100644
--- a/libcloud/base.py
+++ b/libcloud/base.py
@@ -25,6 +25,9 @@ from libcloud.container.providers import get_driver as get_container_driver
from libcloud.dns.providers import Provider as DnsProvider
from libcloud.dns.providers import get_driver as get_dns_driver
+from libcloud.drs.providers import Provider as DrsProvider
+from libcloud.drs.providers import get_driver as get_drs_driver
+
from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider
from libcloud.loadbalancer.providers import get_driver as \
get_loadbalancer_driver
@@ -46,6 +49,9 @@ class DriverType(object):
""" DNS service provider driver """
DNS = DnsProvider
+ """ DRS service provider driver """
+ DRS = DrsProvider
+
""" Load balancer provider-driver """
LOADBALANCER = LoadBalancerProvider
@@ -58,6 +64,7 @@ DriverTypeFactoryMap = {
DriverType.COMPUTE: get_compute_driver,
DriverType.CONTAINER: get_container_driver,
DriverType.DNS: get_dns_driver,
+ DriverType.DRS: get_drs_driver,
DriverType.LOADBALANCER: get_loadbalancer_driver,
DriverType.STORAGE: get_storage_driver
}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/__init__.py b/libcloud/drs/__init__.py
index e69de29..e27c8d7 100644
--- a/libcloud/drs/__init__.py
+++ b/libcloud/drs/__init__.py
@@ -0,0 +1,19 @@
+#
+# 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.
+
+"""
+Module for working with DRS/Consistency Groups
+"""
+
+__all__ = [
+ 'base',
+ 'providers',
+ 'types',
+ 'drivers'
+]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 3467277..8d4cb37 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -37,3 +37,13 @@ class NttCisDRSDriver(Driver):
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(NttCisDRSDriver,
+ self)._ex_connection_class_kwargs()
+ kwargs['region'] = self.selected_region
+ return kwargs
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py
index d214d17..2a31efa 100644
--- a/libcloud/drs/providers.py
+++ b/libcloud/drs/providers.py
@@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from libcloud.loadbalancer.types import Provider
-from libcloud.loadbalancer.types import OLD_CONSTANT_TO_NEW_MAPPING
+from libcloud.drs.types import Provider
+#from libcloud.drs.types import OLD_CONSTANT_TO_NEW_MAPPING
from libcloud.common.providers import get_driver as _get_provider_driver
from libcloud.common.providers import set_driver as _set_provider_driver
@@ -31,9 +31,8 @@ DRIVERS = {
def get_driver(provider):
- deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
- return _get_provider_driver(drivers=DRIVERS, provider=provider,
- deprecated_constants=deprecated_constants)
+ #deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
+ return _get_provider_driver(drivers=DRIVERS, provider=provider)
def set_driver(provider, module, klass):
[22/45] libcloud git commit: drs finished...need to run tox,
pull latest and pull request
Posted by an...@apache.org.
drs finished...need to run tox, pull latest and pull request
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8ed60c7d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8ed60c7d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8ed60c7d
Branch: refs/heads/trunk
Commit: 8ed60c7dc11b2ca4ce35149a4d14a9ecf099ca42
Parents: 3e83d4b
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Nov 8 17:34:29 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Nov 8 17:34:29 2018 -0500
----------------------------------------------------------------------
.../drs/nttcis/add_consistency_group.py | 2 +-
.../drs/nttcis/list_snapshots_by_create_time.py | 23 +++++
libcloud/drs/drivers/nttcis.py | 81 +++++++++++++++-
.../nttcis/delete_consistency_group.xml | 6 ++
.../fixtures/nttcis/drs_initiate_failover.xml | 6 ++
.../fixtures/nttcis/start_snapshot_preview.xml | 6 ++
.../fixtures/nttcis/stop_snapshot_preview.xml | 6 ++
libcloud/test/drs/test_nttcis.py | 97 ++++++++++++++++----
tests/lib_create_test.py | 21 ++++-
tests/lib_edit_test.py | 8 +-
10 files changed, 233 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/docs/examples/drs/nttcis/add_consistency_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/add_consistency_group.py b/docs/examples/drs/nttcis/add_consistency_group.py
index 68861e8..9194b24 100644
--- a/docs/examples/drs/nttcis/add_consistency_group.py
+++ b/docs/examples/drs/nttcis/add_consistency_group.py
@@ -15,7 +15,7 @@ def create_drs(compute_driver, drs_driver):
assert result is True
-def compute_driver():
+if __name__ == "__main__":
cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
libcloud.DriverType.COMPUTE.NTTCIS)
computedriver = cls('my_user', 'my_pass', region='na')
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
new file mode 100644
index 0000000..f3fb7bc
--- /dev/null
+++ b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
@@ -0,0 +1,23 @@
+# This script lists the snapshots in a consistency group
+# filtered by a minimum and maximum create time
+
+import libcloud
+
+
+def get_snapshots_by_min_max(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
+ snaps = drsdriver.list_consistency_group_snapshots(
+ cg_id,
+ create_time_min="2018-11-06T00:00:00.000Z",
+ create_time_max="2018-11-07T00:00:00.000Z")
+ return snaps
+
+
+if __name__ == "__main__":
+ cls = libcloud.get_driver(libcloud.DriverType.DRS,
+ libcloud.DriverType.DRS.NTTCIS)
+ drsdriver = cls('my_user', 'my_pass', region='na')
+ objs = get_snapshots_by_min_max(drsdriver)
+ for obj in objs.snapshot:
+ print(obj)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 13490ae..363d737 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -221,7 +221,86 @@ class NttCisDRSDriver(DRSDriver):
return response_code in ['IN_PROGRESS', 'OK']
def start_failover_preview(self, consistency_group_id, snapshot_id):
- pass
+ """
+ Brings a Consistency Group into PREVIEWING_SNAPSHOT mode
+
+ :param consistency_group_id: Id of the Consistency Group to put into
+ PRIEVEW_MODE
+ :type consistency_group_id: ``str``
+ :param snapshot_id: Id of the Snapshot to preview
+ :type snapshot_id: ``str``
+ :return: True/False
+ :rtype: ``bool``
+ """
+ preview_elm = ET.Element("startPreviewSnapshot",
+ {"consistencyGroupId": consistency_group_id,
+ "xmlns": TYPES_URN
+ })
+ ET.SubElement(preview_elm, "snapshotId").text = snapshot_id
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/startPreviewSnapshot",
+ method="POST",
+ data=ET.tostring(preview_elm)).object
+ response_code = findtext(response, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
+ def stop_failover_preview(self, consistency_group_id):
+ """
+ Takes a Consistency Group out of PREVIEW_MODE and back to DRS_MODE
+
+ :param consistency_group_id: Consistency Group's Id
+ :type ``str``
+ :return: True/False
+ :rtype: ``bool``
+ """
+ preview_elm = ET.Element("stopPreviewSnapshot",
+ {"consistencyGroupId": consistency_group_id,
+ "xmlns": TYPES_URN})
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/stopPreviewSnapshot",
+ method="POST",
+ data=ET.tostring(preview_elm)).object
+ response_code = findtext(response, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
+ def initiate_failover(self, consistency_group_id):
+ """
+ This method is irreversible.
+ It will failover the Consistency Group while removing it as well.
+
+ :param consistency_group_id: Consistency Group's Id to failover
+ :type consistency_group_id: ``str``
+ :return: True/False
+ :rtype: ``bool``
+ """
+ failover_elm = ET.Element("initiateFailover",
+ {"consistencyGroupId": consistency_group_id,
+ "xmlns": TYPES_URN})
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/initiateFailover",
+ method="POST",
+ data=ET.tostring(failover_elm)).object
+ response_code = findtext(response, "responseCode", TYPES_URN)
+ return response_code in ["IN_PROGRESS", "OK"]
+
+ def delete_consistency_group(self, consistency_group_id):
+ """
+ Delete's a Consistency Group
+
+ :param consistency_group_id: Id of Consistency Group to delete
+ :type ``str``
+ :return: True/False
+ :rtype: ``bool``
+ """
+ delete_elm = ET.Element("deleteConsistencyGroup",
+ {"id": consistency_group_id,
+ "xmlns": TYPES_URN})
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/deleteConsistencyGroup",
+ method="POST",
+ data=ET.tostring(delete_elm)).object
+ response_code = findtext(response, "responseCode", TYPES_URN)
+ return response_code in ["IN_PROGRESS", "OK"]
def _to_consistency_groups(self, object):
cgs = findall(object, 'consistencyGroup', TYPES_URN)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
new file mode 100644
index 0000000..6c5c1ed
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T170953967-0500_49fbd66f-4eca-4107-acf5-08d7bb07c706">
+ <operation>DELETE_CONSISTENCY_GROUP</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Delete Consistency Group has been accepted. Please use appropriate Get or List API for status.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml b/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
new file mode 100644
index 0000000..115dda1
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T160941803-0500_729ba262-347d-4da9-bf4d-c30e861bfa63">
+ <operation>INITIATE_FAILOVER</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Initiate Failover has been accepted. Please use appropriate Get or List API for status.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
new file mode 100644
index 0000000..50bede8
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135438714-0500_b30a28fa-f9e4-4e04-ae4c-cf07a3b31bb4">
+ <operation>START_PREVIEW_SNAPSHOT</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Start Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
new file mode 100644
index 0000000..22ae894
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135122604-0500_c06c2498-63d0-4172-8476-5af1b1fe07db">
+ <operation>STOP_PREVIEW_SNAPSHOT</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Stop Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index 9f9bf50..566e1d1 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -66,8 +66,29 @@ def test_list_snapshots_with_min(driver):
assert len(result.snapshot) == 87
-def test_start_failover_preview(driver):
- pass
+def test_start_snapshot_preview(driver):
+ snapshot_id = "87703"
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.start_failover_preview(cg_id, snapshot_id)
+ assert result is True
+
+
+def test_stop_snapshot_preivew(driver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.stop_failover_preview(cg_id)
+ assert result is True
+
+
+def test_initiate_failover(driver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.initiate_failover(cg_id)
+ assert result is True
+
+
+def test_delete_consistency_group(driver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.initiate_failover(cg_id)
+ assert result is True
class NttCisMockHttp(MockHttp):
@@ -113,33 +134,73 @@ class NttCisMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_name(self,
- method,
- url,
- body,
- headers):
+ method,
+ url,
+ body,
+ headers):
body = self.fixtures.load("list_cg_by_params.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_expandJournal(self,
- method,
- url,
- body,
- headers):
+ method,
+ url,
+ body,
+ headers):
body = self.fixtures.load("expand_cg.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("drs_snapshots.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot_WITH_MIN(self,
method,
url,
body,
headers):
+ body = self.fixtures.load("drs_snapshots.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot_WITH_MIN(self,
+ method,
+ url,
+ body,
+ headers):
body = self.fixtures.load("drs_snapshots_by_min.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_startPreviewSnapshot(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("start_snapshot_preview.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_stopPreviewSnapshot(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("stop_snapshot_preview.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("drs_initiate_failover.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("drs_initiate_failover.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_deleteConsistencyGroup(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("delete_consistency_group.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index 9dc28ff..f2c8eeb 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -271,4 +271,23 @@ def test_create_drs(na_compute_driver, drsdriver):
target_id = nodes[0].id
result = drsdriver.create_consistency_group(
"sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
- assert result is True
\ No newline at end of file
+ assert result is True
+
+
+def test_start_snapshot_preview(drsdriver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ snapshot_id = "87703"
+ result = drsdriver.start_failover_preview(cg_id, snapshot_id)
+ assert result is True
+
+
+def test_stop_snapshot_preivew(drsdriver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = drsdriver.stop_failover_preview(cg_id)
+ assert result is True
+
+
+def test_initiate_failover(drsdriver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = drsdriver.initiate_failover(cg_id)
+ assert result is True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8ed60c7d/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
index ff1dccc..9a2904c 100644
--- a/tests/lib_edit_test.py
+++ b/tests/lib_edit_test.py
@@ -459,6 +459,10 @@ def test_expand_journal(drsdriver):
result = drsdriver.expand_journal(cg_id, expand_by)
assert result is True
+
def test_delete_consistency_group(drsdriver):
- cg_name = "sdk_test_cg"
- pass
+ cg_name = "sdk_test2_cg"
+ cg = drsdriver.list_consistency_groups(name=cg_name)
+ cg_id = cg[0].id
+ result = drsdriver.delete_consistency_group(cg_id)
+ assert result is True
[16/45] libcloud git commit: added listing snapshots,
edited the XmlToDictConfig class to handle XML from snapshots,
added integrations test, and a fixture for unit tests
Posted by an...@apache.org.
added listing snapshots, edited the XmlToDictConfig class to handle XML from snapshots, added integrations test, and a fixture for unit tests
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3d3289dc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3d3289dc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3d3289dc
Branch: refs/heads/trunk
Commit: 3d3289dcc953ba302eadd89649ab6a29e1a34248
Parents: 62e0aaf
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Nov 2 17:00:02 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Nov 2 17:00:02 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 15 ++++++++++-----
libcloud/drs/drivers/nttcis.py | 17 +++++++++++++++++
.../test/drs/fixtures/nttcis/drs_snapshots.xml | 14 ++++++++++++++
tests/lib_list_test.py | 9 ++++++++-
4 files changed, 49 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3d3289dc/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 390b85e..a26695a 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -2110,6 +2110,7 @@ class XmlDictConfig(dict):
else:
self.update(dict(parent_element.items()))
+ c_elems = parent_element.items()
for element in parent_element:
if len(element) > 0:
# treat like dict - we assume that if the first two tags
@@ -2134,13 +2135,18 @@ class XmlDictConfig(dict):
# good idea -- time will tell. It works for the way we are
# currently doing XML configuration files...
elif element.items():
+ items = element.items()
# It is possible to have duplicate element tags. If so, convert to a dict of lists
+ i = element.tag.split('}')[1]
if element.tag.split('}')[1] in self:
- tmp_list = list()
- tmp_dict = dict()
+
+ t = type(self[element.tag.split('}')[1]])
if isinstance(self[element.tag.split('}')[1]], list):
- tmp_list.append(element.tag.split('}')[1])
+ self[element.tag.split('}')[1]].append(dict(element.items()))
+ #tmp_list.append(element.tag.split('}')[1])
else:
+ tmp_list = list()
+ tmp_dict = dict()
for k, v in self[element.tag.split('}')[1]].items():
if isinstance(k, XmlListConfig):
tmp_list.append(k)
@@ -2148,8 +2154,7 @@ class XmlDictConfig(dict):
tmp_dict.update({k: v})
tmp_list.append(tmp_dict)
tmp_list.append(dict(element.items()))
- print()
- self[element.tag.split('}')[1]] = tmp_list
+ self[element.tag.split('}')[1]] = tmp_list
else:
self.update({element.tag.split('}')[1]: dict(element.items())})
# finally, if there are no child tags and no attributes, extract
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3d3289dc/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index a2a66a4..49d1986 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -104,9 +104,26 @@ class NttCisDRSDriver(Driver):
cg = self._to_process(response)
return cg
+ def list_consistency_group_snapshots(self, consistency_group_id):
+ params = {"consistencyGroupId": consistency_group_id}
+ paged_result = self.connection.request_with_orgId_api_2(
+ 'consistencyGroup/snapshot',
+ method='GET',
+ params=params
+ ).object
+ snapshots = self._to_process(paged_result)
+ return snapshots
+
def _to_consistency_groups(self, object):
cgs = findall(object, 'consistencyGroup', TYPES_URN)
return [self._to_process(el) for el in cgs]
+ def _to_snapshots(self, object):
+ elem = findall(object, "consistencyGroupSnapshots", TYPES_URN)
+ snapshots = []
+ for element in object.findall(fixxpath("snapshot", TYPES_URN)):
+ snapshots.append(self._to_process(element))
+ return snapshots
+
def _to_process(self, element):
return process_xml(ET.tostring(element))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3d3289dc/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
new file mode 100644
index 0000000..5386f46
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="1013" journalUsageGb="0.22" protectionWindow="P0Y0M2DT1H48M45.532S" predictedProtectionWindow="P23Y1M15DT11H1M58.309S">
+ <snapshot id="297700" createTime="2018-11-02T14:00:13.271-04:00" sizeKb="0"/>
+ <snapshot id="297695" createTime="2018-11-02T14:00:10.219-04:00" sizeKb="2"/>
+ <snapshot id="297650" createTime="2018-11-02T13:59:42.780-04:00" sizeKb="7"/>
+ <snapshot id="297488" createTime="2018-11-02T13:58:05.255-04:00" sizeKb="188"/>
+ <snapshot id="297235" createTime="2018-11-02T13:56:27.697-04:00" sizeKb="29"/>
+ <snapshot id="296911" createTime="2018-11-02T13:53:12.913-04:00" sizeKb="14"/>
+ <snapshot id="296591" createTime="2018-11-02T13:49:57.857-04:00" sizeKb="14"/>
+ <snapshot id="296271" createTime="2018-11-02T13:46:42.980-04:00" sizeKb="14"/>
+ <snapshot id="295951" createTime="2018-11-02T13:43:27.903-04:00" sizeKb="14"/>
+ <snapshot id="295631" createTime="2018-11-02T13:40:12.811-04:00" sizeKb="14"/>
+ <snapshot id="295311" createTime="2018-11-02T13:36:57.691-04:00" sizeKb="14"/>
+</consistencyGroupSnapshots>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3d3289dc/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 77b50cd..0563f9a 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -401,4 +401,11 @@ def test_get_consistency_group(drsdriver):
cgs = drsdriver.list_consistency_groups()
cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
cg = drsdriver.get_consistency_group(cg_id)
- assert hasattr(cg, 'description')
\ No newline at end of file
+ assert hasattr(cg, 'description')
+
+
+def test_get_snapshots(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
+ snaps = drsdriver.list_consistency_group_snapshots(cg_id)
+ print(cg_id)
\ No newline at end of file
[35/45] libcloud git commit: removed changes made and will create new
branch
Posted by an...@apache.org.
removed changes made and will create new branch
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/aa6ad8f5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/aa6ad8f5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/aa6ad8f5
Branch: refs/heads/trunk
Commit: aa6ad8f559ec0435adc18913c804c10d70c35e9a
Parents: ec05af9
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Nov 26 17:32:11 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Nov 26 17:32:11 2018 -0500
----------------------------------------------------------------------
libcloud/common/nttcis.py | 55 +++++++++++++++++++++++++++----
libcloud/compute/drivers/nttcis.py | 29 +++-------------
libcloud/test/compute/test_nttcis.py | 13 --------
3 files changed, 54 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa6ad8f5/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index aac16fa..faf6650 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -1965,14 +1965,25 @@ def processor(mapping, name=None):
Closure that keeps the deepcopy of the original dict
converted to XML current.
:param mapping: The converted XML to dict/lists
+ :type mapping: ``dict``
:param name: (Optional) what becomes the class name if provided
+ :type: ``str``
:return: Nothing
"""
mapping = mapping
-
+ # the map_copy will have keys deleted after the key and value are processed
map_copy = deepcopy(mapping)
def add_items(key, value, name=None):
+ """
+ Add items to the global attr dict, then delete key, value from map copy
+ :param key: from the process function becomes the attribute name
+ :type key: ``str``
+ :param value: The value of the property and may be a dict
+ :type value: ``str``
+ :param name: Name of class, often same as key
+ :type: name" ``str``
+ """
if name in attrs:
attrs[name].update({key: value})
elif name is not None:
@@ -2033,7 +2044,6 @@ def processor(mapping, name=None):
tmp_list = [build_class(k.capitalize(), i)
for i in v]
tmp[k] = tmp_list
- print()
elif isinstance(v, str):
tmp.update({k: v})
return tmp
@@ -2042,7 +2052,12 @@ def processor(mapping, name=None):
klass = class_factory(key.capitalize(), value)
return klass(value)
- def process(mapping, name):
+ def process(mapping):
+ """
+ This function is recursive, creating attributes for the class factory.
+ :param mapping: the dictionary converted from XML
+ :return: itself (recursive)
+ """
for k1, v1 in mapping.items():
if isinstance(v1, Mapping):
types = [type(v) for v in v1.values()]
@@ -2075,11 +2090,21 @@ def processor(mapping, name=None):
if len(map_copy) == 0:
return 1
- return process(mapping, name)
+ return process(mapping)
def class_factory(cls_name, attrs):
-
+ """
+ This class takes a name and a dictionary to create a class.
+ The clkass has an init method, an iter for retrieving properties,
+ and, finally, a repr for returning the instance
+ :param cls_name: The name to be tacked onto the suffix NttCis
+ :type cls_name: ``str``
+ :param attrs: The attributes and values for an instance
+ :type attrs: ``dict``
+ :return: a class that inherits from ClassFactory
+ :rtype: ``ClassFactory``
+ """
def __init__(self, *args, **kwargs):
for key in attrs:
setattr(self, key, attrs[key])
@@ -2104,6 +2129,10 @@ def class_factory(cls_name, attrs):
class XmlListConfig(list):
+ """
+ Creates a class from XML elements that make a list. If a list of
+ XML elements with attributes, the attributes are passed to XmlDictConfig.
+ """
def __init__(self, elem_list):
for element in elem_list:
if element is not None:
@@ -2126,7 +2155,11 @@ class XmlListConfig(list):
class XmlDictConfig(dict):
-
+ """
+ Inherits from dict. Looks for XML elements, such as attrib, that
+ can be converted to a dictionary. Any XML element that contains
+ other XML elements, will be passed to XmlListConfig
+ """
def __init__(self, parent_element):
if parent_element.items():
if 'property' in parent_element.tag:
@@ -2187,6 +2220,16 @@ class XmlDictConfig(dict):
def process_xml(xml):
+ """
+ Take the xml and put it into a dictionary. The process the dictionary
+ recursively. This returns a class based on the XML API. Thus, properties
+ will have the camel case found in the Java XML. This a trade-off
+ to reduce the number of "static" classes that all have to be synchronized
+ with any changes in the API.
+ :param xml: The serialized version of the XML returned from Cloud Control
+ :return: a dynamic class that inherits from ClassFactory
+ :rtype: `ClassFactory`
+ """
global attrs
tree = etree.parse(BytesIO(xml))
root = tree.getroot()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa6ad8f5/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index c788124..9810958 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -52,7 +52,6 @@ from libcloud.common.nttcis import NttCisTagKey
from libcloud.common.nttcis import NttCisTag
from libcloud.common.nttcis import API_ENDPOINTS, DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
-from libcloud.common.nttcis import process_xml
from libcloud.common.nttcis import NETWORK_NS, GENERAL_NS
from libcloud.utils.py3 import urlencode, ensure_string
from libcloud.utils.xml import fixxpath, findtext, findall
@@ -864,19 +863,6 @@ class NttCisNodeDriver(NodeDriver):
driver=self.connection.driver),
]
- def list_geographic_regions(self, params={}):
- """
- Return all geographic regions available to the organization
-
- :return: List of regions
- :rtype: ``list`` of :class:`NttCisGeographicregion`
- """
- return self._to_geographic_regions(
- self.connection.request_with_orgId_api_2(
- "infrastructure/geographicRegion",
- method="GET",
- params=params).object)
-
def list_locations(self, ex_id=None):
"""
List locations (datacenters) available for instantiating servers and
@@ -4989,7 +4975,11 @@ class NttCisNodeDriver(NodeDriver):
return locations
def _to_location(self, element):
- return process_xml(ET.tostring(element))
+ l = NodeLocation(id=element.get('id'),
+ name=findtext(element, 'displayName', TYPES_URN),
+ country=findtext(element, 'country', TYPES_URN),
+ driver=self)
+ return l
def _to_cpu_spec(self, element):
return NttCisServerCpuSpecification(
@@ -5060,15 +5050,6 @@ class NttCisNodeDriver(NodeDriver):
}
- def _to_geographic_regions(self, object):
- regions = []
- for region in object.findall(fixxpath('geographicRegion', TYPES_URN)):
- regions.append(self._to_geographic_region(region))
- return regions
-
- def _to_geographic_region(self, el):
- return process_xml(ET.tostring(el))
-
def _to_ipv4_addresses(self, object):
ipv4_address_elements = object.findall(fixxpath('ipv4', TYPES_URN))
return [self._to_ipv4_6_address(el) for el in ipv4_address_elements]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa6ad8f5/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index 9068edd..cff7094 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -61,12 +61,6 @@ def test_list_locations_response(driver):
assert first_loc.country == 'US'
-def test_list_geograhic_regions(driver):
- ret = driver.list_geographic_regions()
- assert isinstance(ret, list)
- assert ret[7].isHome == 'true'
-
-
def test_list_nodes_response(driver):
NttCisMockHttp.type = None
ret = driver.list_nodes()
@@ -2900,11 +2894,4 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load(
'deploy_customised_server.xml'
)
- return httplib.OK, body, {}, httplib.responses[httplib.OK]
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_geographicRegion(
- self, method, url, body, headers):
- body = self.fixtures.load(
- 'geographic_regions.xml'
- )
return httplib.OK, body, {}, httplib.responses[httplib.OK]
\ No newline at end of file
[28/45] libcloud git commit: added ssl cert chain imports,
listing cert chains,
get a cert chain. Created fixtures and pytest tests for certs
Posted by an...@apache.org.
added ssl cert chain imports, listing cert chains, get a cert chain. Created fixtures and pytest tests for certs
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e347241
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e347241
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e347241
Branch: refs/heads/trunk
Commit: 9e3472417fe01a0638c53c18697bf8cd1e906124
Parents: 35131c8
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Nov 19 16:15:17 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Nov 19 16:15:17 2018 -0500
----------------------------------------------------------------------
libcloud/common/nttcis.py | 21 +++
libcloud/drs/drivers/nttcis.py | 42 ++----
libcloud/loadbalancer/drivers/nttcis.py | 146 +++++++++++++++----
libcloud/test/compute/test_nttcis.py | 2 +
.../test/loadbalancer/fixtures/nttcis/alice.crt | 23 +++
.../test/loadbalancer/fixtures/nttcis/alice.key | 32 ++++
.../test/loadbalancer/fixtures/nttcis/chain.crt | 47 ++++++
.../test/loadbalancer/fixtures/nttcis/denis.crt | 124 ++++++++++++++++
.../test/loadbalancer/fixtures/nttcis/denis.key | 51 +++++++
.../loadbalancer/fixtures/nttcis/get_cert.xml | 9 ++
.../fixtures/nttcis/ssl_cert_by_name.xml | 11 ++
.../fixtures/nttcis/ssl_cert_list.xml | 19 +++
.../fixtures/nttcis/ssl_get_cert_chain.xml | 9 ++
.../fixtures/nttcis/ssl_import_cert_chain.xml | 7 +
.../nttcis/ssl_list_cert_chain_by_name.xml | 11 ++
libcloud/test/loadbalancer/test_nttcis.py | 40 ++++-
tests/lib_create_test.py | 14 +-
tests/lib_list_test.py | 29 +++-
18 files changed, 575 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 2908dfc..aac16fa 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -16,6 +16,8 @@
NTTCIS Common Components
"""
import xml.etree.ElementTree as etree
+import re
+import functools
from copy import deepcopy
from base64 import b64encode
from time import sleep
@@ -291,6 +293,25 @@ BAD_MESSAGE_XML_ELEMENTS = (
)
+def get_params(func):
+ @functools.wraps(func)
+ def paramed(*args, **kwargs):
+ if kwargs:
+ for k, v in kwargs.items():
+ old_key = k
+ matches = re.findall(r'_(\w)', k)
+ for match in matches:
+ k = k.replace('_' + match, match.upper())
+ del kwargs[old_key]
+ kwargs[k] = v
+ params = kwargs
+ result = func(args[0], params)
+ else:
+ result = func(args[0])
+ return result
+ return paramed
+
+
def dd_object_to_id(obj, obj_type, id_value='id'):
"""
Takes in a DD object or string and prints out it's id
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index c5695d1..3c88bbe 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -4,33 +4,13 @@ from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
-from libcloud.common.nttcis import process_xml
+from libcloud.common.nttcis import process_xml, get_params
from libcloud.drs.types import Provider
from libcloud.drs.base import DRSDriver
from libcloud.common.nttcis import TYPES_URN
from libcloud.utils.xml import fixxpath, findtext, findall
-def get_params(func):
- @functools.wraps(func)
- def paramed(*args, **kwargs):
-
- if kwargs:
- for k, v in kwargs.items():
- old_key = k
- matches = re.findall(r'_(\w)', k)
- for match in matches:
- k = k.replace('_' + match, match.upper())
- del kwargs[old_key]
- kwargs[k] = v
- params = kwargs
- result = func(args[0], params)
- else:
- result = func(args[0])
- return result
- return paramed
-
-
class NttCisDRSDriver(DRSDriver):
"""
NttCis DRS driver.
@@ -116,16 +96,16 @@ class NttCisDRSDriver(DRSDriver):
"""
Functions takes a named parameter that must be one of the following
:param params: A dictionary composed of one of the following keys
- and a value
- * target_data_center_id=
- * source_network_domain_id=
- * target_network_domain_id=
- * source_server_id=
- * target_server_id=
- * name=
- * state=
- * operation_status=
- * drs_infrastructure_status=
+ 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`
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 690ecf8..da2165a 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import OpenSSL.crypto
-import functools
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import NttCisPool
@@ -28,7 +27,7 @@ from libcloud.common.nttcis import NttCisDefaultiRule
from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
-from libcloud.common.nttcis import process_xml
+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
@@ -38,26 +37,6 @@ from libcloud.loadbalancer.base import Member
from libcloud.loadbalancer.types import Provider
-def get_params(func):
- @functools.wraps(func)
- def paramed(*args, **kwargs):
-
- if kwargs:
- for k, v in kwargs.items():
- old_key = k
- matches = re.findall(r'_(\w)', k)
- for match in matches:
- k = k.replace('_' + match, match.upper())
- del kwargs[old_key]
- kwargs[k] = v
- params = kwargs
- result = func(args[0], params)
- else:
- result = func(args[0])
- return result
- return paramed
-
-
class NttCisLBDriver(Driver):
"""
NttCis LB driver.
@@ -779,14 +758,30 @@ class NttCisLBDriver(Driver):
status=State.RUNNING
)
- def import_ssl_cert(self, network_domain_id, name, crt_file, key_file,
+ def ex_import_ssl_cert(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``
+ :param name: The name of the ssl certificate
+ :type ``str``
+ :param crt_file: The complete path to the certificate file
+ :type ``str``
+ :param key_file: The complete pathy to the key file
+ :type ``str``
+ :param description: (Optional) A description of the certificate
+ :type ``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).decode(encoding='utf-8')
+ key = OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, k)\
+ .decode(encoding='utf-8')
cert_elem = ET.Element("importSslDomainCertificate", {"xmlns": TYPES_URN})
ET.SubElement(cert_elem, "networkDomainId").text = network_domain_id
ET.SubElement(cert_elem, "name").text = name
@@ -801,6 +796,38 @@ class NttCisLBDriver(Driver):
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
+ :param network_domain_id: The Network Domain's Id.
+ :type ``str``
+ :param name: The name of the ssl certificate chain
+ :type ``str``
+ :param crt_file: The complete path to the certificate chain file
+ :type ``str``
+ :param description: (Optional) A description of the certificate chain
+ :type ``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")\
+ .text = network_domain_id
+ ET.SubElement(cert_chain_elem, "name").text = name
+ if description is not None:
+ ET.SubElement(cert_chain_elem, "description").text = description
+ ET.SubElement(cert_chain_elem, "certificateChain").text = cert
+ result = self.connection.request_with_orgId_api_2(
+ "networkDomainVip/importSslCertificateChain",
+ method="POST",
+ data=ET.tostring(cert_chain_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
@@ -1095,12 +1122,72 @@ class NttCisLBDriver(Driver):
@get_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 dictionary composed of one of the following keys
+ and a value
+ * id=
+ * network_domain_id=
+ * name=
+ * state=
+ * create_time=
+ * expiry_time=
+ * state=
+ :return: `list` of :class: `NttCisdomaincertificate`
+ """
result = self.connection.request_with_orgId_api_2(
action="networkDomainVip/sslDomainCertificate",
params=params,
method="GET").object
return self._to_certs(result)
+ def ex_get_ssl_domain_cert(self, cert_id):
+ """
+ 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
+ """
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslDomainCertificate/%s" % cert_id,
+ method="GET").object
+ return self._to_cert(result)
+
+ @get_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 dictionary composed of one of the following keys
+ and a value
+ * id=
+ * network_domain_id=
+ * name=
+ * state=
+ * create_time=
+ * expiry_time=
+ * state=
+ :return: `list` of :class: `NttCissslcertficiatechain`
+ """
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslCertificateChain",
+ params=params,
+ method="GET").object
+ return self._to_certificate_chains(result)
+
+ def ex_get_ssl_certificate_chain(self, chain_id):
+ """
+ Function gets the certificate chain by id. Use this if only if the id
+ is already known
+ :param cert_id: The id of the specific cert
+ :return: :class: `NttCiscertificatechain
+ """
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslCertificateChain/%s" % chain_id,
+ method="GET").object
+ return self._to_certificate_chain(result)
+
def _to_irules(self, object):
irules = []
matches = object.findall(
@@ -1297,3 +1384,12 @@ class NttCisLBDriver(Driver):
def _to_cert(self, el):
return process_xml(ET.tostring(el))
+
+ def _to_certificate_chains(self, object):
+ cert_chains = []
+ for element in object.findall(fixxpath("sslCertificateChain", TYPES_URN)):
+ cert_chains.append(self._to_certificate_chain(element))
+ return cert_chains
+
+ def _to_certificate_chain(self, el):
+ return process_xml(ET.tostring(el))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index d5c7b6b..cff7094 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -424,6 +424,7 @@ def test_create_node_primary_ipv4(driver):
assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
assert node.extra['status'].action == 'DEPLOY_SERVER'
+
def test_create_node_both_primary_nic_and_vlan_fail(driver):
rootPw = NodeAuthPassword('pass123')
image = driver.list_images()[0]
@@ -517,6 +518,7 @@ def test_create_node_ipv4_gateway(driver):
assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
assert node.extra['status'].action == 'DEPLOY_SERVER'
+
def test_create_node_network_domain_no_vlan_no_ipv4_fail(driver):
rootPw = NodeAuthPassword('pass123')
image = driver.list_images()[0]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/alice.crt
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/alice.crt b/libcloud/test/loadbalancer/fixtures/nttcis/alice.crt
new file mode 100755
index 0000000..bc545a9
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/alice.crt
@@ -0,0 +1,23 @@
+Bag Attributes
+ friendlyName: alice
+ localKeyID: 17 FC F8 5F A1 F3 12 5E 62 D7 49 EE 47 2B FF 78 4D 22 F7 C1
+subject=/CN=alice/C=US
+issuer=/CN=SdkCA/C=US
+-----BEGIN CERTIFICATE-----
+MIIC3zCCAcegAwIBAgIBAjANBgkqhkiG9w0BAQsFADAdMQ4wDAYDVQQDDAVTZGtD
+QTELMAkGA1UEBhMCVVMwHhcNMTgxMTE2MTg1NTI0WhcNMTkxMTE2MTg1NTI0WjAd
+MQ4wDAYDVQQDDAVhbGljZTELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQCusa3hl3F38gjj0u220zZ216wdrOIC+seGSIww9aLQ4B3a
+Mt7Q4isOzyJbqpuJvsVxhEQXQGO1G4ApgfvLkSJTV5p9aoyo0NQKa+42wPKGnBq3
+ekBLPVywcBXU08jXoVv8DeyWdxBA677Ev69mK86skI9uxZXrTp/0CVHuhO1REgf3
+TRT9PRRcO+IuXvjVYk6juFl5nkgZ+IyjGDUy/Y3XpiWgpBl1vowiF/pyXEz+taQ6
+Kug5+uVpISPLlocgayxVRYuf8N8Hzxcqa1pEbfwXAn31AzWKvU7DIrIcsG4jo1uv
+vWJqpQHmzSQtP3Pk/eC4CO4RsMB8A6S2TXVLd9cXAgMBAAGjKjAoMA4GA1UdDwEB
+/wQEAwIHgDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQsFAAOC
+AQEACE7tRLKvIgeMr87r8jhcKmaiE1OQXDNNnd8ywknptQbk3aa0K53c88fQYCPd
+W1yusJVaI3lmAnt3tNtBB1Dzv8D46jBWQ8EWyvpl1bm1nH5ja+cSxlEw5y3cBf8j
+McyEl86PMakX3gVr2KCpMntnq5w0rni/XMMcV5XXJYzY7g/AUIsyF92iUEhYcfWL
+NggjBHvjXhV8lCtztDs/w9S1k1buSlUlbb08G/2eWGvfMC44y2BMFAWAxN7TSXCc
+VGEo9Jfd2jJfqVf6B9jQu+BXcEIHY9zrqXsVFbHE6wIKjSIn0Bk4k8n8ZcR0EqRR
+mhjLBM2mghvfRRxekqE/WN8uIQ==
+-----END CERTIFICATE-----
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/alice.key
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/alice.key b/libcloud/test/loadbalancer/fixtures/nttcis/alice.key
new file mode 100755
index 0000000..69ab352
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/alice.key
@@ -0,0 +1,32 @@
+Bag Attributes
+ friendlyName: alice
+ localKeyID: 17 FC F8 5F A1 F3 12 5E 62 D7 49 EE 47 2B FF 78 4D 22 F7 C1
+Key Attributes: <No Attributes>
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCusa3hl3F38gjj
+0u220zZ216wdrOIC+seGSIww9aLQ4B3aMt7Q4isOzyJbqpuJvsVxhEQXQGO1G4Ap
+gfvLkSJTV5p9aoyo0NQKa+42wPKGnBq3ekBLPVywcBXU08jXoVv8DeyWdxBA677E
+v69mK86skI9uxZXrTp/0CVHuhO1REgf3TRT9PRRcO+IuXvjVYk6juFl5nkgZ+Iyj
+GDUy/Y3XpiWgpBl1vowiF/pyXEz+taQ6Kug5+uVpISPLlocgayxVRYuf8N8Hzxcq
+a1pEbfwXAn31AzWKvU7DIrIcsG4jo1uvvWJqpQHmzSQtP3Pk/eC4CO4RsMB8A6S2
+TXVLd9cXAgMBAAECggEBAKiZvVrTgeSkiOXwhhKESLVsM6Y0W7FKfdThIcSC3c+/
+7a/QlvF8xte1G9DimNjZcM+9OsZCE7kQQKJO3Eg826caDnVqpzSqz2r7fd4EXE2E
+Tdi0uWakY1e55agRem56Qj/C5IrXgK1XmTdkVRFDyGUN5BChy65dpMyvTg7o5e3t
+49G+M4/jLH5Lqqv8Y95wkV5q39JIDYbQyW9EOD0arp58DCQV0xuWS3YV3SgQbqHW
++PCVlyoAfhvacSgxQHKVwfLhzl+uR78neLF6CqnF3HaUnwTto/Tg9oiktKcik5ey
+DLQ21x+Z6CaOw6nGQc63c/P7M3oOmPH00lF8IOdjq7kCgYEA13586FGGpaQsOCtD
+4ixH/IwkIk4fsCVTvQ7ppm5LV4sCS2V5qXK0WiFpdXJd7Wp6wPp2StzGJXa0pOtb
+bzLQPNoWJPG1KEjmiRDs+OFannsKa1EA+3JmKaLHtSQqYSQt8hip8Lrt8AdK8gZy
+H60M1k5GzpNgnpX/OzP7iY5BWaUCgYEAz4fn3dX1ydbp4ti+7jlYXAdIhUur7MPD
+MYRNKGSXfAKzNreKn1gbEpj8owP6WPLGKZskOMv4w2j9O8OR3MS40KVQsI0ZTzuJ
+wRSW3tcGyyhU1P0rZa/qJMrDyRJyMxUfIQtIIJZnG2P+1GJQm2VHdAsol6eWd7E9
+km5FhrgCeQsCgYBiQYA+hX25ZQPskH2hUMN5+YQ4SBrWvA5Uc8pBYqTjw7RGIHy6
+sFxfhECLlpwRNq3F8+2f8M5AIsH3OIE2UJr2RBI4wiTxu1uyP49tY4NoI336tLKX
+8+91KI2aoGTaah6w9mH2K6V1/j1D4YCDxOnHhWVvp280n/wCSI92hvBxKQKBgHd0
+V/91t7uNbCT587S152lZe+HV88kdyY4IBE2a0SM9fqChNzaPBU5IJytCD+kBHRU3
+yrqylacNGK483QnBZkway/5DyWy07Y7o5gqwpKVtup66dy9Z+aFh4R4s8vT6VGe1
+0beIOyMmBLmFObaorl9aSOw6N77/k1xlAroP0sSPAoGBAJLCF24ouFYKtGqdAU1c
+uxuhGd+R5eS/+NbejwgWC8xn2vE6xIACqXlpBd3291fkv+gTV9kkhASysvr6zbWm
+coRqw/epAa9tvCa/+lA2N8VsJjVEoFTWUduBMrbl6lfvZpHhrBgcNY2nmMiADu4s
+NoKpFsHFVOjR8LxV6O7WQoFp
+-----END PRIVATE KEY-----
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/chain.crt
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/chain.crt b/libcloud/test/loadbalancer/fixtures/nttcis/chain.crt
new file mode 100644
index 0000000..122958e
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/chain.crt
@@ -0,0 +1,47 @@
+Bag Attributes
+ friendlyName: ted
+ localKeyID: 8F 9E 3A 57 A1 4A E5 7C A9 36 0E DE E2 CE 1C 69 15 F0 91 9A
+subject=/CN=ted/C=US
+issuer=/CN=SdkCA/C=US
+-----BEGIN CERTIFICATE-----
+MIIC3TCCAcWgAwIBAgIBBTANBgkqhkiG9w0BAQsFADAdMQ4wDAYDVQQDDAVTZGtD
+QTELMAkGA1UEBhMCVVMwHhcNMTgxMTE5MDAyMTMwWhcNMTkxMTE5MDAyMTMwWjAb
+MQwwCgYDVQQDDAN0ZWQxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAxtoIwKV70myxiAtT/k+L3klqUZ/G6Hp7CV01ixUH7r4mW0Fh
+gYZRZoPZ+9tNWnkizKnG8QNQjLaARJTtnLd2Vl1auPeXMVPobboz/9Dh5RhTLi26
+7LSmNozWacPbv3nExObUDTxaLpqs6ZGL/ngfgqJJJ24g/Ku/ZRFanH0HJvaiRBCQ
+CPW5ZrikUBB5SC/7XPw9UWBQH+yD9s+PJCUD7VUzM/sLU5USn7PKkK0EJW3pQArR
+46J+c2VkJexbCxdZ9BAF1gbB8GqGPbyI73gpCasZ6/xL56kbjQnqSMwn1CSIlNz7
++uU/DF3/Ne87qAIr50FGZ/L2EsSS2takIPDMRwIDAQABoyowKDAOBgNVHQ8BAf8E
+BAMCB4AwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEB
+ABHtRAqvsLwHqFAfj0PcocVPxFa0isZ0K+3YxgG5Ut8Jk02VNZAxwsZSPB2a1U53
+rc27VYejWLyv2LB2WX/4wFje6NMrPMoAEGOSrbfrjUUYD5doNwIAxgQC3et+XH3u
+aqYJh0UEj2CV6r/HAjhxkdtpcXh1QOv0zYx5WbZD6QbBw9sYnitpXK+O5gOv0kh+
+6850FBn58DuKjc5IKbm3DhNaVtEVgTW80nEbk4/sxZ6PSZI0T9PhlHbDILLV/YIE
+UjviE24E18N+uuLFefF6aor/nrTyIPr7Yh8niJ4WJWY+D7nOtOXUp/b8jvtDYSTc
+hHz1swjcoADLnN6my2Z9VMs=
+-----END CERTIFICATE-----
+
+Bag Attributes
+ friendlyName: carol
+ localKeyID: DB 22 50 DE 8E 47 7D FA D6 51 85 89 8C AD B6 9B 6E 23 40 6E
+subject=/CN=carol/C=US
+issuer=/CN=SdkCA/C=US
+-----BEGIN CERTIFICATE-----
+MIIC3zCCAcegAwIBAgIBBDANBgkqhkiG9w0BAQsFADAdMQ4wDAYDVQQDDAVTZGtD
+QTELMAkGA1UEBhMCVVMwHhcNMTgxMTE5MDAxMTQ5WhcNMTkxMTE5MDAxMTQ5WjAd
+MQ4wDAYDVQQDDAVjYXJvbDELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQC0Pyk2+vc3M9nB/7mjPueTzM5bf+JrzGumiVQ3zB+Ub9tY
+GIaXs5OebSx6B/8G/AC1M0ohr/Id62se9E9OLU+/vhsoFNWpEKDic63L1lxMpZLw
+eqjUNdgp/d4sNkFucSkQLIGMc0lyzzjtooerTci+kLVAzilx1ys7tOHZdF2i3xsG
+OLjEs+0JjgKB/go4E4fO9O8Se016QbYlSKaBhMZl3lI5IzOFPshLk54FBCz+Xkmn
+uyElHGMvUCf7jfPd/tYODiHXo5kVrB9wGwAd45VTNa7Uy8YsnlvsQ65VkrMa/ihP
+YSHb6K3MkwsZvmeP0LeIjH10v0UZawXagdmRHoR9AgMBAAGjKjAoMA4GA1UdDwEB
+/wQEAwIHgDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQsFAAOC
+AQEArBYvQ494XYc9T+oj34R8Kt5COBpnG0gRjRd10s5wKki3CrArohvWrSt1HdhN
+xYKpWNP5Lx8fsQKNZMfPshzfiBVaJUisE1zh9aITeCOGIRLivLEn+z23LHT9qZZt
+VprL+WfJUlhbS/w2RUp+3FRbl09BGldqYdFXQU3uWepLsOiqHhLsdeaYywKJLAoX
+fXjI0w43emzpcnFxTHwrGMhgfgTKZ2quFpObRb73Irv9t/l2rlKU5URXZ4WE7fuF
+9OqNI1KkxxxhOelQIvo9SPn2sL+B+bnLghqky7FMJ8zeyP8W57yike7aqlYnHZtY
+64so6za/q+LlDMsmFqVlkAPYtg==
+-----END CERTIFICATE-----
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/denis.crt
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/denis.crt b/libcloud/test/loadbalancer/fixtures/nttcis/denis.crt
new file mode 100755
index 0000000..31dd2c0
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/denis.crt
@@ -0,0 +1,124 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4 (0x4)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=FR, ST=Alsace, L=Strasbourg, O=Freelan, CN=ca/emailAddress=contact@freelan.org
+ Validity
+ Not Before: May 5 12:48:56 2012 GMT
+ Not After : May 3 12:48:56 2022 GMT
+ Subject: C=FR, ST=Alsace, O=Freelan, CN=denis/emailAddress=contact@freelan.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (4096 bit)
+ Modulus:
+ 00:ba:89:22:1e:b2:60:d8:f0:82:ef:ee:14:67:79:
+ 47:f4:00:40:62:e7:81:3b:43:62:05:e5:13:e2:30:
+ f0:97:6f:47:b3:fc:f9:09:74:3c:7a:c8:23:fa:33:
+ a1:9f:be:7c:72:92:b4:75:f7:83:2f:83:18:79:22:
+ d9:9d:f7:ed:d7:f0:25:6b:03:89:b1:0e:6f:6c:91:
+ fd:c7:b1:f0:d8:3a:f9:85:ff:94:1b:cd:02:e9:e6:
+ f4:2d:5e:c6:8f:f7:8c:13:da:5a:84:9e:f3:38:a9:
+ e7:5c:54:79:74:99:20:53:82:d5:ae:d9:9d:04:f4:
+ 01:9c:53:73:0f:20:b6:d8:fc:89:ac:71:9c:3b:6f:
+ 1c:db:fa:b2:7f:12:03:6e:55:3f:b6:cf:8b:59:24:
+ bd:44:72:e8:b6:03:bc:29:40:6d:54:a8:df:67:5f:
+ 45:e5:98:ac:dc:15:85:26:a0:69:ab:4b:41:64:e2:
+ 1f:59:87:ce:99:2d:3b:8e:f0:94:04:a3:b1:9e:75:
+ 31:c9:a5:84:6d:39:cb:ce:36:10:d4:7c:c9:93:68:
+ 4e:a9:60:fd:c1:29:cc:86:f1:05:4e:71:25:10:25:
+ 20:bc:36:db:40:89:32:4b:20:0e:58:25:96:59:0e:
+ 05:63:71:06:4c:7c:58:f6:3c:3e:9c:9f:5b:74:3f:
+ f3:80:78:78:b1:6c:d9:01:64:c4:4f:55:f0:c6:7d:
+ 18:1c:b6:ca:0f:d2:70:cd:77:a1:9c:28:cb:d0:1e:
+ ce:42:c0:8f:93:4d:84:55:8c:4c:81:6f:ff:fe:f3:
+ 99:a4:7d:f0:70:a5:19:0b:a2:9d:39:18:93:84:e1:
+ 82:bf:d9:cd:72:ed:46:68:44:19:cf:6e:88:88:64:
+ 3b:fb:23:c7:66:f9:af:be:9e:a7:ac:a0:90:f9:1f:
+ d3:16:3d:53:7a:03:73:d2:c9:3f:37:1b:a1:c6:c1:
+ 3a:06:a8:03:f5:a0:14:2e:8f:69:d4:3d:14:ba:20:
+ 96:ae:4f:87:57:f6:3b:76:25:b1:ab:55:3b:ae:96:
+ 5b:94:a9:42:25:3b:f7:b9:23:72:ea:ab:d0:bc:8a:
+ ed:ac:ec:dc:31:04:28:39:59:31:3d:14:96:f7:dc:
+ 8b:d6:b1:65:d2:42:fc:cb:fc:87:a6:4a:1f:0a:11:
+ ef:28:70:11:72:d2:95:3c:7d:b4:17:3c:e2:77:29:
+ 71:64:10:2a:bc:a0:cd:a1:98:69:0d:81:86:da:a7:
+ dc:57:f7:57:af:38:67:bb:83:96:9b:c3:84:ba:2e:
+ 5c:9d:ec:8c:fc:87:1b:27:ac:59:41:8e:03:f8:16:
+ 22:54:27:bb:54:5b:c7:ce:22:ab:2e:5d:bc:34:4c:
+ 14:de:e3
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints:
+ CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
+ X509v3 Subject Key Identifier:
+ 1C:67:E3:2C:25:29:02:00:38:3C:A5:B6:E3:A2:37:9C:8F:A5:DB:34
+ X509v3 Authority Key Identifier:
+ keyid:42:9C:36:BD:CB:2F:F4:D9:5E:AB:2B:18:24:8B:01:2D:42:C2:E1:47
+
+ Signature Algorithm: sha1WithRSAEncryption
+ b2:da:83:96:6b:a4:78:9e:c5:bf:75:f3:0a:32:a5:f0:fb:c3:
+ 1a:58:42:bc:a8:29:1b:ac:b9:f6:cd:d1:a4:7c:e2:76:e2:98:
+ e1:96:8f:1b:ad:86:ee:df:41:74:7f:8a:85:f9:77:92:4d:e8:
+ ca:e5:d5:6b:94:58:72:a1:63:03:f6:a3:8c:c0:6d:6d:53:1c:
+ 9a:38:1c:36:5d:6b:0f:cd:8f:d9:8b:e8:f3:eb:ea:b0:b0:0b:
+ c9:de:4c:0d:7e:06:53:1e:e2:78:fb:4a:40:ab:ac:60:6a:e4:
+ 60:7f:78:e1:5f:a7:5c:8b:a8:8f:fc:c8:7b:70:d5:b1:47:05:
+ 12:e9:2c:49:75:1a:29:dc:38:b4:ec:31:43:14:bd:f9:e6:1c:
+ 87:1f:89:0e:08:93:a7:20:28:4c:c4:b2:4d:51:a1:85:c8:11:
+ 4a:f5:b7:9c:70:0b:1f:1f:85:3b:d2:9c:a5:5e:ef:8a:0e:7e:
+ 83:e6:b3:45:44:2b:2a:7f:a9:a2:cf:4d:64:bb:30:d1:48:ad:
+ 03:b0:90:60:e4:54:63:da:3b:ff:74:e1:33:7a:0a:93:45:6c:
+ 2b:86:a9:85:59:11:0b:2b:5c:79:b2:e2:5b:e6:da:b1:1d:4c:
+ 97:a7:44:d9:2f:4c:f9:50:b9:ed:ae:85:eb:e1:d8:d1:a0:ae:
+ 2b:00:47:81:bb:2a:a5:3d:74:d9:dc:f6:93:f9:8d:fb:be:f3:
+ fe:1f:5e:e9:68:3d:27:98:5a:aa:48:22:a3:b2:63:91:40:94:
+ 39:36:86:3b:58:f8:7b:be:d5:24:51:72:b1:4b:18:9e:fe:21:
+ 82:02:06:eb:d7:41:2a:41:a7:6f:ef:0b:b3:2f:2f:1e:da:6a:
+ d2:de:1f:c3:e4:5a:39:57:4a:da:8e:10:bf:99:54:5b:ca:9e:
+ 0c:e5:4c:ce:26:1b:ae:0a:a9:7e:f2:a7:c3:61:6d:56:9c:db:
+ f5:19:56:93:1d:3a:a8:ca:a2:5d:fe:3e:b9:a0:ee:16:b5:c0:
+ b6:67:89:d3:91:aa:b8:43:d1:b8:3c:31:ae:b4:08:72:95:8d:
+ 77:3e:95:d8:f1:25:7c:95:8d:0d:28:ea:ce:02:a9:91:19:77:
+ e7:3d:03:a1:02:12:cc:3a:91:42:20:9b:b5:57:bc:4b:db:22:
+ 5a:9f:31:5c:f0:e8:8c:7b:77:fe:c0:01:22:7d:c5:73:29:24:
+ a0:1f:41:f2:84:2a:6e:9e:1c:61:13:25:48:56:6b:a9:3f:02:
+ 33:6e:f2:21:c8:63:b6:cb:e5:c0:a4:c0:1c:98:13:9f:78:e1:
+ 2d:b8:dd:12:17:43:ad:ec:fe:f7:78:17:bc:ae:8f:76:36:26:
+ 7e:52:69:0a:5d:55:15:41
+-----BEGIN CERTIFICATE-----
+MIIF0DCCA7igAwIBAgIBBDANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJGUjEP
+MA0GA1UECAwGQWxzYWNlMRMwEQYDVQQHDApTdHJhc2JvdXJnMRAwDgYDVQQKDAdG
+cmVlbGFuMQswCQYDVQQDDAJjYTEiMCAGCSqGSIb3DQEJARYTY29udGFjdEBmcmVl
+bGFuLm9yZzAeFw0xMjA1MDUxMjQ4NTZaFw0yMjA1MDMxMjQ4NTZaMGQxCzAJBgNV
+BAYTAkZSMQ8wDQYDVQQIDAZBbHNhY2UxEDAOBgNVBAoMB0ZyZWVsYW4xDjAMBgNV
+BAMMBWRlbmlzMSIwIAYJKoZIhvcNAQkBFhNjb250YWN0QGZyZWVsYW4ub3JnMIIC
+IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuokiHrJg2PCC7+4UZ3lH9ABA
+YueBO0NiBeUT4jDwl29Hs/z5CXQ8esgj+jOhn758cpK0dfeDL4MYeSLZnfft1/Al
+awOJsQ5vbJH9x7Hw2Dr5hf+UG80C6eb0LV7Gj/eME9pahJ7zOKnnXFR5dJkgU4LV
+rtmdBPQBnFNzDyC22PyJrHGcO28c2/qyfxIDblU/ts+LWSS9RHLotgO8KUBtVKjf
+Z19F5Zis3BWFJqBpq0tBZOIfWYfOmS07jvCUBKOxnnUxyaWEbTnLzjYQ1HzJk2hO
+qWD9wSnMhvEFTnElECUgvDbbQIkySyAOWCWWWQ4FY3EGTHxY9jw+nJ9bdD/zgHh4
+sWzZAWTET1Xwxn0YHLbKD9JwzXehnCjL0B7OQsCPk02EVYxMgW///vOZpH3wcKUZ
+C6KdORiThOGCv9nNcu1GaEQZz26IiGQ7+yPHZvmvvp6nrKCQ+R/TFj1TegNz0sk/
+NxuhxsE6BqgD9aAULo9p1D0UuiCWrk+HV/Y7diWxq1U7rpZblKlCJTv3uSNy6qvQ
+vIrtrOzcMQQoOVkxPRSW99yL1rFl0kL8y/yHpkofChHvKHARctKVPH20Fzzidylx
+ZBAqvKDNoZhpDYGG2qfcV/dXrzhnu4OWm8OEui5cneyM/IcbJ6xZQY4D+BYiVCe7
+VFvHziKrLl28NEwU3uMCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0E
+HxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFBxn4ywl
+KQIAODyltuOiN5yPpds0MB8GA1UdIwQYMBaAFEKcNr3LL/TZXqsrGCSLAS1CwuFH
+MA0GCSqGSIb3DQEBBQUAA4ICAQCy2oOWa6R4nsW/dfMKMqXw+8MaWEK8qCkbrLn2
+zdGkfOJ24pjhlo8brYbu30F0f4qF+XeSTejK5dVrlFhyoWMD9qOMwG1tUxyaOBw2
+XWsPzY/Zi+jz6+qwsAvJ3kwNfgZTHuJ4+0pAq6xgauRgf3jhX6dci6iP/Mh7cNWx
+RwUS6SxJdRop3Di07DFDFL355hyHH4kOCJOnIChMxLJNUaGFyBFK9beccAsfH4U7
+0pylXu+KDn6D5rNFRCsqf6miz01kuzDRSK0DsJBg5FRj2jv/dOEzegqTRWwrhqmF
+WRELK1x5suJb5tqxHUyXp0TZL0z5ULntroXr4djRoK4rAEeBuyqlPXTZ3PaT+Y37
+vvP+H17paD0nmFqqSCKjsmORQJQ5NoY7WPh7vtUkUXKxSxie/iGCAgbr10EqQadv
+7wuzLy8e2mrS3h/D5Fo5V0rajhC/mVRbyp4M5UzOJhuuCql+8qfDYW1WnNv1GVaT
+HTqoyqJd/j65oO4WtcC2Z4nTkaq4Q9G4PDGutAhylY13PpXY8SV8lY0NKOrOAqmR
+GXfnPQOhAhLMOpFCIJu1V7xL2yJanzFc8OiMe3f+wAEifcVzKSSgH0HyhCpunhxh
+EyVIVmupPwIzbvIhyGO2y+XApMAcmBOfeOEtuN0SF0Ot7P73eBe8ro92NiZ+UmkK
+XVUVQQ==
+-----END CERTIFICATE-----
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/denis.key
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/denis.key b/libcloud/test/loadbalancer/fixtures/nttcis/denis.key
new file mode 100755
index 0000000..dee87ac
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/denis.key
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJJwIBAAKCAgEAuokiHrJg2PCC7+4UZ3lH9ABAYueBO0NiBeUT4jDwl29Hs/z5
+CXQ8esgj+jOhn758cpK0dfeDL4MYeSLZnfft1/AlawOJsQ5vbJH9x7Hw2Dr5hf+U
+G80C6eb0LV7Gj/eME9pahJ7zOKnnXFR5dJkgU4LVrtmdBPQBnFNzDyC22PyJrHGc
+O28c2/qyfxIDblU/ts+LWSS9RHLotgO8KUBtVKjfZ19F5Zis3BWFJqBpq0tBZOIf
+WYfOmS07jvCUBKOxnnUxyaWEbTnLzjYQ1HzJk2hOqWD9wSnMhvEFTnElECUgvDbb
+QIkySyAOWCWWWQ4FY3EGTHxY9jw+nJ9bdD/zgHh4sWzZAWTET1Xwxn0YHLbKD9Jw
+zXehnCjL0B7OQsCPk02EVYxMgW///vOZpH3wcKUZC6KdORiThOGCv9nNcu1GaEQZ
+z26IiGQ7+yPHZvmvvp6nrKCQ+R/TFj1TegNz0sk/NxuhxsE6BqgD9aAULo9p1D0U
+uiCWrk+HV/Y7diWxq1U7rpZblKlCJTv3uSNy6qvQvIrtrOzcMQQoOVkxPRSW99yL
+1rFl0kL8y/yHpkofChHvKHARctKVPH20FzzidylxZBAqvKDNoZhpDYGG2qfcV/dX
+rzhnu4OWm8OEui5cneyM/IcbJ6xZQY4D+BYiVCe7VFvHziKrLl28NEwU3uMCAwEA
+AQKCAgARU0FXBoxWOeh/bmZ4wdv7/rX8ObJYFccZ8w/ot1DxT8WiIwHibehcIxCs
+YXVGiAO5BIU8W7PUiuGQBrudn3R41PY0vUxhpIyW0ex3SsCq5LdeScGw31bA8NGH
+EUFyB7T79xDnNngysB0sBzCMstg8yW8dYVrjJeKsaVfLdOdmufXzjU3Me2J70Aoa
+IUsuST60tQwlSHNH00Bn/2rPjgtZjKHLUR8F1yte+aS3VLjbzw6Q1yvAPgvjUD8y
+5Idq8uVBaXMpXnUxS+fxDDZ99eUnCs4bj0WiVkaH1gT/JyUhHcGvmYy9rsB8F8sd
+RshzFwlLFilWm0oL/MZ395kf7/ymriBdEg/q0qbtuTlRIivxO2eAhv4apP++KzdQ
+eP5/xPOd+/oUVP3K3tyqAphRB25l4IPV55Ou5EEbhCzoM/JwvQ+X1D8hURNj55Ci
+HwrCOJPXcYaBIxgSxWNFw+fgeM98jw2KXlMUQDl5nLposdGBsOPAV1HTRR5jEbit
+k26p2trdsZsAvi19fOaVf9rneis+8RUwtuf57amLnc5M+4eg63t98ULZOGsipuFg
+CTjbNaE/gqRIhplvSrZOry00ykE/e81SkFiwEbbJWzM3Vmlm6LSmwij2czK1SSDM
+f2OYDr4E/CjFym4EliR9w2a8t5GgM7SFc/VPYPqfuJzb6EBzSQKCAQEA96w61Bxw
+jR1JboTzKkAjbQs79aggjv6Tv90/eNo4t62dC5Vs/NoduOVFwEyZH/Pj/JxJPFwv
++pOFMBGnzCGI1e/j6rFR5w+5q8T0ReQX36uWQINryKvL+LtY/koa8LlZvH20cLRI
+ccEjqGeKIWQU4eo+8API2ZR1J4bTAykdMWM2zWn0Vyim6YYRwuBlgiKBEJYFOD7K
+G//UWwyGpdhnKdOLmVWtw6V07XZr8pHDPA5kUpphOLYeEzKkQb9qcIxta3g4WKyJ
+/ghuYiY/+BvC0KxejGOSjt+GDrNu+VVi8W6kwX8crFihWEVYLzOb+oGS7f5v/rjS
+FcpqIagLvlVQdwKCAQEAwM6vGmX5wBGp1cw0aY0Yest9VKlQ99halzdWIlvNqgc6
+HMCXQvCxKAvswE3GclL2ml5K5gpCBdE9wdN9tf9+nWa2p+4UzIqj810s0NA0QVY1
+ry/1lBc6zUHqcyj7dCJA7F4yTYAp2Pex6Nt8xUr5Z0lyQ8O+To0hDZnYmI4mlymM
+W2C/idcMbxvSmldSvm3ZAElRf9K5sxCK80zJi2jMXY+s1IbYwdRBJ8QTeGgC1FgD
+E37eux9c0PtUFO5+eWX9FLPjREnnVlEpihkk3Mkz7hW2F7wb0HhVQinN3A4jnsAk
+kDYKcxkI80J49PpT2hbGow9RGjK3/Xwt3xvVPARL9QKCAQAP8bN70jTgsMD4b3Ck
+CKr/Kxj6EI/ABN2IHXsnkYzTLkcM5tq0UGpXa9MYtRWqe+3yZjFExH6GOBb76DcQ
+KhyAAUh/5FhscpO2XiCHm056JLawgoVezsh7w7vP6v9e/d+sBb+m/cQoJpHgFoJK
+8gFyJb1VgDje4PLFz6Un7+6kLknp4WdMcR6FrA7ap82BGi2K3s2JOGmUcdy+28iT
+RqIljCvRfDWKgc1MODJs1DtoU1jcBHo7x2WaQMlYPjVg93lX0M53zuu3Qd2xTdsS
+Yt8gxef0S7i0n+kmayC6xmdvOXs7xa4X3kDMyPILX9wrvUmzLo0RLd7Abl50uje/
+UgizAoIBABIvLBqcRYrU36S3ZrYRxZ5HNOHYOje14w1h/bCt4d7IYbW2gE2i78Js
+JX8Zlr7PjkyO2heKHiH4Uw/Fx5RzrVhhCJccAEAuTzozrndfO55x6AxGxK2b50LW
+lasY0WZpmJ/yXmIq1UeOTOw+Ty04Xf9c0PcNLhSwgM6MlP4GYiNdmsw/erEgZB7S
+i/FcjQRCzfWV9KbOlA8MX16E/nk0gBnO5CkDMsxNHXwHpSJ1BNdMGbYsAAu78IAR
+RCPZPnpqoQzjzmpxYe0lKHrK1kwwecJZr9vbNPBbeQcNdEnt13QwgQJM5n1mfg6b
+VVcdiO0HuuJEHo0O/YVdweHJ+Tl42kUCggEAfzvpV/z3p528lUep1a1m2adJVtvm
+Nvz2J+qS+FanuF3yzpV/wxm/jJPLWsxRkQbr/grqaSceXbScfSJExc7V2J8Ly3hs
+nNI0ytlo4uwOA65E3K6yY5D1P+GlqwSPRFpP7fx5lo50GwwfdE+1q/Mjz19CDK8Q
+f/e58R1xjXAQkT5cZ2n/E9r7BXh0+AUu6DhRiLwA+iGlI90aBGM4TlA/Nl0oumsA
+IQzUX8mEBQYUgKOpXVxVKSC3A/T8GwROu7/BMYnG1mvPcz4JAW2Y0L9OO2Zg65+i
+Wop8CIW22bLgH2b++CiEoL5NI3Nav8PSnyXJIQ4+dA3v1JswowIfyTrhPw==
+-----END RSA PRIVATE KEY-----
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/get_cert.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/get_cert.xml b/libcloud/test/loadbalancer/fixtures/nttcis/get_cert.xml
new file mode 100644
index 0000000..b78e886
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/get_cert.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslDomainCertificate xmlns="urn:didata.com:api:cloud:types" id="352146be-0d6a-40cf-b935-808ab504a868" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>bob</name>
+ <description>test cert</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-17T02:15:04.000Z</createTime>
+ <expiryTime>2019-11-17T02:05:54.000Z</expiryTime>
+</sslDomainCertificate>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_by_name.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_by_name.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_by_name.xml
new file mode 100644
index 0000000..f10cde1
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_by_name.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslDomainCertificates xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <sslDomainCertificate id="4d2e9792-c986-4f2b-80c9-39e457eed8e8" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>alice</name>
+ <description>test cert</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-16T19:52:20.000Z</createTime>
+ <expiryTime>2019-11-16T18:55:24.000Z</expiryTime>
+ </sslDomainCertificate>
+</sslDomainCertificates>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_list.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_list.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_list.xml
new file mode 100644
index 0000000..68042dd
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_cert_list.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslDomainCertificates xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="2" totalCount="2" pageSize="250">
+ <sslDomainCertificate id="4d2e9792-c986-4f2b-80c9-39e457eed8e8" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>alice</name>
+ <description>test cert</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-16T19:52:20.000Z</createTime>
+ <expiryTime>2019-11-16T18:55:24.000Z</expiryTime>
+ </sslDomainCertificate>
+ <sslDomainCertificate id="352146be-0d6a-40cf-b935-808ab504a868" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>bob</name>
+ <description>test cert</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-17T02:15:04.000Z</createTime>
+ <expiryTime>2019-11-17T02:05:54.000Z</expiryTime>
+ </sslDomainCertificate>
+</sslDomainCertificates>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/ssl_get_cert_chain.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_get_cert_chain.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_get_cert_chain.xml
new file mode 100644
index 0000000..68b545b
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_get_cert_chain.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslCertificateChain xmlns="urn:didata.com:api:cloud:types" id="dc5a4235-2f1b-47e1-b6dd-455938a3377b" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>ted_carol</name>
+ <description>test cert chain</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-19T02:07:32.000Z</createTime>
+ <expiryTime>2019-11-19T00:21:30.000Z</expiryTime>
+</sslCertificateChain>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_cert_chain.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_cert_chain.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_cert_chain.xml
new file mode 100644
index 0000000..3567572
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_import_cert_chain.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181119T183847180+0100_4adcc201-ef53-4756-a115-7cfa5291e87d">
+ <operation>IMPORT_SSL_CERTIFICATE_CHAIN</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Certificate Chain has been imported.</message>
+ <info name="sslCertificateChainId" value="14613439-c24b-45c2-bd53-af4ef6fabd43"/>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/fixtures/nttcis/ssl_list_cert_chain_by_name.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/ssl_list_cert_chain_by_name.xml b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_list_cert_chain_by_name.xml
new file mode 100644
index 0000000..a268b77
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/ssl_list_cert_chain_by_name.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslCertificateChains xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <sslCertificateChain id="dc5a4235-2f1b-47e1-b6dd-455938a3377b" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>ted_carol</name>
+ <description>test cert chain</description>
+ <state>NORMAL</state>
+ <createTime>2018-11-19T02:07:32.000Z</createTime>
+ <expiryTime>2019-11-19T00:21:30.000Z</expiryTime>
+ </sslCertificateChain>
+</sslCertificateChains>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/libcloud/test/loadbalancer/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_nttcis.py b/libcloud/test/loadbalancer/test_nttcis.py
index 1d99fc6..81d42a5 100644
--- a/libcloud/test/loadbalancer/test_nttcis.py
+++ b/libcloud/test/loadbalancer/test_nttcis.py
@@ -19,6 +19,7 @@ from libcloud.utils.py3 import httplib
from libcloud.common.types import InvalidCredsError
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.types import State
@@ -518,6 +519,24 @@ def test_ex_get_default_irules(driver):
assert irules[0].compatible_listeners[0].type == 'PERFORMANCE_LAYER_4'
+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")
+ 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'
+ with pytest.raises(NttCisAPIException) as excinfo:
+ result = driver.ex_import_ssl_cert(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."
+
+
class NttCisMockHttp(MockHttp):
fixtures = LoadBalancerFileFixtures('nttcis')
@@ -529,7 +548,7 @@ class NttCisMockHttp(MockHttp):
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):
+ 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])
@@ -643,5 +662,24 @@ class NttCisMockHttp(MockHttp):
'networkDomainVip_defaultIrule.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_importSslDomainCertificate(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "ssl_import_success.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_importSslDomainCertificate_FAIL(self,
+ method, url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "ssl_import_fail.xml"
+ )
+ return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
+
if __name__ == '__main__':
sys.exit(unittest.main())
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index 944cea0..250d087 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -296,7 +296,15 @@ def test_initiate_failover(drsdriver):
def test_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/alice.crt'
- key = '/home/mraful/client/alice.key'
- result = lbdriver.import_ssl_cert(net_dom.id, "alice", cert, key, description="test cert")
+ 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")
+ assert result is True
+
+
+def test_insert_ssl_chain(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/chain.crt'
+ result = lbdriver.ex_import_ssl_cert_chain(net_dom.id, "ted_carol", cert, description="test cert chain")
assert result is True
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e347241/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 650984e..0c25529 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -426,7 +426,32 @@ def test_get_snapshots_by_min(drsdriver):
print(snap)
-def test_list_domain_certs(compute_driver, lbdriver):
+def test_list_domain_certs(lbdriver):
certs = lbdriver.ex_list_ssl_domain_certs()
for cert in certs:
- print(cert)
\ No newline at end of file
+ print(cert)
+
+
+def test_list_domain_certs_by_name(lbdriver):
+ certs = lbdriver.ex_list_ssl_domain_certs(name="alice")
+ for cert in certs:
+ print(cert)
+
+
+def test_get_domain_cert(lbdriver):
+ cert_id = "352146be-0d6a-40cf-b935-808ab504a868"
+ cert = lbdriver.ex_get_ssl_domain_cert(cert_id)
+ print(cert.name)
+
+
+def test_list_certificate_chains(lbdriver):
+ cert_name = "ted_carol"
+ certs = lbdriver.ex_list_certificate_chains(name=cert_name)
+ for cert in certs:
+ print(cert)
+
+
+def test_get_certificate_chain(lbdriver):
+ chain_id = "dc5a4235-2f1b-47e1-b6dd-455938a3377b"
+ cert_chain = lbdriver.ex_get_ssl_certificate_chain(chain_id)
+ print(cert_chain.name)
\ No newline at end of file
[32/45] libcloud git commit: removed indentation of list in in
list_consisitency_groups
Posted by an...@apache.org.
removed indentation of list in in list_consisitency_groups
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/97f4dd35
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/97f4dd35
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/97f4dd35
Branch: refs/heads/trunk
Commit: 97f4dd3511b45fa2743f789942602e9c3c291919
Parents: 44923b9
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 21 23:50:53 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 21 23:50:53 2018 -0500
----------------------------------------------------------------------
libcloud/drs/drivers/nttcis.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/97f4dd35/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index a94edde..54127d4 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -95,15 +95,15 @@ class NttCisDRSDriver(DRSDriver):
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=
+ * 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`
"""
[38/45] libcloud git commit: removing drs componoents
Posted by an...@apache.org.
removing drs componoents
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/d1580f45
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/d1580f45
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/d1580f45
Branch: refs/heads/trunk
Commit: d1580f45afed606ee3341e55a632230ed2d20235
Parents: 321a9f2
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 27 10:42:48 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 27 10:42:48 2018 -0500
----------------------------------------------------------------------
docs/drs/_supported_methods.rst | 9 -
docs/drs/_supported_providers.rst | 9 -
docs/drs/drivers/index.rst | 12 -
docs/drs/drivers/nttcis.rst | 18 --
docs/drs/index.rst | 15 -
docs/drs/supported_providers.rst | 14 -
docs/examples/drs/__init__.py | 0
docs/examples/drs/nttcis/__init__.py | 0
.../drs/nttcis/add_consistency_group.py | 27 --
.../drs/nttcis/list_snapshots_by_create_time.py | 23 --
libcloud/drs/__init__.py | 19 --
libcloud/drs/base.py | 201 -------------
libcloud/drs/drivers/__init__.py | 18 --
libcloud/drs/drivers/nttcis.py | 296 -------------------
libcloud/drs/providers.py | 39 ---
libcloud/drs/types.py | 43 ---
libcloud/test/drs/__init__.py | 0
.../nttcis/delete_consistency_group.xml | 6 -
.../test/drs/fixtures/nttcis/drs_ineligible.xml | 6 -
.../fixtures/nttcis/drs_initiate_failover.xml | 6 -
.../test/drs/fixtures/nttcis/drs_snapshots.xml | 14 -
.../fixtures/nttcis/drs_snapshots_by_min.xml | 90 ------
libcloud/test/drs/fixtures/nttcis/expand_cg.xml | 6 -
.../fixtures/nttcis/get_consistency_group.xml | 27 --
.../drs/fixtures/nttcis/list_cg_by_params.xml | 25 --
.../fixtures/nttcis/list_consistency_groups.xml | 25 --
.../drs/fixtures/nttcis/oec_0_9_myaccount.xml | 26 --
.../fixtures/nttcis/start_snapshot_preview.xml | 6 -
.../fixtures/nttcis/stop_snapshot_preview.xml | 6 -
libcloud/test/drs/test_nttcis.py | 206 -------------
30 files changed, 1192 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_methods.rst b/docs/drs/_supported_methods.rst
deleted file mode 100644
index 6e792fd..0000000
--- a/docs/drs/_supported_methods.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
-
-=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
-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 yes yes yes yes yes yes
-=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
-
-.. _`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/d1580f45/docs/drs/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_providers.rst b/docs/drs/_supported_providers.rst
deleted file mode 100644
index 16b893b..0000000
--- a/docs/drs/_supported_providers.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
-
-=================================== ================================== ================= ==================== ================================== ========================
-Provider Documentation Provider Constant Supported Regions Module Class Name
-=================================== ================================== ================= ==================== ================================== ========================
-`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://www.us.ntt.com/en/services/cloud/enterprise-cloud.html
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/drivers/index.rst
----------------------------------------------------------------------
diff --git a/docs/drs/drivers/index.rst b/docs/drs/drivers/index.rst
deleted file mode 100644
index 5599158..0000000
--- a/docs/drs/drivers/index.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-:orphan:
-
-DNS Drivers Documentation
-=========================
-
-This chapter includes links to driver (provider) specific documentation pages.
-
-.. toctree::
- :glob:
- :maxdepth: 1
-
- *
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/drivers/nttcis.rst
----------------------------------------------------------------------
diff --git a/docs/drs/drivers/nttcis.rst b/docs/drs/drivers/nttcis.rst
deleted file mode 100644
index accb00e..0000000
--- a/docs/drs/drivers/nttcis.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-NttCis DRS Driver Documentation
-===============================
-
-NTT Communications Cloud Infrastructure Services offers disaster recovery services for Compute Services.
-
-
-Instantiating the driver
-------------------------
-
-.. literalinclude:: /examples/drs/nttcis/add_consistency_group.py
- :language: python
-
-API Docs
---------
-
-.. autoclass:: libcloud.drs.drivers.nttcis.NttCisDRSDriver
- :members:
- :inherited-members:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/index.rst
----------------------------------------------------------------------
diff --git a/docs/drs/index.rst b/docs/drs/index.rst
deleted file mode 100644
index 909b8ae..0000000
--- a/docs/drs/index.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-DRS
-===
-
-.. note::
-
- DRS API is available in Libcloud 2.4.0 and higher.
-
-DRS API allows you to manage disaster recovery as a separate service.
-
-Supported Providers
--------------------
-
-For a list of supported providers see :doc:`supported providers page
-</drs/supported_providers>`.
-
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/drs/supported_providers.rst b/docs/drs/supported_providers.rst
deleted file mode 100644
index e34e5eb..0000000
--- a/docs/drs/supported_providers.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-:orphan:
-
-Supported Providers
-===================
-
-Provider Matrix
----------------
-
-.. include:: _supported_providers.rst
-
-Supported Methods
------------------
-
-.. include:: _supported_methods.rst
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/__init__.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/__init__.py b/docs/examples/drs/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/__init__.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/__init__.py b/docs/examples/drs/nttcis/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/add_consistency_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/add_consistency_group.py b/docs/examples/drs/nttcis/add_consistency_group.py
deleted file mode 100644
index 89fdbfc..0000000
--- a/docs/examples/drs/nttcis/add_consistency_group.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# This script creates a consistency group
-
-import libcloud
-
-
-def create_drs(compute_driver, drs_driver):
- nodes = compute_driver.list_nodes(ex_name='src-sdk-test')
- src_id = nodes[0].id
- nodes = compute_driver.list_nodes(ex_name="tgt-sdk-test")
- target_id = nodes[0].id
- consistency_group_name = "sdk_test_cg"
- journal_size_gb = "100"
- result = drs_driver.create_consistency_group(
- consistency_group_name, journal_size_gb, src_id, target_id,
- description="A test consistency group")
- assert result is True
-
-
-if __name__ == "__main__":
- cls = libcloud.get_driver(libcloud.DriverType.COMPUTE,
- libcloud.DriverType.COMPUTE.NTTCIS)
- computedriver = cls('my_user', 'my_pass', region='na')
-
- cls = libcloud.get_driver(libcloud.DriverType.DRS,
- libcloud.DriverType.DRS.NTTCIS)
- drsdriver = cls('my_user', 'my_pass', region='na')
- create_drs(computedriver, drsdriver)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
deleted file mode 100644
index 81f8167..0000000
--- a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# This script lists the snapshots in a consistency group
-# filtered by a minimum and maximum create time
-
-import libcloud
-
-
-def get_snapshots_by_min_max(drsdriver):
- cgs = drsdriver.list_consistency_groups()
- cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
- snaps = drsdriver.list_consistency_group_snapshots(
- cg_id,
- create_time_min="2018-11-06T00:00:00.000Z",
- create_time_max="2018-11-07T00:00:00.000Z")
- return snaps
-
-
-if __name__ == "__main__":
- cls = libcloud.get_driver(libcloud.DriverType.DRS,
- libcloud.DriverType.DRS.NTTCIS)
- drsdriver = cls('my_user', 'my_pass', region='na')
- objs = get_snapshots_by_min_max(drsdriver)
- for obj in objs.snapshot:
- print(obj)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/__init__.py b/libcloud/drs/__init__.py
deleted file mode 100644
index e27c8d7..0000000
--- a/libcloud/drs/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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.
-
-"""
-Module for working with DRS/Consistency Groups
-"""
-
-__all__ = [
- 'base',
- 'providers',
- 'types',
- 'drivers'
-]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/base.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/base.py b/libcloud/drs/base.py
deleted file mode 100644
index 38d5c5c..0000000
--- a/libcloud/drs/base.py
+++ /dev/null
@@ -1,201 +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.common.base import ConnectionKey
-from libcloud.common.base import BaseDriver
-
-__all__ = [
- 'DRSConsistencyGroup',
- 'DRSDriver',
-]
-
-
-class DRSConsistencyGroup(object):
- """
- Provide a common interface for handling DRS.
- """
-
- def __init__(self, id, name, description, journalSizeGB,
- serverPairSourceServerId, serverPairtargetServerId,
- driver, extra=None):
- """
- :param id: Load balancer ID.
- :type id: ``str``
-
- :param name: Load balancer name.
- :type name: ``str``
-
- :param state: State this loadbalancer is in.
- :type state: :class:`libcloud.loadbalancer.types.State`
-
- :param ip: IP address of this loadbalancer.
- :type ip: ``str``
-
- :param port: Port of this loadbalancer.
- :type port: ``int``
-
- :param driver: Driver this loadbalancer belongs to.
- :type driver: :class:`.Driver`
-
- :param extra: Provider specific attributes. (optional)
- :type extra: ``dict``
- """
- self.id = str(id) if id else None
- self.name = name
- self.description = description
- self.journalSizeGB = journalSizeGB
-
- self.serverPairSourceServerId = serverPairSourceServerId
- self.serverPairtargetServerId = serverPairtargetServerId
- self.driver = driver
- self.extra = extra or {}
-
-
-class DRSDriver(BaseDriver):
- """
- A base Driver class to derive from
-
- This class is always subclassed by a specific driver.
- """
-
- connectionCls = ConnectionKey
- name = None
- type = None
- port = None
-
- def __init__(self, key, secret=None, secure=True, host=None,
- port=None, **kwargs):
- super(DRSDriver, self).__init__(key=key, secret=secret, secure=secure,
- host=host, port=port, **kwargs)
-
- def create_consistency_group(self, name, journal_sz_gb,
- source_server_id, target_server_id):
- """
- :param name: Name of the consistency group to create
- :type name: ``str``
- :param journal_sz_gb: Size in 10 Gb increments of the consistency
- group's journal
- :type journal_sz_gb: ``str``
- :param source_server_id: The id of the server to copy from
- :type source_server_id: ``str``
- :param target_server_id: The id of the server to copy to
- :type target_server_id: ``str``
- :return: :class: `ConsistencyGroup`
- """
- raise NotImplementedError(
- 'create_consistency_group not implemented for this driver')
-
- def list_consistency_groups(self):
- """
- List all consistency groups
-
- :rtype: ``list`` of :class:`ConsistencyGroup`
- """
- raise NotImplementedError(
- 'list_consistency_groups not implemented for this driver')
-
- def get_consistency_group(self, consistency_group_id):
- """
- Return a :class:`ConsistencyGroup` object.
-
- :param consistency_group_id: id of a consistency group you want
- to fetch
- :type consistency_group_id: ``str``
-
- :rtype: :class:`ConsistencyGroup`
- """
-
- raise NotImplementedError(
- 'get_consistency_group not implemented for this driver')
-
- def delete_consistency_group(self, consistency_group_id):
- """
- Delete a consistency group
-
- :param consistency_group_id: Id of consistency group to delete
- :type consistency_group_id: ``str``
-
- :return: ``True`` For successful deletion, otherwise ``False``.
- :rtype: ``bool``
- """
-
- raise NotImplementedError(
- 'delete_consistency_group not implemented for this driver')
-
- def list_consistency_group_snapshots(self, consistency_group_id):
- """
- Return a list of consistency group snapshots.
-
- :param consistency_group_id: id of a consistency group to fetch
- snapshots from.
- :type consistency_group_id: ``str``
- :rtype: ``list``
- """
-
- raise NotImplementedError(
- 'list_consistency_group_snapshots not implemented for this driver')
-
- def expand_journal(self, consistency_group_id, size_gb):
- """
- :param consistency_group_id: consistency group's id with journal
- to expand
- :type consistency_group_id: ``str``
- :param size_gb: Size in increments of 10 Gb to expand journal.
- :return: ``True`` For successful deletion, otherwise ``False``.
- :rtype: ``bool``
- """
-
- raise NotImplementedError(
- 'expand_journal not implemented for this driver')
-
- def start_failover_preview(self, consistency_group_id, snapshot_id):
- """
- :param consistency_group_id: consistency group's id with journal
- to expand
- :type consistency_group_id: ``str ``
- :param snapshot_id: Snapshot Id to bring into preview mode.
- :type snapshot_id: ``str``
- :return: ``True`` For successful deletion, otherwise ``False``.
- :rtype: ``bool``
- """
-
- raise NotImplementedError(
- 'start_failover_preview not implemented for this driver')
-
- def stop_failover_preview(self, consistency_group_id):
- """
- :param consistency_group_id: Consistency group id of consistency
- group to brought out of
- PREVIEWING_SNAHSHOT and into DRS_MODE.
- :type consistency_group_id: ``str``
- :return: ``True`` For successful deletion, otherwise ``False``.
- :rtype: ``bool``
- """
-
- raise NotImplementedError(
- 'stop_failover_preview not implemented for this driver')
-
- def initiate_failover(self, consistency_group_id):
- """
- :param consistency_group_id: Consistency group id of consistency
- group on which to initiate failover.
- :type consistency_group_id: ``str``
- :return: ``True`` For successful deletion, otherwise ``False``.
- :rtype: ``bool``
- """
-
- raise NotImplementedError(
- 'initiate_failover not implemented for this driver')
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/drivers/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/__init__.py b/libcloud/drs/drivers/__init__.py
deleted file mode 100644
index 2473c57..0000000
--- a/libcloud/drs/drivers/__init__.py
+++ /dev/null
@@ -1,18 +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.
-
-__all__ = [
- 'nttcis'
-]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
deleted file mode 100644
index 54127d4..0000000
--- a/libcloud/drs/drivers/nttcis.py
+++ /dev/null
@@ -1,296 +0,0 @@
-from libcloud.utils.py3 import ET
-from libcloud.common.nttcis import NttCisConnection
-from libcloud.common.nttcis import API_ENDPOINTS
-from libcloud.common.nttcis import DEFAULT_REGION
-from libcloud.common.nttcis import process_xml, get_params
-from libcloud.drs.types import Provider
-from libcloud.drs.base import DRSDriver
-from libcloud.common.nttcis import TYPES_URN
-from libcloud.utils.xml import fixxpath, findtext, findall
-
-
-class NttCisDRSDriver(DRSDriver):
- """
- NttCis DRS driver.
- """
-
- selected_region = None
- connectionCls = NttCisConnection
- name = 'NTTC-CIS DRS Consistencty Groups'
- website = 'https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html'
- type = Provider.NTTCIS
- 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(NttCisDRSDriver, self).__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(NttCisDRSDriver,
- self)._ex_connection_class_kwargs()
- kwargs['region'] = self.selected_region
- return kwargs
-
- def create_consistency_group(self, name, journal_size_gb,
- source_server_id, target_server_id,
- description=None):
- """
- Create a consistency group
-
- :param name: Name of consistency group
- :type name: ``str``
- :param journal_size_gb: Journal size in GB
- :type journal_size_gb: ``str``
- :param source_server_id: Id of the server to copy
- :type source_server_id: ``str``
- :param target_server_id: Id of the server to receive the copy
- :type source_server_id: ``str``
- :param description: (Optional) Description of consistency group
- :type description: ``str``
- :returns: :class: NttCisConsistenccyGroup
- """
-
- consistency_group_elm = ET.Element('createConsistencyGroup',
- {'xmlns': TYPES_URN})
- ET.SubElement(consistency_group_elm, "name").text = name
- if description is not None:
- ET.SubElement(
- consistency_group_elm, "description").text = description
- ET.SubElement(
- consistency_group_elm, "journalSizeGb").text = journal_size_gb
- server_pair = ET.SubElement(consistency_group_elm, "serverPair")
- ET.SubElement(
- server_pair, "sourceServerId").text = source_server_id
- ET.SubElement(
- server_pair, "targetServerId").text = target_server_id
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/createConsistencyGroup",
- method="POST",
- data=ET.tostring(consistency_group_elm)).object
- response_code = findtext(response, 'responseCode', TYPES_URN)
- return response_code in ['IN_PROGRESS', 'OK']
-
- @get_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=
- :returns: `list` of :class: `NttCisConsistencyGroup`
- """
-
- response = self.connection.request_with_orgId_api_2(
- 'consistencyGroup/consistencyGroup', params=params).object
- cgs = self._to_consistency_groups(response)
- return cgs
-
- def get_consistency_group(self, consistency_group_id):
- """
- 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``
- :returns: :class: `NttCisConsistencygroup`
- """
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/consistencyGroup/%s" % consistency_group_id
- ).object
- cg = self._to_process(response)
- return cg
-
- def list_consistency_group_snapshots(self, consistency_group_id,
- create_time_min=None,
- create_time_max=None):
- """
- Optional parameters identify the date of creation of Consistency Group
- snapshots in *XML Schema (XSD) date time format. Best used as a
- combination of createTime.MIN and createTime.MAX. If neither is
- provided then all snapshots up to the possible maximum of 1014
- will be returned. If MIN is provided by itself, all snapshots
- between the time specified by MIN and the point in time of
- execution will be returned. If MAX is provided by itself,
- then all snapshots up to that point in time (up to the
- maximum number of 1014) will be returned. MIN and MAX are
- inclusive for this API function
-
- :param consistency_group_id: The id of consistency group
- :type consistency_group_id: ``str``
- :param create_time_min: (Optional) in form YYYY-MM-DDT00:00.00.00Z or
- substitute time offset for Z, i.e,
- -05:00
- :type create_time_min: ``str``
- :param create_time_max: (Optional) in form YYYY-MM-DDT00:00:00.000Z or
- substitute time offset for Z, i.e,
- -05:00
- :type create_time_max: ``str``
- :returns: `list` of :class: `NttCisSnapshots`
- """
-
- if create_time_min is None and create_time_max is None:
- params = {"consistencyGroupId": consistency_group_id}
- elif create_time_min and create_time_max:
- params = {"consistencyGroupId": consistency_group_id,
- "createTime.MIN": create_time_min,
- "createTime.MAX": create_time_max
- }
- elif create_time_min or create_time_max:
- if create_time_max is not None:
- params = {"consistencyGroupId": consistency_group_id,
- "createTime.MAX": create_time_max
- }
- elif create_time_min is not None:
- params = {"consistencyGroupId": consistency_group_id,
- "createTime.MIN": create_time_min
- }
- paged_result = self.connection.request_with_orgId_api_2(
- 'consistencyGroup/snapshot',
- method='GET',
- params=params
- ).object
- snapshots = self._to_process(paged_result)
- return snapshots
-
- 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``
- :returns: ``bool``
- """
-
- expand_elm = ET.Element("expandJournal", {"id": consistency_group_id,
- "xmlns": TYPES_URN})
- ET.SubElement(expand_elm, "sizeGb").text = size_gb
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/expandJournal",
- method="POST",
- data=ET.tostring(expand_elm)).object
- response_code = findtext(response, 'responseCode', TYPES_URN)
- return response_code in ['IN_PROGRESS', 'OK']
-
- def start_failover_preview(self, consistency_group_id, snapshot_id):
- """
- Brings a Consistency Group into PREVIEWING_SNAPSHOT mode
-
- :param consistency_group_id: Id of the Consistency Group to put into
- PRIEVEW_MODE
- :type consistency_group_id: ``str``
- :param snapshot_id: Id of the Snapshot to preview
- :type snapshot_id: ``str``
- :returns: True/False
- :rtype: ``bool``
- """
- preview_elm = ET.Element("startPreviewSnapshot",
- {"consistencyGroupId": consistency_group_id,
- "xmlns": TYPES_URN
- })
- ET.SubElement(preview_elm, "snapshotId").text = snapshot_id
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/startPreviewSnapshot",
- method="POST",
- data=ET.tostring(preview_elm)).object
- response_code = findtext(response, 'responseCode', TYPES_URN)
- return response_code in ['IN_PROGRESS', 'OK']
-
- def stop_failover_preview(self, consistency_group_id):
- """
- Takes a Consistency Group out of PREVIEW_MODE and back to DRS_MODE
-
- :param consistency_group_id: Consistency Group's Id
- :type ``str``
- :returns: True/False
- :rtype: ``bool``
- """
- preview_elm = ET.Element("stopPreviewSnapshot",
- {"consistencyGroupId": consistency_group_id,
- "xmlns": TYPES_URN})
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/stopPreviewSnapshot",
- method="POST",
- data=ET.tostring(preview_elm)).object
- response_code = findtext(response, 'responseCode', TYPES_URN)
- return response_code in ['IN_PROGRESS', 'OK']
-
- def initiate_failover(self, consistency_group_id):
- """
- This method is irreversible.
- It will failover the Consistency Group while removing it as well.
-
- :param consistency_group_id: Consistency Group's Id to failover
- :type consistency_group_id: ``str``
- :returns: True/False
- :rtype: ``bool``
- """
- failover_elm = ET.Element("initiateFailover",
- {"consistencyGroupId": consistency_group_id,
- "xmlns": TYPES_URN})
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/initiateFailover",
- method="POST",
- data=ET.tostring(failover_elm)).object
- response_code = findtext(response, "responseCode", TYPES_URN)
- return response_code in ["IN_PROGRESS", "OK"]
-
- def delete_consistency_group(self, consistency_group_id):
- """
- Delete's a Consistency Group
-
- :param consistency_group_id: Id of Consistency Group to delete
- :type consistency_group_id: ``str``
- :return: True/False
- :rtype: ``bool``
- """
- delete_elm = ET.Element("deleteConsistencyGroup",
- {"id": consistency_group_id,
- "xmlns": TYPES_URN})
- response = self.connection.request_with_orgId_api_2(
- "consistencyGroup/deleteConsistencyGroup",
- method="POST",
- data=ET.tostring(delete_elm)).object
- response_code = findtext(response, "responseCode", TYPES_URN)
- return response_code in ["IN_PROGRESS", "OK"]
-
- def _to_consistency_groups(self, object):
- cgs = findall(object, 'consistencyGroup', TYPES_URN)
- return [self._to_process(el) for el in cgs]
-
- def _to_snapshots(self, object):
- snapshots = []
- for element in object.findall(fixxpath("snapshot", TYPES_URN)):
- snapshots.append(self._to_process(element))
- return snapshots
-
- def _to_process(self, element):
- return process_xml(ET.tostring(element))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py
deleted file mode 100644
index 9aadaae..0000000
--- a/libcloud/drs/providers.py
+++ /dev/null
@@ -1,39 +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.drs.types import Provider
-from libcloud.common.providers import get_driver as _get_provider_driver
-from libcloud.common.providers import set_driver as _set_provider_driver
-
-__all__ = [
- "Provider",
- "DRIVERS",
- "get_driver",
-]
-
-DRIVERS = {
- Provider.NTTCIS:
- ('libcloud.drs.drivers.nttcis', 'NttCisDRSDriver'),
-}
-
-
-def get_driver(provider):
- # deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
- return _get_provider_driver(drivers=DRIVERS, provider=provider)
-
-
-def set_driver(provider, module, klass):
- return _set_provider_driver(drivers=DRIVERS, provider=provider,
- module=module, klass=klass)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/types.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/types.py b/libcloud/drs/types.py
deleted file mode 100644
index 39c6368..0000000
--- a/libcloud/drs/types.py
+++ /dev/null
@@ -1,43 +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.
-
-__all__ = [
- "Provider",
- "LibcloudDRSError",
- "LibcloudDRSImmutableError",
-
-]
-
-from libcloud.common.types import LibcloudError
-
-
-class LibcloudDRSError(LibcloudError):
- pass
-
-
-class LibcloudDRSImmutableError(LibcloudDRSError):
- pass
-
-
-class Provider(object):
- """
- Defines for each of the supported providers
-
- Non-Dummy drivers are sorted in alphabetical order. Please preserve this
- ordering when adding new drivers.
-
- :cvar NTTCIS: NTT Communications CIS DRS driver
- """
- NTTCIS = 'nttcis'
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/__init__.py b/libcloud/test/drs/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
deleted file mode 100644
index 6c5c1ed..0000000
--- a/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T170953967-0500_49fbd66f-4eca-4107-acf5-08d7bb07c706">
- <operation>DELETE_CONSISTENCY_GROUP</operation>
- <responseCode>IN_PROGRESS</responseCode>
- <message>Request to Delete Consistency Group has been accepted. Please use appropriate Get or List API for status.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
deleted file mode 100644
index a0ff44c..0000000
--- a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
- <operation>CREATE_CONSISTENCY_GROUP</operation>
- <responseCode>INCOMPATIBLE_OPERATION</responseCode>
- <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml b/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
deleted file mode 100644
index 115dda1..0000000
--- a/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T160941803-0500_729ba262-347d-4da9-bf4d-c30e861bfa63">
- <operation>INITIATE_FAILOVER</operation>
- <responseCode>IN_PROGRESS</responseCode>
- <message>Request to Initiate Failover has been accepted. Please use appropriate Get or List API for status.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
deleted file mode 100644
index 5386f46..0000000
--- a/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="1013" journalUsageGb="0.22" protectionWindow="P0Y0M2DT1H48M45.532S" predictedProtectionWindow="P23Y1M15DT11H1M58.309S">
- <snapshot id="297700" createTime="2018-11-02T14:00:13.271-04:00" sizeKb="0"/>
- <snapshot id="297695" createTime="2018-11-02T14:00:10.219-04:00" sizeKb="2"/>
- <snapshot id="297650" createTime="2018-11-02T13:59:42.780-04:00" sizeKb="7"/>
- <snapshot id="297488" createTime="2018-11-02T13:58:05.255-04:00" sizeKb="188"/>
- <snapshot id="297235" createTime="2018-11-02T13:56:27.697-04:00" sizeKb="29"/>
- <snapshot id="296911" createTime="2018-11-02T13:53:12.913-04:00" sizeKb="14"/>
- <snapshot id="296591" createTime="2018-11-02T13:49:57.857-04:00" sizeKb="14"/>
- <snapshot id="296271" createTime="2018-11-02T13:46:42.980-04:00" sizeKb="14"/>
- <snapshot id="295951" createTime="2018-11-02T13:43:27.903-04:00" sizeKb="14"/>
- <snapshot id="295631" createTime="2018-11-02T13:40:12.811-04:00" sizeKb="14"/>
- <snapshot id="295311" createTime="2018-11-02T13:36:57.691-04:00" sizeKb="14"/>
-</consistencyGroupSnapshots>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
deleted file mode 100644
index 99c6ced..0000000
--- a/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="87" journalUsageGb="0.22" protectionWindow="P0Y0M7DT4H47M26.177S" predictedProtectionWindow="P91Y3M21DT22H2M36.211S">
- <snapshot id="140736" createTime="2018-11-07T15:58:53.916-05:00" sizeKb="0"/>
- <snapshot id="140731" createTime="2018-11-07T15:58:50.873-05:00" sizeKb="5"/>
- <snapshot id="140601" createTime="2018-11-07T15:57:31.642-05:00" sizeKb="54"/>
- <snapshot id="139321" createTime="2018-11-07T15:44:32.220-05:00" sizeKb="54"/>
- <snapshot id="138041" createTime="2018-11-07T15:31:32.329-05:00" sizeKb="54"/>
- <snapshot id="136761" createTime="2018-11-07T15:18:32.749-05:00" sizeKb="54"/>
- <snapshot id="135481" createTime="2018-11-07T15:05:32.688-05:00" sizeKb="75"/>
- <snapshot id="134183" createTime="2018-11-07T14:52:32.661-05:00" sizeKb="54"/>
- <snapshot id="132903" createTime="2018-11-07T14:39:32.389-05:00" sizeKb="54"/>
- <snapshot id="131623" createTime="2018-11-07T14:26:32.069-05:00" sizeKb="54"/>
- <snapshot id="130343" createTime="2018-11-07T14:13:32.825-05:00" sizeKb="27"/>
- <snapshot id="129703" createTime="2018-11-07T14:07:02.931-05:00" sizeKb="55"/>
- <snapshot id="129041" createTime="2018-11-07T14:00:33.348-05:00" sizeKb="54"/>
- <snapshot id="127761" createTime="2018-11-07T13:47:33.123-05:00" sizeKb="54"/>
- <snapshot id="126481" createTime="2018-11-07T13:34:33.073-05:00" sizeKb="54"/>
- <snapshot id="125201" createTime="2018-11-07T13:21:33.622-05:00" sizeKb="54"/>
- <snapshot id="123921" createTime="2018-11-07T13:08:34.110-05:00" sizeKb="43"/>
- <snapshot id="123268" createTime="2018-11-07T13:02:04.173-05:00" sizeKb="249"/>
- <snapshot id="122516" createTime="2018-11-07T12:55:34.213-05:00" sizeKb="54"/>
- <snapshot id="121236" createTime="2018-11-07T12:42:34.018-05:00" sizeKb="54"/>
- <snapshot id="119956" createTime="2018-11-07T12:29:34.921-05:00" sizeKb="54"/>
- <snapshot id="118676" createTime="2018-11-07T12:16:34.703-05:00" sizeKb="54"/>
- <snapshot id="117396" createTime="2018-11-07T12:03:35.038-05:00" sizeKb="82"/>
- <snapshot id="116094" createTime="2018-11-07T11:50:34.781-05:00" sizeKb="54"/>
- <snapshot id="114814" createTime="2018-11-07T11:37:34.411-05:00" sizeKb="54"/>
- <snapshot id="113534" createTime="2018-11-07T11:24:34.562-05:00" sizeKb="54"/>
- <snapshot id="112254" createTime="2018-11-07T11:11:34.661-05:00" sizeKb="33"/>
- <snapshot id="111606" createTime="2018-11-07T11:05:04.533-05:00" sizeKb="117"/>
- <snapshot id="110911" createTime="2018-11-07T10:58:34.802-05:00" sizeKb="139"/>
- <snapshot id="109579" createTime="2018-11-07T10:45:35.381-05:00" sizeKb="61"/>
- <snapshot id="108285" createTime="2018-11-07T10:32:35.296-05:00" sizeKb="72"/>
- <snapshot id="106985" createTime="2018-11-07T10:19:35.070-05:00" sizeKb="54"/>
- <snapshot id="105705" createTime="2018-11-07T10:06:34.828-05:00" sizeKb="75"/>
- <snapshot id="104407" createTime="2018-11-07T09:53:35.075-05:00" sizeKb="54"/>
- <snapshot id="103127" createTime="2018-11-07T09:40:35.476-05:00" sizeKb="54"/>
- <snapshot id="101847" createTime="2018-11-07T09:27:35.646-05:00" sizeKb="54"/>
- <snapshot id="100567" createTime="2018-11-07T09:14:35.570-05:00" sizeKb="27"/>
- <snapshot id="99927" createTime="2018-11-07T09:08:05.453-05:00" sizeKb="53"/>
- <snapshot id="99261" createTime="2018-11-07T09:01:35.363-05:00" sizeKb="62"/>
- <snapshot id="97971" createTime="2018-11-07T08:48:35.423-05:00" sizeKb="54"/>
- <snapshot id="96691" createTime="2018-11-07T08:35:35.499-05:00" sizeKb="54"/>
- <snapshot id="95411" createTime="2018-11-07T08:22:35.176-05:00" sizeKb="54"/>
- <snapshot id="94131" createTime="2018-11-07T08:09:35.704-05:00" sizeKb="63"/>
- <snapshot id="92840" createTime="2018-11-07T07:56:35.594-05:00" sizeKb="54"/>
- <snapshot id="91560" createTime="2018-11-07T07:43:35.557-05:00" sizeKb="57"/>
- <snapshot id="90275" createTime="2018-11-07T07:30:36.714-05:00" sizeKb="57"/>
- <snapshot id="88991" createTime="2018-11-07T07:17:36.518-05:00" sizeKb="61"/>
- <snapshot id="87703" createTime="2018-11-07T07:04:36.925-05:00" sizeKb="75"/>
- <snapshot id="86404" createTime="2018-11-07T06:51:36.594-05:00" sizeKb="54"/>
- <snapshot id="85124" createTime="2018-11-07T06:38:36.944-05:00" sizeKb="54"/>
- <snapshot id="83844" createTime="2018-11-07T06:25:37.281-05:00" sizeKb="54"/>
- <snapshot id="82564" createTime="2018-11-07T06:12:37.253-05:00" sizeKb="27"/>
- <snapshot id="81924" createTime="2018-11-07T06:06:07.098-05:00" sizeKb="48"/>
- <snapshot id="81266" createTime="2018-11-07T05:59:37.367-05:00" sizeKb="54"/>
- <snapshot id="79986" createTime="2018-11-07T05:46:37.421-05:00" sizeKb="54"/>
- <snapshot id="78706" createTime="2018-11-07T05:33:38.322-05:00" sizeKb="54"/>
- <snapshot id="77426" createTime="2018-11-07T05:20:38.384-05:00" sizeKb="54"/>
- <snapshot id="76146" createTime="2018-11-07T05:07:38.985-05:00" sizeKb="62"/>
- <snapshot id="75475" createTime="2018-11-07T05:01:09.065-05:00" sizeKb="32"/>
- <snapshot id="74826" createTime="2018-11-07T04:54:38.976-05:00" sizeKb="54"/>
- <snapshot id="73546" createTime="2018-11-07T04:41:38.697-05:00" sizeKb="54"/>
- <snapshot id="72266" createTime="2018-11-07T04:28:39.145-05:00" sizeKb="54"/>
- <snapshot id="70986" createTime="2018-11-07T04:15:39.114-05:00" sizeKb="55"/>
- <snapshot id="69702" createTime="2018-11-07T04:02:39.563-05:00" sizeKb="83"/>
- <snapshot id="68403" createTime="2018-11-07T03:49:39.577-05:00" sizeKb="27"/>
- <snapshot id="67763" createTime="2018-11-07T03:43:09.797-05:00" sizeKb="51"/>
- <snapshot id="67102" createTime="2018-11-07T03:36:39.935-05:00" sizeKb="58"/>
- <snapshot id="65820" createTime="2018-11-07T03:23:39.859-05:00" sizeKb="37"/>
- <snapshot id="65170" createTime="2018-11-07T03:17:09.938-05:00" sizeKb="372"/>
- <snapshot id="64341" createTime="2018-11-07T03:10:39.796-05:00" sizeKb="27"/>
- <snapshot id="63701" createTime="2018-11-07T03:04:10.126-05:00" sizeKb="50"/>
- <snapshot id="63042" createTime="2018-11-07T02:57:40.014-05:00" sizeKb="54"/>
- <snapshot id="61762" createTime="2018-11-07T02:44:40.619-05:00" sizeKb="54"/>
- <snapshot id="60466" createTime="2018-11-07T02:31:31.343-05:00" sizeKb="54"/>
- <snapshot id="59186" createTime="2018-11-07T02:18:31.853-05:00" sizeKb="55"/>
- <snapshot id="57902" createTime="2018-11-07T02:05:31.526-05:00" sizeKb="83"/>
- <snapshot id="56598" createTime="2018-11-07T01:52:31.345-05:00" sizeKb="54"/>
- <snapshot id="55318" createTime="2018-11-07T01:39:31.367-05:00" sizeKb="54"/>
- <snapshot id="54038" createTime="2018-11-07T01:26:31.545-05:00" sizeKb="54"/>
- <snapshot id="52758" createTime="2018-11-07T01:13:31.876-05:00" sizeKb="27"/>
- <snapshot id="52118" createTime="2018-11-07T01:07:01.827-05:00" sizeKb="55"/>
- <snapshot id="51456" createTime="2018-11-07T01:00:31.835-05:00" sizeKb="59"/>
- <snapshot id="50167" createTime="2018-11-07T00:47:32.638-05:00" sizeKb="54"/>
- <snapshot id="48887" createTime="2018-11-07T00:34:33.021-05:00" sizeKb="54"/>
- <snapshot id="47607" createTime="2018-11-07T00:21:33.155-05:00" sizeKb="54"/>
- <snapshot id="46327" createTime="2018-11-07T00:08:33.145-05:00" sizeKb="42"/>
- <snapshot id="45670" createTime="2018-11-07T00:02:03.027-05:00" sizeKb="48"/>
-</consistencyGroupSnapshots>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/expand_cg.xml b/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
deleted file mode 100644
index f29d9a1..0000000
--- a/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181106T161731342-0500_8c65ed73-ddb1-4043-981a-535a0c8e28aa">
- <operation>EXPAND_JOURNAL</operation>
- <responseCode>IN_PROGRESS</responseCode>
- <message>Request to Expand DRS Journal Space has been accepted. Please use appropriate Get or List API for status.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
deleted file mode 100644
index bcbe931..0000000
--- a/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
- <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5">
- <name>sdk_test2_cg</name>
- <description>A test consistency group</description>
- <journal sizeGb="100" extentCount="1"/>
- <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
- <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
- </source>
- <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
- <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
- </target>
- <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
- <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
- <name>src-sdk-test</name>
- </sourceServer>
- <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
- <name>tgt-sdk-test</name>
- </targetServer>
- </serverPair>
- <createTime>2018-10-31T16:02:05.000Z</createTime>
- <operationStatus>DRS_MODE</operationStatus>
- <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T19:40:01.000Z"/>
- <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
- <state>NORMAL</state>
- </consistencyGroup>
-</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml b/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
deleted file mode 100644
index 0115461..0000000
--- a/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
- <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5"><name>sdk_test2_cg</name>
- <description>A test consistency group</description><journal sizeGb="100" extentCount="1"/>
- <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
- <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
- </source>
- <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
- <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
- </target>
- <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
- <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
- <name>src-sdk-test</name>
- </sourceServer>
- <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
- <name>tgt-sdk-test</name>
- </targetServer>
- </serverPair>
- <createTime>2018-10-31T16:02:05.000Z</createTime>
- <operationStatus>DRS_MODE</operationStatus>
- <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-05T16:35:01.000Z"/>
- <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
- <state>NORMAL</state>
- </consistencyGroup>
-</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml b/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
deleted file mode 100644
index 8b1a936..0000000
--- a/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
- <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5">
- <name>sdk_test2_cg</name>
- <description>A test consistency group</description>
- <journal sizeGb="100" extentCount="1"/>
- <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
- <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
- </source>
- <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
- <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
- </target>
- <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
- <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
- <name>src-sdk-test</name>
- </sourceServer>
- <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
- <name>tgt-sdk-test</name></targetServer></serverPair>
- <createTime>2018-10-31T16:02:05.000Z</createTime>
- <operationStatus>DRS_MODE</operationStatus>
- <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T14:20:01.000Z"/>
- <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
- <state>NORMAL</state>
- </consistencyGroup>
-</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
deleted file mode 100644
index 4f3b132..0000000
--- a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<ns3:Account xmlns="http://oec.api.opsource.net/schemas/server" xmlns:ns9="http://oec.api.opsource.net/schemas/reset" xmlns:ns5="http://oec.api.opsource.net/schemas/vip" xmlns:ns12="http://oec.api.opsource.net/schemas/general" xmlns:ns6="http://oec.api.opsource.net/schemas/imageimportexport" xmlns:ns13="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns10="http://oec.api.opsource.net/schemas/ipplan" xmlns:ns8="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns11="http://oec.api.opsource.net/schemas/storage" xmlns:ns2="http://oec.api.opsource.net/schemas/organization" xmlns:ns4="http://oec.api.opsource.net/schemas/network" xmlns:ns3="http://oec.api.opsource.net/schemas/directory">
- <ns3:userName>testuser</ns3:userName>
- <ns3:fullName>Test User</ns3:fullName>
- <ns3:firstName>Test</ns3:firstName>
- <ns3:lastName>User</ns3:lastName>
- <ns3:emailAddress>test@example.com</ns3:emailAddress>
- <ns3:orgId>8a8f6abc-2745-4d8a-9cbc-8dabe5a7d0e4</ns3:orgId>
- <ns3:roles>
- <ns3:role>
- <ns3:name>create image</ns3:name>
- </ns3:role>
- <ns3:role>
- <ns3:name>reports</ns3:name>
- </ns3:role>
- <ns3:role>
- <ns3:name>server</ns3:name>
- </ns3:role>
- <ns3:role>
- <ns3:name>primary administrator</ns3:name>
- </ns3:role>
- <ns3:role>
- <ns3:name>network</ns3:name>
- </ns3:role>
- </ns3:roles>
-</ns3:Account>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
deleted file mode 100644
index 50bede8..0000000
--- a/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135438714-0500_b30a28fa-f9e4-4e04-ae4c-cf07a3b31bb4">
- <operation>START_PREVIEW_SNAPSHOT</operation>
- <responseCode>IN_PROGRESS</responseCode>
- <message>Request to Start Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
deleted file mode 100644
index 22ae894..0000000
--- a/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135122604-0500_c06c2498-63d0-4172-8476-5af1b1fe07db">
- <operation>STOP_PREVIEW_SNAPSHOT</operation>
- <responseCode>IN_PROGRESS</responseCode>
- <message>Request to Stop Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
-</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
deleted file mode 100644
index 0070a6d..0000000
--- a/libcloud/test/drs/test_nttcis.py
+++ /dev/null
@@ -1,206 +0,0 @@
-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
-from libcloud.test.file_fixtures import DRSFileFixtures
-from libcloud.test.secrets import NTTCIS_PARAMS
-
-
-@pytest.fixture()
-def driver():
- NttCisDRSDriver.connectionCls.active_api_version = "2.7"
- NttCisDRSDriver.connectionCls.conn_class = NttCisMockHttp
- NttCisMockHttp.type = None
- driver = NttCisDRSDriver(*NTTCIS_PARAMS)
- return driver
-
-
-def test_ineligible_server(driver):
- NttCisMockHttp.type = 'INPROGRESS'
- with pytest.raises(NttCisAPIException) as excinfo:
- driver.create_consistency_group(
- "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4",
- "aee58575-38e2-495f-89d3-854e6a886411",
- description="A test consistency group")
- assert excinfo.value.msg == 'The drsEligible flag for target Server ' \
- 'aee58575-38e2-495f-89d3-854e6a886411 must be set.'
-
-
-def test_list_consistency_groups(driver):
- cgs = driver.list_consistency_groups()
- assert isinstance(cgs, list)
- assert hasattr(cgs[0], 'serverPair')
-
-
-def test_get_consistency_group(driver):
- cg = driver.get_consistency_group("3710c093-7dcc-4a21-bd07-af9f4d93b6b5")
- assert cg.id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
-
-
-def test_get_consistency_group_by_name(driver):
- cgs = driver.list_consistency_groups(name="skd_test2_cg")
- assert cgs[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
-
-
-def test_expand_journal(driver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- size_gb = "100"
- result = driver.expand_journal(cg_id, size_gb)
- assert result is True
-
-
-def test_list_snapshots(driver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.list_consistency_group_snapshots(cg_id)
- assert hasattr(result, 'snapshot')
- assert len(result.snapshot) == 11
-
-
-def test_list_snapshots_with_min(driver):
- NttCisMockHttp.type = "WITH_MIN"
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.list_consistency_group_snapshots(
- cg_id, create_time_min="2018-11-07T00:00:00.000-05:00")
- assert hasattr(result, 'snapshot')
- assert len(result.snapshot) == 87
-
-
-def test_start_snapshot_preview(driver):
- snapshot_id = "87703"
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.start_failover_preview(cg_id, snapshot_id)
- assert result is True
-
-
-def test_stop_snapshot_preivew(driver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.stop_failover_preview(cg_id)
- assert result is True
-
-
-def test_initiate_failover(driver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.initiate_failover(cg_id)
- assert result is True
-
-
-def test_delete_consistency_group(driver):
- cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
- result = driver.initiate_failover(cg_id)
- assert result is True
-
-
-class NttCisMockHttp(MockHttp):
-
- fixtures = DRSFileFixtures('nttcis')
-
- 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_WITH_MIN(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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_INPROGRESS(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load(
- 'drs_ineligible.xml'
- )
- return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("list_consistency_groups.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_3710c093_7dcc_4a21_bd07_af9f4d93b6b5(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("get_consistency_group.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_name(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("list_cg_by_params.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_expandJournal(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("expand_cg.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("drs_snapshots.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot_WITH_MIN(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("drs_snapshots_by_min.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_startPreviewSnapshot(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("start_snapshot_preview.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_stopPreviewSnapshot(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("stop_snapshot_preview.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("drs_initiate_failover.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("drs_initiate_failover.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
- def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_deleteConsistencyGroup(self,
- method,
- url,
- body,
- headers):
- body = self.fixtures.load("delete_consistency_group.xml")
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
[39/45] libcloud git commit: added lots of server snapshot tests
Posted by an...@apache.org.
added lots of server snapshot tests
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bbe90e5b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bbe90e5b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bbe90e5b
Branch: refs/heads/trunk
Commit: bbe90e5bc6fd917bcf6bb4cea698e15ae1bc7416
Parents: d1580f4
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 28 21:52:24 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 28 21:52:24 2018 -0500
----------------------------------------------------------------------
.../test/compute/fixtures/nttcis/create_preview_server.xml | 0
.../fixtures/nttcis/disable_server_snapshot_service.xml | 0
.../test/compute/fixtures/nttcis/enable_snapshot_service.xml | 7 +++++++
.../test/compute/fixtures/nttcis/initiate_manual_snapshot.xml | 7 +++++++
.../test/compute/fixtures/nttcis/list_server_snapshots.xml | 0
.../test/compute/fixtures/nttcis/manual_snapshot_server.xml | 0
6 files changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/enable_snapshot_service.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/enable_snapshot_service.xml b/libcloud/test/compute/fixtures/nttcis/enable_snapshot_service.xml
new file mode 100644
index 0000000..df862c7
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/enable_snapshot_service.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181128T191755488+0100_fa87fa5e-43bb-46b0-a16c-cb860d311ca2">
+ <operation>ENABLE_SNAPSHOT_SERVICE</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Enable Snapshot Service has been accepted. Please use appropriate Get or List API for status.</message>
+ <info name="manualSnapshotId" value="dce63d38-1dcf-4b64-9166-341b7085f3f1"/>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
new file mode 100644
index 0000000..988342b
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181128T194011598+0100_fe475eac-01df-44ee-99c1-a1322eff3195">
+ <operation>INITIATE_MANUAL_SNAPSHOT</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Initiate Manual Snapshot has been accepted. Please use appropriate Get or List API for status.</message>
+ <info name="manualSnapshotId" value="dd9a9e7e-2de7-4543-adef-bb1fda7ac030"/>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbe90e5b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
new file mode 100644
index 0000000..e69de29
[34/45] libcloud git commit: added listing geographical regions
Posted by an...@apache.org.
added listing geographical regions
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ec05af99
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ec05af99
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ec05af99
Branch: refs/heads/trunk
Commit: ec05af99dd3a80d92f673ad988e511fd240dfbda
Parents: b58c770
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Nov 26 14:03:06 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Nov 26 14:03:06 2018 -0500
----------------------------------------------------------------------
libcloud/compute/drivers/nttcis.py | 51 +++++++------
.../fixtures/nttcis/geographic_regions.xml | 75 ++++++++++++++++++++
libcloud/test/compute/test_nttcis.py | 13 ++++
3 files changed, 113 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ec05af99/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 0fc651d..c788124 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -52,6 +52,7 @@ from libcloud.common.nttcis import NttCisTagKey
from libcloud.common.nttcis import NttCisTag
from libcloud.common.nttcis import API_ENDPOINTS, DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
+from libcloud.common.nttcis import process_xml
from libcloud.common.nttcis import NETWORK_NS, GENERAL_NS
from libcloud.utils.py3 import urlencode, ensure_string
from libcloud.utils.xml import fixxpath, findtext, findall
@@ -863,6 +864,19 @@ class NttCisNodeDriver(NodeDriver):
driver=self.connection.driver),
]
+ def list_geographic_regions(self, params={}):
+ """
+ Return all geographic regions available to the organization
+
+ :return: List of regions
+ :rtype: ``list`` of :class:`NttCisGeographicregion`
+ """
+ return self._to_geographic_regions(
+ self.connection.request_with_orgId_api_2(
+ "infrastructure/geographicRegion",
+ method="GET",
+ params=params).object)
+
def list_locations(self, ex_id=None):
"""
List locations (datacenters) available for instantiating servers and
@@ -872,7 +886,7 @@ class NttCisNodeDriver(NodeDriver):
:type ex_id: ``str``
:return: List of locations
- :rtype: ``list`` of :class:`NodeLocation`
+ :rtype: ``list`` of :class:`NttCisDatacenter`
"""
params = {}
@@ -887,26 +901,6 @@ class NttCisNodeDriver(NodeDriver):
).object
)
- def ex_get_datacneter(self, ex_id):
- """
- List locations (datacenters) available for instantiating servers and
- networks.
-
- :keyword ex_id: Filters the location list to this id
- :type ex_id: ``str``
-
- :return: List of locations
- :rtype: ``list`` of :class:`NodeLocation`
- """
-
- params = {}
- if ex_id is not None:
- params['id'] = ex_id
-
- return self.connection.\
- request_with_orgId_api_2('infrastructure/datacenter',
- params=params)
-
def list_snapshot_windows(self, location, plan):
"""
List snapshot windows in a given location
@@ -4995,11 +4989,7 @@ class NttCisNodeDriver(NodeDriver):
return locations
def _to_location(self, element):
- l = NodeLocation(id=element.get('id'),
- name=findtext(element, 'displayName', TYPES_URN),
- country=findtext(element, 'country', TYPES_URN),
- driver=self)
- return l
+ return process_xml(ET.tostring(element))
def _to_cpu_spec(self, element):
return NttCisServerCpuSpecification(
@@ -5070,6 +5060,15 @@ class NttCisNodeDriver(NodeDriver):
}
+ def _to_geographic_regions(self, object):
+ regions = []
+ for region in object.findall(fixxpath('geographicRegion', TYPES_URN)):
+ regions.append(self._to_geographic_region(region))
+ return regions
+
+ def _to_geographic_region(self, el):
+ return process_xml(ET.tostring(el))
+
def _to_ipv4_addresses(self, object):
ipv4_address_elements = object.findall(fixxpath('ipv4', TYPES_URN))
return [self._to_ipv4_6_address(el) for el in ipv4_address_elements]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ec05af99/libcloud/test/compute/fixtures/nttcis/geographic_regions.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/geographic_regions.xml b/libcloud/test/compute/fixtures/nttcis/geographic_regions.xml
new file mode 100644
index 0000000..1ac025a
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/geographic_regions.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<geographicRegions xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="8" totalCount="8" pageSize="250">
+ <geographicRegion id="africa" isHome="false">
+ <name>Africa</name>
+ <cloudApiHost>afapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://mea.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://af-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-af.cloud-vpn.net</ftpsHost>
+ <timeZone>Africa/Johannesburg</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="asiapacific" isHome="false">
+ <name>Asia Pacific</name>
+ <cloudApiHost>apapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://ap.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://ap-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-ap.cloud-vpn.net</ftpsHost>
+ <timeZone>Asia/Tokyo</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="australia" isHome="false">
+ <name>Australia</name>
+ <cloudApiHost>auapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://au.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://au-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-au.cloud-vpn.net</ftpsHost>
+ <timeZone>Australia/Sydney</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="canada" isHome="false">
+ <name>Canada</name>
+ <cloudApiHost>api-canada.dimensiondata.com</cloudApiHost>
+ <cloudUiUrl>https://canada.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://ca-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-canada.cloud-vpn.net</ftpsHost>
+ <timeZone>America/Toronto</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="europe" isHome="false">
+ <name>Europe</name>
+ <cloudApiHost>euapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://eu.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://eu-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-eu.cloud-vpn.net</ftpsHost>
+ <timeZone>Europe/Amsterdam</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="indonesia" isHome="false">
+ <name>Indonesia</name>
+ <cloudApiHost>idapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://id.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://id-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-id.cloud-vpn.net</ftpsHost>
+ <timeZone>Asia/Jakarta</timeZone>
+ <state>NOT_ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="israel" isHome="false">
+ <name>Israel</name>
+ <cloudApiHost>ilapi.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://il.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://il-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-med-1.cloud-vpn.net</ftpsHost>
+ <timeZone>Asia/Jerusalem</timeZone>
+ <state>NOT_ENABLED</state>
+ </geographicRegion>
+ <geographicRegion id="northamerica" isHome="true">
+ <name>North America</name>
+ <cloudApiHost>api.opsourcecloud.net</cloudApiHost>
+ <cloudUiUrl>https://na.mcp-services.net</cloudUiUrl>
+ <monitoringUrl>https://na-monitoring.mcp-services.net</monitoringUrl>
+ <ftpsHost>ftps-na.cloud-vpn.net</ftpsHost>
+ <timeZone>America/New_York</timeZone>
+ <state>ENABLED</state>
+ </geographicRegion>
+</geographicRegions>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ec05af99/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index cff7094..9068edd 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -61,6 +61,12 @@ def test_list_locations_response(driver):
assert first_loc.country == 'US'
+def test_list_geograhic_regions(driver):
+ ret = driver.list_geographic_regions()
+ assert isinstance(ret, list)
+ assert ret[7].isHome == 'true'
+
+
def test_list_nodes_response(driver):
NttCisMockHttp.type = None
ret = driver.list_nodes()
@@ -2894,4 +2900,11 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load(
'deploy_customised_server.xml'
)
+ return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_geographicRegion(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ 'geographic_regions.xml'
+ )
return httplib.OK, body, {}, httplib.responses[httplib.OK]
\ No newline at end of file
[20/45] libcloud git commit: added auto generated rst files to
../docs/drs/
Posted by an...@apache.org.
added auto generated rst files to ../docs/drs/
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9c76b415
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9c76b415
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9c76b415
Branch: refs/heads/trunk
Commit: 9c76b415254ba193509ae546a752b169d2731bf7
Parents: 614b43d
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 6 16:42:10 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 6 16:42:10 2018 -0500
----------------------------------------------------------------------
docs/drs/_supported_methods.rst | 9 +++++++++
docs/drs/_supported_providers.rst | 9 +++++++++
2 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9c76b415/docs/drs/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_methods.rst b/docs/drs/_supported_methods.rst
new file mode 100644
index 0000000..ac74337
--- /dev/null
+++ b/docs/drs/_supported_methods.rst
@@ -0,0 +1,9 @@
+.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
+
+=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== =================
+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`: https://cloud.nttcis.com/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9c76b415/docs/drs/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/drs/_supported_providers.rst b/docs/drs/_supported_providers.rst
new file mode 100644
index 0000000..d282e4a
--- /dev/null
+++ b/docs/drs/_supported_providers.rst
@@ -0,0 +1,9 @@
+.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
+
+=================================== ================================== ================= ==================== ================================== ========================
+Provider Documentation Provider Constant Supported Regions Module Class Name
+=================================== ================================== ================= ==================== ================================== ========================
+`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/
[08/45] libcloud git commit: changed _to_nodes and _to_node and
drivers/nttcis.py to handle node retrieval by process_xml
Posted by an...@apache.org.
changed _to_nodes and _to_node and drivers/nttcis.py to handle node retrieval by process_xml
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/81d57364
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/81d57364
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/81d57364
Branch: refs/heads/trunk
Commit: 81d57364270d58038f02895bc136f19044446b5f
Parents: a88fb2f
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Sun Oct 28 11:18:23 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Sun Oct 28 11:18:23 2018 -0400
----------------------------------------------------------------------
libcloud/common/nttcis.py | 6 ++----
libcloud/compute/drivers/nttcis.py | 10 +++++++---
2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/81d57364/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 019aead..126530f 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -1942,7 +1942,6 @@ def processor(mapping, name=None):
def add_items(key, value, name=None):
if name in attrs:
- print(attrs)
attrs[name].update({key: value})
elif name is not None:
attrs[name] = value
@@ -2049,7 +2048,6 @@ def processor(mapping, name=None):
if len(map_copy) == 0:
return 1
- #print(attrs)
return process(mapping, name)
@@ -2080,7 +2078,6 @@ class XmlListConfig(list):
for element in elem_list:
if element is not None:
# treat like dict
- #print(element.attrib, len(element))
if len(element) >= 0 or element[0].tag != element[1].tag:
self.append(XmlDictConfig(element))
# treat like list
@@ -2153,6 +2150,7 @@ class XmlDictConfig(dict):
def process_xml(xml):
+ global attrs
tree = etree.parse(BytesIO(xml))
root = tree.getroot()
elem = root.tag.split('}')[1].capitalize()
@@ -2166,6 +2164,6 @@ def process_xml(xml):
processor(converted_xml)
klass = class_factory(elem.capitalize(), attrs)
cls = klass(attrs)
-
+ attrs = {}
return cls
http://git-wip-us.apache.org/repos/asf/libcloud/blob/81d57364/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index c1266d9..a17286a 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -782,6 +782,9 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:`Node`
"""
node_list = []
+ # This is a generator so we changed from the original
+ # and if nodes is not empty, ie, the stop iteration confdition
+ # Then set node_list to nodes and retrn.
for nodes in self.ex_list_nodes_paginated(
location=ex_location,
name=ex_name, ipv6=ex_ipv6,
@@ -789,8 +792,8 @@ class NttCisNodeDriver(NodeDriver):
image=ex_image, deployed=ex_deployed,
started=ex_started, state=ex_state,
network_domain=ex_network_domain):
- node_list.extend(nodes)
-
+ if nodes:
+ node_list = nodes
return node_list
def list_images(self, location=None):
@@ -5123,7 +5126,8 @@ class NttCisNodeDriver(NodeDriver):
return [self._to_node(el) for el in node_elements]
def _to_node(self, element):
- return process_xml(element)
+ # Get all information at once and process in common/nttcis
+ return process_xml(ET.tostring(element))
"""
started = findtext(element, 'started', TYPES_URN)
status = self._to_status(element.find(fixxpath('progress', TYPES_URN)))
[29/45] libcloud git commit: added ssl offload profiles as well as
listing and getting profiles
Posted by an...@apache.org.
added ssl offload profiles as well as listing and getting profiles
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e18efb15
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e18efb15
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e18efb15
Branch: refs/heads/trunk
Commit: e18efb151bb8361c1b3755e5c215c8b4e94efe22
Parents: 9e34724
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 20 23:47:16 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 20 23:47:16 2018 -0500
----------------------------------------------------------------------
libcloud/drs/drivers/nttcis.py | 4 +-
libcloud/loadbalancer/drivers/nttcis.py | 140 +++++++++++++++++--
.../nttcis/create_ssl_offload_profile.xml | 7 +
.../nttcis/edit_ssl_offload_profile.xml | 6 +
.../fixtures/nttcis/get_ssl_offload_profile.xml | 11 ++
.../nttcis/list_ssl_offload_profiles.xml | 13 ++
libcloud/test/loadbalancer/test_nttcis.py | 64 +++++++++
tests/lib_create_test.py | 8 ++
tests/lib_edit_test.py | 11 ++
tests/lib_list_test.py | 14 +-
10 files changed, 267 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 3c88bbe..f67ab5f 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -92,10 +92,10 @@ 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 dictionary composed of one of the following keys
+ :param params: A sequence of comma separated keyword arguments
and a value
* target_data_center_id=
* source_network_domain_id=
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index da2165a..2dddf2e 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -804,7 +804,7 @@ class NttCisLBDriver(Driver):
:type ``str``
:param name: The name of the ssl certificate chain
:type ``str``
- :param crt_file: The complete path to the certificate chain file
+ :param chain_crt_file: The complete path to the certificate chain file
:type ``str``
:param description: (Optional) A description of the certificate chain
:type ``str``
@@ -828,6 +828,92 @@ class NttCisLBDriver(Driver):
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,
+ ciphers=None,
+ ssl_cert_chain_id=None):
+ """
+ Creates an SSL Offload profile
+ :param network_domain_id: The network domain's Id
+ :type ``str``
+ :param name: Offload profile's name
+ :type ``str``
+ :param ssl_domain_cert_id: Certificate's Id
+ :type ``str``
+ :param description: (Optional) Profile's description
+ :type ``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``
+ :param ssl_cert_chain_id: (Optional) Bind the certificate
+ chain to the profile.
+ :type ``str``
+ """
+ ssl_offload_elem = ET.Element("createSslOffloadProfile",
+ {"xmlns": TYPES_URN})
+ 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
+ if ciphers is not None:
+ ET.SubElement(ssl_offload_elem, "ciphers").text = ciphers
+ 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")\
+ .text = ssl_cert_chain_id
+ result = self.connection.request_with_orgId_api_2(
+ "networkDomainVip/createSslOffloadProfile",
+ method="POST",
+ data=ET.tostring(ssl_offload_elem)).object
+ response_code = findtext(result, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
+ def ex_edit_ssl_offload_profile(self, profile_id,
+ name, ssl_domain_cert_id,
+ description=None,
+ ciphers=None,
+ 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``
+ :param name: The name of the profile, new name or previous name
+ :type ``str``
+ :param ssl_domain_cert_id: The certificate id to use, new or current
+ :type ``str``
+ :param description: (Optional) Profile's description
+ :type ``str``
+ :param ciphers: (Optional) String of acceptable ciphers to use
+ :type ``str``
+ :param ssl_cert_chain_id: If using a certificate chain
+ or changing to a new one
+ :type: ``str``
+ :return: ``bool``
+ """
+ ssl_offload_elem = ET.Element("editSslOffloadProfile",
+ {"xmlns": TYPES_URN, "id": profile_id})
+ ET.SubElement(ssl_offload_elem, "name").text = name
+ if description is not None:
+ 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") \
+ .text = ssl_domain_cert_id
+ if ssl_cert_chain_id is not None:
+ ET.SubElement(ssl_offload_elem, "sslCertificateChainId") \
+ .text = ssl_cert_chain_id
+ result = self.connection.request_with_orgId_api_2(
+ "networkDomainVip/editSslOffloadProfile",
+ method="POST",
+ data=ET.tostring(ssl_offload_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
@@ -1121,11 +1207,11 @@ 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 dictionary composed of one of the following keys
+ :param params: A sequence of comma separated keyword arguments
and a value
* id=
* network_domain_id=
@@ -1133,8 +1219,7 @@ class NttCisLBDriver(Driver):
* state=
* create_time=
* expiry_time=
- * state=
- :return: `list` of :class: `NttCisdomaincertificate`
+ :return: `list` of :class: `NttCisDomaincertificate`
"""
result = self.connection.request_with_orgId_api_2(
action="networkDomainVip/sslDomainCertificate",
@@ -1155,11 +1240,11 @@ 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 dictionary composed of one of the following keys
+ :param params: A sequence of comma separated keyword arguments
and a value
* id=
* network_domain_id=
@@ -1167,7 +1252,6 @@ class NttCisLBDriver(Driver):
* state=
* create_time=
* expiry_time=
- * state=
:return: `list` of :class: `NttCissslcertficiatechain`
"""
result = self.connection.request_with_orgId_api_2(
@@ -1188,6 +1272,37 @@ class NttCisLBDriver(Driver):
method="GET").object
return self._to_certificate_chain(result)
+ @get_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=
+ :return: `list` of :class: `NttCisSslssloffloadprofile`
+ """
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslOffloadProfile",
+ params=params,
+ method="GET").object
+ return self._to_ssl_profiles(result)
+
+ def ex_get_ssl_offload_profile(self, profile_id):
+ result = self.connection.request_with_orgId_api_2(
+ action="networkDomainVip/sslOffloadProfile/%s" % profile_id,
+ method="GET").object
+ return self._to_ssl_profile(result)
+
def _to_irules(self, object):
irules = []
matches = object.findall(
@@ -1393,3 +1508,12 @@ class NttCisLBDriver(Driver):
def _to_certificate_chain(self, el):
return process_xml(ET.tostring(el))
+
+ def _to_ssl_profiles(self, object):
+ profiles = []
+ for element in object.findall(fixxpath("sslOffloadProfile", TYPES_URN)):
+ profiles.append(self._to_ssl_profile(element))
+ return profiles
+
+ def _to_ssl_profile(self, el):
+ return process_xml(ET.tostring(el))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/test/loadbalancer/fixtures/nttcis/create_ssl_offload_profile.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/create_ssl_offload_profile.xml b/libcloud/test/loadbalancer/fixtures/nttcis/create_ssl_offload_profile.xml
new file mode 100644
index 0000000..39330f6
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/create_ssl_offload_profile.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181120T182115551+0100_71eaf104-d809-4a13-a64a-70af21467378">
+ <operation>CREATE_SSL_OFFLOAD_PROFILE</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Offload Profile has been created.</message>
+ <info name="sslOffloadProfileId" value="e47a11ba-ea09-4826-a0f4-b3e09040bc1a"/>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/test/loadbalancer/fixtures/nttcis/edit_ssl_offload_profile.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/edit_ssl_offload_profile.xml b/libcloud/test/loadbalancer/fixtures/nttcis/edit_ssl_offload_profile.xml
new file mode 100644
index 0000000..d887061
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/edit_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_20181121T045948006+0100_fcc86e5b-770a-430c-8593-1b188d3dd393">
+ <operation>EDIT_SSL_OFFLOAD_PROFILE</operation>
+ <responseCode>OK</responseCode>
+ <message>SSL Offload Profile has been edited.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/test/loadbalancer/fixtures/nttcis/get_ssl_offload_profile.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/get_ssl_offload_profile.xml b/libcloud/test/loadbalancer/fixtures/nttcis/get_ssl_offload_profile.xml
new file mode 100644
index 0000000..ef72068
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/get_ssl_offload_profile.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslOffloadProfile xmlns="urn:didata.com:api:cloud:types" id="b1d3b5a7-75d7-4c44-a2b7-5bfa773dec63" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>ssl_offload</name>
+ <sslDomainCertificate id="4d2e9792-c986-4f2b-80c9-39e457eed8e8" expiryTime="2019-11-16T18:55:24.000Z">
+ <name>alice</name>
+ </sslDomainCertificate>
+ <ciphers>!ECDHE+AES-GCM:</ciphers>
+ <state>NORMAL</state>
+ <createTime>2018-11-20T14:16:04.000Z</createTime>
+</sslOffloadProfile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/test/loadbalancer/fixtures/nttcis/list_ssl_offload_profiles.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/nttcis/list_ssl_offload_profiles.xml b/libcloud/test/loadbalancer/fixtures/nttcis/list_ssl_offload_profiles.xml
new file mode 100644
index 0000000..59ac1c8
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/nttcis/list_ssl_offload_profiles.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sslOffloadProfiles xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <sslOffloadProfile id="b1d3b5a7-75d7-4c44-a2b7-5bfa773dec63" datacenterId="EU6">
+ <networkDomainId>6aafcf08-cb0b-432c-9c64-7371265db086</networkDomainId>
+ <name>ssl_offload</name>
+ <sslDomainCertificate id="4d2e9792-c986-4f2b-80c9-39e457eed8e8" expiryTime="2019-11-16T18:55:24.000Z">
+ <name>alice</name>
+ </sslDomainCertificate>
+ <ciphers>!ECDHE+AES-GCM:</ciphers>
+ <state>NORMAL</state>
+ <createTime>2018-11-20T14:16:04.000Z</createTime>
+ </sslOffloadProfile>
+</sslOffloadProfiles>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/libcloud/test/loadbalancer/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_nttcis.py b/libcloud/test/loadbalancer/test_nttcis.py
index 81d42a5..992b2d9 100644
--- a/libcloud/test/loadbalancer/test_nttcis.py
+++ b/libcloud/test/loadbalancer/test_nttcis.py
@@ -537,6 +537,26 @@ def test_ex_insert_ssl_certificate_FAIL(driver):
assert excinfo.value.msg == "Data Center EU6 requires key length must be one of 512, 1024, 2048."
+def test_ex_create_ssl_offload_profile(driver):
+ net_domain_id = "6aafcf08-cb0b-432c-9c64-7371265db086"
+ name = "ssl_offload"
+ domain_cert = driver.ex_list_ssl_domain_certs(name="alice")[0]
+ result = driver.ex_create_ssl_offload_profile(net_domain_id, name, domain_cert.id, ciphers="!ECDHE+AES-GCM:")
+ assert result is True
+
+
+def test_ex_list_ssl_offload_profile(driver):
+ NttCisMockHttp.type = "LIST"
+ profiles = driver.ex_list_ssl_offload_profiles()
+ assert profiles[0].sslDomainCertificate.name == "alice"
+
+
+def test_ex_get_ssl_offload_profile(driver):
+ profile_id = "b1d3b5a7-75d7-4c44-a2b7-5bfa773dec63"
+ profile = driver.ex_get_ssl_offload_profile(profile_id)
+ assert profile.name == "ssl_offload"
+
+
class NttCisMockHttp(MockHttp):
fixtures = LoadBalancerFileFixtures('nttcis')
@@ -552,6 +572,10 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load('oec_0_9_myaccount.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _oec_0_9_myaccount_LIST(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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener(self, method, url, body, headers):
body = self.fixtures.load(
'networkDomainVip_virtualListener.xml')
@@ -681,5 +705,45 @@ class NttCisMockHttp(MockHttp):
)
return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslDomainCertificate(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_createSslOffloadProfile(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "create_ssl_offload_profile.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslOffloadProfile_LIST(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "list_ssl_offload_profiles.xml"
+ )
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_sslOffloadProfile_b1d3b5a7_75d7_4c44_a2b7_5bfa773dec63(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load(
+ "get_ssl_offload_profile.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/e18efb15/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index 250d087..0fbec69 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -307,4 +307,12 @@ def test_insert_ssl_chain(lbdriver, compute_driver):
net_dom = compute_driver.ex_list_network_domains(name=net_dom_name)[0]
cert = '/home/mraful/client/chain.crt'
result = lbdriver.ex_import_ssl_cert_chain(net_dom.id, "ted_carol", cert, description="test cert chain")
+ assert result is True
+
+
+def test_create_ssl_profile(lbdriver):
+ net_domain_id = "6aafcf08-cb0b-432c-9c64-7371265db086"
+ name = "ssl_offload"
+ 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
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
index 9a2904c..8941630 100644
--- a/tests/lib_edit_test.py
+++ b/tests/lib_edit_test.py
@@ -466,3 +466,14 @@ def test_delete_consistency_group(drsdriver):
cg_id = cg[0].id
result = drsdriver.delete_consistency_group(cg_id)
assert result is True
+
+
+def test_edit_ssl_offload_profile(lbdriver):
+ profile_name = "ssl_offload"
+ datacenter_id = "EU6"
+ profile = lbdriver.ex_list_ssl_offload_profiles(name=profile_name, datacenter_id=datacenter_id)[0]
+ 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
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e18efb15/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 0c25529..f79fc33 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -454,4 +454,16 @@ def test_list_certificate_chains(lbdriver):
def test_get_certificate_chain(lbdriver):
chain_id = "dc5a4235-2f1b-47e1-b6dd-455938a3377b"
cert_chain = lbdriver.ex_get_ssl_certificate_chain(chain_id)
- print(cert_chain.name)
\ No newline at end of file
+ print(cert_chain.name)
+
+
+def test_list_ssl_offload_profiles(lbdriver):
+ profiles = lbdriver.ex_list_ssl_offload_profiles()
+ for profile in profiles:
+ print(profile)
+
+
+def test_get_ssl_offload_profile(lbdriver):
+ profile_id = "b1d3b5a7-75d7-4c44-a2b7-5bfa773dec63"
+ profile = lbdriver.ex_get_ssl_offload_profile(profile_id)
+ print(profile.name, profile.createTime, profile.state)
\ No newline at end of file
[10/45] libcloud git commit: moved create_consistency_group to
drs/drivers/nttcis.py from compute/drivers/nttcis.py. Started testing delete
Posted by an...@apache.org.
moved create_consistency_group to drs/drivers/nttcis.py from compute/drivers/nttcis.py. Started testing delete
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/88daff6d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/88daff6d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/88daff6d
Branch: refs/heads/trunk
Commit: 88daff6db7d252e8cad773b43fedf93a6e3bc553
Parents: 10c4a31
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Oct 30 16:09:59 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Oct 30 16:09:59 2018 -0400
----------------------------------------------------------------------
libcloud/drs/drivers/nttcis.py | 8 +-------
tests/lib_create_test.py | 10 ++++++++++
tests/lib_edit_test.py | 5 +++++
3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/88daff6d/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index e368560..ab5f0de 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -87,10 +87,4 @@ class NttCisDRSDriver(Driver):
method="POST",
data=ET.tostring(consistency_group_elm)).object
response_code = findtext(response, 'responseCode', TYPES_URN)
- try:
- assert response_code in ['IN_PROGRESS', 'OK']
- except AssertionError:
- return response_code
- else:
- info = findtext(response, "info", TYPES_URN)
- print(info)
+ return response_code in ['IN_PROGRESS', 'OK']
http://git-wip-us.apache.org/repos/asf/libcloud/blob/88daff6d/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index 0b345a8..a38f65b 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -250,3 +250,13 @@ def test_fail_create_drs(na_compute_driver, drsdriver):
"sdk_cg", "100", src_id, target_id, description="A test consistency group")
exception_msg = excinfo.value.msg
assert exception_msg == 'DRS is not supported between source Data Center NA9 and target Data Center NA12.'
+
+
+def test_create_drs(na_compute_driver, drsdriver):
+ nodes = na_compute_driver.list_nodes(ex_name='Src-Test-VM01')
+ src_id = nodes[0].id
+ nodes = na_compute_driver.list_nodes(ex_name="Tgt-Test-VM01")
+ target_id = nodes[0].id
+ result = drsdriver.create_consistency_group(
+ "sdk_test_cg", "100", src_id, target_id, description="A test consistency group")
+ assert result is True
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/88daff6d/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
index 32984ee..db628c2 100644
--- a/tests/lib_edit_test.py
+++ b/tests/lib_edit_test.py
@@ -450,3 +450,8 @@ def test_delete_listener(compute_driver, lbdriver):
listener = [l for l in listeners if l.name == listener_name][0]
result = lbdriver.destroy_balancer(listener)
assert result is True
+
+
+def test_delete_consistency_group(drsdriver):
+ cg_name = "sdk_test_cg"
+ pass
[18/45] libcloud git commit: Added documentation for drs via sphinx
and added tests for expand journal.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/storage/_supported_methods_cdn.rst
----------------------------------------------------------------------
diff --git a/docs/storage/_supported_methods_cdn.rst b/docs/storage/_supported_methods_cdn.rst
index 088b5ac..bedc837 100644
--- a/docs/storage/_supported_methods_cdn.rst
+++ b/docs/storage/_supported_methods_cdn.rst
@@ -8,6 +8,7 @@ Provider enable container cdn enable object cdn get contain
`Microsoft Azure (blobs)`_ no no no no
`Backblaze B2`_ no no no no
`CloudFiles`_ yes no yes yes
+`DigitalOcean Spaces`_ no no no no
`Google Cloud Storage`_ no no no no
`KTUCloud Storage`_ yes no yes yes
`Local Storage`_ yes yes yes yes
@@ -23,6 +24,7 @@ Provider enable container cdn enable object cdn get contain
`Amazon S3 (ap-southeast-2)`_ no no no no
`Amazon S3 (ca-central-1)`_ no no no no
`Amazon S3 (cn-north-1)`_ no no no no
+`Amazon S3 (cn-northwest-1)`_ no no no no
`Amazon S3 (eu-central-1)`_ no no no no
`Amazon S3 (eu-west-1)`_ no no no no
`Amazon S3 (eu-west-2)`_ no no no no
@@ -40,6 +42,7 @@ Provider enable container cdn enable object cdn get contain
.. _`Microsoft Azure (blobs)`: http://windows.azure.com/
.. _`Backblaze B2`: https://www.backblaze.com/b2/
.. _`CloudFiles`: http://www.rackspace.com/
+.. _`DigitalOcean Spaces`: https://www.digitalocean.com/products/object-storage/
.. _`Google Cloud Storage`: http://cloud.google.com/storage
.. _`KTUCloud Storage`: http://www.rackspace.com/
.. _`Local Storage`: http://example.com
@@ -55,6 +58,7 @@ Provider enable container cdn enable object cdn get contain
.. _`Amazon S3 (ap-southeast-2)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (ca-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (cn-north-1)`: http://aws.amazon.com/s3/
+.. _`Amazon S3 (cn-northwest-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-2)`: http://aws.amazon.com/s3/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/storage/_supported_methods_main.rst
----------------------------------------------------------------------
diff --git a/docs/storage/_supported_methods_main.rst b/docs/storage/_supported_methods_main.rst
index 0e377a2..938ae30 100644
--- a/docs/storage/_supported_methods_main.rst
+++ b/docs/storage/_supported_methods_main.rst
@@ -24,6 +24,7 @@ Provider list containers list objects create container dele
`Amazon S3 (ap-southeast-2)`_ yes yes yes yes yes yes yes yes yes
`Amazon S3 (ca-central-1)`_ yes yes yes yes yes yes yes yes yes
`Amazon S3 (cn-north-1)`_ yes yes yes yes yes yes yes yes yes
+`Amazon S3 (cn-northwest-1)`_ yes yes yes yes yes yes yes yes yes
`Amazon S3 (eu-central-1)`_ yes yes yes yes yes yes yes yes yes
`Amazon S3 (eu-west-1)`_ yes yes yes yes yes yes yes yes yes
`Amazon S3 (eu-west-2)`_ yes yes yes yes yes yes yes yes yes
@@ -57,6 +58,7 @@ Provider list containers list objects create container dele
.. _`Amazon S3 (ap-southeast-2)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (ca-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (cn-north-1)`: http://aws.amazon.com/s3/
+.. _`Amazon S3 (cn-northwest-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-2)`: http://aws.amazon.com/s3/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/docs/storage/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/storage/_supported_providers.rst b/docs/storage/_supported_providers.rst
index 7c8687b..d33e377 100644
--- a/docs/storage/_supported_providers.rst
+++ b/docs/storage/_supported_providers.rst
@@ -24,6 +24,7 @@ Provider Documentation
`Amazon S3 (ap-southeast-2)`_ S3_AP_SOUTHEAST2 single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3APSE2StorageDriver`
`Amazon S3 (ca-central-1)`_ S3_CA_CENTRAL single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3CACentralStorageDriver`
`Amazon S3 (cn-north-1)`_ S3_CN_NORTH single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3CNNorthStorageDriver`
+`Amazon S3 (cn-northwest-1)`_ S3_CN_NORTHWEST single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3CNNorthWestStorageDriver`
`Amazon S3 (eu-central-1)`_ S3_EU_CENTRAL single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3EUCentralStorageDriver`
`Amazon S3 (eu-west-1)`_ S3_EU_WEST single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3EUWestStorageDriver`
`Amazon S3 (eu-west-2)`_ S3_EU_WEST2 single region driver :mod:`libcloud.storage.drivers.s3` :class:`S3EUWest2StorageDriver`
@@ -57,6 +58,7 @@ Provider Documentation
.. _`Amazon S3 (ap-southeast-2)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (ca-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (cn-north-1)`: http://aws.amazon.com/s3/
+.. _`Amazon S3 (cn-northwest-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-central-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-1)`: http://aws.amazon.com/s3/
.. _`Amazon S3 (eu-west-2)`: http://aws.amazon.com/s3/
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index 78dc73f..d257bf8 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -1693,10 +1693,6 @@ class NttCisTagKey(object):
% (self.id, self.name))
-class NttCisFactory(object):
- pass
-
-
class NttCisIpAddressList(object):
"""
NttCis IP Address list
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 18e2bdb..cfe5619 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -203,6 +203,7 @@ class NttCisNodeDriver(NodeDriver):
:return: The newly created :class:`Node`.
:rtype: :class:`Node`
"""
+
password = None
image_needs_auth = self._image_needs_auth(image)
if image_needs_auth:
@@ -704,6 +705,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('deleteServer',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -723,6 +725,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('rebootServer',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -781,6 +784,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of `Node` objects
:rtype: ``list`` of :class:`Node`
"""
+
node_list = []
# This is a generator so we changed from the original
# and if nodes is not empty, ie, the stop iteration confdition
@@ -811,6 +815,7 @@ class NttCisNodeDriver(NodeDriver):
:return: List of images available
:rtype: ``list`` of :class:`NodeImage`
"""
+
params = {}
if location is not None:
params['datacenterId'] = self._location_to_location_id(location)
@@ -829,6 +834,7 @@ class NttCisNodeDriver(NodeDriver):
@inherits: :class:`NodeDriver.list_sizes`
"""
+
return [
NodeSize(id=1,
name="default",
@@ -869,6 +875,7 @@ class NttCisNodeDriver(NodeDriver):
:return: List of locations
:rtype: ``list`` of :class:`NodeLocation`
"""
+
params = {}
if ex_id is not None:
params['id'] = ex_id
@@ -892,6 +899,7 @@ class NttCisNodeDriver(NodeDriver):
:return: List of locations
:rtype: ``list`` of :class:`NodeLocation`
"""
+
params = {}
if ex_id is not None:
params['id'] = ex_id
@@ -908,6 +916,7 @@ class NttCisNodeDriver(NodeDriver):
:return: dictionary with keys id, day_of_week, start_hour, availability
:rtype: dict
"""
+
params = {}
params['datacenterId'] = self._location_to_location_id(location)
params['servicePlan'] = plan
@@ -927,6 +936,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisNetwork objects
:rtype: ``list`` of :class:`NttCisNetwork`
"""
+
url_ext = ''
if location is not None:
url_ext = '/' + self._location_to_location_id(location)
@@ -1075,11 +1085,9 @@ class NttCisNodeDriver(NodeDriver):
:keyword started: Filters the node list to nodes that are
started or not
:type started: ``bool``
-
:keyword state: Filters the node list to nodes that are in
this state
:type state: ``str``
-
:keyword network: Filters the node list to nodes in this network
:type network: :class:`NttCisNetwork` or ``str``
@@ -1087,9 +1095,9 @@ class NttCisNodeDriver(NodeDriver):
network domain
:type network_domain: :class:`NttCisNetworkDomain`
or ``str``
-
:return: a list of `Node` objects
:rtype: ``generator`` of `list` of :class:`Node`
+
"""
params = {}
@@ -1153,6 +1161,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('startServer',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -1174,6 +1183,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('shutdownServer',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -1195,6 +1205,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('powerOffServer',
{'xmlns': TYPES_URN, 'id': node.id})
@@ -1222,6 +1233,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('resetServer',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -1241,6 +1253,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request_elm = ET.Element('updateVmwareTools',
{'xmlns': TYPES_URN, 'id': node.id})
body = self.connection.request_with_orgId_api_2(
@@ -1272,6 +1285,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
data = {}
if name is not None:
data['name'] = name
@@ -1335,6 +1349,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list``
"""
+
params = {}
params['serverId'] = self.list_nodes(ex_name=node)[0].id
return self._to_snapshots(self.connection.request_with_orgId_api_2(
@@ -1350,6 +1365,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``dict``
"""
+
return self._to_snapshot(self.connection.request_with_orgId_api_2(
'snapshot/snapshot/%s' % snapshot_id).object)
@@ -1362,6 +1378,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list``
"""
+
update_node = ET.Element('disableSnapshotService',
{'xmlns': TYPES_URN})
@@ -1377,14 +1394,16 @@ class NttCisNodeDriver(NodeDriver):
def ex_initiate_manual_snapshot(self, name=None, server_id=None):
"""
Initiate a manual snapshot of server on the fly
+
:param name: optional name of server
- :type ``str``
+ :type name: ``str``
:param server_id: optinal parameter to use instead of name
- :type ``str``
+ :type `server_id`str``
:return: True of False
:rtype: ``bool``
+
"""
if server_id is None:
@@ -1453,6 +1472,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``str``
"""
+
create_preview = ET.Element('createSnapshotPreviewServer',
{'xmlns': TYPES_URN,
'snapshotId': snapshot_id})
@@ -1510,6 +1530,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
if not isinstance(node_list, (list, tuple)):
raise TypeError("Node list must be a list or a tuple.")
anti_affinity_xml_request = ET.Element('createAntiAffinityRule',
@@ -1534,6 +1555,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
rule_id = anti_affinity_rule
update_node = ET.Element('deleteAntiAffinityRule',
@@ -1575,6 +1597,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:NttCisAntiAffinityRule`
"""
+
not_none_arguments = [key
for key in (network, network_domain, node)
if key is not None]
@@ -1629,6 +1652,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request = ET.Element('addNic',
{'xmlns': TYPES_URN})
ET.SubElement(request, 'serverId').text = node.id
@@ -1658,6 +1682,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
request = ET.Element('removeNic',
{'xmlns': TYPES_URN,
'id': nic_id})
@@ -1680,6 +1705,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisNetwork objects
:rtype: ``list`` of :class:`NttCisNetwork`
"""
+
return self.list_networks(location=location)
def ex_create_network(self, location, name, description=None):
@@ -1698,6 +1724,7 @@ class NttCisNodeDriver(NodeDriver):
:return: A new instance of `NttCisNetwork`
:rtype: Instance of :class:`NttCisNetwork`
"""
+
network_location = self._location_to_location_id(location)
create_node = ET.Element('NewNetworkWithLocation',
@@ -1728,6 +1755,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
response = self.connection.request_with_orgId_api_1(
'network/%s?delete' % network.id,
method='GET').object
@@ -1746,6 +1774,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
response = self.connection.request_with_orgId_api_1(
'network/%s' % network.id,
method='POST',
@@ -1762,6 +1791,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NttCisNetworkDomain`
"""
+
locations = self.list_locations()
net = self.connection.request_with_orgId_api_2(
'network/networkDomain/%s' % network_domain_id).object
@@ -1789,6 +1819,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of `NttCisNetwork` objects
:rtype: ``list`` of :class:`NttCisNetwork`
"""
+
params = {}
if location is not None:
params['datacenterId'] = self._location_to_location_id(location)
@@ -1826,6 +1857,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisNetworkDomain`
:rtype: :class:`NttCisNetworkDomain`
"""
+
create_node = ET.Element('deployNetworkDomain', {'xmlns': TYPES_URN})
ET.SubElement(
create_node,
@@ -1867,6 +1899,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisNetworkDomain`
:rtype: :class:`NttCisNetworkDomain`
"""
+
edit_node = ET.Element('editNetworkDomain', {'xmlns': TYPES_URN})
edit_node.set('id', network_domain.id)
ET.SubElement(edit_node, "name").text = network_domain.name
@@ -1891,6 +1924,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
delete_node = ET.Element('deleteNetworkDomain', {'xmlns': TYPES_URN})
delete_node.set('id', network_domain.id)
result = self.connection.request_with_orgId_api_2(
@@ -1930,6 +1964,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisVlan`
:rtype: :class:`NttCisVlan`
"""
+
create_node = ET.Element('deployVlan', {'xmlns': TYPES_URN})
ET.SubElement(create_node, "networkDomainId").text = network_domain.id
ET.SubElement(create_node, "name").text = name
@@ -1963,6 +1998,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisVlan`
:rtype: :class:`NttCisVlan`
"""
+
locations = self.list_locations()
vlan = self.connection.request_with_orgId_api_2(
'network/vlan/%s' % vlan_id).object
@@ -1979,6 +2015,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisVlan`
:rtype: :class:`NttCisVlan`
"""
+
edit_node = ET.Element('editVlan', {'xmlns': TYPES_URN})
edit_node.set('id', vlan.id)
ET.SubElement(edit_node, "name").text = vlan.name
@@ -2006,6 +2043,7 @@ class NttCisNodeDriver(NodeDriver):
:return: an instance of `NttCisVlan`
:rtype: :class:`NttCisVlan`
"""
+
edit_node = ET.Element('expandVlan', {'xmlns': TYPES_URN})
edit_node.set('id', vlan.id)
ET.SubElement(edit_node, "privateIpv4PrefixSize").text =\
@@ -2027,6 +2065,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
delete_node = ET.Element('deleteVlan', {'xmlns': TYPES_URN})
delete_node.set('id', vlan.id)
result = self.connection.request_with_orgId_api_2(
@@ -2063,6 +2102,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisVlan objects
:rtype: ``list`` of :class:`NttCisVlan`
"""
+
params = {}
if location is not None:
params['datacenterId'] = self._location_to_location_id(location)
@@ -2237,24 +2277,24 @@ class NttCisNodeDriver(NodeDriver):
:type network_domain: :class:`NttCisNetworkDomain` or ``str``
:param name: The rule's name
- :type ``str``
+ :type name: ``str``
:param action: 'ACCEPT_DECISIVELY' or 'DROP'
- :type ``str``
+ :type action: ``str``
:param ip_version: 'IPV4' or 'IPV6'
- :type ``str``
+ :type ip_version: ``str``
:param protocol: One of 'IP', 'ICMP', 'TCP', or 'UDP'
- :type ``str``
+ :type protocol: ``str``
:param source_addr: The source address, which must be an
NttCisFirewallAddress instance
- :type ``NttCisFirewallAddress``
+ :type source_addr: ``NttCisFirewallAddress``
:param dest_addr: The destination address, which must be an
NttCisFirewallAddress instance
- :type `NttCisFirewallAddress``
+ :type dest_addr: `NttCisFirewallAddress``
:param position: The position in which to create the rule
There are two types of positions
@@ -2265,7 +2305,7 @@ class NttCisNodeDriver(NodeDriver):
:param enabled: Firewall rule is enabled upon creation.
Set to 1 for true or 0 for false.
- :type ``int``
+ :type enabled: ``int``
:param position_relative_to_rule: The rule or rule name in
which to decide positioning by
@@ -2274,6 +2314,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
positions_without_rule = ('FIRST', 'LAST')
positions_with_rule = ('BEFORE', 'AFTER')
@@ -2528,6 +2569,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('editFirewallRule', {'xmlns': TYPES_URN})
update_node.set('id', rule.id)
ET.SubElement(update_node, 'enabled').text = str(state).lower()
@@ -2548,6 +2590,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('deleteFirewallRule', {'xmlns': TYPES_URN})
update_node.set('id', rule.id)
result = self.connection.request_with_orgId_api_2(
@@ -2573,6 +2616,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NttCisNatRule`
"""
+
create_node = ET.Element('createNatRule', {'xmlns': TYPES_URN})
ET.SubElement(create_node, 'networkDomainId').text = network_domain.id
ET.SubElement(create_node, 'internalIp').text = internal_ip
@@ -2604,6 +2648,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:`NttCisNatRule`
"""
+
params = {}
params['networkDomainId'] = network_domain.id
@@ -2624,6 +2669,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NttCisNatRule`
"""
+
rule = self.connection.request_with_orgId_api_2(
'network/natRule/%s' % rule_id).object
return self._to_nat_rule(rule, network_domain)
@@ -2637,6 +2683,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('deleteNatRule', {'xmlns': TYPES_URN})
update_node.set('id', rule.id)
result = self.connection.request_with_orgId_api_2(
@@ -2656,6 +2703,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NodeLocation`
"""
+
location = None
if id is not None:
location = self.list_locations(ex_id=id)[0]
@@ -2687,6 +2735,7 @@ class NttCisNodeDriver(NodeDriver):
:param kwargs: The arguments for func
:type kwargs: Keyword arguments
"""
+
return self.connection.wait_for_state(state, func, poll_interval,
timeout, *args, **kwargs)
@@ -2703,6 +2752,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('enableServerMonitoring',
{'xmlns': TYPES_URN})
update_node.set('id', node.id)
@@ -2728,6 +2778,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('changeServerMonitoringPlan',
{'xmlns': TYPES_URN})
update_node.set('id', node.id)
@@ -2749,6 +2800,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update_node = ET.Element('disableServerMonitoring',
{'xmlns': TYPES_URN})
update_node.set('id', node.id)
@@ -2770,6 +2822,7 @@ class NttCisNodeDriver(NodeDriver):
:param bus_number: optional number of server's bus
:return: whether addition is in progress or 'OK' otherwise false
"""
+
update_node = ET.Element('addScsiController',
{'xmlns': TYPES_URN})
ET.SubElement(update_node, 'serverId').text = server_id
@@ -2790,6 +2843,7 @@ class NttCisNodeDriver(NodeDriver):
:param controller_id: Scsi controller's id
:return: whether addition is in progress or 'OK' otherwise false
"""
+
update_node = ET.Element('removeScsiController', {'xmlns': TYPES_URN})
update_node.set('id', controller_id)
result = self.connection.request_with_orgId_api_2(
@@ -2865,6 +2919,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
disk = [disk for disk in node.extra['disks']
if disk.scsi_id == scsi_id][0]
return self.ex_remove_storage(disk.id)
@@ -2881,6 +2936,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
remove_disk = ET.Element('removeDisk',
{'xmlns': TYPES_URN})
remove_disk.set('id', disk_id)
@@ -2906,6 +2962,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
create_node = ET.Element('changeDiskSpeed', {'xmlns': TYPES_URN})
create_node.set('id', disk_id)
ET.SubElement(create_node, 'speed').text = speed
@@ -2933,6 +2990,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
create_node = ET.Element('expandDisk', {'xmlns': TYPES_URN,
'id': disk_id})
ET.SubElement(create_node, 'newSizeGb').text = str(size)
@@ -2973,6 +3031,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
update = ET.Element('reconfigureServer', {'xmlns': TYPES_URN})
update.set('id', node.id)
if memory_gb is not None:
@@ -3009,6 +3068,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
if image_description is None:
image_description = ''
@@ -3072,6 +3132,7 @@ class NttCisNodeDriver(NodeDriver):
:param node: The failed node to clean
:type node: :class:`Node` or ``str``
"""
+
node_id = self._node_to_node_id(node)
request_elm = ET.Element('cleanServer',
{'xmlns': TYPES_URN, 'id': node_id})
@@ -3091,6 +3152,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:`NodeImage`
"""
+
params = {}
if location is not None:
params['datacenterId'] = self._location_to_location_id(location)
@@ -3110,6 +3172,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NodeImage`
"""
+
image = self.connection.request_with_orgId_api_2(
'image/osImage/%s' % id).object
return self._to_image(image)
@@ -3123,6 +3186,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NodeImage`
"""
+
image = self.connection.request_with_orgId_api_2(
'image/customerImage/%s' % id).object
return self._to_image(image)
@@ -3141,6 +3205,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NodeImage`
"""
+
try:
return self.ex_get_base_image_by_id(id)
except NttCisAPIException as e:
@@ -3169,6 +3234,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
create_tag_key = ET.Element('createTagKey', {'xmlns': TYPES_URN})
ET.SubElement(create_tag_key, 'name').text = name
if description is not None:
@@ -3205,6 +3271,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:`NttCisTagKey`
"""
+
params = {}
if id is not None:
params['id'] = id
@@ -3235,6 +3302,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: :class:`NttCisTagKey`
"""
+
tag_key = self.connection.request_with_orgId_api_2(
'tag/tagKey/%s' % id).object
return self._to_tag_key(tag_key)
@@ -3244,13 +3312,14 @@ class NttCisNodeDriver(NodeDriver):
NOTICE: Tag key is one of those instances where Libloud
handles the search of a list for the client code.
This behavior exists inconsistently across libcloud.
- Get a specific tag key by Name
+ Get a specific tag key by Name
:param name: Name of the tag key you want (required)
:type name: ``str``
:rtype: :class:`NttCisTagKey`
"""
+
tag_keys = self.ex_list_tag_keys(name=name)
if len(tag_keys) != 1:
raise ValueError("No tags found with name %s" % name)
@@ -3281,6 +3350,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
tag_key_id = self._tag_key_to_tag_key_id(tag_key)
modify_tag_key = ET.Element('editTagKey',
{'xmlns': TYPES_URN, 'id': tag_key_id})
@@ -3311,6 +3381,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
tag_key_id = self._tag_key_to_tag_key_id(tag_key)
remove_tag_key = ET.Element('deleteTagKey',
{'xmlns': TYPES_URN, 'id': tag_key_id})
@@ -3341,6 +3412,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
asset_type = self._get_tagging_asset_type(asset)
tag_key_name = self._tag_key_to_tag_key_name(tag_key)
@@ -3375,6 +3447,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``bool``
"""
+
asset_type = self._get_tagging_asset_type(asset)
tag_key_name = self._tag_key_to_tag_key_name(tag_key)
@@ -3423,6 +3496,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of :class:`NttCisTag`
"""
+
params = {}
if asset_id is not None:
params['assetId'] = asset_id
@@ -3464,6 +3538,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of ``list``
"""
+
result = self.connection.raw_request_with_orgId_api_1(
'report/usage?startDate=%s&endDate=%s' % (
start_date, end_date))
@@ -3481,6 +3556,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of ``list``
"""
+
result = self.connection.raw_request_with_orgId_api_1(
'report/usageDetailed?startDate=%s&endDate=%s' % (
start_date, end_date))
@@ -3498,6 +3574,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of ``list``
"""
+
result = self.connection.raw_request_with_orgId_api_1(
'report/usageSoftwareUnits?startDate=%s&endDate=%s' % (
start_date, end_date))
@@ -3515,6 +3592,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of ``list``
"""
+
result = self.connection.raw_request_with_orgId_api_1(
'auditlog?startDate=%s&endDate=%s' % (
start_date, end_date))
@@ -3536,6 +3614,7 @@ class NttCisNodeDriver(NodeDriver):
:rtype: ``list`` of ``list``
"""
+
datacenter_id = self._location_to_location_id(location)
result = self.connection.raw_request_with_orgId_api_1(
'backup/detailedUsageReport?datacenterId=%s&fromDate=%s&toDate=%s'
@@ -3576,6 +3655,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisIpAddressList objects
:rtype: ``list`` of :class:`NttCisIpAddressList`
"""
+
params = {'networkDomainId': self._network_domain_to_network_domain_id(
ex_network_domain)}
response = self.connection.request_with_orgId_api_2(
@@ -3706,6 +3786,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisIpAddressList objects
:rtype: ``list`` of :class:`NttCisIpAddressList`
"""
+
if (ip_address_collection is None and
child_ip_address_list is None):
raise ValueError("At least one ipAddress element or one "
@@ -3946,6 +4027,7 @@ class NttCisNodeDriver(NodeDriver):
:return: a list of NttCisPortList objects
:rtype: ``list`` of :class:`NttCisPortList`
"""
+
params = {'networkDomainId':
self._network_domain_to_network_domain_id(ex_network_domain)}
response = self.connection.request_with_orgId_api_2(
@@ -3977,6 +4059,7 @@ class NttCisNodeDriver(NodeDriver):
:return: NttCisPortList object
:rtype: :class:`NttCisPort`
"""
+
url_path = ('network/portList/%s' % ex_portlist_id)
response = self.connection.request_with_orgId_api_2(
url_path).object
@@ -4044,6 +4127,7 @@ class NttCisNodeDriver(NodeDriver):
:return: result of operation
:rtype: ``bool``
"""
+
new_port_list = ET.Element('createPortList', {'xmlns': TYPES_URN})
ET.SubElement(
new_port_list,
@@ -4972,6 +5056,7 @@ class NttCisNodeDriver(NodeDriver):
type of snapshot
state
"""
+
snapshot_elements = object.findall(fixxpath('snapshot', TYPES_URN))
return [self._to_snapshot(el) for el in snapshot_elements]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/drs/base.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/base.py b/libcloud/drs/base.py
index 157fe5a..b5ee738 100644
--- a/libcloud/drs/base.py
+++ b/libcloud/drs/base.py
@@ -58,7 +58,7 @@ class DRSConsistencyGroup(object):
self.extra = extra or {}
-class Driver(BaseDriver):
+class DRSDriver(BaseDriver):
"""
A base Driver class to derive from
@@ -72,7 +72,7 @@ class Driver(BaseDriver):
def __init__(self, key, secret=None, secure=True, host=None,
port=None, **kwargs):
- super(Driver, self).__init__(key=key, secret=secret, secure=secure,
+ super(DRSDriver, self).__init__(key=key, secret=secret, secure=secure,
host=host, port=port, **kwargs)
def create_consistency_group(self, name, journal_sz_gb,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index d97b632..b0930c8 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -6,7 +6,7 @@ from libcloud.common.nttcis import API_ENDPOINTS
from libcloud.common.nttcis import DEFAULT_REGION
from libcloud.common.nttcis import process_xml
from libcloud.drs.types import Provider
-from libcloud.drs.base import Driver
+from libcloud.drs.base import DRSDriver
from libcloud.common.nttcis import TYPES_URN
from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.common.types import LibcloudError
@@ -32,7 +32,7 @@ def get_params(func):
return paramed
-class NttCisDRSDriver(Driver):
+class NttCisDRSDriver(DRSDriver):
"""
NttCis node driver.
"""
@@ -117,15 +117,15 @@ class NttCisDRSDriver(Driver):
"""
Functions takes a named parameter that must be one of the following
:param params: A dictionary composed of one of the follwing keys and a value
- target_data_center_id:
- source_network_domain_id:
- target_network_domain_id:
- source_server_id:
- target_server_id:
- name:
- state:
- operation_status:
- drs_infrastructure_status:
+ * 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`
"""
@@ -158,6 +158,26 @@ class NttCisDRSDriver(Driver):
snapshots = self._to_process(paged_result)
return snapshots
+ 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:
+ """
+
+ expand_elm = ET.Element("expandJournal", {"id": consistency_group_id,
+ "xmlns": TYPES_URN})
+ ET.SubElement(expand_elm, "sizeGb").text = size_gb
+ response = self.connection.request_with_orgId_api_2(
+ "consistencyGroup/expandJournal",
+ method="POST",
+ data=ET.tostring(expand_elm)).object
+ response_code = findtext(response, 'responseCode', TYPES_URN)
+ return response_code in ['IN_PROGRESS', 'OK']
+
def _to_consistency_groups(self, object):
cgs = findall(object, 'consistencyGroup', TYPES_URN)
return [self._to_process(el) for el in cgs]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 4a18376..1348c65 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -141,6 +141,7 @@ class NttCisLBDriver(Driver):
:rtype: :class:`LoadBalancer`
"""
+
network_domain_id = self.network_domain_id
if protocol is None:
protocol = 'http'
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/expand_cg.xml b/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
new file mode 100644
index 0000000..f29d9a1
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/expand_cg.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181106T161731342-0500_8c65ed73-ddb1-4043-981a-535a0c8e28aa">
+ <operation>EXPAND_JOURNAL</operation>
+ <responseCode>IN_PROGRESS</responseCode>
+ <message>Request to Expand DRS Journal Space has been accepted. Please use appropriate Get or List API for status.</message>
+</response>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index 7431a25..a7e939c 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -53,6 +53,17 @@ def test_get_consistency_group_by_name(driver):
assert cgs[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+def test_expand_journal(driver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ size_gb = "100"
+ result = driver.expand_journal(cg_id, size_gb)
+ assert result is True
+
+
+def test_start_failover_preview(driver):
+ pass
+
+
class NttCisMockHttp(MockHttp):
fixtures = DRSFileFixtures('nttcis')
@@ -97,4 +108,12 @@ class NttCisMockHttp(MockHttp):
body,
headers):
body = self.fixtures.load("list_cg_by_params.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_expandJournal(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("expand_cg.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/614b43d4/tests/lib_edit_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_edit_test.py b/tests/lib_edit_test.py
index db628c2..ff1dccc 100644
--- a/tests/lib_edit_test.py
+++ b/tests/lib_edit_test.py
@@ -452,6 +452,13 @@ def test_delete_listener(compute_driver, lbdriver):
assert result is True
+def test_expand_journal(drsdriver):
+ cgs = drsdriver.list_consistency_groups(name="sdk_test2_cg")
+ cg_id = cgs[0].id
+ expand_by = "100"
+ result = drsdriver.expand_journal(cg_id, expand_by)
+ assert result is True
+
def test_delete_consistency_group(drsdriver):
cg_name = "sdk_test_cg"
pass
[25/45] libcloud git commit: renamed file after testing .pylintrc.bak
-> .pylintrc
Posted by an...@apache.org.
renamed file after testing .pylintrc.bak -> .pylintrc
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/99b7bda8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/99b7bda8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/99b7bda8
Branch: refs/heads/trunk
Commit: 99b7bda820f706567b6ca2509c27a6831b06ba36
Parents: 805a272
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 13 11:56:02 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 13 11:56:02 2018 -0500
----------------------------------------------------------------------
.pylintrc | 36 ++++++++++++++++++++++++++++++++++++
.pylintrc.bak | 36 ------------------------------------
2 files changed, 36 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/99b7bda8/.pylintrc
----------------------------------------------------------------------
diff --git a/.pylintrc b/.pylintrc
new file mode 100644
index 0000000..21b7711
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,36 @@
+[MASTER]
+# Add <file or directory> to the black list. It should be a base name, not a
+# path. You may set this option multiple times.
+ignore=test
+ignore=constants
+
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+
+[MESSAGES CONTROL]
+disable=redefined-builtin,too-many-arguments,too-few-public-methods,missing-docstring,invalid-name,abstract-method,no-self-use
+
+
+[TYPECHECK]
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed. Python regular
+# expressions are accepted.
+generated-members=async_request,objects
+
+[VARIABLES]
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching names used for dummy variables (i.e. not used).
+dummy-variables-rgx=_|dummy
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid to define new builtins when possible.
+additional-builtins=
http://git-wip-us.apache.org/repos/asf/libcloud/blob/99b7bda8/.pylintrc.bak
----------------------------------------------------------------------
diff --git a/.pylintrc.bak b/.pylintrc.bak
deleted file mode 100644
index 21b7711..0000000
--- a/.pylintrc.bak
+++ /dev/null
@@ -1,36 +0,0 @@
-[MASTER]
-# Add <file or directory> to the black list. It should be a base name, not a
-# path. You may set this option multiple times.
-ignore=test
-ignore=constants
-
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-
-[MESSAGES CONTROL]
-disable=redefined-builtin,too-many-arguments,too-few-public-methods,missing-docstring,invalid-name,abstract-method,no-self-use
-
-
-[TYPECHECK]
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed. Python regular
-# expressions are accepted.
-generated-members=async_request,objects
-
-[VARIABLES]
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# A regular expression matching names used for dummy variables (i.e. not used).
-dummy-variables-rgx=_|dummy
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
[21/45] libcloud git commit: added addtional tests and the
functionality to choose snapshots by filtering create times
Posted by an...@apache.org.
added addtional tests and the functionality to choose snapshots by filtering create times
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3e83d4be
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3e83d4be
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3e83d4be
Branch: refs/heads/trunk
Commit: 3e83d4beb4380ff36061b20fae991175f91e2f84
Parents: 9c76b41
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Thu Nov 8 09:20:00 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Thu Nov 8 09:20:00 2018 -0500
----------------------------------------------------------------------
libcloud/drs/drivers/nttcis.py | 53 +++++++++++-
.../fixtures/nttcis/drs_snapshots_by_min.xml | 90 ++++++++++++++++++++
libcloud/test/drs/test_nttcis.py | 48 ++++++++---
tests/lib_list_test.py | 23 ++++-
4 files changed, 198 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e83d4be/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index b0930c8..13490ae 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -116,7 +116,7 @@ class NttCisDRSDriver(DRSDriver):
def list_consistency_groups(self, params={}):
"""
Functions takes a named parameter that must be one of the following
- :param params: A dictionary composed of one of the follwing keys and a value
+ :param params: A dictionary composed of one of the following keys and a value
* target_data_center_id=
* source_network_domain_id=
* target_network_domain_id=
@@ -148,8 +148,50 @@ class NttCisDRSDriver(DRSDriver):
cg = self._to_process(response)
return cg
- def list_consistency_group_snapshots(self, consistency_group_id):
- params = {"consistencyGroupId": consistency_group_id}
+ def list_consistency_group_snapshots(self, consistency_group_id,
+ create_time_min=None,
+ create_time_max=None):
+ """
+ Optional parameters identify the date of creation of Consistency Group
+ snapshots in *XML Schema (XSD) date time format. Best used as a
+ combination of createTime.MIN and createTime.MAX. If neither is
+ provided then all snapshots up to the possible maximum of 1014
+ will be returned. If MIN is provided by itself, all snapshots
+ between the time specified by MIN and the point in time of
+ execution will be returned. If MAX is provided by itself,
+ then all snapshots up to that point in time (up to the
+ maximum number of 1014) will be returned. MIN and MAX are
+ inclusive for this API function
+
+ :param consistency_group_id: The id of consistency group
+ :type consistency_group_id: ``str``
+ :param create_time_min: (Optional) in form YYYY-MM-DDT00:00.00.00Z or
+ substitute time offset for Z, i.e,
+ -05:00
+ :type create_time_min: ``str``
+ :param create_time_max: (Optional) in form YYYY-MM-DDT00:00:00.000Z or
+ substitute time offset for Z, i.e,
+ -05:00
+ :type create_time_max: ``str``
+ :return: `list` of :class" `NttCisSnapshots`
+ """
+
+ if create_time_min is None and create_time_max is None:
+ params = {"consistencyGroupId": consistency_group_id}
+ elif create_time_min and create_time_max:
+ params = {"consistencyGroupId": consistency_group_id,
+ "createTime.MIN": create_time_min,
+ "createTime.MAX": create_time_max
+ }
+ elif create_time_min or create_time_max:
+ if create_time_max is not None:
+ params = {"consistencyGroupId": consistency_group_id,
+ "createTime.MAX": create_time_max
+ }
+ elif create_time_min is not None:
+ params = {"consistencyGroupId": consistency_group_id,
+ "createTime.MIN": create_time_min
+ }
paged_result = self.connection.request_with_orgId_api_2(
'consistencyGroup/snapshot',
method='GET',
@@ -165,7 +207,7 @@ class NttCisDRSDriver(DRSDriver):
:type consistency_group_id: ``str``
:param size_gb: Gb in 100 Gb increments
:type size_gb: ``str``
- :return:
+ :return: ``bool``
"""
expand_elm = ET.Element("expandJournal", {"id": consistency_group_id,
@@ -178,6 +220,9 @@ class NttCisDRSDriver(DRSDriver):
response_code = findtext(response, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
+ def start_failover_preview(self, consistency_group_id, snapshot_id):
+ pass
+
def _to_consistency_groups(self, object):
cgs = findall(object, 'consistencyGroup', TYPES_URN)
return [self._to_process(el) for el in cgs]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e83d4be/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
new file mode 100644
index 0000000..99c6ced
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="87" journalUsageGb="0.22" protectionWindow="P0Y0M7DT4H47M26.177S" predictedProtectionWindow="P91Y3M21DT22H2M36.211S">
+ <snapshot id="140736" createTime="2018-11-07T15:58:53.916-05:00" sizeKb="0"/>
+ <snapshot id="140731" createTime="2018-11-07T15:58:50.873-05:00" sizeKb="5"/>
+ <snapshot id="140601" createTime="2018-11-07T15:57:31.642-05:00" sizeKb="54"/>
+ <snapshot id="139321" createTime="2018-11-07T15:44:32.220-05:00" sizeKb="54"/>
+ <snapshot id="138041" createTime="2018-11-07T15:31:32.329-05:00" sizeKb="54"/>
+ <snapshot id="136761" createTime="2018-11-07T15:18:32.749-05:00" sizeKb="54"/>
+ <snapshot id="135481" createTime="2018-11-07T15:05:32.688-05:00" sizeKb="75"/>
+ <snapshot id="134183" createTime="2018-11-07T14:52:32.661-05:00" sizeKb="54"/>
+ <snapshot id="132903" createTime="2018-11-07T14:39:32.389-05:00" sizeKb="54"/>
+ <snapshot id="131623" createTime="2018-11-07T14:26:32.069-05:00" sizeKb="54"/>
+ <snapshot id="130343" createTime="2018-11-07T14:13:32.825-05:00" sizeKb="27"/>
+ <snapshot id="129703" createTime="2018-11-07T14:07:02.931-05:00" sizeKb="55"/>
+ <snapshot id="129041" createTime="2018-11-07T14:00:33.348-05:00" sizeKb="54"/>
+ <snapshot id="127761" createTime="2018-11-07T13:47:33.123-05:00" sizeKb="54"/>
+ <snapshot id="126481" createTime="2018-11-07T13:34:33.073-05:00" sizeKb="54"/>
+ <snapshot id="125201" createTime="2018-11-07T13:21:33.622-05:00" sizeKb="54"/>
+ <snapshot id="123921" createTime="2018-11-07T13:08:34.110-05:00" sizeKb="43"/>
+ <snapshot id="123268" createTime="2018-11-07T13:02:04.173-05:00" sizeKb="249"/>
+ <snapshot id="122516" createTime="2018-11-07T12:55:34.213-05:00" sizeKb="54"/>
+ <snapshot id="121236" createTime="2018-11-07T12:42:34.018-05:00" sizeKb="54"/>
+ <snapshot id="119956" createTime="2018-11-07T12:29:34.921-05:00" sizeKb="54"/>
+ <snapshot id="118676" createTime="2018-11-07T12:16:34.703-05:00" sizeKb="54"/>
+ <snapshot id="117396" createTime="2018-11-07T12:03:35.038-05:00" sizeKb="82"/>
+ <snapshot id="116094" createTime="2018-11-07T11:50:34.781-05:00" sizeKb="54"/>
+ <snapshot id="114814" createTime="2018-11-07T11:37:34.411-05:00" sizeKb="54"/>
+ <snapshot id="113534" createTime="2018-11-07T11:24:34.562-05:00" sizeKb="54"/>
+ <snapshot id="112254" createTime="2018-11-07T11:11:34.661-05:00" sizeKb="33"/>
+ <snapshot id="111606" createTime="2018-11-07T11:05:04.533-05:00" sizeKb="117"/>
+ <snapshot id="110911" createTime="2018-11-07T10:58:34.802-05:00" sizeKb="139"/>
+ <snapshot id="109579" createTime="2018-11-07T10:45:35.381-05:00" sizeKb="61"/>
+ <snapshot id="108285" createTime="2018-11-07T10:32:35.296-05:00" sizeKb="72"/>
+ <snapshot id="106985" createTime="2018-11-07T10:19:35.070-05:00" sizeKb="54"/>
+ <snapshot id="105705" createTime="2018-11-07T10:06:34.828-05:00" sizeKb="75"/>
+ <snapshot id="104407" createTime="2018-11-07T09:53:35.075-05:00" sizeKb="54"/>
+ <snapshot id="103127" createTime="2018-11-07T09:40:35.476-05:00" sizeKb="54"/>
+ <snapshot id="101847" createTime="2018-11-07T09:27:35.646-05:00" sizeKb="54"/>
+ <snapshot id="100567" createTime="2018-11-07T09:14:35.570-05:00" sizeKb="27"/>
+ <snapshot id="99927" createTime="2018-11-07T09:08:05.453-05:00" sizeKb="53"/>
+ <snapshot id="99261" createTime="2018-11-07T09:01:35.363-05:00" sizeKb="62"/>
+ <snapshot id="97971" createTime="2018-11-07T08:48:35.423-05:00" sizeKb="54"/>
+ <snapshot id="96691" createTime="2018-11-07T08:35:35.499-05:00" sizeKb="54"/>
+ <snapshot id="95411" createTime="2018-11-07T08:22:35.176-05:00" sizeKb="54"/>
+ <snapshot id="94131" createTime="2018-11-07T08:09:35.704-05:00" sizeKb="63"/>
+ <snapshot id="92840" createTime="2018-11-07T07:56:35.594-05:00" sizeKb="54"/>
+ <snapshot id="91560" createTime="2018-11-07T07:43:35.557-05:00" sizeKb="57"/>
+ <snapshot id="90275" createTime="2018-11-07T07:30:36.714-05:00" sizeKb="57"/>
+ <snapshot id="88991" createTime="2018-11-07T07:17:36.518-05:00" sizeKb="61"/>
+ <snapshot id="87703" createTime="2018-11-07T07:04:36.925-05:00" sizeKb="75"/>
+ <snapshot id="86404" createTime="2018-11-07T06:51:36.594-05:00" sizeKb="54"/>
+ <snapshot id="85124" createTime="2018-11-07T06:38:36.944-05:00" sizeKb="54"/>
+ <snapshot id="83844" createTime="2018-11-07T06:25:37.281-05:00" sizeKb="54"/>
+ <snapshot id="82564" createTime="2018-11-07T06:12:37.253-05:00" sizeKb="27"/>
+ <snapshot id="81924" createTime="2018-11-07T06:06:07.098-05:00" sizeKb="48"/>
+ <snapshot id="81266" createTime="2018-11-07T05:59:37.367-05:00" sizeKb="54"/>
+ <snapshot id="79986" createTime="2018-11-07T05:46:37.421-05:00" sizeKb="54"/>
+ <snapshot id="78706" createTime="2018-11-07T05:33:38.322-05:00" sizeKb="54"/>
+ <snapshot id="77426" createTime="2018-11-07T05:20:38.384-05:00" sizeKb="54"/>
+ <snapshot id="76146" createTime="2018-11-07T05:07:38.985-05:00" sizeKb="62"/>
+ <snapshot id="75475" createTime="2018-11-07T05:01:09.065-05:00" sizeKb="32"/>
+ <snapshot id="74826" createTime="2018-11-07T04:54:38.976-05:00" sizeKb="54"/>
+ <snapshot id="73546" createTime="2018-11-07T04:41:38.697-05:00" sizeKb="54"/>
+ <snapshot id="72266" createTime="2018-11-07T04:28:39.145-05:00" sizeKb="54"/>
+ <snapshot id="70986" createTime="2018-11-07T04:15:39.114-05:00" sizeKb="55"/>
+ <snapshot id="69702" createTime="2018-11-07T04:02:39.563-05:00" sizeKb="83"/>
+ <snapshot id="68403" createTime="2018-11-07T03:49:39.577-05:00" sizeKb="27"/>
+ <snapshot id="67763" createTime="2018-11-07T03:43:09.797-05:00" sizeKb="51"/>
+ <snapshot id="67102" createTime="2018-11-07T03:36:39.935-05:00" sizeKb="58"/>
+ <snapshot id="65820" createTime="2018-11-07T03:23:39.859-05:00" sizeKb="37"/>
+ <snapshot id="65170" createTime="2018-11-07T03:17:09.938-05:00" sizeKb="372"/>
+ <snapshot id="64341" createTime="2018-11-07T03:10:39.796-05:00" sizeKb="27"/>
+ <snapshot id="63701" createTime="2018-11-07T03:04:10.126-05:00" sizeKb="50"/>
+ <snapshot id="63042" createTime="2018-11-07T02:57:40.014-05:00" sizeKb="54"/>
+ <snapshot id="61762" createTime="2018-11-07T02:44:40.619-05:00" sizeKb="54"/>
+ <snapshot id="60466" createTime="2018-11-07T02:31:31.343-05:00" sizeKb="54"/>
+ <snapshot id="59186" createTime="2018-11-07T02:18:31.853-05:00" sizeKb="55"/>
+ <snapshot id="57902" createTime="2018-11-07T02:05:31.526-05:00" sizeKb="83"/>
+ <snapshot id="56598" createTime="2018-11-07T01:52:31.345-05:00" sizeKb="54"/>
+ <snapshot id="55318" createTime="2018-11-07T01:39:31.367-05:00" sizeKb="54"/>
+ <snapshot id="54038" createTime="2018-11-07T01:26:31.545-05:00" sizeKb="54"/>
+ <snapshot id="52758" createTime="2018-11-07T01:13:31.876-05:00" sizeKb="27"/>
+ <snapshot id="52118" createTime="2018-11-07T01:07:01.827-05:00" sizeKb="55"/>
+ <snapshot id="51456" createTime="2018-11-07T01:00:31.835-05:00" sizeKb="59"/>
+ <snapshot id="50167" createTime="2018-11-07T00:47:32.638-05:00" sizeKb="54"/>
+ <snapshot id="48887" createTime="2018-11-07T00:34:33.021-05:00" sizeKb="54"/>
+ <snapshot id="47607" createTime="2018-11-07T00:21:33.155-05:00" sizeKb="54"/>
+ <snapshot id="46327" createTime="2018-11-07T00:08:33.145-05:00" sizeKb="42"/>
+ <snapshot id="45670" createTime="2018-11-07T00:02:03.027-05:00" sizeKb="48"/>
+</consistencyGroupSnapshots>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e83d4be/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index a7e939c..9f9bf50 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -1,20 +1,10 @@
import pytest
-
-
-import sys
-from types import GeneratorType
from libcloud.utils.py3 import httplib
-from libcloud.utils.py3 import ET
-from libcloud.common.types import InvalidCredsError
-from libcloud.common.nttcis import NttCisAPIException, NetworkDomainServicePlan
-from libcloud.common.nttcis import TYPES_URN
+from libcloud.common.nttcis import NttCisAPIException
from libcloud.drs.drivers.nttcis import NttCisDRSDriver as NttCis
-from libcloud.compute.drivers.nttcis import NttCisNic
-from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
from libcloud.test import MockHttp, unittest
from libcloud.test.file_fixtures import DRSFileFixtures
from libcloud.test.secrets import NTTCIS_PARAMS
-from libcloud.utils.xml import fixxpath, findtext, findall
@pytest.fixture()
@@ -60,6 +50,22 @@ def test_expand_journal(driver):
assert result is True
+def test_list_snapshots(driver):
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.list_consistency_group_snapshots(cg_id)
+ assert hasattr(result, 'snapshot')
+ assert len(result.snapshot) == 11
+
+
+def test_list_snapshots_with_min(driver):
+ NttCisMockHttp.type = "WITH_MIN"
+ cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+ result = driver.list_consistency_group_snapshots(
+ cg_id, create_time_min="2018-11-07T00:00:00.000-05:00")
+ assert hasattr(result, 'snapshot')
+ assert len(result.snapshot) == 87
+
+
def test_start_failover_preview(driver):
pass
@@ -76,6 +82,10 @@ class NttCisMockHttp(MockHttp):
body = self.fixtures.load('oec_0_9_myaccount.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _oec_0_9_myaccount_WITH_MIN(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_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_INPROGRESS(self,
method,
url,
@@ -116,4 +126,20 @@ class NttCisMockHttp(MockHttp):
body,
headers):
body = self.fixtures.load("expand_cg.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("drs_snapshots.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot_WITH_MIN(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("drs_snapshots_by_min.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e83d4be/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 81e88a5..b218a07 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -421,4 +421,25 @@ def test_get_snapshots(drsdriver):
cgs = drsdriver.list_consistency_groups()
cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
snaps = drsdriver.list_consistency_group_snapshots(cg_id)
- assert hasattr(snaps, 'journalUsageGb')
\ No newline at end of file
+ assert hasattr(snaps, 'journalUsageGb')
+
+
+def test_get_snapshots_by_min_max(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
+ snaps = drsdriver.list_consistency_group_snapshots(
+ cg_id,
+ create_time_min="2018-11-06T00:00:00.000Z",
+ create_time_max="2018-11-07T00:00:00.000Z")
+ for snap in snaps.snapshot:
+ print(snap)
+
+
+def test_get_snapshots_by_min(drsdriver):
+ cgs = drsdriver.list_consistency_groups()
+ cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
+ snaps = drsdriver.list_consistency_group_snapshots(
+ cg_id,
+ create_time_min="2018-11-07T00:00:00.000-05:00")
+ for snap in snaps.snapshot:
+ print(snap)
\ No newline at end of file
[17/45] libcloud git commit: added more tests to tests and test
directory. nttcis module for drs uses a decorator to list/filter consistency
groups
Posted by an...@apache.org.
added more tests to tests and test directory. nttcis module for drs uses a decorator to list/filter consistency groups
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1935b5f2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1935b5f2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1935b5f2
Branch: refs/heads/trunk
Commit: 1935b5f2cff2d8e1d44ead7ab0686dd70d00c93d
Parents: 3d3289d
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Mon Nov 5 17:21:30 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Mon Nov 5 17:21:30 2018 -0500
----------------------------------------------------------------------
libcloud/common/nttcis.py | 31 +++---
libcloud/compute/drivers/nttcis.py | 109 -------------------
libcloud/drs/drivers/nttcis.py | 51 ++++++++-
.../drs/fixtures/nttcis/list_cg_by_params.xml | 25 +++++
libcloud/test/drs/test_nttcis.py | 13 +++
tests/lib_list_test.py | 19 +++-
6 files changed, 115 insertions(+), 133 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index a26695a..78dc73f 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -744,13 +744,13 @@ class NttCisPublicIpBlock(object):
self.status))
-"""
class NttCisServerCpuSpecification(object):
-
+ """
A class that represents the specification of the CPU(s) for a
node
-
+ """
def __init__(self, cpu_count, cores_per_socket, performance):
+ """
Instantiate a new :class:`NttCisServerCpuSpecification`
:param cpu_count: The number of CPUs
@@ -762,7 +762,7 @@ class NttCisServerCpuSpecification(object):
:param performance: The performance type, e.g. HIGHPERFORMANCE
:type performance: ``str``
-
+ """
self.cpu_count = cpu_count
self.cores_per_socket = cores_per_socket
self.performance = performance
@@ -772,13 +772,14 @@ class NttCisServerCpuSpecification(object):
'cpu_count=%s, cores_per_socket=%s, '
'performance=%s>')
% (self.cpu_count, self.cores_per_socket, self.performance))
-"""
-"""
+
+
class NttCisServerDisk(object):
-
+ """
A class that represents the disk on a server
-
+ """
def __init__(self, id=None, scsi_id=None, size_gb=None, speed=None, state=None):
+ """
Instantiate a new :class:`DimensionDataServerDisk`
:param id: The id of the disk
@@ -795,7 +796,7 @@ class NttCisServerDisk(object):
:param state: State of the disk (i.e. PENDING)
:type state: ``str``
-
+ """
self.id = id
self.scsi_id = scsi_id
self.size_gb = size_gb
@@ -809,11 +810,11 @@ class NttCisServerDisk(object):
class NttCisScsiController(object):
-
+ """
A class that represents the disk on a server
-
+ """
def __init__(self, id, adapter_type, bus_number, state):
-
+ """
Instantiate a new :class:`DimensionDataServerDisk`
:param id: The id of the controller
@@ -830,7 +831,7 @@ class NttCisScsiController(object):
:param state: State of the disk (i.e. PENDING)
:type state: ``str``
-
+ """
self.id = id
self.adapter_type = adapter_type
self.bus_number = bus_number
@@ -840,7 +841,6 @@ class NttCisScsiController(object):
return (('<NttCisScsiController: '
'id=%s, adapter_type=%s, bus_number=%s, state=%s')
% (self.id, self.adapter_type, self.bus_number, self.state))
-"""
class NttCisServerVMWareTools(object):
@@ -2135,12 +2135,9 @@ class XmlDictConfig(dict):
# good idea -- time will tell. It works for the way we are
# currently doing XML configuration files...
elif element.items():
- items = element.items()
# It is possible to have duplicate element tags. If so, convert to a dict of lists
- i = element.tag.split('}')[1]
if element.tag.split('}')[1] in self:
- t = type(self[element.tag.split('}')[1]])
if isinstance(self[element.tag.split('}')[1]], list):
self[element.tag.split('}')[1]].append(dict(element.items()))
#tmp_list.append(element.tag.split('}')[1])
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index d8b4aa3..18e2bdb 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -2224,115 +2224,6 @@ class NttCisNodeDriver(NodeDriver):
params=params).object
return self._to_firewall_rules(response, network_domain)
- """
- def ex_create_firewall_rule(self, network_domain, rule, position,
- position_relative_to_rule=None):
- Creates a firewall rule
- :param network_domain: The network domain in which to create
- the firewall rule
- :type network_domain: :class:`NttCisNetworkDomain` or ``str``
- :param rule: The rule in which to create
- :type rule: :class:`NttCisFirewallRule`
- :param position: The position in which to create the rule
- There are two types of positions
- with position_relative_to_rule arg and without it
- With: 'BEFORE' or 'AFTER'
- Without: 'FIRST' or 'LAST'
- :type position: ``str``
- :param position_relative_to_rule: The rule or rule name in
- which to decide positioning by
- :type position_relative_to_rule:
- :class:`NttCisFirewallRule` or ``str``
- :rtype: ``bool``
- positions_without_rule = ('FIRST', 'LAST')
- positions_with_rule = ('BEFORE', 'AFTER')
- create_node = ET.Element('createFirewallRule', {'xmlns': TYPES_URN})
- ET.SubElement(create_node, "networkDomainId").text = \
- self._network_domain_to_network_domain_id(network_domain)
- ET.SubElement(create_node, "name").text = rule.name
- ET.SubElement(create_node, "action").text = rule.action
- ET.SubElement(create_node, "ipVersion").text = rule.ip_version
- ET.SubElement(create_node, "protocol").text = rule.protocol
- # Setup source port rule
- source = ET.SubElement(create_node, "source")
- if rule.source.address_list_id is not None:
- source_ip = ET.SubElement(source, 'ipAddressListId')
- source_ip.text = rule.source.address_list_id
- else:
- source_ip = ET.SubElement(source, 'ip')
- if rule.source.any_ip:
- source_ip.set('address', 'ANY')
- else:
- source_ip.set('address', rule.source.ip_address)
- if rule.source.ip_prefix_size is not None:
- source_ip.set('prefixSize',
- str(rule.source.ip_prefix_size))
- if rule.source.port_list_id is not None:
- source_port = ET.SubElement(source, 'portListId')
- source_port.text = rule.source.port_list_id
- else:
- if rule.source.port_begin is not None:
- source_port = ET.SubElement(source, 'port')
- source_port.set('begin', rule.source.port_begin)
- if rule.source.port_end is not None:
- source_port.set('end', rule.source.port_end)
- # Setup destination port rule
- dest = ET.SubElement(create_node, "destination")
- if rule.destination.address_list_id is not None:
- dest_ip = ET.SubElement(dest, 'ipAddressListId')
- dest_ip.text = rule.destination.address_list_id
- else:
- dest_ip = ET.SubElement(dest, 'ip')
- if rule.destination.any_ip:
- dest_ip.set('address', 'ANY')
- else:
- dest_ip.set('address', rule.destination.ip_address)
- if rule.destination.ip_prefix_size is not None:
- dest_ip.set('prefixSize',
- rule.destination.ip_prefix_size)
- if rule.destination.port_list_id is not None:
- dest_port = ET.SubElement(dest, 'portListId')
- dest_port.text = rule.destination.port_list_id
- else:
- if rule.destination.port_begin is not None:
- dest_port = ET.SubElement(dest, 'port')
- dest_port.set('begin', rule.destination.port_begin)
- if rule.destination.port_end is not None:
- dest_port.set('end', rule.destination.port_end)
- # Set up positioning of rule
- ET.SubElement(create_node, "enabled").text = str(rule.enabled).lower()
- placement = ET.SubElement(create_node, "placement")
- if position_relative_to_rule is not None:
- if position not in positions_with_rule:
- raise ValueError("When position_relative_to_rule is specified"
- " position must be %s"
- % ', '.join(positions_with_rule))
- if isinstance(position_relative_to_rule,
- NttCisFirewallRule):
- rule_name = position_relative_to_rule.name
- else:
- rule_name = position_relative_to_rule
- placement.set('relativeToRule', rule_name)
- else:
- if position not in positions_without_rule:
- raise ValueError("When position_relative_to_rule is not"
- " specified position must be %s"
- % ', '.join(positions_without_rule))
- placement.set('position', position)
-
- response = self.connection.request_with_orgId_api_2(
- 'network/createFirewallRule',
- method='POST',
- data=ET.tostring(create_node)).object
-
- rule_id = None
- for info in findall(response, 'info', TYPES_URN):
- if info.get('name') == 'firewallRuleId':
- rule_id = info.get('value')
- rule.id = rule_id
- return rule
- """
-
def ex_create_firewall_rule(self, network_domain, name, action,
ip_version, protocol,
source_addr, dest_addr,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 49d1986..d97b632 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -1,3 +1,5 @@
+import re
+import functools
from libcloud.utils.py3 import ET
from libcloud.common.nttcis import NttCisConnection
from libcloud.common.nttcis import API_ENDPOINTS
@@ -10,6 +12,26 @@ from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.common.types import LibcloudError
+def get_params(func):
+ @functools.wraps(func)
+ def paramed(*args, **kwargs):
+
+ if kwargs:
+ for k, v in kwargs.items():
+ old_key = k
+ matches = re.findall(r'_(\w)', k)
+ for match in matches:
+ k = k.replace('_'+match, match.upper())
+ del kwargs[old_key]
+ kwargs[k] = v
+ params = kwargs
+ result = func(args[0], params)
+ else:
+ result = func(args[0])
+ return result
+ return paramed
+
+
class NttCisDRSDriver(Driver):
"""
NttCis node driver.
@@ -90,14 +112,36 @@ class NttCisDRSDriver(Driver):
response_code = findtext(response, 'responseCode', TYPES_URN)
return response_code in ['IN_PROGRESS', 'OK']
- def list_consistency_groups(self):
- #params = {'networkDomainId': ex_network_domain_id}
+ @get_params
+ def list_consistency_groups(self, params={}):
+ """
+ Functions takes a named parameter that must be one of the following
+ :param params: A dictionary composed of one of the follwing keys and a value
+ target_data_center_id:
+ source_network_domain_id:
+ target_network_domain_id:
+ source_server_id:
+ target_server_id:
+ name:
+ state:
+ operation_status:
+ drs_infrastructure_status:
+ :return: `list` of :class: `NttCisConsistencyGroup`
+ """
+
response = self.connection.request_with_orgId_api_2(
- 'consistencyGroup/consistencyGroup').object
+ 'consistencyGroup/consistencyGroup', params=params).object
cgs = self._to_consistency_groups(response)
return cgs
def get_consistency_group(self, consistency_group_id):
+ """
+ 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`
+ """
response = self.connection.request_with_orgId_api_2(
"consistencyGroup/consistencyGroup/%s" % consistency_group_id
).object
@@ -119,7 +163,6 @@ class NttCisDRSDriver(Driver):
return [self._to_process(el) for el in cgs]
def _to_snapshots(self, object):
- elem = findall(object, "consistencyGroupSnapshots", TYPES_URN)
snapshots = []
for element in object.findall(fixxpath("snapshot", TYPES_URN)):
snapshots.append(self._to_process(element))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml b/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
new file mode 100644
index 0000000..0115461
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250">
+ <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5"><name>sdk_test2_cg</name>
+ <description>A test consistency group</description><journal sizeGb="100" extentCount="1"/>
+ <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026">
+ <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName>
+ </source>
+ <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2">
+ <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName>
+ </target>
+ <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL">
+ <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2">
+ <name>src-sdk-test</name>
+ </sourceServer>
+ <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738">
+ <name>tgt-sdk-test</name>
+ </targetServer>
+ </serverPair>
+ <createTime>2018-10-31T16:02:05.000Z</createTime>
+ <operationStatus>DRS_MODE</operationStatus>
+ <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-05T16:35:01.000Z"/>
+ <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount>
+ <state>NORMAL</state>
+ </consistencyGroup>
+</consistencyGroups>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
index 9e99d49..7431a25 100644
--- a/libcloud/test/drs/test_nttcis.py
+++ b/libcloud/test/drs/test_nttcis.py
@@ -48,6 +48,11 @@ def test_get_consistency_group(driver):
assert cg.id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+def test_get_consistency_group_by_name(driver):
+ cgs = driver.list_consistency_groups(name="skd_test2_cg")
+ assert cgs[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+
+
class NttCisMockHttp(MockHttp):
fixtures = DRSFileFixtures('nttcis')
@@ -85,3 +90,11 @@ class NttCisMockHttp(MockHttp):
headers):
body = self.fixtures.load("get_consistency_group.xml")
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+ def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_name(self,
+ method,
+ url,
+ body,
+ headers):
+ body = self.fixtures.load("list_cg_by_params.xml")
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1935b5f2/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index 0563f9a..81e88a5 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -394,10 +394,23 @@ def test_list_health_monitors(compute_driver, lbdriver):
def test_list_consistency_groups(drsdriver):
cgs = drsdriver.list_consistency_groups()
- return cgs
+ for cg in cgs:
+ print(cg.name)
-def test_get_consistency_group(drsdriver):
+def test_list_cg_by_src_net_domain(drsdriver):
+ nd = "f9d6a249-c922-4fa1-9f0f-de5b452c4026"
+ cgs = drsdriver.list_consistency_groups(source_network_domain_id=nd)
+ assert cgs[0].name == "sdk_test2_cg"
+
+
+def test_list_cg_by_name(drsdriver):
+ name = "sdk_test2_cg"
+ cg = drsdriver.list_consistency_groups(name=name)
+ assert cg[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5"
+
+
+def test_get_consistency_group_by_id(drsdriver):
cgs = drsdriver.list_consistency_groups()
cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
cg = drsdriver.get_consistency_group(cg_id)
@@ -408,4 +421,4 @@ def test_get_snapshots(drsdriver):
cgs = drsdriver.list_consistency_groups()
cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id
snaps = drsdriver.list_consistency_group_snapshots(cg_id)
- print(cg_id)
\ No newline at end of file
+ assert hasattr(snaps, 'journalUsageGb')
\ No newline at end of file
[42/45] libcloud git commit: removed reference to DRS in index.rst
Posted by an...@apache.org.
removed reference to DRS in index.rst
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/de505012
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/de505012
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/de505012
Branch: refs/heads/trunk
Commit: de5050121144327027b719af32a70db3dadada6b
Parents: b0eee74
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 28 22:51:29 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 28 22:51:29 2018 -0500
----------------------------------------------------------------------
docs/index.rst | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/de505012/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index 463abaa..885d66a 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,7 +13,6 @@ Resource you can manage with Libcloud are divided in the following categories:
Rackspace CloudFiles
* :doc:`Load Balancers as a Service </loadbalancer/index>` - services such as Amazon Elastic Load Balancer and GoGrid LoadBalancers
* :doc:`DNS as a Service </dns/index>` - services such as Amazon Route 53 and Zerigo
-* :doc:`Disaster Recovery as a Service as a Service (DRS) </drs/index>` - services such as Amazon Route 53 and Zerigo
* :doc:`Container Services </container/index>` - container virtualization like Docker and Rkt as well as container based services
* :doc:`Backup as a Service </backup/index>` - services such as Amazon EBS and OpenStack Freezer
[43/45] libcloud git commit: removed yet another reference to DRS in
index.rst
Posted by an...@apache.org.
removed yet another reference to DRS in index.rst
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9dcb4c95
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9dcb4c95
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9dcb4c95
Branch: refs/heads/trunk
Commit: 9dcb4c95ac994542ca151b358b04d15867cff60d
Parents: de50501
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Wed Nov 28 22:55:37 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Wed Nov 28 22:55:37 2018 -0500
----------------------------------------------------------------------
docs/index.rst | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9dcb4c95/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index 885d66a..d44bc36 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -38,7 +38,6 @@ Main
storage/index
loadbalancer/index
dns/index
- drs/index
container/index
backup/index
troubleshooting
[23/45] libcloud git commit: fixed drs examples in
docs/examples/drs/nttcis;
added imports for MutableSequence and Mapping based on python vesions in
libcloud/common/nttcis;
Posted by an...@apache.org.
fixed drs examples in docs/examples/drs/nttcis; added imports for MutableSequence and Mapping based on python vesions in libcloud/common/nttcis;
added code blocks for dynamic class creation from xml as opposed to pick and choose properties from xml in common/nttcis; firewall rules are dynamic
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bc4482a5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bc4482a5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bc4482a5
Branch: refs/heads/trunk
Commit: bc4482a5c1497a86a4267451513f033893e58cfa
Parents: 8ed60c7
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Tue Nov 13 11:28:39 2018 -0500
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Tue Nov 13 11:28:39 2018 -0500
----------------------------------------------------------------------
.pylintrc | 36 ---------
.pylintrc.bak | 36 +++++++++
.../drs/nttcis/add_consistency_group.py | 5 +-
.../drs/nttcis/list_snapshots_by_create_time.py | 2 +-
libcloud/common/nttcis.py | 77 +++++++++++---------
libcloud/compute/drivers/nttcis.py | 46 ++++++------
libcloud/compute/types.py | 1 +
libcloud/drs/base.py | 25 ++++---
libcloud/drs/drivers/__init__.py | 2 +-
libcloud/drs/drivers/nttcis.py | 14 ++--
libcloud/drs/providers.py | 5 +-
libcloud/drs/types.py | 2 +-
libcloud/test/compute/test_nttcis.py | 27 +++----
tests/lib_list_test.py | 22 +-----
14 files changed, 148 insertions(+), 152 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/.pylintrc
----------------------------------------------------------------------
diff --git a/.pylintrc b/.pylintrc
deleted file mode 100644
index 21b7711..0000000
--- a/.pylintrc
+++ /dev/null
@@ -1,36 +0,0 @@
-[MASTER]
-# Add <file or directory> to the black list. It should be a base name, not a
-# path. You may set this option multiple times.
-ignore=test
-ignore=constants
-
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-
-[MESSAGES CONTROL]
-disable=redefined-builtin,too-many-arguments,too-few-public-methods,missing-docstring,invalid-name,abstract-method,no-self-use
-
-
-[TYPECHECK]
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed. Python regular
-# expressions are accepted.
-generated-members=async_request,objects
-
-[VARIABLES]
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# A regular expression matching names used for dummy variables (i.e. not used).
-dummy-variables-rgx=_|dummy
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/.pylintrc.bak
----------------------------------------------------------------------
diff --git a/.pylintrc.bak b/.pylintrc.bak
new file mode 100644
index 0000000..21b7711
--- /dev/null
+++ b/.pylintrc.bak
@@ -0,0 +1,36 @@
+[MASTER]
+# Add <file or directory> to the black list. It should be a base name, not a
+# path. You may set this option multiple times.
+ignore=test
+ignore=constants
+
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+
+[MESSAGES CONTROL]
+disable=redefined-builtin,too-many-arguments,too-few-public-methods,missing-docstring,invalid-name,abstract-method,no-self-use
+
+
+[TYPECHECK]
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed. Python regular
+# expressions are accepted.
+generated-members=async_request,objects
+
+[VARIABLES]
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching names used for dummy variables (i.e. not used).
+dummy-variables-rgx=_|dummy
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid to define new builtins when possible.
+additional-builtins=
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/docs/examples/drs/nttcis/add_consistency_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/add_consistency_group.py b/docs/examples/drs/nttcis/add_consistency_group.py
index 9194b24..89fdbfc 100644
--- a/docs/examples/drs/nttcis/add_consistency_group.py
+++ b/docs/examples/drs/nttcis/add_consistency_group.py
@@ -11,7 +11,8 @@ def create_drs(compute_driver, drs_driver):
consistency_group_name = "sdk_test_cg"
journal_size_gb = "100"
result = drs_driver.create_consistency_group(
- consistency_group_name, journal_size_gb, src_id, target_id, description="A test consistency group")
+ consistency_group_name, journal_size_gb, src_id, target_id,
+ description="A test consistency group")
assert result is True
@@ -23,4 +24,4 @@ if __name__ == "__main__":
cls = libcloud.get_driver(libcloud.DriverType.DRS,
libcloud.DriverType.DRS.NTTCIS)
drsdriver = cls('my_user', 'my_pass', region='na')
- create_drs(computedriver, drsdriver)
\ No newline at end of file
+ create_drs(computedriver, drsdriver)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
----------------------------------------------------------------------
diff --git a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
index f3fb7bc..81f8167 100644
--- a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
+++ b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py
@@ -20,4 +20,4 @@ if __name__ == "__main__":
drsdriver = cls('my_user', 'my_pass', region='na')
objs = get_snapshots_by_min_max(drsdriver)
for obj in objs.snapshot:
- print(obj)
\ No newline at end of file
+ print(obj)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/common/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py
index d257bf8..2908dfc 100644
--- a/libcloud/common/nttcis.py
+++ b/libcloud/common/nttcis.py
@@ -15,12 +15,15 @@
"""
NTTCIS Common Components
"""
+import xml.etree.ElementTree as etree
from copy import deepcopy
-from collections.abc import MutableSequence, Mapping
from base64 import b64encode
from time import sleep
-from lxml import etree
from io import BytesIO
+try:
+ from collections.abc import MutableSequence, Mapping
+except ImportError:
+ from collections import MutableSequence, Mapping
# TODO: use disutils.version when Travis CI fixed the pylint issue with version
# from distutils.version import LooseVersion
from libcloud.utils.py3 import httplib
@@ -778,22 +781,23 @@ class NttCisServerDisk(object):
"""
A class that represents the disk on a server
"""
- def __init__(self, id=None, scsi_id=None, size_gb=None, speed=None, state=None):
+ def __init__(self, id=None, scsi_id=None, size_gb=None, speed=None,
+ state=None):
"""
Instantiate a new :class:`DimensionDataServerDisk`
-
+
:param id: The id of the disk
:type id: ``str``
-
+
:param scsi_id: Representation for scsi
:type scsi_id: ``int``
-
+
:param size_gb: Size of the disk
:type size_gb: ``int``
-
+
:param speed: Speed of the disk (i.e. STANDARD)
:type speed: ``str``
-
+
:param state: State of the disk (i.e. PENDING)
:type state: ``str``
"""
@@ -1924,8 +1928,13 @@ class NttCisNic(object):
% (self.private_ip_v4, self.vlan, self.network_adapter_name))
+# Dynamically create classes from returned XML. Leaves the API as the
+# single authoritative source.
+
+
+class ClassFactory(object):
+ pass
-##### Testing new concept below this line
attrs = {}
@@ -1961,7 +1970,8 @@ def processor(mapping, name=None):
def handle_map(map, name):
tmp = {}
types = [type(x) for x in map.values()]
- if XmlListConfig not in types and XmlDictConfig not in types and dict not in types:
+ if XmlListConfig not in types and \
+ XmlDictConfig not in types and dict not in types:
return map
elif XmlListConfig in types:
@@ -1981,7 +1991,6 @@ def processor(mapping, name=None):
def handle_seq(seq, name):
tmp = {}
- tmp_list = []
if isinstance(seq, list):
tmp = []
for _ in seq:
@@ -1989,9 +1998,7 @@ def processor(mapping, name=None):
tmp.append(cls)
return tmp
for k, v in seq.items():
- if isinstance(v, Mapping):
- result1 = handle_map(v, k)
- elif isinstance(v, MutableSequence):
+ if isinstance(v, MutableSequence):
for _ in v:
if isinstance(_, Mapping):
types = [type(x) for x in _.values()]
@@ -2002,7 +2009,8 @@ def processor(mapping, name=None):
else:
tmp.update({k: result})
else:
- tmp_list = [build_class(k.capitalize(), i) for i in v]
+ tmp_list = [build_class(k.capitalize(), i)
+ for i in v]
tmp[k] = tmp_list
print()
elif isinstance(v, str):
@@ -2030,7 +2038,6 @@ def processor(mapping, name=None):
cls = build_class(k1.capitalize(), result)
add_items(k1, cls, k1)
elif isinstance(v1, list):
- tmp = {}
tmp1 = {}
tmp2 = {}
tmp2[k1] = []
@@ -2041,14 +2048,10 @@ def processor(mapping, name=None):
tmp1[k1 + str(i)] = build_class(k1, result)
tmp2[k1].append(tmp1[k1 + str(i)])
if tmp2:
- #cls = build_class(k1.capitalize(), tmp2)
add_items(k1, tmp2[k1], k1)
elif isinstance(v1, str):
add_items(k1, v1)
-
-
-
if len(map_copy) == 0:
return 1
return process(mapping, name)
@@ -2059,21 +2062,24 @@ def class_factory(cls_name, attrs):
def __init__(self, *args, **kwargs):
for key in attrs:
setattr(self, key, attrs[key])
+ if cls_name == "NttCisServer":
+ self.state = self._get_state()
def __iter__(self):
for name in self.__dict__:
yield getattr(self, name)
def __repr__(self):
- values = ', '.join('{}={!r}'.format(*i) for i in zip(self.__dict__, self))
+ values = ', '.join('{}={!r}'.format(*i)
+ for i in zip(self.__dict__, self))
return '{}({})'.format(self.__class__.__name__, values)
cls_attrs = dict(
- __init__=__init__,
- __iter__=__iter__,
- __repr__=__repr__)
+ __init__=__init__,
+ __iter__=__iter__,
+ __repr__=__repr__)
- return type("NttCis{}".format(cls_name), (object,), cls_attrs)
+ return type("NttCis{}".format(cls_name), (ClassFactory,), cls_attrs)
class XmlListConfig(list):
@@ -2088,7 +2094,8 @@ class XmlListConfig(list):
# property refers to an element used repeatedly
# in the XML for data centers only
if 'property' in element.tag:
- self.append({element.attrib.get('name'): element.attrib.get('value')})
+ self.append({element.attrib.get('name'):
+ element.attrib.get('value')})
else:
self.append(element.attrib)
elif element.text:
@@ -2102,11 +2109,10 @@ class XmlDictConfig(dict):
def __init__(self, parent_element):
if parent_element.items():
if 'property' in parent_element.tag:
- self.update({parent_element.attrib.get('name'): parent_element.attrib.get('value')})
+ self.update({parent_element.attrib.get('name'):
+ parent_element.attrib.get('value')})
else:
self.update(dict(parent_element.items()))
-
- c_elems = parent_element.items()
for element in parent_element:
if len(element) > 0:
# treat like dict - we assume that if the first two tags
@@ -2120,7 +2126,8 @@ class XmlDictConfig(dict):
# here, we put the list in dictionary; the key is the
# tag name the list elements all share in common, and
# the value is the list itself
- elem_dict = {element[0].tag.split('}')[1]: XmlListConfig(element)}
+ elem_dict = {element[0].tag.split('}')[1]:
+ XmlListConfig(element)}
# if the tag has attributes, add those to the dict
if element.items():
@@ -2131,12 +2138,13 @@ class XmlDictConfig(dict):
# good idea -- time will tell. It works for the way we are
# currently doing XML configuration files...
elif element.items():
- # It is possible to have duplicate element tags. If so, convert to a dict of lists
+ # It is possible to have duplicate element tags.
+ # If so, convert to a dict of lists
if element.tag.split('}')[1] in self:
if isinstance(self[element.tag.split('}')[1]], list):
- self[element.tag.split('}')[1]].append(dict(element.items()))
- #tmp_list.append(element.tag.split('}')[1])
+ self[element.tag.split('}')[1]].\
+ append(dict(element.items()))
else:
tmp_list = list()
tmp_dict = dict()
@@ -2149,7 +2157,8 @@ class XmlDictConfig(dict):
tmp_list.append(dict(element.items()))
self[element.tag.split('}')[1]] = tmp_list
else:
- self.update({element.tag.split('}')[1]: dict(element.items())})
+ self.update({element.tag.split('}')[1]:
+ dict(element.items())})
# finally, if there are no child tags and no attributes, extract
# the text
else:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index cfe5619..0fc651d 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -30,9 +30,9 @@ from libcloud.common.nttcis import (NttCisConnection,
from libcloud.common.nttcis import NttCisNetwork
from libcloud.common.nttcis import NttCisNetworkDomain
from libcloud.common.nttcis import NttCisVlan
-#from libcloud.common.nttcis import NttCisServerCpuSpecification
-#from libcloud.common.nttcis import NttCisServerDisk
-#from libcloud.common.nttcis import NttCisScsiController
+from libcloud.common.nttcis import NttCisServerCpuSpecification
+from libcloud.common.nttcis import NttCisServerDisk
+from libcloud.common.nttcis import NttCisScsiController
from libcloud.common.nttcis import NttCisServerVMWareTools
from libcloud.common.nttcis import NttCisPublicIpBlock
from libcloud.common.nttcis import NttCisFirewallRule
@@ -53,7 +53,6 @@ from libcloud.common.nttcis import NttCisTag
from libcloud.common.nttcis import API_ENDPOINTS, DEFAULT_REGION
from libcloud.common.nttcis import TYPES_URN
from libcloud.common.nttcis import NETWORK_NS, GENERAL_NS
-from libcloud.common.nttcis import process_xml
from libcloud.utils.py3 import urlencode, ensure_string
from libcloud.utils.xml import fixxpath, findtext, findall
from libcloud.utils.py3 import basestring
@@ -4825,22 +4824,23 @@ class NttCisNodeDriver(NodeDriver):
location_id = element.get('datacenterId')
location = list(filter(lambda x: x.id == location_id,
locations))[0]
- return process_xml(ET.tostring(element))
-
- #return NttCisFirewallRule(
- # id=element.get('id'),
- # network_domain=network_domain,
- # name=findtext(element, 'name', TYPES_URN),
- # action=findtext(element, 'action', TYPES_URN),
- # ip_version=findtext(element, 'ipVersion', TYPES_URN),
- # protocol=findtext(element, 'protocol', TYPES_URN),
- # enabled=findtext(element, 'enabled', TYPES_URN),
- # source=self._to_firewall_address(
- # element.find(fixxpath('source', TYPES_URN))),
- # destination=self._to_firewall_address(
- # element.find(fixxpath('destination', TYPES_URN))),
- # location=location,
- # status=findtext(element, 'state', TYPES_URN))
+ # For future dynamic rule creation
+ # return process_xml(ET.tostring(element))
+
+ return NttCisFirewallRule(
+ id=element.get('id'),
+ network_domain=network_domain,
+ name=findtext(element, 'name', TYPES_URN),
+ action=findtext(element, 'action', TYPES_URN),
+ ip_version=findtext(element, 'ipVersion', TYPES_URN),
+ protocol=findtext(element, 'protocol', TYPES_URN),
+ enabled=findtext(element, 'enabled', TYPES_URN),
+ source=self._to_firewall_address(
+ element.find(fixxpath('source', TYPES_URN))),
+ destination=self._to_firewall_address(
+ element.find(fixxpath('destination', TYPES_URN))),
+ location=location,
+ status=findtext(element, 'state', TYPES_URN))
def _to_firewall_address(self, element):
ip = element.find(fixxpath('ip', TYPES_URN))
@@ -5104,8 +5104,8 @@ class NttCisNodeDriver(NodeDriver):
def _to_node(self, element):
# Get all information at once and process in common/nttcis
- return process_xml(ET.tostring(element))
- """
+ # Below, future to dynamically generate classes
+ # return process_xml(ET.tostring(element))
started = findtext(element, 'started', TYPES_URN)
status = self._to_status(element.find(fixxpath('progress', TYPES_URN)))
dd_state = findtext(element, 'state', TYPES_URN)
@@ -5211,7 +5211,7 @@ class NttCisNodeDriver(NodeDriver):
driver=self.connection.driver,
extra=extra)
return n
- """
+
def _to_status(self, element):
if element is None:
return NttCisStatus()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index 9b75144..63b68c4 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -89,6 +89,7 @@ class Provider(Type):
:cvar NEPHOSCALE: NephoScale driver
:cvar NIMBUS: Nimbus
:cvar NINEFOLD: Ninefold
+ :cvar NTTC-CIS: NTT Communications CIS
:cvar OPENNEBULA: OpenNebula.org
:cvar OPSOURCE: Opsource Cloud
:cvar OUTSCALE_INC: Outscale INC driver.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/drs/base.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/base.py b/libcloud/drs/base.py
index b5ee738..38d5c5c 100644
--- a/libcloud/drs/base.py
+++ b/libcloud/drs/base.py
@@ -14,8 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from libcloud.common.base import ConnectionKey, BaseDriver
-from libcloud.common.types import LibcloudError
+from libcloud.common.base import ConnectionKey
+from libcloud.common.base import BaseDriver
+
+__all__ = [
+ 'DRSConsistencyGroup',
+ 'DRSDriver',
+]
class DRSConsistencyGroup(object):
@@ -23,7 +28,8 @@ class DRSConsistencyGroup(object):
Provide a common interface for handling DRS.
"""
- def __init__(self, id, name, description, journalSizeGB, serverPairSourceServerId, serverPairtargetServerId,
+ def __init__(self, id, name, description, journalSizeGB,
+ serverPairSourceServerId, serverPairtargetServerId,
driver, extra=None):
"""
:param id: Load balancer ID.
@@ -65,15 +71,15 @@ class DRSDriver(BaseDriver):
This class is always subclassed by a specific driver.
"""
- name = None
- website = None
-
connectionCls = ConnectionKey
+ name = None
+ type = None
+ port = None
def __init__(self, key, secret=None, secure=True, host=None,
port=None, **kwargs):
super(DRSDriver, self).__init__(key=key, secret=secret, secure=secure,
- host=host, port=port, **kwargs)
+ host=host, port=port, **kwargs)
def create_consistency_group(self, name, journal_sz_gb,
source_server_id, target_server_id):
@@ -105,7 +111,8 @@ class DRSDriver(BaseDriver):
"""
Return a :class:`ConsistencyGroup` object.
- :param consistency_group_id: id of a consistency group you want to fetch
+ :param consistency_group_id: id of a consistency group you want
+ to fetch
:type consistency_group_id: ``str``
:rtype: :class:`ConsistencyGroup`
@@ -191,4 +198,4 @@ class DRSDriver(BaseDriver):
"""
raise NotImplementedError(
- 'initiate_failover not implemented for this driver')
\ No newline at end of file
+ 'initiate_failover not implemented for this driver')
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/drs/drivers/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/__init__.py b/libcloud/drs/drivers/__init__.py
index f2f9f29..2473c57 100644
--- a/libcloud/drs/drivers/__init__.py
+++ b/libcloud/drs/drivers/__init__.py
@@ -15,4 +15,4 @@
__all__ = [
'nttcis'
-]
\ No newline at end of file
+]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 363d737..c5695d1 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -9,7 +9,6 @@ from libcloud.drs.types import Provider
from libcloud.drs.base import DRSDriver
from libcloud.common.nttcis import TYPES_URN
from libcloud.utils.xml import fixxpath, findtext, findall
-from libcloud.common.types import LibcloudError
def get_params(func):
@@ -21,7 +20,7 @@ def get_params(func):
old_key = k
matches = re.findall(r'_(\w)', k)
for match in matches:
- k = k.replace('_'+match, match.upper())
+ k = k.replace('_' + match, match.upper())
del kwargs[old_key]
kwargs[k] = v
params = kwargs
@@ -34,13 +33,13 @@ def get_params(func):
class NttCisDRSDriver(DRSDriver):
"""
- NttCis node driver.
+ NttCis DRS driver.
"""
selected_region = None
connectionCls = NttCisConnection
name = 'NTTC-CIS DRS Consistencty Groups'
- website = 'https://cloud.nttcis.com/'
+ website = 'https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html'
type = Provider.NTTCIS
api_version = 1.0
@@ -73,7 +72,7 @@ class NttCisDRSDriver(DRSDriver):
kwargs['region'] = self.selected_region
return kwargs
- def create_consistency_group(self, name, journal_size_gb ,
+ def create_consistency_group(self, name, journal_size_gb,
source_server_id, target_server_id,
description=None):
"""
@@ -97,7 +96,7 @@ class NttCisDRSDriver(DRSDriver):
ET.SubElement(consistency_group_elm, "name").text = name
if description is not None:
ET.SubElement(
- consistency_group_elm,"description").text = description
+ consistency_group_elm, "description").text = description
ET.SubElement(
consistency_group_elm, "journalSizeGb").text = journal_size_gb
server_pair = ET.SubElement(consistency_group_elm, "serverPair")
@@ -116,7 +115,8 @@ class NttCisDRSDriver(DRSDriver):
def list_consistency_groups(self, params={}):
"""
Functions takes a named parameter that must be one of the following
- :param params: A dictionary composed of one of the following keys and a value
+ :param params: A dictionary composed of one of the following keys
+ and a value
* target_data_center_id=
* source_network_domain_id=
* target_network_domain_id=
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/drs/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py
index 2a31efa..9aadaae 100644
--- a/libcloud/drs/providers.py
+++ b/libcloud/drs/providers.py
@@ -14,7 +14,6 @@
# limitations under the License.
from libcloud.drs.types import Provider
-#from libcloud.drs.types import OLD_CONSTANT_TO_NEW_MAPPING
from libcloud.common.providers import get_driver as _get_provider_driver
from libcloud.common.providers import set_driver as _set_provider_driver
@@ -31,10 +30,10 @@ DRIVERS = {
def get_driver(provider):
- #deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
+ # deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
return _get_provider_driver(drivers=DRIVERS, provider=provider)
def set_driver(provider, module, klass):
return _set_provider_driver(drivers=DRIVERS, provider=provider,
- module=module, klass=klass)
\ No newline at end of file
+ module=module, klass=klass)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/drs/types.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/types.py b/libcloud/drs/types.py
index b902f74..39c6368 100644
--- a/libcloud/drs/types.py
+++ b/libcloud/drs/types.py
@@ -38,6 +38,6 @@ class Provider(object):
Non-Dummy drivers are sorted in alphabetical order. Please preserve this
ordering when adding new drivers.
- :cvar ALIYUN_SLB: Aliyun SLB loadbalancer driver
+ :cvar NTTCIS: NTT Communications CIS DRS driver
"""
NTTCIS = 'nttcis'
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index 61a4756..d5c7b6b 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -12,11 +12,12 @@ from libcloud.common.nttcis import NttCisTag, NttCisTagKey
from libcloud.common.nttcis import NttCisIpAddress, \
NttCisIpAddressList, NttCisChildIpAddressList, \
NttCisPortList, NttCisPort, NttCisChildPortList
+from libcloud.common.nttcis import ClassFactory
from libcloud.common.nttcis import TYPES_URN
from libcloud.compute.drivers.nttcis import NttCisNodeDriver as NttCis
from libcloud.compute.drivers.nttcis import NttCisNic
from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
-from libcloud.test import MockHttp, unittest
+from libcloud.test import MockHttp
from libcloud.test.file_fixtures import ComputeFileFixtures
from libcloud.test.secrets import NTTCIS_PARAMS
from libcloud.utils.xml import fixxpath, findtext, findall
@@ -73,29 +74,29 @@ def test_node_extras(driver):
assert isinstance(ret[0].extra['cpu'], NttCisServerCpuSpecification)
assert isinstance(ret[0].extra['disks'], list)
assert isinstance(ret[0].extra['disks'][0], NttCisServerDisk)
- assert ret[0].extra['disks'][0].size_gb == 50
+ assert ret[0].extra['disks'][0].size_gb, 10
assert isinstance(ret[1].extra['disks'], list)
assert isinstance(ret[1].extra['disks'][0], NttCisServerDisk)
- assert ret[1].extra['disks'][0].size_gb == 50
+ assert ret[1].extra['disks'][0].size_gb, 10
def test_server_states(driver):
NttCisMockHttp.type = None
ret = driver.list_nodes()
- assert (ret[0].state == 'running')
- assert (ret[1].state == 'starting')
- assert (ret[2].state == 'stopping')
- assert (ret[3].state == 'reconfiguring')
- assert (ret[4].state == 'running')
- assert (ret[5].state == 'terminated')
- assert (ret[6].state == 'stopped')
+ assert ret[0].state == 'running'
+ assert ret[1].state == 'starting'
+ assert ret[2].state == 'stopping'
+ assert ret[3].state == 'reconfiguring'
+ assert ret[4].state == 'running'
+ assert ret[5].state == 'terminated'
+ assert ret[6].state == 'stopped'
assert len(ret) == 7
def test_list_nodes_response_PAGINATED(driver):
NttCisMockHttp.type = 'PAGINATED'
ret = driver.list_nodes()
- assert len(ret) == 9
+ assert len(ret) == 7
def test_paginated_mcp2_call_EMPTY(driver):
@@ -143,7 +144,6 @@ def test_list_nodes_response_strings_ALLFILTERS(driver):
node = ret[3]
assert isinstance(node.extra['disks'], list)
assert isinstance(node.extra['disks'][0], NttCisServerDisk)
- assert node.size.id == '1'
assert node.image.id == '3ebf3c0f-90fe-4a8b-8585-6e65b316592c'
assert node.image.name == 'WIN2008S/32'
disk = node.extra['disks'][0]
@@ -424,7 +424,6 @@ def test_create_node_primary_ipv4(driver):
assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
assert node.extra['status'].action == 'DEPLOY_SERVER'
-
def test_create_node_both_primary_nic_and_vlan_fail(driver):
rootPw = NodeAuthPassword('pass123')
image = driver.list_images()[0]
@@ -518,7 +517,6 @@ def test_create_node_ipv4_gateway(driver):
assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
assert node.extra['status'].action == 'DEPLOY_SERVER'
-
def test_create_node_network_domain_no_vlan_no_ipv4_fail(driver):
rootPw = NodeAuthPassword('pass123')
image = driver.list_images()[0]
@@ -549,7 +547,6 @@ def test_create_node_mcp2_additional_nics_legacy(driver):
assert node.id == 'e75ead52-692f-4314-8725-c8a4f4d13a87'
assert node.extra['status'].action == 'DEPLOY_SERVER'
-
def test_create_node_bad_additional_nics_ipv4(driver):
rootPw = NodeAuthPassword('pass123')
image = driver.list_images()[0]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bc4482a5/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index b218a07..c6395c4 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -82,6 +82,7 @@ def test_list_node_by_image(compute_driver):
requires retrieving vlan Id first
"""
+
def test_list_node_vlan(compute_driver):
nodes = compute_driver.list_nodes(ex_vlan='eb05a24e-85a6-46e3-a7c9-f1765737476d')
print()
@@ -170,26 +171,7 @@ def test_list_firewall_rules(compute_driver):
rules = compute_driver.ex_list_firewall_rules('6aafcf08-cb0b-432c-9c64-7371265db086')
print()
for rule in rules:
- print("id {}, name {}, action {}. location {}, ip ver {}, protocol {}, any ip {}, ip {}, prefix {},"
- " port range {} {} , src address {}, src port list {}, dest. any__ip {}, dest address {}, "
- "dest prefix {}, dest port range {} {}, dest address list id {}"
- ", dest port list id {}".format(
- rule.id, rule.name, rule.action,
- rule.location.name, rule.ip_version,
- rule.protocol, rule.source.any_ip,
- rule.source.ip_address,
- rule.source.ip_prefix_size,
- rule.source.port_begin, rule.source.port_end,
- rule.source.address_list_id,
- rule.source.port_list_id,
- rule.destination.any_ip,
- rule.destination.ip_address,
- rule.destination.ip_prefix_size,
- rule.destination.port_begin,
- rule.destination.port_end,
- rule.destination.address_list_id,
- rule.destination.port_list_id,
- ))
+ print(rule)
def test_list_address_lists(compute_driver):