aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/L2Util.py
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python/L2Util.py')
-rw-r--r--resources/libraries/python/L2Util.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py
index e0824598b4..5903d03549 100644
--- a/resources/libraries/python/L2Util.py
+++ b/resources/libraries/python/L2Util.py
@@ -248,3 +248,26 @@ class L2Util(object):
return bridge_domain
return data
+
+ @staticmethod
+ def l2_tag_rewrite(node, interface, tag_rewrite_method):
+ """Rewrite tags in frame.
+
+ :param node: Node to rewrite tags.
+ :param interface: Interface on which rewrite tags.
+ :param tag_rewrite_method: Method of tag rewrite.
+ :type node: dict
+ :type interface: str or int
+ :type tag_rewrite_method : str
+ """
+
+ if isinstance(interface, basestring):
+ sw_if_index = Topology.get_interface_sw_index(node, interface)
+ else:
+ sw_if_index = interface
+
+ with VatTerminal(node) as vat:
+ vat.vat_terminal_exec_cmd_from_template("l2_tag_rewrite.vat",
+ sw_if_index=sw_if_index,
+ tag_rewrite_method=
+ tag_rewrite_method)