aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/Memif.py20
-rw-r--r--resources/libraries/python/SRv6.py6
2 files changed, 17 insertions, 9 deletions
diff --git a/resources/libraries/python/Memif.py b/resources/libraries/python/Memif.py
index d38f5000a7..4e0bb5fa4f 100644
--- a/resources/libraries/python/Memif.py
+++ b/resources/libraries/python/Memif.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 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:
@@ -74,7 +74,7 @@ class Memif:
includes only retval.
:rtype: dict
"""
- cmd = u"memif_socket_filename_add_del"
+ cmd = u"memif_socket_filename_add_del_v2"
err_msg = f"Failed to create memif socket on host {node[u'host']}"
args = dict(
is_add=is_add,
@@ -85,7 +85,7 @@ class Memif:
return papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
- def _memif_create(node, mid, sid, rxq=1, txq=1, role=1):
+ def _memif_create(node, mid, sid, rxq=1, txq=1, role=1, use_dma=False):
"""Create Memif interface on the given node, return its sw_if_index.
:param node: Given node to create Memif interface on.
@@ -94,16 +94,18 @@ class Memif:
:param rxq: Number of RX queues; 0 means do not set.
:param txq: Number of TX queues; 0 means do not set.
:param role: Memif interface role [master=0|slave=1]. Default is slave.
+ :param use_dma: Use DMA acceleration. Requires hardware support.
:type node: dict
:type mid: str
:type sid: str
:type rxq: int
:type txq: int
:type role: int
+ :type use_dma: bool
:returns: sw_if_index
:rtype: int
"""
- cmd = u"memif_create"
+ cmd = u"memif_create_v2"
err_msg = f"Failed to create memif interface on host {node[u'host']}"
args = dict(
role=role,
@@ -111,7 +113,8 @@ class Memif:
tx_queues=int(txq),
socket_id=int(sid),
id=int(mid),
- secret=u""
+ secret=u"",
+ use_dma=use_dma,
)
with PapiSocketExecutor(node) as papi_exec:
@@ -119,7 +122,8 @@ class Memif:
@staticmethod
def create_memif_interface(
- node, filename, mid, sid, rxq=1, txq=1, role=u"SLAVE"):
+ node, filename, mid, sid, rxq=1, txq=1, role=u"SLAVE", use_dma=False
+ ):
"""Create Memif interface on the given node.
:param node: Given node to create Memif interface on.
@@ -129,6 +133,7 @@ class Memif:
:param rxq: Number of RX queues; 0 means do not set.
:param txq: Number of TX queues; 0 means do not set.
:param role: Memif interface role [master=0|slave=1]. Default is master.
+ :param use_dma: Use DMA acceleration. Requires hardware support.
:type node: dict
:type filename: str
:type mid: str
@@ -136,6 +141,7 @@ class Memif:
:type rxq: int
:type txq: int
:type role: str
+ :type use_dma: bool
:returns: SW interface index.
:rtype: int
:raises ValueError: If command 'create memif' fails.
@@ -147,7 +153,7 @@ class Memif:
# Create memif
sw_if_index = Memif._memif_create(
- node, mid, sid, rxq=rxq, txq=txq, role=role
+ node, mid, sid, rxq=rxq, txq=txq, role=role, use_dma=use_dma
)
# Update Topology
diff --git a/resources/libraries/python/SRv6.py b/resources/libraries/python/SRv6.py
index eca22a2b17..d16c3529c3 100644
--- a/resources/libraries/python/SRv6.py
+++ b/resources/libraries/python/SRv6.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 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:
@@ -222,6 +222,8 @@ class SRv6:
:type sid_list: list
:type mode: str
"""
+ # TODO: Convert to use sr_policy_add_v2.
+ # The conversion is not straightforward so it was not done when bumping.
cmd = u"sr_policy_add"
args = dict(
bsid_addr=IPv6Address(bsid).packed,
@@ -243,7 +245,7 @@ class SRv6:
:param node: Given node to show SRv6 policies on.
:type node: dict
"""
- cmd = u"sr_policies_dump"
+ cmd = u"sr_policies_v2_dump"
PapiSocketExecutor.dump_and_log(node, (cmd,))
@staticmethod