X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FNsimUtil.py;h=bd319e668e6e0439c9c6a380bb69cbfc7490a8e0;hp=9d60a911b18bcde66f3ddfbbd84760a96cbdc1da;hb=d79b753c1fde3cd831f60ac5cc0034f613c44b43;hpb=20e972ce413e727b0a3d89d04460534cb454f107 diff --git a/resources/libraries/python/NsimUtil.py b/resources/libraries/python/NsimUtil.py index 9d60a911b1..bd319e668e 100644 --- a/resources/libraries/python/NsimUtil.py +++ b/resources/libraries/python/NsimUtil.py @@ -13,14 +13,11 @@ """VPP Network Simulator Plugin util library.""" -from robot.api import logger - -from resources.libraries.python.Constants import Constants from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.InterfaceUtil import InterfaceUtil -class NsimUtil(object): +class NsimUtil(): """VPP NSIM Plugin Keywords.""" @staticmethod @@ -33,14 +30,14 @@ class NsimUtil(object): :param interface1: 2nd Interface name for cross-connect feature :type node: dict :type vpp_nsim_attr: dict - :type interface0: string or int - :type interface1: string or int + :type interface0: str or int + :type interface1: str or int :raises RuntimeError: if no NSIM features are enabled or vpp papi command fails. """ host = node[u"host"] - if vpp_nsim_attr[u"output_feature_enable"] == False \ - and vpp_nsim_attr[u"cross_connect_feature_enable"] == False: + if not vpp_nsim_attr[u"output_feature_enable"] \ + and not vpp_nsim_attr[u"cross_connect_feature_enable"]: raise RuntimeError(f"No NSIM features enabled on host {host}:\n" f"vpp_nsim_attr = {vpp_nsim_attr}") cmd = u"nsim_configure" @@ -56,7 +53,7 @@ class NsimUtil(object): with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) - if vpp_nsim_attr[u"output_feature_enable"] == True: + if vpp_nsim_attr[u"output_feature_enable"]: cmd = u"nsim_output_feature_enable_disable" args = dict( enable_disable=vpp_nsim_attr[u"output_feature_enable"], @@ -67,7 +64,7 @@ class NsimUtil(object): with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) - elif vpp_nsim_attr[u"cross_connect_feature_enable"] == True: + elif vpp_nsim_attr[u"cross_connect_feature_enable"]: cmd = u"nsim_cross_connect_feature_enable_disable" args = dict( enable_disable=vpp_nsim_attr[u"cross_connect_feature_enable"],