コード例 #1
0
    def test_instantiate_error(self, ssh):
        mock_ssh(ssh, exec_result=(1, "", ""))

        mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
        mock_traffic_profile.get_traffic_definition.return_value = "64"
        mock_traffic_profile.params = self.TRAFFIC_PROFILE

        trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
        trex_traffic_gen.resource_helper = mock.MagicMock()
        scenario_cfg = {
            "tc": "tc_baremetal_rfc2544_ipv4_1flow_64B",
            "nodes": [
                "tg_1",
                "vnf_1",
            ],
            "topology": 'nsb_test_case.yaml',
            'options': {
                'packetsize': 64,
                'traffic_type': 4,
                'rfc2544': {
                    'allowed_drop_rate': '0.8 - 1',
                },
                'vnf__1': {
                    'rules': 'acl_1rule.yaml',
                    'vnf_config': {
                        'lb_config': 'SW',
                        'lb_count': 1,
                        'worker_config': '1C/1T',
                        'worker_threads': 1,
                    },
                },
            },
        }
        trex_traffic_gen.instantiate(scenario_cfg, {})
コード例 #2
0
    def test_instantiate(self, ssh):
        mock_ssh(ssh)

        mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
        mock_traffic_profile.get_traffic_definition.return_value = "64"
        mock_traffic_profile.params = self.TRAFFIC_PROFILE

        trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
        trex_traffic_gen._start_server = mock.Mock(return_value=0)
        trex_traffic_gen.resource_helper = mock.MagicMock()
        trex_traffic_gen.setup_helper.setup_vnf_environment = mock.MagicMock()

        scenario_cfg = {
            "tc": "tc_baremetal_rfc2544_ipv4_1flow_64B",
            "topology": 'nsb_test_case.yaml',
            'options': {
                'packetsize': 64,
                'traffic_type': 4,
                'rfc2544': {
                    'allowed_drop_rate': '0.8 - 1',
                },
                'vnf__1': {
                    'rules': 'acl_1rule.yaml',
                    'vnf_config': {
                        'lb_config': 'SW',
                        'lb_count': 1,
                        'worker_config': '1C/1T',
                        'worker_threads': 1
                    },
                },
            },
        }
        tg_rfc2544_trex.WAIT_TIME = 3
        scenario_cfg.update({"nodes": ["tg_1", "vnf_1"]})
        self.assertIsNone(trex_traffic_gen.instantiate(scenario_cfg, {}))
コード例 #3
0
 def test_instantiate(self):
     mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
     mock_traffic_profile.get_traffic_definition.return_value = "64"
     mock_traffic_profile.params = self.TRAFFIC_PROFILE
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "", ""))
         ssh_mock.run = \
             mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         trex_traffic_gen = TrexTrafficGenRFC(vnfd)
         trex_traffic_gen._start_server = mock.Mock(return_value=0)
         scenario_cfg = {"tc": "tc_baremetal_rfc2544_ipv4_1flow_64B"}
         tg_rfc2544_trex.WAIT_TIME = 3
         self.assertEqual(0, trex_traffic_gen.instantiate(scenario_cfg, {}))