diff --git a/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py b/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py index 7954b7d374..d73ae80215 100644 --- a/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py +++ b/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py @@ -100,6 +100,7 @@ class BigSwitchMechanismDriver(NeutronRestProxyV2Base, net = context.network.current port['network'] = net port['binding_host'] = context._binding.host + port['bound_segment'] = context.bound_segment actx = ctx.get_admin_context() if (portbindings.HOST_ID in port and 'id' in port): host_id = port[portbindings.HOST_ID] diff --git a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py index dc2e00a28b..d8cd797f87 100644 --- a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py +++ b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py @@ -109,3 +109,14 @@ class TestBigSwitchMechDriverPortsV2(test_db_plugin.TestPortsV2, ) ]) self.spawn_p.start() + + def test_backend_request_contents(self): + with nested( + mock.patch(SERVER_POOL + '.rest_create_port'), + self.port(**{'device_id': 'devid', 'binding:host_id': 'host'}) + ) as (mock_rest, p): + # make sure basic expected keys are present in the port body + pb = mock_rest.mock_calls[0][1][2] + self.assertEqual('host', pb['binding_host']) + self.assertIn('bound_segment', pb) + self.assertIn('network', pb)