]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
change get_host and get_instance_port function name
authorYing Liu <yinliu2@cisco.com>
Fri, 26 Aug 2011 00:01:50 +0000 (17:01 -0700)
committerYing Liu <yinliu2@cisco.com>
Fri, 26 Aug 2011 00:01:50 +0000 (17:01 -0700)
extensions/novatenant.py
quantum/plugins/cisco/tests/unit/test_cisco_extension.py

index 5cbfc4bd0a1282266d6630690d34cfa439eca988..4f21516bc5c350651880eef1883f6d10c74ac36e 100644 (file)
@@ -65,8 +65,8 @@ class Novatenant(object):
         """ Returns Ext Resource Name """
         parent_resource = dict(member_name="tenant", 
                                collection_name="extensions/csco/tenants")
-        member_actions = {'get_host': "PUT",
-                          'get_instance_port': "PUT"}
+        member_actions = {'schedule_host': "PUT",
+                          'associate_port': "PUT"}
         controller = NovatenantsController(QuantumManager.get_plugin())
         return [extensions.ResourceExtension('novatenants', controller,
                                              parent=parent_resource,
@@ -81,7 +81,7 @@ class NovatenantsController(common.QuantumController):
         'param-name': 'novatenant_name',
         'required': True}]
     
-    _get_host_ops_param_list = [{
+    _schedule_host_ops_param_list = [{
         'param-name': 'instance_id',
         'required': True}, {
         'param-name': 'instance_desc',
@@ -126,21 +126,21 @@ class NovatenantsController(common.QuantumController):
         return "novatenant is a dummy resource"
          
     #added for cisco's extension
-    def get_host(self, request, tenant_id, id):
+    def schedule_host(self, request, tenant_id, id):
         content_type = request.best_match_content_type()
         print "Content type:%s" % content_type
         
         try:
             req_params = \
                 self._parse_request_params(request,
-                                           self._get_host_ops_param_list)
+                                           self._schedule_host_ops_param_list)
         except exc.HTTPError as exp:
             return faults.Fault(exp)
         instance_id = req_params['instance_id']
         
         instance_desc = req_params['instance_desc']
         try:
-            host = self._plugin.get_host(tenant_id, instance_id, instance_desc)
+            host = self._plugin.schedule_host(tenant_id, instance_id, instance_desc)
             builder = novatenant_view.get_view_builder(request)
             result = builder.build_host(host)
             return result
@@ -148,14 +148,14 @@ class NovatenantsController(common.QuantumController):
         except qexception.PortNotFound as exp:
             return faults.Fault(faults.PortNotFound(exp))
         
-    def get_instance_port(self, request, tenant_id, id):
+    def associate_port(self, request, tenant_id, id):
         content_type = request.best_match_content_type()
         print "Content type:%s" % content_type
         
         try:
             req_params = \
                 self._parse_request_params(request,
-                                           self._get_host_ops_param_list)
+                                           self._schedule_host_ops_param_list)
         except exc.HTTPError as exp:
             return faults.Fault(exp)
         instance_id = req_params['instance_id']
@@ -163,7 +163,7 @@ class NovatenantsController(common.QuantumController):
         instance_desc = req_params['instance_desc']
         try:
             vif = self._plugin. \
-            get_instance_port(tenant_id, instance_id, instance_desc)
+            associate_port(tenant_id, instance_id, instance_desc)
             builder = novatenant_view.get_view_builder(request)
             result = builder.build_vif(vif)
             return result
index f69ac3df0cbb84a37473e6e46768465ef6eae2fb..172a2e71228013e9be4e5f44c1f2ca73d1f458a2 100644 (file)
@@ -405,8 +405,8 @@ class NovatenantExtensionTest(unittest.TestCase):
     def setUp(self):
         parent_resource = dict(member_name="tenant",
                                collection_name="extensions/csco/tenants")
-        member_actions = {'get_host': "PUT",
-                          'get_instance_port': "PUT"}
+        member_actions = {'schedule_host': "PUT",
+                          'associate_port': "PUT"}
         controller = novatenant.NovatenantsController(
                                QuantumManager.get_plugin())
         res_ext = extensions.ResourceExtension('novatenants', controller,
@@ -420,29 +420,29 @@ class NovatenantExtensionTest(unittest.TestCase):
                                    'instance_desc': {'key1': '1',
                                    'key2': '2'}}}
 
-    def test_get_host(self):
-        LOG.debug("test_get_host - START")
+    def test_schedule_host(self):
+        LOG.debug("test_schedule_host - START")
         req_body = json.dumps(self.test_instance_data)
-        host_path = self.novatenants_path + "001/get_host"
+        host_path = self.novatenants_path + "001/schedule_host"
         host_response = self.test_app.put(
                                   host_path, req_body,
                                   content_type=self.contenttype)
         self.assertEqual(200, host_response.status_int)
-        LOG.debug("test_get_host - END")
+        LOG.debug("test_schedule_host - END")
 
-    def test_get_hostBADRequest(self):
-        LOG.debug("test_get_hostBADRequest - START")
-        host_path = self.novatenants_path + "001/get_host"
+    def test_schedule_hostBADRequest(self):
+        LOG.debug("test_schedule_hostBADRequest - START")
+        host_path = self.novatenants_path + "001/schedule_host"
         host_response = self.test_app.put(
                                   host_path, 'BAD_REQUEST',
                                   content_type=self.contenttype, status='*')
         self.assertEqual(400, host_response.status_int)
-        LOG.debug("test_get_hostBADRequest - END")
+        LOG.debug("test_schedule_hostBADRequest - END")
 
     def test_instance_port(self):
         LOG.debug("test_instance_port - START")
         req_body = json.dumps(self.test_instance_data)
-        instance_port_path = self.novatenants_path + "001/get_instance_port"
+        instance_port_path = self.novatenants_path + "001/associate_port"
         instance_port_response = self.test_app.put(
                                   instance_port_path, req_body,
                                   content_type=self.contenttype)