Merge "Disable spoof check on vfs in sriov setup"
[yardstick.git] / tests / unit / network_services / helpers / test_samplevnf_helper.py
index 3d3f6dc..05acdfa 100644 (file)
@@ -37,7 +37,7 @@ class TestPortPairs(unittest.TestCase):
         vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         interfaces = vnfd['vdu'][0]['external-interface']
         port_pairs = PortPairs(interfaces)
-        self.assertEqual(port_pairs.valid_networks, [("private_0", "public_0")])
+        self.assertEqual(port_pairs.valid_networks, [("uplink_0", "downlink_0")])
 
     def test_all_ports(self):
         vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -45,17 +45,17 @@ class TestPortPairs(unittest.TestCase):
         port_pairs = PortPairs(interfaces)
         self.assertEqual(set(port_pairs.all_ports), {"xe0", "xe1"})
 
-    def test_priv_ports(self):
+    def test_uplink_ports(self):
         vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         interfaces = vnfd['vdu'][0]['external-interface']
         port_pairs = PortPairs(interfaces)
-        self.assertEqual(port_pairs.priv_ports, ["xe0"])
+        self.assertEqual(port_pairs.uplink_ports, ["xe0"])
 
-    def test_pub_ports(self):
+    def test_downlink_ports(self):
         vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         interfaces = vnfd['vdu'][0]['external-interface']
         port_pairs = PortPairs(interfaces)
-        self.assertEqual(port_pairs.pub_ports, ["xe1"])
+        self.assertEqual(port_pairs.downlink_ports, ["xe1"])
 
 
 class TestMultiPortConfig(unittest.TestCase):
@@ -99,7 +99,7 @@ class TestMultiPortConfig(unittest.TestCase):
                                     'ifname': 'xe0',
                                     'local_iface_name': 'eth0',
                                     'local_mac': '00:00:00:00:00:02',
-                                    'vld_id': 'private_0',
+                                    'vld_id': 'uplink_0',
                                 },
                                 'vnfd-connection-point-ref': 'xe0',
                                 'name': 'xe0'},
@@ -117,7 +117,7 @@ class TestMultiPortConfig(unittest.TestCase):
                                     'ifname': 'xe1',
                                     'local_iface_name': 'eth1',
                                     'local_mac': '00:00:00:00:00:01',
-                                    'vld_id': 'public_0',
+                                    'vld_id': 'downlink_0',
                                 },
                                 'vnfd-connection-point-ref': 'xe1',
                                 'name': 'xe1'}
@@ -211,6 +211,7 @@ class TestMultiPortConfig(unittest.TestCase):
         opnfv_vnf.generate_script_data = \
             mock.Mock(return_value={'link_config': 0, 'arp_config': '',
                                     'arp_config6': '', 'actions': '',
+                                    'arp_route_tbl': '', 'arp_route_tbl6': '',
                                     'rules': ''})
         opnfv_vnf.port_pair_list = [("xe0", "xe1")]
         self.assertIsNotNone(opnfv_vnf.generate_script(self.VNFD))
@@ -796,7 +797,7 @@ class TestMultiPortConfig(unittest.TestCase):
     def test_generate_arp_route_tbl(self, *_):
         topology_file = mock.Mock()
         config_tpl = mock.Mock()
-        tmp_file = mock.Mock()
+        tmp_file = ""
         vnfd_mock = mock.MagicMock()
         vnfd_mock.port_num.side_effect = ['32', '1', '987']
         vnfd_mock.find_interface.side_effect = [
@@ -823,8 +824,9 @@ class TestMultiPortConfig(unittest.TestCase):
         opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file, vnfd_mock)
         opnfv_vnf.all_ports = [3, 2, 5]
 
-        expected = '(0a141000,fffff000,32,0a141e28) (0ac81e00,ffffff00,1,0ac81e28) ' \
-                   '(0a000000,ff000000,987,0a140328)'
+        expected = 'routeadd net 32 10.20.30.40 0xfffff000\n' \
+                   'routeadd net 1 10.200.30.40 0xffffff00\n' \
+                   'routeadd net 987 10.20.3.40 0xff000000'
         result = opnfv_vnf.generate_arp_route_tbl()
         self.assertEqual(result, expected)