]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
WIP
authorSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Mon, 1 Aug 2011 16:42:25 +0000 (17:42 +0100)
committerSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Mon, 1 Aug 2011 16:42:25 +0000 (17:42 +0100)
quantum/api/networks.py

index 9afc09c24e32fb555a0c30a4c887088f101187b6..eecff05d12e9f8de840d498a3de4312c71213c21 100644 (file)
@@ -29,7 +29,7 @@ class Controller(common.QuantumController):
     """ Network API controller for Quantum API """
 
     _network_ops_param_list = [{
-        'param-name': 'net-name',
+        'param-name': 'name',
         'required': True}, ]
 
     _serialization_metadata = {
@@ -46,11 +46,6 @@ class Controller(common.QuantumController):
         self._resource_name = 'network'
         super(Controller, self).__init__(plugin)
 
-    def index(self, request, tenant_id):
-        """ Returns a list of network ids """
-        #TODO: this should be for a given tenant!!!
-        return self._items(request, tenant_id)
-
     def _item(self, req, tenant_id, network_id,
               net_details=True, port_details=False):
         # We expect get_network_details to return information
@@ -69,6 +64,10 @@ class Controller(common.QuantumController):
                   for network in networks]
         return dict(networks=result)
 
+    def index(self, request, tenant_id):
+        """ Returns a list of network ids """
+        return self._items(request, tenant_id)
+
     def show(self, request, tenant_id, id):
         """ Returns network details for the given network id """
         try:
@@ -109,10 +108,11 @@ class Controller(common.QuantumController):
             return faults.Fault(e)
         network = self._plugin.\
                        create_network(tenant_id,
-                                      request_params['net-name'])
+                                      request_params['name'])
         builder = networks_view.get_view_builder(request)
-        result = builder.build(network)
-        return dict(networks=result)
+        result = builder.build(network)['network']
+        #MUST RETURN 202
+        return dict(network=result)
 
     def update(self, request, tenant_id, id):
         """ Updates the name for the network with the given id """
@@ -125,7 +125,7 @@ class Controller(common.QuantumController):
         try:
             self._plugin.rename_network(tenant_id, id,
                                         request_params['net-name'])
-            return exc.HTTPAccepted()
+            return exc.HTTPNoContent()
         except exception.NetworkNotFound as e:
             return faults.Fault(faults.NetworkNotFound(e))
 
@@ -133,7 +133,7 @@ class Controller(common.QuantumController):
         """ Destroys the network with the given id """
         try:
             self._plugin.delete_network(tenant_id, id)
-            return exc.HTTPAccepted()
+            return exc.HTTPNoContent()
         except exception.NetworkNotFound as e:
             return faults.Fault(faults.NetworkNotFound(e))
         except exception.NetworkInUse as e: