Merge "Provide hook for networking-sfc OVS agent code"
This commit is contained in:
commit
42d2fc2d8c
@ -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')
|
||||
|
@ -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…
Reference in New Issue
Block a user