Correct key names in network-related http bodies
[kamaki] / kamaki / clients / cyclades / __init__.py
index 0372e83..671ace6 100644 (file)
@@ -58,8 +58,8 @@ class CycladesClient(CycladesRestClient, Waiter):
 
         :param networks: (list of dicts) Networks to connect to, list this:
             "networks": [
-                {"network": <network_uuid>},
-                {"network": <network_uuid>, "fixed_ip": address},
+                {"uuid": <network_uuid>},
+                {"uuid": <network_uuid>, "fixed_ip": address},
                 {"port": <port_id>}, ...]
             ATTENTION: Empty list is different to None. None means ' do not
             mention it', empty list means 'automatically get an ip'
@@ -231,6 +231,11 @@ class CycladesNetworkClient(NetworkClient):
         r = self.networks_post(json_data=req, success=201)
         return r.json['network']
 
+    def list_ports(self, detail=None):
+        path = path4url('ports', 'detail' if detail else '')
+        r = self.get(path, success=200)
+        return r.json['ports']
+
     def create_port(
             self, network_id,
             device_id=None, security_groups=None, name=None, fixed_ips=None):
@@ -251,7 +256,7 @@ class CycladesNetworkClient(NetworkClient):
                         'Invalid format for "fixed_ips"', details=[
                         'fixed_ips format: [{"ip_address": IPv4}, ...]'])
             port['fixed_ips'] = fixed_ips
-        r = self.ports_post(json_data=dict(port=port), success=200)
+        r = self.ports_post(json_data=dict(port=port), success=201)
         return r.json['port']
 
     def create_floatingip(self, floating_network_id, floating_ip_address=''):