aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/InterfaceUtil.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2023-12-13 13:52:26 +0100
committerVratko Polak <vrpolak@cisco.com>2023-12-13 13:52:26 +0100
commit185d2338b5d5b40e7da71523b814d598ec83849f (patch)
treef3d3c82ef2f1544feec71a3497844f99a2e1663a /resources/libraries/python/InterfaceUtil.py
parentc3303c5cd6290634a4d5918b6fad5debc9f2db76 (diff)
fix(Interfaces): do not use JsonParser
In past, there perhaps were Robot keywords needing JsonParser. But now the single remaining call site can call json.loads directly. + Delete now unused resources/libraries/python/parsers/. Change-Id: I9c5d94d6b320f917f1f621abb83556ebccadc3ec Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r--resources/libraries/python/InterfaceUtil.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 13a04441b2..c62592e7ec 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -13,6 +13,7 @@
"""Interface util library."""
+from json import loads
from time import sleep
from enum import IntEnum
@@ -25,7 +26,6 @@ from resources.libraries.python.DUTSetup import DUTSetup
from resources.libraries.python.IPAddress import IPAddress
from resources.libraries.python.L2Util import L2Util
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
-from resources.libraries.python.parsers.JsonParser import JsonParser
from resources.libraries.python.ssh import SSH, exec_cmd, exec_cmd_no_error
from resources.libraries.python.topology import NodeType, Topology
from resources.libraries.python.VPPUtil import VPPUtil
@@ -723,9 +723,8 @@ class InterfaceUtil:
ret_code, stdout, _ = ssh.exec_command(cmd)
if int(ret_code) != 0:
raise RuntimeError(u"Get interface name and MAC failed")
- tmp = u"{" + stdout.rstrip().replace(u"\n", u",") + u"}"
- interfaces = JsonParser().parse_data(tmp)
+ interfaces = loads("{" + stdout.rstrip().replace("\n", ",") + "}")
for interface in node[u"interfaces"].values():
name = interfaces.get(interface[u"mac_address"])
if name is None: