From 99915fa76bd4ce13e0d36059616ba357f4f54ee2 Mon Sep 17 00:00:00 2001 From: Hynek Mlnarik Date: Thu, 24 Mar 2016 16:22:17 +0100 Subject: [PATCH] Fix setting peer to bridge interfaces OVSDB implementation refuses to set options:peer column value as there is no such column in the Interface table. The correct way is to set 'options' column value to a map containing key 'peer', as already used in ovs_lib. Change-Id: Ib5e956f425b36f54cda017c91ac71d9d7ee9747c Closes-Bug: 1528894 --- .../openvswitch/agent/ovs_neutron_agent.py | 4 ++-- .../openvswitch/agent/test_ovs_neutron_agent.py | 16 ++++++++-------- .../drivers/openvswitch/agent/test_ovs_tunnel.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index a08d3d3ed1e..7effec238b4 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -1148,9 +1148,9 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, else: # associate patch ports to pass traffic self.int_br.set_db_attribute('Interface', int_if_name, - 'options:peer', phys_if_name) + 'options', {'peer': phys_if_name}) br.set_db_attribute('Interface', phys_if_name, - 'options:peer', int_if_name) + 'options', {'peer': int_if_name}) def update_stale_ofport_rules(self): # right now the ARP spoofing rules are the only thing that utilizes diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index a94dd5a8f00..d2e1a97b40c 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -1091,11 +1091,11 @@ class TestOvsNeutronAgent(object): mock.call.int_br.drop_port(in_port='int_ofport'), mock.call.phys_br.drop_port(in_port='phy_ofport'), mock.call.int_br.set_db_attribute('Interface', 'int-br-eth', - 'options:peer', - 'phy-br-eth'), + 'options', + {'peer': 'phy-br-eth'}), mock.call.phys_br.set_db_attribute('Interface', 'phy-br-eth', - 'options:peer', - 'int-br-eth'), + 'options', + {'peer': 'int-br-eth'}), ] parent.assert_has_calls(expected_calls) self.assertEqual("int_ofport", @@ -1169,11 +1169,11 @@ class TestOvsNeutronAgent(object): mock.call.int_br.drop_port(in_port='int_ofport'), mock.call.phys_br.drop_port(in_port='phy_ofport'), mock.call.int_br.set_db_attribute('Interface', 'int-br-eth', - 'options:peer', - 'phy-br-eth'), + 'options', + {'peer': 'phy-br-eth'}), mock.call.phys_br.set_db_attribute('Interface', 'phy-br-eth', - 'options:peer', - 'int-br-eth'), + 'options', + {'peer': 'int-br-eth'}), ] parent.assert_has_calls(expected_calls) self.assertEqual("int_ofport", diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py index c50f6778fb6..278ce1c9f0f 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py @@ -203,13 +203,13 @@ class TunnelTest(object): mock.call.drop_port(in_port=self.MAP_TUN_INT_OFPORT), mock.call.set_db_attribute( 'Interface', 'int-%s' % self.MAP_TUN_BRIDGE, - 'options:peer', 'phy-%s' % self.MAP_TUN_BRIDGE), + 'options', {'peer': 'phy-%s' % self.MAP_TUN_BRIDGE}), ] self.mock_map_tun_bridge_expected += [ mock.call.drop_port(in_port=self.MAP_TUN_PHY_OFPORT), mock.call.set_db_attribute( 'Interface', 'phy-%s' % self.MAP_TUN_BRIDGE, - 'options:peer', 'int-%s' % self.MAP_TUN_BRIDGE), + 'options', {'peer': 'int-%s' % self.MAP_TUN_BRIDGE}), ] self.mock_tun_bridge_expected = [