]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
BigSwitch ML2: Include bound_segment in port
authorKevin Benton <blak111@gmail.com>
Tue, 18 Mar 2014 20:11:27 +0000 (13:11 -0700)
committerKevin Benton <blak111@gmail.com>
Wed, 19 Mar 2014 08:25:34 +0000 (01:25 -0700)
Includes bound segment in port create/update
requests to disambiguate when the parent network
has multiple segments.

Closes-Bug: #1294355
Change-Id: I59ef38aa5de46c1229384e0c4a9f0ee01c1bc678

neutron/plugins/ml2/drivers/mech_bigswitch/driver.py
neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py

index ced7b37ff1aee4de3304ef4ece4d766e74d2a595..9bede39335b70630fdcfd288dc3fe8e8a44f5688 100644 (file)
@@ -98,6 +98,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]
index c1d3c527797b2f00f1f56e974bd6e1fb9c7a9974..4defb2d2f2123b614f99ecd6339eefd401efab26 100644 (file)
@@ -123,3 +123,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)