Browse Source

Merge "Provide hook for networking-sfc OVS agent code"

changes/82/449182/1
Jenkins 5 years ago
committed by Gerrit Code Review
parent
commit
42d2fc2d8c
  1. 8
      neutron/agent/common/ovs_lib.py
  2. 8
      neutron/tests/unit/agent/common/test_ovs_lib.py

8
neutron/agent/common/ovs_lib.py

@ -322,6 +322,14 @@ class OVSBridge(BaseOVS):
port_name)
return ofport
def get_port_mac(self, port_name):
"""Get the port's mac address.
This is especially useful when the port is not a neutron port.
E.g. networking-sfc needs the MAC address of "patch-tun
"""
return self.db_get_val("Interface", port_name, "mac_in_use")
def get_datapath_id(self):
return self.db_get_val('Bridge',
self.br_name, 'datapath_id')

8
neutron/tests/unit/agent/common/test_ovs_lib.py

@ -271,6 +271,14 @@ class OVS_Lib_Test(base.BaseTestCase):
self._test_get_port_ofport(ovs_lib.INVALID_OFPORT,
ovs_lib.INVALID_OFPORT)
def test_get_port_mac(self):
pname = "tap99"
self.br.vsctl_timeout = 0 # Don't waste precious time retrying
self.execute.return_value = self._encode_ovs_json(
['mac_in_use'], [['00:01:02:03:04:05']])
expected_result = '00:01:02:03:04:05'
self.assertEqual(self.br.get_port_mac(pname), expected_result)
def test_default_datapath(self):
# verify kernel datapath is default
expected = p_const.OVS_DATAPATH_SYSTEM

Loading…
Cancel
Save