diff options
author | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2019-02-22 16:52:54 +0200 |
---|---|---|
committer | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2019-02-22 16:52:54 +0200 |
commit | 9159f8e208a8c94ac9db0e20da41e1f1a5b6ffba (patch) | |
tree | 04c091db02d4050d36613bcd9812634ee7e94378 | |
parent | d1f84fa084f1c7d9bede5c31596f4bbe8636fd1b (diff) |
Add new scenario NSPerf-RFC3511
New scenarion executes complete run per runner's
iteration and designed to work with IxLoad TG.
JIRA: YARDSTICK-1592
Change-Id: I43f37ae4ab211a29d75a9c9edd93141767a4c57d
Signed-off-by: Chornyi Taras <tarasx.chornyi@intel.com>
4 files changed, 112 insertions, 6 deletions
diff --git a/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_concurrent_connections_ixload.yaml b/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_concurrent_connections_ixload.yaml index 51270d2f0..78fcd98ce 100644 --- a/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_concurrent_connections_ixload.yaml +++ b/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_concurrent_connections_ixload.yaml @@ -16,7 +16,7 @@ schema: yardstick:task:0.1 {% set page = page or "/1b.html" %} scenarios: -- type: NSPerf +- type: NSPerf-RFC3511 traffic_profile: "../../traffic_profiles/ixload/http_ixload.yaml" topology: agnostic_vnf_topology_ixload_2ports.yaml nodes: @@ -27,8 +27,8 @@ scenarios: uplink: [{{page}}] vnf__0: [] runner: - type: Duration - duration: 2 + type: Iteration + iterations: 1 ixia_profile: ../../traffic_profiles/ixload/HTTP-ConcurrentConnections_2Ports.rxf context: type: Node diff --git a/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_connections_ixload.yaml b/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_connections_ixload.yaml index a989bdbef..a20032c06 100644 --- a/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_connections_ixload.yaml +++ b/samples/vnf_samples/nsut/agnostic/tc_baremetal_http_connections_ixload.yaml @@ -16,7 +16,7 @@ schema: yardstick:task:0.1 {% set page = page or "/1b.html" %} scenarios: -- type: NSPerf +- type: NSPerf-RFC3511 traffic_profile: "../../traffic_profiles/ixload/http_ixload.yaml" topology: agnostic_vnf_topology_ixload_2ports.yaml nodes: @@ -27,8 +27,8 @@ scenarios: uplink: [{{page}}] vnf__0: [] runner: - type: Duration - duration: 2 + type: Iteration + iterations: 1 ixia_profile: ../../traffic_profiles/ixload/HTTP-Connections_2Ports.rxf context: type: Node diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index c88ea51c3..c5e75d093 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -627,3 +627,58 @@ class NetworkServiceRFC2544(NetworkServiceBase): output.push(self.collector.get_kpi()) self.collector.stop() + +class NetworkServiceRFC3511(NetworkServiceBase): + """Class handles RFC3511 Network service testing""" + + __scenario_type__ = "NSPerf-RFC3511" + + def __init__(self, scenario_cfg, context_cfg): # pragma: no cover + super(NetworkServiceRFC3511, self).__init__(scenario_cfg, context_cfg) + + def setup(self): + """Setup infrastructure, provision VNFs""" + self.map_topology_to_infrastructure() + self.load_vnf_models() + + traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic] + non_traffic_runners = [vnf for vnf in self.vnfs if not vnf.runs_traffic] + try: + for vnf in chain(traffic_runners, non_traffic_runners): + LOG.info("Instantiating %s", vnf.name) + vnf.instantiate(self.scenario_cfg, self.context_cfg) + LOG.info("Waiting for %s to instantiate", vnf.name) + vnf.wait_for_instantiate() + except: + LOG.exception("") + for vnf in self.vnfs: + vnf.terminate() + raise + + self._generate_pod_yaml() + + def run(self, output): + """ Run experiment + + :param output: scenario output to push results + :return: None + """ + + self._fill_traffic_profile() + + traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic] + + for traffic_gen in traffic_runners: + traffic_gen.listen_traffic(self.traffic_profile) + + self.collector = Collector(self.vnfs, + context_base.Context.get_physical_nodes()) + self.collector.start() + + for traffic_gen in traffic_runners: + LOG.info("Run traffic on %s", traffic_gen.name) + traffic_gen.run_traffic(self.traffic_profile) + + output.push(self.collector.get_kpi()) + + self.collector.stop() diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index ecc9e1249..cf9a26a76 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -820,3 +820,54 @@ class TestNetworkServiceRFC2544TestCase(TestNetworkServiceTestCase): mock.Mock(return_value=TRAFFIC_PROFILE) with self.assertRaises(RuntimeError): self.s.setup() + +class TestNetworkServiceRFC3511TestCase(TestNetworkServiceTestCase): + + def setUp(self): + super(TestNetworkServiceRFC3511TestCase, self).setUp() + self.s = vnf_generic.NetworkServiceRFC3511(self.scenario_cfg, + self.context_cfg) + + def test_run(self): + tgen = mock.Mock(autospec=GenericTrafficGen) + tgen.traffic_finished = True + verified_dict = {"verified": True} + tgen.verify_traffic = lambda x: verified_dict + tgen.name = "tgen__1" + vnf = mock.Mock(autospec=GenericVNF) + vnf.runs_traffic = False + self.s.vnfs = [tgen, vnf] + self.s.traffic_profile = mock.Mock() + self.s._fill_traffic_profile = mock.Mock() + self.s.collector = mock.Mock(autospec=Collector) + self.s.collector.get_kpi = mock.Mock() + result = mock.Mock() + self.s.run(result) + self.s._fill_traffic_profile.assert_called_once() + result.push.assert_called_once() + + def test_setup(self): + with mock.patch("yardstick.ssh.SSH") as ssh: + ssh_mock = mock.Mock(autospec=ssh.SSH) + ssh_mock.execute = \ + mock.Mock(return_value=(0, SYS_CLASS_NET + IP_ADDR_SHOW, "")) + ssh.from_node.return_value = ssh_mock + + tgen = mock.Mock(autospec=GenericTrafficGen) + tgen.traffic_finished = True + verified_dict = {"verified": True} + tgen.verify_traffic = lambda x: verified_dict + tgen.terminate = mock.Mock(return_value=True) + tgen.name = "tgen__1" + tgen.run_traffic.return_value = 'tg_id' + vnf = mock.Mock(autospec=GenericVNF) + vnf.runs_traffic = False + vnf.terminate = mock.Mock(return_value=True) + self.s.vnfs = [tgen, vnf] + self.s.traffic_profile = mock.Mock() + self.s.collector = mock.Mock(autospec=Collector) + self.s.collector.get_kpi = \ + mock.Mock(return_value={tgen.name: verified_dict}) + self.s.map_topology_to_infrastructure = mock.Mock(return_value=0) + self.s.load_vnf_models = mock.Mock(return_value=self.s.vnfs) + self.s.setup() |