Merge "Add physical_network to binding:vif_details dictionary"
This commit is contained in:
commit
b53c094d83
@ -69,6 +69,9 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||
if self.check_segment_for_agent(segment, agent):
|
||||
vif_type = self._get_vif_type(
|
||||
context.current[portbindings.VNIC_TYPE])
|
||||
if segment[api.NETWORK_TYPE] in ['flat', 'vlan']:
|
||||
self.vif_details['physical_network'] = segment[
|
||||
'physical_network']
|
||||
context.set_binding(segment[api.ID],
|
||||
vif_type,
|
||||
self.vif_details)
|
||||
|
@ -116,3 +116,24 @@ class MlnxMechanismProfileTestCase(MlnxMechanismBaseTestCase):
|
||||
self.driver.try_to_bind_segment_for_agent(context, segment, agent)
|
||||
self.assertEqual('{"physical_network": "fake_physical_network"}',
|
||||
context._binding.profile)
|
||||
|
||||
|
||||
class MlnxMechanismVifDetailsTestCase(MlnxMechanismBaseTestCase):
|
||||
def setUp(self):
|
||||
super(MlnxMechanismVifDetailsTestCase, self).setUp()
|
||||
|
||||
def test_vif_details_contains_physical_net(self):
|
||||
VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
|
||||
api.NETWORK_TYPE: 'vlan',
|
||||
api.PHYSICAL_NETWORK: 'fake_physical_network',
|
||||
api.SEGMENTATION_ID: 1234}]
|
||||
|
||||
context = base.FakePortContext(self.AGENT_TYPE,
|
||||
self.AGENTS,
|
||||
VLAN_SEGMENTS,
|
||||
portbindings.VNIC_DIRECT)
|
||||
segment = VLAN_SEGMENTS[0]
|
||||
agent = self.AGENTS[0]
|
||||
self.driver.try_to_bind_segment_for_agent(context, segment, agent)
|
||||
set({"physical_network": "fake_physical_network"}).issubset(
|
||||
set(context._bound_vif_details.items()))
|
||||
|
Loading…
Reference in New Issue
Block a user