Report: NAT44 graphs
[csit.git] / resources / libraries / python / DPDK / L3fwdCheck.py
1 # Copyright (c) 2022 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:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
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.
13
14 from resources.libraries.python.Constants import Constants
15 from resources.libraries.python.DpdkUtil import DpdkUtil
16 from resources.libraries.python.ssh import exec_cmd_no_error, exec_cmd
17 from resources.libraries.python.topology import NodeType, Topology
18
19
20 class L3fwdCheck:
21     """Test the DPDK l3fwd is ready."""
22
23     @staticmethod
24     def check_l3fwd(node):
25         """
26         Execute the l3fwd check on the DUT node.
27
28         :param node: DUT node.
29         :type node: dict
30         :raises RuntimeError: If the script "check_l3fwd.sh" fails.
31         """
32         if node[u"type"] == NodeType.DUT:
33             command = f"{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_LIB_SH}"\
34                 f"/entry/check_l3fwd.sh"
35             message = f"Failed to check l3fwd state at node {node['host']}"
36             exec_cmd_no_error(node, command, timeout=1800, message=message)