Add unit test for add_vxlan in test_linux_ip_lib
This patch adds unit tests for the add_vxlan function in the test_linux_ip_lib.py file. Fixes bug: 1291974 Change-Id: I0238bedab7a3566aff1115a091ada494a01d2e02
This commit is contained in:
parent
1ed0b46373
commit
719452d9d5
@ -371,6 +371,32 @@ class TestIpWrapper(base.BaseTestCase):
|
|||||||
self.assertNotIn(mock.call().delete('ns'),
|
self.assertNotIn(mock.call().delete('ns'),
|
||||||
ip_ns_cmd_cls.mock_calls)
|
ip_ns_cmd_cls.mock_calls)
|
||||||
|
|
||||||
|
def test_add_vxlan_valid_port_length(self):
|
||||||
|
retval = ip_lib.IPWrapper('sudo').add_vxlan('vxlan0', 'vni0',
|
||||||
|
group='group0',
|
||||||
|
dev='dev0', ttl='ttl0',
|
||||||
|
tos='tos0',
|
||||||
|
local='local0', proxy=True,
|
||||||
|
port=('1', '2'))
|
||||||
|
self.assertIsInstance(retval, ip_lib.IPDevice)
|
||||||
|
self.assertEqual(retval.name, 'vxlan0')
|
||||||
|
self.execute.assert_called_once_with('', 'link',
|
||||||
|
['add', 'vxlan0', 'type',
|
||||||
|
'vxlan', 'id', 'vni0', 'group',
|
||||||
|
'group0', 'dev', 'dev0',
|
||||||
|
'ttl', 'ttl0', 'tos', 'tos0',
|
||||||
|
'local', 'local0', 'proxy',
|
||||||
|
'port', '1', '2'],
|
||||||
|
'sudo', None)
|
||||||
|
|
||||||
|
def test_add_vxlan_invalid_port_length(self):
|
||||||
|
wrapper = ip_lib.IPWrapper('sudo')
|
||||||
|
self.assertRaises(exceptions.NetworkVxlanPortRangeError,
|
||||||
|
wrapper.add_vxlan, 'vxlan0', 'vni0', group='group0',
|
||||||
|
dev='dev0', ttl='ttl0', tos='tos0',
|
||||||
|
local='local0', proxy=True,
|
||||||
|
port=('1', '2', '3'))
|
||||||
|
|
||||||
def test_add_device_to_namespace(self):
|
def test_add_device_to_namespace(self):
|
||||||
dev = mock.Mock()
|
dev = mock.Mock()
|
||||||
ip_lib.IPWrapper('sudo', 'ns').add_device_to_namespace(dev)
|
ip_lib.IPWrapper('sudo', 'ns').add_device_to_namespace(dev)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user