aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/ContainerUtils.py
diff options
context:
space:
mode:
authorxinfengx <xinfengx.zhao@intel.com>2023-09-21 08:39:39 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2024-02-06 10:52:14 +0000
commit27668008077fd69b29b83f8e3e736b2dc67df361 (patch)
tree3ef06e5ffa8fa9e0e22102930fbf3469cf1d3770 /resources/libraries/python/ContainerUtils.py
parent9b72b5f8018de7863903a7e3b3b8a914a29feb3c (diff)
Add memif with DMA test suites
Change-Id: I8c27b5956c0c26bb2de48321675e285ed961412f Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
Diffstat (limited to 'resources/libraries/python/ContainerUtils.py')
-rw-r--r--resources/libraries/python/ContainerUtils.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py
index 158eb4bc48..fc32248f6b 100644
--- a/resources/libraries/python/ContainerUtils.py
+++ b/resources/libraries/python/ContainerUtils.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# 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:
@@ -256,6 +256,11 @@ class ContainerManager:
self._configure_vpp_chain_ipsec(
mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2,
guest_dir=guest_dir, nf_instance=idx, **kwargs)
+ elif chain_topology == u"chain_dma":
+ self._configure_vpp_chain_dma(
+ mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2,
+ guest_dir=guest_dir, **kwargs
+ )
else:
raise RuntimeError(
f"Container topology {chain_topology} not implemented"
@@ -278,6 +283,25 @@ class ContainerManager:
f"{self.engine.container.name}-{kwargs[u'sid2']}"
)
+ def _configure_vpp_chain_dma(self, **kwargs):
+ """Configure VPP in chain topology with l2xc (dma).
+
+ :param kwargs: Named parameters.
+ :type kwargs: dict
+ """
+ dma_wqs = kwargs[f"dma_wqs"]
+ self.engine.create_vpp_startup_config_dma(dma_wqs)
+
+ self.engine.create_vpp_exec_config(
+ u"memif_create_chain_dma.exec",
+ mid1=kwargs[u"mid1"], mid2=kwargs[u"mid2"],
+ sid1=kwargs[u"sid1"], sid2=kwargs[u"sid2"],
+ socket1=f"{kwargs[u'guest_dir']}/memif-"
+ f"{self.engine.container.name}-{kwargs[u'sid1']}",
+ socket2=f"{kwargs[u'guest_dir']}/memif-"
+ f"{self.engine.container.name}-{kwargs[u'sid2']}"
+ )
+
def _configure_vpp_cross_horiz(self, **kwargs):
"""Configure VPP in cross horizontal topology (single memif).
@@ -768,6 +792,22 @@ class ContainerEngine:
f'echo "{vpp_config.get_config_str()}" | tee /etc/vpp/startup.conf'
)
+ def create_vpp_startup_config_dma(self, dma_devices):
+ """Create startup configuration of VPP DMA.
+
+ :param dma_devices: DMA devices list.
+ :type dma_devices: list
+ """
+ vpp_config = self.create_base_vpp_startup_config()
+ vpp_config.add_plugin(u"enable", u"dma_intel_plugin.so")
+ vpp_config.add_dma_dev(dma_devices)
+
+ # Apply configuration
+ self.execute(u"mkdir -p /etc/vpp/")
+ self.execute(
+ f'echo "{vpp_config.get_config_str()}" | tee /etc/vpp/startup.conf'
+ )
+
def create_vpp_exec_config(self, template_file, **kwargs):
"""Create VPP exec configuration on container.