Fix handling of dstport option for VXLANs

When specifying a value for the 'dstport' option in the [vxlan] section
of the Linux bridge agent, the agent crashes upon start. This is
because the value specified in 'dstport' is incorrectly converted to
a string before being passed to pyroute2 when creating a VXLAN tunnel.
pyroute2 expects an integer value. This patch fixes this bug.

Change-Id: I83131f3bb32253cbc4acec3a1f38bf225223ff8b
Closes-Bug: #1764867
This commit is contained in:
Miguel Lavalle 2018-04-17 16:10:34 -05:00
parent d015e84a6d
commit be8a7a2795
2 changed files with 2 additions and 2 deletions

View File

@ -259,7 +259,7 @@ class IPWrapper(SubProcessBase):
else:
raise n_exc.NetworkVxlanPortRangeError(vxlan_range=srcport)
if dstport:
kwargs['vxlan_port'] = str(dstport)
kwargs['vxlan_port'] = dstport
privileged.create_interface(name, self.namespace, "vxlan", **kwargs)
return (IPDevice(name, namespace=self.namespace))

View File

@ -512,7 +512,7 @@ class TestIpWrapper(base.BaseTestCase):
'vxlan_local': 'local0',
'vxlan_proxy': True,
'vxlan_port_range': ('1', '2'),
'vxlan_port': '4789'}
'vxlan_port': 4789}
retval = ip_lib.IPWrapper().add_vxlan('vxlan0', 'vni0',
group='group0',