1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 """SPAN setup library"""
16 from resources.libraries.python.topology import Topology
17 from resources.libraries.python.VatExecutor import VatTerminal
20 # pylint: disable=too-few-public-methods
22 """Class contains methods for setting up SPAN mirroring on DUTs."""
29 def set_span_mirroring(node, src_if, dst_if):
30 """Set Span mirroring on the specified node.
32 :param node: DUT node.
33 :param src_if: Interface to mirror traffic from.
34 :param dst_if: Interface to mirror traffic to.
40 src_if = Topology.get_interface_name(node, src_if)
41 dst_if = Topology.get_interface_name(node, dst_if)
43 with VatTerminal(node, json_param=False) as vat:
44 vat.vat_terminal_exec_cmd_from_template('span_create.vat',
48 # TODO: Update "span_create.vat" to use VAT command, once available