Updated Branches: refs/heads/trunk 9548848cb -> 43c772c38
Issue LIBCLOUD-493: Add extra instance properties that now exist in the 2013-10-15 version of the EC2 API into the Node.extra dictionary. The updates include block device mapping, VPC information and root device information among other. All unit tests were updated accordingly and the fixture has been updated with a more recent XML response. Closes #221. Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/91608576 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/91608576 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/91608576 Branch: refs/heads/trunk Commit: 91608576cdcc23fc3c4a01492152e1d623b2abe2 Parents: 9548848 Author: Chris DeRamus <[email protected]> Authored: Sun Jan 12 09:16:14 2014 -0500 Committer: Tomaz Muraus <[email protected]> Committed: Sun Jan 12 17:26:15 2014 +0100 ---------------------------------------------------------------------- libcloud/compute/drivers/ec2.py | 241 ++++++++++++------ .../compute/fixtures/ec2/describe_instances.xml | 246 +++++++++++++------ .../ec2/describe_instances_with_tags.xml | 53 ---- libcloud/test/compute/test_ec2.py | 50 ++-- 4 files changed, 365 insertions(+), 225 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/91608576/libcloud/compute/drivers/ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index fb7b5c9..a226f88 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -678,6 +678,120 @@ RESOURCE_EXTRA_ATTRIBUTES_MAP = { 'transform_func': str } }, + 'node': { + 'availability': { + 'xpath': 'placement/availabilityZone', + 'transform_func': str + }, + 'architecture': { + 'xpath': 'architecture', + 'transform_func': str + }, + 'client_token': { + 'xpath': 'clientToken', + 'transform_func': str + }, + 'dns_name': { + 'xpath': 'dnsName', + 'transform_func': str + }, + 'hypervisor': { + 'xpath': 'hypervisor', + 'transform_func': str + }, + 'iam_profile': { + 'xpath': 'iamInstanceProfile/id', + 'transform_func': str + }, + 'image_id': { + 'xpath': 'imageId', + 'transform_func': str + }, + 'instance_id': { + 'xpath': 'instanceId', + 'transform_func': str + }, + 'instance_lifecycle': { + 'xpath': 'instanceLifecycle', + 'transform_func': str + }, + 'instance_tenancy': { + 'xpath': 'placement/tenancy', + 'transform_func': str + }, + 'instance_type': { + 'xpath': 'instanceType', + 'transform_func': str + }, + 'key_name': { + 'xpath': 'keyName', + 'transform_func': str + }, + 'launch_index': { + 'xpath': 'amiLaunchIndex', + 'transform_func': int + }, + 'launch_time': { + 'xpath': 'launchTime', + 'transform_func': str + }, + 'kernel_id': { + 'xpath': 'kernelId', + 'transform_func': str + }, + 'monitoring': { + 'xpath': 'monitoring/state', + 'transform_func': str + }, + 'platform': { + 'xpath': 'platform', + 'transform_func': str + }, + 'private_dns': { + 'xpath': 'privateDnsName', + 'transform_func': str + }, + 'ramdisk_id': { + 'xpath': 'ramdiskId', + 'transform_func': str + }, + 'root_device_type': { + 'xpath': 'rootDeviceType', + 'transform_func': str + }, + 'root_device_name': { + 'xpath': 'rootDeviceName', + 'transform_func': str + }, + 'reason': { + 'xpath': 'reason', + 'transform_func': str + }, + 'source_dest_check': { + 'xpath': 'sourceDestCheck', + 'transform_func': str + }, + 'status': { + 'xpath': 'instanceState/name', + 'transform_func': str + }, + 'subnet_id': { + 'xpath': 'subnetId', + 'transform_func': str + }, + 'virtualization_type': { + 'xpath': 'virtualizationType', + 'transform_func': str + }, + 'ebs_optimized': { + 'xpath': 'ebsOptimized', + 'transform_func': str + }, + 'vpc_id': { + 'xpath': 'vpcId', + 'transform_func': str + } + }, 'reserved_node': { 'instance_type': { 'xpath': 'instanceType', @@ -1037,11 +1151,7 @@ class BaseEC2NodeDriver(NodeDriver): nodes = [] for rs in findall(element=elem, xpath='reservationSet/item', namespace=NAMESPACE): - groups = [g.findtext('') - for g in findall(element=rs, - xpath='groupSet/item/groupId', - namespace=NAMESPACE)] - nodes += self._to_nodes(rs, 'instancesSet/item', groups) + nodes += self._to_nodes(rs, 'instancesSet/item') nodes_elastic_ips_mappings = self.ex_describe_addresses(nodes) for node in nodes: @@ -2853,12 +2963,12 @@ class BaseEC2NodeDriver(NodeDriver): return result - def _to_nodes(self, object, xpath, groups=None): - return [self._to_node(el, groups=groups) + def _to_nodes(self, object, xpath): + return [self._to_node(el) for el in object.findall(fixxpath(xpath=xpath, namespace=NAMESPACE))] - def _to_node(self, element, groups=None): + def _to_node(self, element): try: state = self.NODE_STATE_MAP[findattr(element=element, xpath="instanceState/name", @@ -2869,70 +2979,36 @@ class BaseEC2NodeDriver(NodeDriver): instance_id = findtext(element=element, xpath='instanceId', namespace=NAMESPACE) - - # Get our tags - tags = self._get_resource_tags(element) - - name = tags.get('Name', instance_id) - public_ip = findtext(element=element, xpath='ipAddress', namespace=NAMESPACE) public_ips = [public_ip] if public_ip else [] private_ip = findtext(element=element, xpath='privateIpAddress', namespace=NAMESPACE) private_ips = [private_ip] if private_ip else [] + product_codes = [] + for p in findall(element=element, + xpath="productCodesSet/item/productCode", + namespace=NAMESPACE): + product_codes.append(p) - n = Node( - id=findtext(element=element, xpath='instanceId', - namespace=NAMESPACE), - name=name, - state=state, - public_ips=public_ips, - private_ips=private_ips, - driver=self.connection.driver, - extra={ - 'dns_name': findattr(element=element, xpath="dnsName", - namespace=NAMESPACE), - 'instanceId': findattr(element=element, xpath="instanceId", - namespace=NAMESPACE), - 'imageId': findattr(element=element, xpath="imageId", - namespace=NAMESPACE), - 'private_dns': findattr(element=element, - xpath="privateDnsName", - namespace=NAMESPACE), - 'status': findattr(element=element, xpath="instanceState/name", - namespace=NAMESPACE), - 'key_name': findattr(element=element, xpath="keyName", - namespace=NAMESPACE), - 'launchindex': findattr(element=element, - xpath="amiLaunchIndex", - namespace=NAMESPACE), - 'productcode': [ - p.text for p in findall( - element=element, - xpath="productCodesSet/item/productCode", - namespace=NAMESPACE - )], - 'instancetype': findattr(element=element, xpath="instanceType", - namespace=NAMESPACE), - 'launchdatetime': findattr(element=element, xpath="launchTime", - namespace=NAMESPACE), - 'availability': findattr(element, - xpath="placement/availabilityZone", - namespace=NAMESPACE), - 'kernelid': findattr(element=element, xpath="kernelId", - namespace=NAMESPACE), - 'ramdiskid': findattr(element=element, xpath="ramdiskId", - namespace=NAMESPACE), - 'clienttoken': findattr(element=element, xpath="clientToken", - namespace=NAMESPACE), - 'groups': groups, - 'tags': tags, - 'iam_profile': findattr(element, xpath="iamInstanceProfile/id", - namespace=NAMESPACE) - } - ) - return n + # Get our tags + tags = self._get_resource_tags(element) + name = tags.get('Name', instance_id) + + # Get our extra dictionary + extra = self._get_extra_dict( + element, RESOURCE_EXTRA_ATTRIBUTES_MAP['node']) + + # Add additional properties to our extra dictionary + extra['block_device_mapping'] = self._to_device_mappings(element) + extra['groups'] = self._get_security_groups(element) + extra['network_interfaces'] = self._to_interfaces(element) + extra['product_codes'] = product_codes + extra['tags'] = tags + + return Node(id=instance_id, name=name, state=state, + public_ips=public_ips, private_ips=private_ips, + driver=self.connection.driver, extra=extra) def _to_images(self, object): return [self._to_image(el) for el in object.findall( @@ -3175,17 +3251,7 @@ class BaseEC2NodeDriver(NodeDriver): name = name if name else tags.get('Name', interface_id) # Build security groups - groups = [] - for item in findall(element=element, - xpath='groupSet/item', - namespace=NAMESPACE): - - groups.append({'group_id': findtext(element=item, - xpath='groupId', - namespace=NAMESPACE), - 'group_name': findtext(element=item, - xpath='groupName', - namespace=NAMESPACE)}) + groups = self._get_security_groups(element) # Build private IPs priv_ips = [] @@ -3426,6 +3492,29 @@ class BaseEC2NodeDriver(NodeDriver): return params + def _get_security_groups(self, element): + """ + Parse security groups from the provided element and return a + list of security groups with the id ane name key/value pairs. + + :rtype: ``list`` of ``dict`` + """ + groups = [] + + for item in findall(element=element, + xpath='groupSet/item', + namespace=NAMESPACE): + groups.append({ + 'group_id': findtext(element=item, + xpath='groupId', + namespace=NAMESPACE), + 'group_name': findtext(element=item, + xpath='groupName', + namespace=NAMESPACE) + }) + + return groups + class EC2NodeDriver(BaseEC2NodeDriver): """ http://git-wip-us.apache.org/repos/asf/libcloud/blob/91608576/libcloud/test/compute/fixtures/ec2/describe_instances.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/ec2/describe_instances.xml b/libcloud/test/compute/fixtures/ec2/describe_instances.xml index c7f6594..1c3233e 100644 --- a/libcloud/test/compute/fixtures/ec2/describe_instances.xml +++ b/libcloud/test/compute/fixtures/ec2/describe_instances.xml @@ -1,74 +1,182 @@ <DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/"> - <requestId>56d0fffa-8819-4658-bdd7-548f143a86d2</requestId> - <reservationSet> - <item> - <reservationId>r-07adf66e</reservationId> - <ownerId>822272953071</ownerId> - <groupSet> + <requestId>ec0d2a7d-5080-4f4b-9b02-cb0d5d2d4274</requestId> + <reservationSet> <item> - <groupId>default</groupId> + <reservationId>r-fd67fb97</reservationId> + <ownerId>123456789098</ownerId> + <groupSet/> + <instancesSet> + <item> + <instanceId>i-4382922a</instanceId> + <imageId>ami-3215fe5a</imageId> + <instanceState> + <code>80</code> + <name>stopped</name> + </instanceState> + <privateDnsName/> + <dnsName/> + <reason>User initiated (2014-01-11 14:39:31 GMT)</reason> + <keyName>fauxkey</keyName> + <amiLaunchIndex>0</amiLaunchIndex> + <productCodes/> + <instanceType>m1.small</instanceType> + <launchTime>2013-12-02T11:58:11.000Z</launchTime> + <placement> + <availabilityZone>us-east-1d</availabilityZone> + <groupName/> + <tenancy>default</tenancy> + </placement> + <kernelId>aki-88aa75e1</kernelId> + <monitoring> + <state>disabled</state> + </monitoring> + <privateIpAddress>10.211.11.211</privateIpAddress> + <ipAddress>1.2.3.4</ipAddress> + <groupSet> + <item> + <groupId>sg-42916629</groupId> + <groupName>Test Group 1</groupName> + </item> + <item> + <groupId>sg-42916628</groupId> + <groupName>Test Group 2</groupName> + </item> + </groupSet> + <stateReason> + <code>Client.UserInitiatedShutdown</code> + <message>Client.UserInitiatedShutdown: User initiated shutdown</message> + </stateReason> + <architecture>x86_64</architecture> + <rootDeviceType>ebs</rootDeviceType> + <rootDeviceName>/dev/sda1</rootDeviceName> + <blockDeviceMapping> + <item> + <deviceName>/dev/sda1</deviceName> + <ebs> + <volumeId>vol-5e312311</volumeId> + <status>attached</status> + <attachTime>2013-04-09T18:01:01.000Z</attachTime> + <deleteOnTermination>true</deleteOnTermination> + </ebs> + </item> + </blockDeviceMapping> + <virtualizationType>paravirtual</virtualizationType> + <clientToken>ifmxj1365530456668</clientToken> + <tagSet/> + <hypervisor>xen</hypervisor> + <networkInterfaceSet/> + <ebsOptimized>false</ebsOptimized> + </item> + </instancesSet> </item> - </groupSet> - <instancesSet> <item> - <instanceId>i-4382922a</instanceId> - <imageId>ami-0d57b264</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName/> - <dnsName/> - <reason/> - <keyName>my-key-pair</keyName> - <privateIpAddress>1.2.3.5</privateIpAddress> - <ipAddress>1.2.3.5</ipAddress> - <amiLaunchIndex>0</amiLaunchIndex> - <productCodes/> - <instanceType>m1.small</instanceType> - <launchTime>2009-08-07T05:47:04.000Z</launchTime> - <placement> - <availabilityZone>us-east-1a</availabilityZone> - </placement> - <monitoring> - <state>disabled</state> - </monitoring> + <reservationId>r-88dc1bef</reservationId> + <ownerId>123456789098</ownerId> + <groupSet/> + <instancesSet> + <item> + <instanceId>i-8474834a</instanceId> + <imageId>ami-29674340</imageId> + <instanceState> + <code>80</code> + <name>stopped</name> + </instanceState> + <privateDnsName>ip-172-16-9-139.ec2.internal</privateDnsName> + <dnsName/> + <reason>User initiated (2014-01-11 14:39:31 GMT)</reason> + <keyName>cderamus</keyName> + <amiLaunchIndex>0</amiLaunchIndex> + <productCodes/> + <instanceType>t1.micro</instanceType> + <launchTime>2013-12-02T15:58:29.000Z</launchTime> + <placement> + <availabilityZone>us-east-1d</availabilityZone> + <groupName/> + <tenancy>default</tenancy> + </placement> + <kernelId>aki-88aa75e1</kernelId> + <monitoring> + <state>disabled</state> + </monitoring> + <subnetId>subnet-5fd9d412</subnetId> + <vpcId>vpc-61dcd30e</vpcId> + <privateIpAddress>172.16.9.139</privateIpAddress> + <ipAddress>1.2.3.5</ipAddress> + <sourceDestCheck>true</sourceDestCheck> + <groupSet> + <item> + <groupId>sg-495a9926</groupId> + <groupName>default</groupName> + </item> + </groupSet> + <stateReason> + <code>Client.UserInitiatedShutdown</code> + <message>Client.UserInitiatedShutdown: User initiated shutdown</message> + </stateReason> + <architecture>x86_64</architecture> + <rootDeviceType>ebs</rootDeviceType> + <rootDeviceName>/dev/sda1</rootDeviceName> + <blockDeviceMapping> + <item> + <deviceName>/dev/sda1</deviceName> + <ebs> + <volumeId>vol-60124921</volumeId> + <status>attached</status> + <attachTime>2013-12-02T15:58:32.000Z</attachTime> + <deleteOnTermination>false</deleteOnTermination> + </ebs> + </item> + </blockDeviceMapping> + <virtualizationType>paravirtual</virtualizationType> + <clientToken/> + <tagSet> + <item> + <key>Name</key> + <value>Test Server 2</value> + </item> + <item> + <key>Group</key> + <value>VPC Test</value> + </item> + </tagSet> + <hypervisor>xen</hypervisor> + <networkInterfaceSet> + <item> + <networkInterfaceId>eni-c5dffd83</networkInterfaceId> + <subnetId>subnet-5fd9d412</subnetId> + <vpcId>vpc-61dcd30e</vpcId> + <description/> + <ownerId>123456789098</ownerId> + <status>in-use</status> + <macAddress>0e:27:72:16:52:ab</macAddress> + <privateIpAddress>172.16.9.139</privateIpAddress> + <privateDnsName>ip-172-16-9-139.ec2.internal</privateDnsName> + <sourceDestCheck>true</sourceDestCheck> + <groupSet> + <item> + <groupId>sg-495a9926</groupId> + <groupName>default</groupName> + </item> + </groupSet> + <attachment> + <attachmentId>eni-attach-4d924721</attachmentId> + <deviceIndex>0</deviceIndex> + <status>attached</status> + <attachTime>2013-12-02T15:58:29.000Z</attachTime> + <deleteOnTermination>true</deleteOnTermination> + </attachment> + <privateIpAddressesSet> + <item> + <privateIpAddress>172.16.4.139</privateIpAddress> + <privateDnsName>ip-172-16-4-139.ec2.internal</privateDnsName> + <primary>true</primary> + </item> + </privateIpAddressesSet> + </item> + </networkInterfaceSet> + <ebsOptimized>false</ebsOptimized> + </item> + </instancesSet> </item> - <item> - <instanceId>i-8474834a</instanceId> - <imageId>ami-0f234b234</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName/> - <dnsName/> - <reason/> - <keyName>my-key-pair2</keyName> - <privateIpAddress>1.2.3.5</privateIpAddress> - <ipAddress>1.2.3.5</ipAddress> - <amiLaunchIndex>0</amiLaunchIndex> - <productCodes/> - <instanceType>m1.micro</instanceType> - <launchTime>2009-08-07T05:47:04.000Z</launchTime> - <placement> - <availabilityZone>us-west-1a</availabilityZone> - </placement> - <monitoring> - <state>disabled</state> - </monitoring> - <tagSet> - <item> - <key>user_key0</key> - <value>user_val0</value> - </item> - <item> - <key>user_key1</key> - <value>user_val1</value> - </item> - </tagSet> - </item> - </instancesSet> - </item> - </reservationSet> -</DescribeInstancesResponse> + </reservationSet> +</DescribeInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/91608576/libcloud/test/compute/fixtures/ec2/describe_instances_with_tags.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/ec2/describe_instances_with_tags.xml b/libcloud/test/compute/fixtures/ec2/describe_instances_with_tags.xml deleted file mode 100644 index 4bcb5b1..0000000 --- a/libcloud/test/compute/fixtures/ec2/describe_instances_with_tags.xml +++ /dev/null @@ -1,53 +0,0 @@ -<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/"> - <requestId>56d0fffa-8819-4658-bdd7-548f143a86d2</requestId> - <reservationSet> - <item> - <reservationId>r-07adf66e</reservationId> - <ownerId>822272953071</ownerId> - <groupSet> - <item> - <groupId>default</groupId> - </item> - </groupSet> - <instancesSet> - <item> - <instanceId>i-8474834a</instanceId> - <imageId>ami-0f234b234</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName/> - <dnsName/> - <reason/> - <privateIpAddress>1.2.3.5</privateIpAddress> - <ipAddress>1.2.3.5</ipAddress> - <amiLaunchIndex>0</amiLaunchIndex> - <productCodes/> - <instanceType>m1.micro</instanceType> - <launchTime>2009-08-07T05:47:04.000Z</launchTime> - <placement> - <availabilityZone>us-west-1a</availabilityZone> - </placement> - <monitoring> - <state>disabled</state> - </monitoring> - <tagSet> - <item> - <key>Name</key> - <value>foobar1</value> - </item> - <item> - <key>user_key1</key> - <value>user_val1</value> - </item> - <item> - <key>user_key2</key> - <value>user_val2</value> - </item> - </tagSet> - </item> - </instancesSet> - </item> - </reservationSet> -</DescribeInstancesResponse> http://git-wip-us.apache.org/repos/asf/libcloud/blob/91608576/libcloud/test/compute/test_ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py index 9a16e05..d86af68 100644 --- a/libcloud/test/compute/test_ec2.py +++ b/libcloud/test/compute/test_ec2.py @@ -133,7 +133,7 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): node = self.driver.create_node(name='foo', image=image, size=size, ex_clienttoken=token) self.assertEqual(node.id, 'i-2ba64342') - self.assertEqual(node.extra['clienttoken'], token) + self.assertEqual(node.extra['client_token'], token) # from: http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?Run_Instance_Idempotency.html # If you repeat the request with the same client token, but change @@ -174,13 +174,17 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): self.assertEqual(node.id, 'i-4382922a') self.assertEqual(node.name, node.id) self.assertEqual(len(node.public_ips), 2) - self.assertEqual(node.extra['launchdatetime'], - '2009-08-07T05:47:04.000Z') - self.assertEqual(node.extra['key_name'], 'my-key-pair') - self.assertTrue('instancetype' in node.extra) + self.assertEqual(node.extra['launch_time'], + '2013-12-02T11:58:11.000Z') + self.assertTrue('instance_type' in node.extra) + self.assertEqual(node.extra['availability'], 'us-east-1d') + self.assertEqual(node.extra['key_name'], 'fauxkey') + self.assertEqual(node.extra['monitoring'], 'disabled') + self.assertEqual(node.extra['image_id'], 'ami-3215fe5a') + self.assertEqual(len(node.extra['groups']), 2) + self.assertEqual(len(node.extra['block_device_mapping']), 1) self.assertEqual(public_ips[0], '1.2.3.4') - self.assertEqual(public_ips[1], '1.2.3.5') nodes = self.driver.list_nodes(ex_node_ids=['i-4382922a', 'i-8474834a']) @@ -189,14 +193,16 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): self.assertEqual(ret_node1.id, 'i-4382922a') self.assertEqual(ret_node2.id, 'i-8474834a') - - self.assertEqual(ret_node1.extra['launchdatetime'], - '2009-08-07T05:47:04.000Z') - self.assertTrue('instancetype' in ret_node1.extra) - - self.assertEqual(ret_node2.extra['launchdatetime'], - '2009-08-07T05:47:04.000Z') - self.assertTrue('instancetype' in ret_node2.extra) + self.assertEqual(ret_node2.name, 'Test Server 2') + self.assertEqual(ret_node2.extra['subnet_id'], 'subnet-5fd9d412') + self.assertEqual(ret_node2.extra['vpc_id'], 'vpc-61dcd30e') + self.assertEqual(ret_node2.extra['tags']['Group'], 'VPC Test') + self.assertEqual(ret_node1.extra['launch_time'], + '2013-12-02T11:58:11.000Z') + self.assertTrue('instance_type' in ret_node1.extra) + self.assertEqual(ret_node2.extra['launch_time'], + '2013-12-02T15:58:29.000Z') + self.assertTrue('instance_type' in ret_node2.extra) def test_ex_list_reserved_nodes(self): node = self.driver.ex_list_reserved_nodes()[0] @@ -214,12 +220,6 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): self.assertEqual(node.extra['currency_code'], 'USD') self.assertEqual(node.extra['offering_type'], 'Light Utilization') - def test_list_nodes_with_name_tag(self): - EC2MockHttp.type = 'WITH_TAGS' - node = self.driver.list_nodes()[0] - self.assertEqual(node.id, 'i-8474834a') - self.assertEqual(node.name, 'foobar1') - def test_list_location(self): locations = self.driver.list_locations() self.assertTrue(len(locations) > 0) @@ -1030,10 +1030,6 @@ class EC2MockHttp(MockHttpTestCase): body = self.fixtures.load('describe_instances.xml') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - def _WITH_TAGS_DescribeInstances(self, method, url, body, headers): - body = self.fixtures.load('describe_instances_with_tags.xml') - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - def _DescribeReservedInstances(self, method, url, body, headers): body = self.fixtures.load('describe_reserved_instances.xml') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1367,7 +1363,7 @@ class NimbusTests(EC2Tests): public_ips = node.public_ips self.assertEqual(node.id, 'i-4382922a') self.assertEqual(len(node.public_ips), 1) - self.assertEqual(public_ips[0], '1.2.3.5') + self.assertEqual(public_ips[0], '1.2.3.4') self.assertEqual(node.extra['tags'], {}) node = self.driver.list_nodes()[1] @@ -1376,8 +1372,8 @@ class NimbusTests(EC2Tests): self.assertEqual(node.id, 'i-8474834a') self.assertEqual(len(node.public_ips), 1) self.assertEqual(public_ips[0], '1.2.3.5') - self.assertEqual(node.extra['tags'], { - 'user_key0': 'user_val0', 'user_key1': 'user_val1'}) + self.assertEqual(node.extra['tags'], + {'Name': 'Test Server 2', 'Group': 'VPC Test'}) def test_ex_create_tags(self): # Nimbus doesn't support creating tags so this one should be a
