libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/3] git commit: When creating a CloudSigma node, assign public interface to the node.
Date Thu, 30 Jan 2014 14:19:52 GMT
When creating a CloudSigma node, assign public interface to the node.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4c527c89
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4c527c89
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4c527c89

Branch: refs/heads/trunk
Commit: 4c527c8999f065a73699d05f257abe9cb2044530
Parents: 626c881
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Thu Jan 30 14:20:20 2014 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu Jan 30 14:24:38 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py              | 11 +++++++++++
 .../fixtures/cloudsigma_2_0/servers_create.json     | 16 +++++++++++++++-
 libcloud/test/compute/test_cloudsigma_v2_0.py       |  2 ++
 3 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c527c89/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 0b23a85..c50db8b 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1112,6 +1112,17 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         if ex_metadata:
             data['meta'] = ex_metadata
 
+        # Assign 1 public interface (DHCP) to the node
+        data['nics'] = [
+            {
+                'boot_order': None,
+                'ip_v4_conf': {
+                    'conf': 'dhcp',
+                },
+                'ip_v6_conf': None
+            }
+        ]
+
         data['drives'] = [
             {
                 'boot_order': 1,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c527c89/libcloud/test/compute/fixtures/cloudsigma_2_0/servers_create.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudsigma_2_0/servers_create.json b/libcloud/test/compute/fixtures/cloudsigma_2_0/servers_create.json
index 257fb31..4c93a60 100644
--- a/libcloud/test/compute/fixtures/cloudsigma_2_0/servers_create.json
+++ b/libcloud/test/compute/fixtures/cloudsigma_2_0/servers_create.json
@@ -12,7 +12,21 @@
             "mem": 536870912,
             "meta": {},
             "name": "test node",
-            "nics": [],
+            "nics": [
+                {
+                    "boot_order": null,
+                    "firewall_policy": null,
+                    "ip_v4_conf": {
+                        "conf": "dhcp",
+                        "ip": null
+                    },
+                    "ip_v6_conf": null,
+                    "mac": "22:08:76:b1:ce:41",
+                    "model": "virtio",
+                    "runtime": null,
+                    "vlan": null
+                }
+            ],
             "owner": {
                 "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                 "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c527c89/libcloud/test/compute/test_cloudsigma_v2_0.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py
index 9e6690c..0b5948f 100644
--- a/libcloud/test/compute/test_cloudsigma_v2_0.py
+++ b/libcloud/test/compute/test_cloudsigma_v2_0.py
@@ -91,6 +91,8 @@ class CloudSigmaAPI20BaseTestCase(object):
         node = self.driver.create_node(name='test node', size=size, image=image,
                                        ex_metadata=metadata)
         self.assertEqual(node.name, 'test node')
+        self.assertEqual(len(node.extra['nics']), 1)
+        self.assertEqual(node.extra['nics'][0]['ip_v4_conf']['conf'], 'dhcp')
 
     def test_destroy_node(self):
         status = self.driver.destroy_node(node=self.node)


Mime
View raw message