X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FIPUtil.py;h=359bd1dce96bcdd5f1bec5bc753633a65599cdd0;hb=5302eeabb757ccf710568a66b8f6435c1894cd4d;hp=0a573d72fb64e256b5cf4654647dd140cf2cd6ca;hpb=442a8b449fea1f632d7a3d5d31c9c4f21de0c76b;p=csit.git diff --git a/resources/libraries/python/IPUtil.py b/resources/libraries/python/IPUtil.py index 0a573d72fb..359bd1dce9 100644 --- a/resources/libraries/python/IPUtil.py +++ b/resources/libraries/python/IPUtil.py @@ -1,5 +1,5 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. -# Copyright (c) 2021 PANTHEON.tech s.r.o. +# Copyright (c) 2023 Cisco and/or its affiliates. +# Copyright (c) 2023 PANTHEON.tech s.r.o. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -155,8 +155,8 @@ class NetworkIncrement(ObjIncrement): return f"{self._value.network_address}/{self._prefix_len}" elif self._format == u"addr": return f"{self._value.network_address}" - else: - raise RuntimeError(f"Unsupported format {self._format}") + + raise RuntimeError(f"Unsupported format {self._format}") class IPUtil: @@ -500,7 +500,7 @@ class IPUtil: :type ip_addr: str :type prefix_length: int :type namespace: str - :rtype boolean + :rtype: boolean :raises RuntimeError: Request fails. """ ip_addr_with_prefix = f"{ip_addr}/{prefix_length}" @@ -652,7 +652,7 @@ class IPUtil: vrf: VRF table ID. (int) count: number of IP addresses to add starting from network IP (int) local: The route is local with same prefix (increment is 1). - If None, then is not used. (bool) + If None, then is not used. (bool) lookup_vrf: VRF table ID for lookup. (int) weight: Weight value for unequal cost multipath routing. (int) (Multipath value enters at higher level.) @@ -724,7 +724,7 @@ class IPUtil: vrf: VRF table ID. (int) count: number of IP addresses to add starting from network IP (int) local: The route is local with same prefix (increment is 1 network) - If None, then is not used. (bool) + If None, then is not used. (bool) lookup_vrf: VRF table ID for lookup. (int) multipath: Enable multipath routing. (bool) Default: True. weight: Weight value for unequal cost multipath routing. (int) @@ -796,7 +796,7 @@ class IPUtil: ip_network(f"{network}/{prefix_len}", strict=strict), format=u"addr" ) - with PapiSocketExecutor(node) as papi_exec: + with PapiSocketExecutor(node, is_async=True) as papi_exec: for i in range(count): args[u"route"] = IPUtil.compose_vpp_route_structure( node, netiter.inc_fmt(), prefix_len, **kwargs