]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
portbindings: use constants for extension keys
authorGary Kotton <gkotton@vmware.com>
Mon, 21 Dec 2015 18:21:57 +0000 (10:21 -0800)
committerGary Kotton <gkotton@vmware.com>
Sun, 10 Jan 2016 08:42:53 +0000 (00:42 -0800)
Use the constants defined in the portbindings extension.

TrivialFix

Change-Id: I90c3deeae9018d4e5b23283f64657d9f5d5723c7

neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py
neutron/tests/unit/plugins/ml2/_test_mech_agent.py
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py

index 4fe5879a37ab19f08370600ebe32aba10820f201..3f2edef626bd521bbcc029f4c8afbf3d5ecc60af 100644 (file)
@@ -71,8 +71,8 @@ class SriovNicSwitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
         # processed in the same order as the relevant API requests.
         mac = port['mac_address']
         pci_slot = None
-        if port.get('binding:profile'):
-            pci_slot = port['binding:profile'].get('pci_slot')
+        if port.get(portbindings.PROFILE):
+            pci_slot = port[portbindings.PROFILE].get('pci_slot')
 
         if pci_slot:
             self.agent.updated_devices.add((mac, pci_slot))
index 2402bc15b67605416f585152580316a110adf168..271620c63914ada9b30823cdf79bd1f50b46f8c2 100644 (file)
@@ -53,7 +53,7 @@ class FakePortContext(api.PortContext):
     @property
     def current(self):
         return {'id': PORT_ID,
-                'binding:vnic_type': self._bound_vnic_type}
+                portbindings.VNIC_TYPE: self._bound_vnic_type}
 
     @property
     def original(self):
index a794d87640d7cc55835ba667b3f18951a75732a2..947a7aebc378a983fc498b696a6cc020aec49226 100644 (file)
@@ -286,7 +286,7 @@ class TestSriovNicSwitchRpcCallbacks(base.BaseTestCase):
 
     def _create_fake_port(self):
         return {'id': uuidutils.generate_uuid(),
-                'binding:profile': {'pci_slot': PCI_SLOT},
+                portbindings.PROFILE: {'pci_slot': PCI_SLOT},
                 'mac_address': DEVICE_MAC}
 
     def test_port_update_with_pci_slot(self):
@@ -305,7 +305,7 @@ class TestSriovNicSwitchRpcCallbacks(base.BaseTestCase):
 
     def test_port_update_without_pci_slot(self):
         port = self._create_fake_port()
-        port['binding:profile'] = None
+        port[portbindings.PROFILE] = None
         kwargs = {'context': self.context, 'port': port}
         self.sriov_rpc_callback.port_update(**kwargs)
         self.assertEqual(set(), self.agent.updated_devices)
index df42a57acd2bfd4f94940f8cbed049a135abcd62..c69e0a47196101214641ceac98f6551dba88aad0 100644 (file)
@@ -45,8 +45,8 @@ class TestFakePortContext(base.FakePortContext):
         @property
         def current(self):
             return {'id': base.PORT_ID,
-                    'binding:vnic_type': self._bound_vnic_type,
-                    'binding:profile': self._bound_profile}
+                    portbindings.VNIC_TYPE: self._bound_vnic_type,
+                    portbindings.PROFILE: self._bound_profile}
 
         def set_binding(self, segment_id, vif_type, vif_details, state):
             self._bound_segment_id = segment_id