You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2016/04/16 19:39:46 UTC
[05/11] libcloud git commit: Updated tests to check for new scenario
Updated tests to check for new scenario
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/40f7a68d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/40f7a68d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/40f7a68d
Branch: refs/heads/ex_connection_class_kwargs_regression_fix
Commit: 40f7a68ddbbf49d94ade3eb59ca6773f1ff40a0e
Parents: b8e7512
Author: anthony-shaw <an...@apache.org>
Authored: Fri Apr 15 16:27:10 2016 +1000
Committer: anthony-shaw <an...@apache.org>
Committed: Sat Apr 16 15:36:03 2016 +1000
----------------------------------------------------------------------
libcloud/compute/drivers/dimensiondata.py | 52 ++++++++++++++----------
libcloud/test/compute/test_dimensiondata.py | 7 ++++
2 files changed, 37 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/40f7a68d/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index 0915777..fed4791 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -1365,32 +1365,40 @@ class DimensionDataNodeDriver(NodeDriver):
ET.SubElement(create_node, "protocol").text = rule.protocol
# Setup source port rule
source = ET.SubElement(create_node, "source")
- source_ip = ET.SubElement(source, 'ip')
- if rule.source.any_ip:
- source_ip.set('address', 'ANY')
+ if rule.source.address_list_id is not None:
+ source_ip = ET.SubElement(source, 'ipAddressListId')
+ source_ip.set('id', rule.source.address_list_id)
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_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)
+ 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_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")
- dest_ip = ET.SubElement(dest, 'ip')
- if rule.destination.any_ip:
- dest_ip.set('address', 'ANY')
+ if rule.destination.address_list_id is not None:
+ dest_ip = ET.SubElement(dest, 'ipAddressListId')
+ dest_ip.set('id', rule.destination.address_list_id)
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_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)
+ 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_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")
http://git-wip-us.apache.org/repos/asf/libcloud/blob/40f7a68d/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index 6d66837..89e1b09 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -704,6 +704,13 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
rule = self.driver.ex_create_firewall_rule(net, specific_source_ip_rule, 'FIRST')
self.assertEqual(rule.id, 'd0a20f59-77b9-4f28-a63b-e58496b73a6c')
+ def test_ex_create_firewall_rule_address_list(self):
+ net = self.driver.ex_get_network_domain('8cdfd607-f429-4df6-9352-162cfc0891be')
+ rule = self.driver.ex_list_firewall_rules(net)[0]
+ rule.source.address_list_id = '12345'
+ rule.destination.address_list_id = '12345'
+ self.driver.ex_create_firewall_rule(net, rule, 'LAST')
+
def test_ex_create_firewall_rule_ALL_VALUES(self):
net = self.driver.ex_get_network_domain('8cdfd607-f429-4df6-9352-162cfc0891be')
rules = self.driver.ex_list_firewall_rules(net)