portbindings: use constants for extension keys
Use the constants defined in the portbindings extension. TrivialFix Change-Id: I90c3deeae9018d4e5b23283f64657d9f5d5723c7
This commit is contained in:
parent
6c5ecdc0e6
commit
49d25b3992
|
@ -71,8 +71,8 @@ class SriovNicSwitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||||
# processed in the same order as the relevant API requests.
|
# processed in the same order as the relevant API requests.
|
||||||
mac = port['mac_address']
|
mac = port['mac_address']
|
||||||
pci_slot = None
|
pci_slot = None
|
||||||
if port.get('binding:profile'):
|
if port.get(portbindings.PROFILE):
|
||||||
pci_slot = port['binding:profile'].get('pci_slot')
|
pci_slot = port[portbindings.PROFILE].get('pci_slot')
|
||||||
|
|
||||||
if pci_slot:
|
if pci_slot:
|
||||||
self.agent.updated_devices.add((mac, pci_slot))
|
self.agent.updated_devices.add((mac, pci_slot))
|
||||||
|
|
|
@ -53,7 +53,7 @@ class FakePortContext(api.PortContext):
|
||||||
@property
|
@property
|
||||||
def current(self):
|
def current(self):
|
||||||
return {'id': PORT_ID,
|
return {'id': PORT_ID,
|
||||||
'binding:vnic_type': self._bound_vnic_type}
|
portbindings.VNIC_TYPE: self._bound_vnic_type}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def original(self):
|
def original(self):
|
||||||
|
|
|
@ -286,7 +286,7 @@ class TestSriovNicSwitchRpcCallbacks(base.BaseTestCase):
|
||||||
|
|
||||||
def _create_fake_port(self):
|
def _create_fake_port(self):
|
||||||
return {'id': uuidutils.generate_uuid(),
|
return {'id': uuidutils.generate_uuid(),
|
||||||
'binding:profile': {'pci_slot': PCI_SLOT},
|
portbindings.PROFILE: {'pci_slot': PCI_SLOT},
|
||||||
'mac_address': DEVICE_MAC}
|
'mac_address': DEVICE_MAC}
|
||||||
|
|
||||||
def test_port_update_with_pci_slot(self):
|
def test_port_update_with_pci_slot(self):
|
||||||
|
@ -305,7 +305,7 @@ class TestSriovNicSwitchRpcCallbacks(base.BaseTestCase):
|
||||||
|
|
||||||
def test_port_update_without_pci_slot(self):
|
def test_port_update_without_pci_slot(self):
|
||||||
port = self._create_fake_port()
|
port = self._create_fake_port()
|
||||||
port['binding:profile'] = None
|
port[portbindings.PROFILE] = None
|
||||||
kwargs = {'context': self.context, 'port': port}
|
kwargs = {'context': self.context, 'port': port}
|
||||||
self.sriov_rpc_callback.port_update(**kwargs)
|
self.sriov_rpc_callback.port_update(**kwargs)
|
||||||
self.assertEqual(set(), self.agent.updated_devices)
|
self.assertEqual(set(), self.agent.updated_devices)
|
||||||
|
|
|
@ -45,8 +45,8 @@ class TestFakePortContext(base.FakePortContext):
|
||||||
@property
|
@property
|
||||||
def current(self):
|
def current(self):
|
||||||
return {'id': base.PORT_ID,
|
return {'id': base.PORT_ID,
|
||||||
'binding:vnic_type': self._bound_vnic_type,
|
portbindings.VNIC_TYPE: self._bound_vnic_type,
|
||||||
'binding:profile': self._bound_profile}
|
portbindings.PROFILE: self._bound_profile}
|
||||||
|
|
||||||
def set_binding(self, segment_id, vif_type, vif_details, state):
|
def set_binding(self, segment_id, vif_type, vif_details, state):
|
||||||
self._bound_segment_id = segment_id
|
self._bound_segment_id = segment_id
|
||||||
|
|
Loading…
Reference in New Issue