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_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): 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): 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, '')