def test_vpe_rxq(self): vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 2) config = configparser.ConfigParser() config_create.downlink_ports = ['xe0'] config_create.vpe_rxq(config) self.assertEqual(config.get('RXQ0.0', 'mempool'), 'MEMPOOL1')
def test_create_vpe_config(self): uplink_ports = [ { 'index': 0, 'dpdk_port_num': 1, 'peer_intf': { 'dpdk_port_num': 2, 'index': 3, }, }, ] downlink_ports = [ { 'index': 2, 'dpdk_port_num': 3, 'peer_intf': { 'dpdk_port_num': 0, 'index': 1, }, }, ] vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 23) config_create.downlink_ports = ['xe1'] config_create.uplink_ports = ['xe1'] curr_path = os.path.dirname(os.path.abspath(__file__)) vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config" vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg) config_create.create_vpe_config(vnf_cfg) os.system("git checkout -- %s" % vnf_cfg)
def test_get_sink_swq(self): vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 2) config = configparser.ConfigParser() config.add_section('PIPELINE0') config.set('PIPELINE0', 'key1', 'value1') config.set('PIPELINE0', 'key2', 'value2 SINK') config.set('PIPELINE0', 'key3', 'TM value3') config.set('PIPELINE0', 'key4', 'value4') config.set('PIPELINE0', 'key5', 'the SINK value5') self.assertEqual( config_create.get_sink_swq(config, 'PIPELINE0', 'key1', 5), 'SWQ-1') self.assertEqual( config_create.get_sink_swq(config, 'PIPELINE0', 'key2', 5), 'SWQ-1 SINK0') self.assertEqual( config_create.get_sink_swq(config, 'PIPELINE0', 'key3', 5), 'SWQ-1 TM5') config_create.sw_q += 1 self.assertEqual( config_create.get_sink_swq(config, 'PIPELINE0', 'key4', 5), 'SWQ0') self.assertEqual( config_create.get_sink_swq(config, 'PIPELINE0', 'key5', 5), 'SWQ0 SINK1')
def test_create_vpe_config(self): priv_ports = [ { 'index': 0, 'dpdk_port_num': 1, 'peer_intf': { 'dpdk_port_num': 2, 'index': 3, }, }, ] pub_ports = [ { 'index': 2, 'dpdk_port_num': 3, 'peer_intf': { 'dpdk_port_num': 0, 'index': 1, }, }, ] config_create = ConfigCreate(priv_ports, pub_ports, 23) curr_path = os.path.dirname(os.path.abspath(__file__)) vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config" vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg) config_create.create_vpe_config(vnf_cfg) os.system("git checkout -- %s" % vnf_cfg)
def test_dpdk_port_to_link_id(self): vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 2) self.assertEqual(config_create.dpdk_port_to_link_id_map, { 'xe0': 0, 'xe1': 1 })
def test_vpe_initialize(self): config_create = ConfigCreate([0], [1], 2) config = configparser.ConfigParser() config_create.vpe_initialize(config) self.assertEqual(config.get('EAL', 'log_level'), '0') self.assertEqual(config.get('PIPELINE0', 'type'), 'MASTER') self.assertEqual(config.get('PIPELINE0', 'core'), 's2C0') self.assertEqual(config.get('MEMPOOL0', 'pool_size'), '256K') self.assertEqual(config.get('MEMPOOL1', 'pool_size'), '2M')
def test_create_vpe_config(self): vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 23) config_create.downlink_ports = ['xe1'] config_create.uplink_ports = ['xe1'] curr_path = os.path.dirname(os.path.abspath(__file__)) vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config" vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg) config_create.create_vpe_config(vnf_cfg) os.system("git checkout -- %s" % vnf_cfg)
def test_generate_vpe_script(self): vpe_config_vnf = ConfigCreate([0], [0], 0) intf = [ { "virtual-interface": { "dst_ip": "1.1.1.1", "dst_mac": "00:00:00:00:00:00:02", }, }, ] result = vpe_config_vnf.generate_vpe_script(intf) self.assertIsInstance(result, str) self.assertNotEqual(result, '')
def test_generate_vpe_script(self): vnfd_helper = VnfdHelper(self.VNFD_0) vpe_config_vnf = ConfigCreate(vnfd_helper, 2) intf = [ { "name": 'xe1', "virtual-interface": { "dst_ip": "1.1.1.1", "dst_mac": "00:00:00:00:00:00:02", }, }, { "name": 'xe2', "virtual-interface": { "dst_ip": "1.1.1.1", "dst_mac": "00:00:00:00:00:00:02", }, }, ] vpe_config_vnf.downlink_ports = ['xe1'] vpe_config_vnf.uplink_ports = ['xe2'] result = vpe_config_vnf.generate_vpe_script(intf) self.assertIsInstance(result, str) self.assertNotEqual(result, '')
def test___init__(self): vnfd_helper = VnfdHelper(self.VNFD_0) config_create = ConfigCreate(vnfd_helper, 2) self.assertEqual(config_create.uplink_ports, ['xe0']) self.assertEqual(config_create.downlink_ports, ['xe1']) self.assertEqual(config_create.socket, 2)
def test_vpe_rxq(self): config_create = ConfigCreate([0], [1, 2], 3) config = configparser.ConfigParser() config_create.vpe_rxq(config) self.assertEqual(config.get('RXQ1.0', 'mempool'), 'MEMPOOL1') self.assertEqual(config.get('RXQ2.0', 'mempool'), 'MEMPOOL1')
def test___init__(self): config_create = ConfigCreate([0], [1], 2) self.assertEqual(config_create.priv_ports, [0]) self.assertEqual(config_create.pub_ports, [1]) self.assertEqual(config_create.socket, 2)
def test___init__(self): config_create = ConfigCreate([0], [1], 2) self.assertEqual(config_create.uplink_ports, [0]) self.assertEqual(config_create.downlink_ports, [1]) self.assertEqual(config_create.socket, 2)