def test_append_nd_routes(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) nd_route = generic_vn_f._append_nd_routes(IP_PIPELINE_ND_CFG_FILE_TPL) expected = '\nnd_route_tbl = (0064:ff9b:0:0:0:0:9810:6414,112,0,' \ '0064:ff9b:0:0:0:0:9810:6414) '\ '(0064:ff9b:0:0:0:0:9810:2814,112,'\ '1,0064:ff9b:0:0:0:0:9810:2814)\n,' self.assertEqual(expected, nd_route)
def test__get_kpi_definition(self): vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] generic_vnf = GenericVNF('vnf1', vnfd) kpi = generic_vnf._get_kpi_definition() self.assertEqual(kpi, ['packets_in', 'packets_fwd', 'packets_dropped'])
def test_collect_kpi(self): generic_vnf = GenericVNF('vnf1', self.VNFD_0) self.assertRaises(NotImplementedError, generic_vnf.collect_kpi)
def test___init__(self): generic_vnf = GenericVNF('vnf1', self.VNFD_0) assert generic_vnf.kpi
def test_terminate(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) self.assertRaises(NotImplementedError, generic_vn_f.terminate)
def test_instantiate(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) self.assertRaises(NotImplementedError, generic_vn_f.instantiate, {}, {})
def test_get_dpdk_port_num(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) port_num = generic_vn_f._get_dpdk_port_num('xe0') self.assertEqual('0', port_num)
def test_collect_kpi(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) self.assertRaises(NotImplementedError, generic_vn_f.collect_kpi)
def test_get_port1prefixip6(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) port1_v6 = generic_vn_f._get_port1prefixlen6() self.assertEqual('112', port1_v6)
def test_get_port1localip6(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) port1_v6 = generic_vn_f._get_port1localip6() expected = '0064:ff9b:0:0:0:0:9810:2814' self.assertEqual(expected, port1_v6)
def test_append_routes(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) arp_route = generic_vn_f._append_routes(IP_PIPELINE_CFG_FILE_TPL) expected = '\narp_route_tbl = (98106414,FFFFFF00,0,98106414)' \ ' (98102814,FFFFFF00,1,98102814)\n,' self.assertEqual(expected, arp_route)
def test_ip_to_hex(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) hex_ip = generic_vn_f._ip_to_hex("192.168.10.1") self.assertEqual("C0A80A01", hex_ip)
def test_get_ip_version_error(self, mock_LOG): ip_addr = "152.16.1.1.1" generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) self.assertRaises(ValueError, generic_vn_f.get_ip_version(ip_addr))
def test_get_ip_version(self): ip_addr = "152.16.1.1" generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) self.assertEqual(4, generic_vn_f.get_ip_version(ip_addr))
def test_instantiate(self): generic_vnf = GenericVNF('vnf1', self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) with self.assertRaises(NotImplementedError): generic_vnf.instantiate({}, {})
def test_get_port1gateway6(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) port1_v6 = generic_vn_f._get_port1gateway6() self.assertEqual('0064:ff9b:0:0:0:0:9810:2814', port1_v6)
def test_terminate(self): generic_vnf = GenericVNF('vnf1', self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) with self.assertRaises(NotImplementedError): generic_vnf.terminate()
def test___init__(self): generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]) assert generic_vn_f.kpi