Exemplo n.º 1
0
    def setUp(self):
        scenario_cfg = {
            'topology': 'fake_topology',
            'task_path': 'fake_path',
            'traffic_profile': 'fake_fprofile_path'
        }
        context_cfg = {}
        topology_yaml = {'nsd:nsd-catalog': {'nsd': [mock.Mock()]}}

        with mock.patch.object(utils, 'open_relative_file') as mock_open_path:
            mock_open_path.side_effect = mock.mock_open(
                read_data=str(topology_yaml))
            self.ns_testcase = vnf_generic.NetworkServiceTestCase(
                scenario_cfg, context_cfg)
        self.ns_testcase._get_traffic_profile = mock.Mock()
        self.ns_testcase._get_topology = mock.Mock()
Exemplo n.º 2
0
    def setUp(self):
        self.tg__1 = {
            'name': 'trafficgen_1.yardstick',
            'ip': '10.10.10.11',
            'role': 'TrafficGen',
            'user': '******',
            'password': '******',
            'interfaces': {
                'xe0': {
                    'netmask': '255.255.255.0',
                    'local_ip': '152.16.100.20',
                    'local_mac': '00:00:00:00:00:01',
                    'driver': 'i40e',
                    'vpci': '0000:07:00.0',
                    'dpdk_port_num': 0,
                },
                'xe1': {
                    'netmask': '255.255.255.0',
                    'local_ip': '152.16.40.20',
                    'local_mac': '00:00:00:00:00:02',
                    'driver': 'i40e',
                    'vpci': '0000:07:00.1',
                    'dpdk_port_num': 1,
                },
            },
        }

        self.vnf__1 = {
            'name': 'vnf.yardstick',
            'ip': '10.10.10.12',
            'host': '10.223.197.164',
            'role': 'vnf',
            'user': '******',
            'password': '******',
            'interfaces': {
                'xe0': {
                    'netmask': '255.255.255.0',
                    'local_ip': '152.16.100.19',
                    'local_mac': '00:00:00:00:00:03',
                    'driver': 'i40e',
                    'vpci': '0000:07:00.0',
                    'dpdk_port_num': 0,
                },
                'xe1': {
                    'netmask': '255.255.255.0',
                    'local_ip': '152.16.40.19',
                    'local_mac': '00:00:00:00:00:04',
                    'driver': 'i40e',
                    'vpci': '0000:07:00.1',
                    'dpdk_port_num': 1,
                },
            },
            'routing_table': [
                {
                    'netmask': '255.255.255.0',
                    'gateway': '152.16.100.20',
                    'network': '152.16.100.20',
                    'if': 'xe0',
                },
                {
                    'netmask': '255.255.255.0',
                    'gateway': '152.16.40.20',
                    'network': '152.16.40.20',
                    'if': 'xe1',
                },
            ],
            'nd_route_tbl': [
                {
                    'netmask': '112',
                    'gateway': '0064:ff9b:0:0:0:0:9810:6414',
                    'network': '0064:ff9b:0:0:0:0:9810:6414',
                    'if': 'xe0',
                },
                {
                    'netmask': '112',
                    'gateway': '0064:ff9b:0:0:0:0:9810:2814',
                    'network': '0064:ff9b:0:0:0:0:9810:2814',
                    'if': 'xe1',
                },
            ],
        }

        self.context_cfg = {
            'nodes': {
                'tg__1': self.tg__1,
                'vnf__1': self.vnf__1,
            },
            'networks': {
                GenericVNF.UPLINK: {
                    'vld_id': GenericVNF.UPLINK,
                },
                GenericVNF.DOWNLINK: {
                    'vld_id': GenericVNF.DOWNLINK,
                },
            },
        }

        self.vld0 = {
            'vnfd-connection-point-ref': [
                {
                    'vnfd-connection-point-ref': 'xe0',
                    'member-vnf-index-ref': '1',
                    'vnfd-id-ref': 'trexgen'
                },
                {
                    'vnfd-connection-point-ref': 'xe0',
                    'member-vnf-index-ref': '2',
                    'vnfd-id-ref': 'trexgen'
                }
            ],
            'type': 'ELAN',
            'id': GenericVNF.UPLINK,
            'name': 'tg__1 to vnf__1 link 1'
        }

        self.vld1 = {
            'vnfd-connection-point-ref': [
                {
                    'vnfd-connection-point-ref': 'xe1',
                    'member-vnf-index-ref': '1',
                    'vnfd-id-ref': 'trexgen'
                },
                {
                    'vnfd-connection-point-ref': 'xe1',
                    'member-vnf-index-ref': '2',
                    'vnfd-id-ref': 'trexgen'
                }
            ],
            'type': 'ELAN',
            'id': GenericVNF.DOWNLINK,
            'name': 'vnf__1 to tg__1 link 2'
        }

        self.topology = {
            'id': 'trex-tg-topology',
            'short-name': 'trex-tg-topology',
            'name': 'trex-tg-topology',
            'description': 'trex-tg-topology',
            'constituent-vnfd': [
                {
                    'member-vnf-index': '1',
                    'VNF model': 'tg_trex_tpl.yaml',
                    'vnfd-id-ref': 'tg__1',
                },
                {
                    'member-vnf-index': '2',
                    'VNF model': 'tg_trex_tpl.yaml',
                    'vnfd-id-ref': 'vnf__1',
                },
            ],
            'vld': [self.vld0, self.vld1],
        }

        self.scenario_cfg = {
            'task_path': "",
            "topology": self._get_file_abspath("vpe_vnf_topology.yaml"),
            'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
            'tc': 'tc_ipv4_1Mflow_64B_packetsize',
            'traffic_profile': 'ipv4_throughput_vpe.yaml',
            'extra_args': {'arg1': 'value1', 'arg2': 'value2'},
            'type': 'ISB',
            'tc_options': {
                'rfc2544': {
                    'allowed_drop_rate': '0.8 - 1',
                },
            },
            'options': {
                'framesize': {'64B': 100}
            },
            'runner': {
                'object': 'NetworkServiceTestCase',
                'interval': 35,
                'output_filename': 'yardstick.out',
                'runner_id': 74476,
                'duration': 400,
                'type': 'Duration',
            },
            'traffic_options': {
                'flow': 'ipv4_1flow_Packets_vpe.yaml',
                'imix': 'imix_voice.yaml'
            },
            'nodes': {
                'tg__2': 'trafficgen_2.yardstick',
                'tg__1': 'trafficgen_1.yardstick',
                'vnf__1': 'vnf.yardstick',
            },
        }

        self.s = vnf_generic.NetworkServiceTestCase(self.scenario_cfg,
                                                    self.context_cfg)