aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authoropensource-tnbt <sridhar.rao@spirent.com>2020-11-25 15:11:47 +0530
committeropensource-tnbt <sridhar.rao@spirent.com>2020-11-25 15:23:55 +0530
commit5be0a76d76aefbfc7b0555482df2dada7a6e5a08 (patch)
tree003daa1e3c97d6ff75522b672fecee2568d8efbd /testcases
parent092de71ff79b23ab05d013ceb417b4f0b48dcc55 (diff)
Kubernetes: Infrastructure For K8S Net testing.
This patch adds necessary code to perform K8S Networking performance benchmarking. Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com> Change-Id: I059ddd2e9ad3ee7c05e4620c64401f81474be195
Diffstat (limited to 'testcases')
-rw-r--r--testcases/__init__.py1
-rw-r--r--testcases/k8s_performance.py39
-rw-r--r--testcases/testcase.py57
3 files changed, 95 insertions, 2 deletions
diff --git a/testcases/__init__.py b/testcases/__init__.py
index 0b6b77e4..736be883 100644
--- a/testcases/__init__.py
+++ b/testcases/__init__.py
@@ -17,3 +17,4 @@
from testcases.testcase import (TestCase)
from testcases.performance import (PerformanceTestCase)
from testcases.integration import (IntegrationTestCase)
+from testcases.k8s_performance import (K8sPerformanceTestCase)
diff --git a/testcases/k8s_performance.py b/testcases/k8s_performance.py
new file mode 100644
index 00000000..3c31430c
--- /dev/null
+++ b/testcases/k8s_performance.py
@@ -0,0 +1,39 @@
+# Copyright 2015-2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""PerformanceTestCase class
+"""
+
+import logging
+
+from testcases.testcase import TestCase
+#from tools.report import report
+
+class K8sPerformanceTestCase(TestCase):
+ """K8sPerformanceTestCase class
+
+ In this basic form runs RFC2544 throughput test
+ """
+ def __init__(self, cfg):
+ """ Testcase initialization
+ """
+ self._type = 'k8s_performance'
+ super().__init__(cfg)
+ self._logger = logging.getLogger(__name__)
+ self._k8s = True
+
+ def run_report(self):
+ pass
+ #super().run_report()
+ #if self._tc_results:
+ # report.generate(self)
diff --git a/testcases/testcase.py b/testcases/testcase.py
index a30558ff..51d212b4 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -73,6 +73,8 @@ class TestCase(object):
self._hugepages_mounted = False
self._traffic_ctl = None
self._vnf_ctl = None
+ self._pod_ctl = None
+ self._pod_list = None
self._vswitch_ctl = None
self._collector = None
self._loadgen = None
@@ -81,6 +83,7 @@ class TestCase(object):
self._settings_paths_modified = False
self._testcast_run_time = None
self._versions = []
+ self._k8s = False
# initialization of step driven specific members
self._step_check = False # by default don't check result for step driven testcases
self._step_vnf_list = {}
@@ -216,6 +219,12 @@ class TestCase(object):
self._vnf_list = self._vnf_ctl.get_vnfs()
+ self._pod_ctl = component_factory.create_pod(
+ self.deployment,
+ loader.get_pod_class())
+
+ self._pod_list = self._pod_ctl.get_pods()
+
# verify enough hugepages are free to run the testcase
if not self._check_for_enough_hugepages():
raise RuntimeError('Not enough hugepages free to run test.')
@@ -281,6 +290,10 @@ class TestCase(object):
# Stop all VNFs started by TestSteps in case that something went wrong
self.step_stop_vnfs()
+ if self._k8s:
+ self._pod_ctl.stop()
+
+
# Cleanup any LLC-allocations
if S.getValue('LLC_ALLOCATION'):
self._rmd.cleanup_llc_allocation()
@@ -350,15 +363,18 @@ class TestCase(object):
"""Run the test
All setup and teardown through controllers is included.
+
"""
# prepare test execution environment
self.run_initialize()
try:
with self._vswitch_ctl:
- with self._vnf_ctl, self._collector, self._loadgen:
- if not self._vswitch_none:
+ with self._vnf_ctl, self._pod_ctl, self._collector, self._loadgen:
+ if not self._vswitch_none and not self._k8s:
self._add_flows()
+ if self._k8s:
+ self._add_connections()
self._versions += self._vswitch_ctl.get_vswitch().get_version()
@@ -595,6 +611,43 @@ class TestCase(object):
return list(result.keys())
+ def _add_connections(self):
+ """
+ Add connections for Kubernetes Usecases
+ """
+ logging.info("Kubernetes: Adding Connections")
+ vswitch = self._vswitch_ctl.get_vswitch()
+ bridge = S.getValue('VSWITCH_BRIDGE_NAME')
+ if S.getValue('K8S') and 'sriov' not in S.getValue('PLUGIN'):
+ if 'Ovs' in S.getValue('VSWITCH'):
+ # Add OVS Flows
+ logging.info("Kubernetes: Adding OVS Connections")
+ flow = {'table':'0', 'in_port':'1',
+ 'idle_timeout':'0', 'actions': ['output:3']}
+ vswitch.add_flow(bridge, flow)
+ flow = {'table':'0', 'in_port':'3',
+ 'idle_timeout':'0', 'actions': ['output:1']}
+ vswitch.add_flow(bridge, flow)
+ flow = {'table':'0', 'in_port':'2',
+ 'idle_timeout':'0', 'actions': ['output:4']}
+ vswitch.add_flow(bridge, flow)
+ flow = {'table':'0', 'in_port':'4',
+ 'idle_timeout':'0', 'actions': ['output:2']}
+ vswitch.add_flow(bridge, flow)
+ elif 'vpp' in S.getValue('VSWITCH'):
+ phy_ports = vswitch.get_ports()
+ virt_port0 = 'memif1/0'
+ virt_port1 = 'memif2/0'
+ vswitch.add_connection(bridge, phy_ports[0],
+ virt_port0, None)
+ vswitch.add_connection(bridge, virt_port0,
+ phy_ports[0], None)
+ vswitch.add_connection(bridge, phy_ports[1],
+ virt_port1, None)
+ vswitch.add_connection(bridge, virt_port1,
+ phy_ports[1], None)
+
+
def _add_flows(self):
"""Add flows to the vswitch
"""