aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/IPv6Util.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-11-12 05:27:43 +0100
committerJan Gelety <jgelety@cisco.com>2019-11-28 18:26:21 +0100
commitd68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch)
tree487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/python/IPv6Util.py
parented0258a440cfad7023d643f717ab78ac568dc59b (diff)
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/IPv6Util.py')
-rw-r--r--resources/libraries/python/IPv6Util.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/resources/libraries/python/IPv6Util.py b/resources/libraries/python/IPv6Util.py
index aacf0fb5f7..683f892f62 100644
--- a/resources/libraries/python/IPv6Util.py
+++ b/resources/libraries/python/IPv6Util.py
@@ -19,7 +19,7 @@ from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.topology import NodeType
-class IPv6Util(object):
+class IPv6Util:
"""IPv6 utilities"""
@staticmethod
@@ -31,12 +31,13 @@ class IPv6Util(object):
:type node: dict
:type interface: str
"""
- cmd = 'sw_interface_ip6nd_ra_config'
+ cmd = u"sw_interface_ip6nd_ra_config"
args = dict(
sw_if_index=InterfaceUtil.get_interface_index(node, interface),
- suppress=1)
- err_msg = 'Failed to suppress ICMPv6 router advertisement message on ' \
- 'interface {ifc}'.format(ifc=interface)
+ suppress=1
+ )
+ err_msg = f"Failed to suppress ICMPv6 router advertisement message " \
+ f"on interface {interface}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@@ -53,12 +54,13 @@ class IPv6Util(object):
:type interface: str
:type interval: int
"""
- cmd = 'sw_interface_ip6nd_ra_config'
+ cmd = u"sw_interface_ip6nd_ra_config"
args = dict(
sw_if_index=InterfaceUtil.get_interface_index(node, interface),
- initial_interval=int(interval))
- err_msg = 'Failed to set router advertisement interval on ' \
- 'interface {ifc}'.format(ifc=interface)
+ initial_interval=int(interval)
+ )
+ err_msg = f"Failed to set router advertisement interval " \
+ f"on interface {interface}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@@ -72,10 +74,11 @@ class IPv6Util(object):
:type nodes: dict
"""
for node in nodes.values():
- if node['type'] == NodeType.TG:
+ if node[u"type"] == NodeType.TG:
continue
- for port_k in node['interfaces'].keys():
+ for port_k in node[u"interfaces"].keys():
ip6_addr_list = IPUtil.vpp_get_interface_ip_addresses(
- node, port_k, 'ipv6')
+ node, port_k, u"ipv6"
+ )
if ip6_addr_list:
IPv6Util.vpp_ra_suppress_link_layer(node, port_k)