Only send string values to OVSDB other_config column

The other_config columns in OVSDB are defined as maps with string
keys and string values. The OVS agent was passing an integer
segmentation id and could pass None as the physical_network.
Unfortunately, the upstream Python OVS library does not pass the
exceptions through to us.

Change-Id: Iafa6be3749b1ee863f5fa71150c708fc46951510
Closes-Bug: #1630920
This commit is contained in:
Terry Wilson 2016-10-06 21:52:56 -05:00
parent 80d4df144d
commit 3d500d3660
3 changed files with 6 additions and 6 deletions

View File

@ -809,9 +809,9 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
vlan_mapping = {'net_uuid': net_uuid,
'network_type': network_type,
'physical_network': physical_network}
'physical_network': str(physical_network)}
if segmentation_id is not None:
vlan_mapping['segmentation_id'] = segmentation_id
vlan_mapping['segmentation_id'] = str(segmentation_id)
port_other_config.update(vlan_mapping)
self.int_br.set_db_attribute("Port", port.port_name, "other_config",
port_other_config)
@ -833,7 +833,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
cur_info = info_by_port.get(port.port_name)
if cur_info is not None and cur_info[0] != lvm.vlan:
other_config = cur_info[1] or {}
other_config['tag'] = lvm.vlan
other_config['tag'] = str(lvm.vlan)
self.int_br.set_db_attribute(
"Port", port.port_name, "other_config", other_config)

View File

@ -165,7 +165,7 @@ class TestOvsNeutronAgent(object):
else:
vlan_mapping = {'net_uuid': net_uuid,
'network_type': 'local',
'physical_network': None}
'physical_network': 'None'}
int_br.set_db_attribute.assert_called_once_with(
"Port", mock.ANY, "other_config", vlan_mapping)
self.assertTrue(needs_binding)

View File

@ -470,8 +470,8 @@ class TunnelTest(object):
self._verify_mock_calls()
def test_port_bound(self):
vlan_mapping = {'segmentation_id': LS_ID,
'physical_network': None,
vlan_mapping = {'segmentation_id': str(LS_ID),
'physical_network': 'None',
'net_uuid': NET_UUID,
'network_type': 'gre'}
self.mock_int_bridge_expected += [