From be8a7a2795edf9ce510b29d5b67d4ff0a4eb0f79 Mon Sep 17 00:00:00 2001 From: Miguel Lavalle Date: Tue, 17 Apr 2018 16:10:34 -0500 Subject: [PATCH] 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 --- neutron/agent/linux/ip_lib.py | 2 +- neutron/tests/unit/agent/linux/test_ip_lib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index 691b2c236a7..9c0deb720a1 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -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)) diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py index d9e0ba42465..27112500696 100644 --- a/neutron/tests/unit/agent/linux/test_ip_lib.py +++ b/neutron/tests/unit/agent/linux/test_ip_lib.py @@ -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',