Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fix: Show mrr trials in trending graphs
[csit.git]
/
resources
/
libraries
/
python
/
SRv6.py
diff --git
a/resources/libraries/python/SRv6.py
b/resources/libraries/python/SRv6.py
index
063bcd5
..
0170df5
100644
(file)
--- a/
resources/libraries/python/SRv6.py
+++ b/
resources/libraries/python/SRv6.py
@@
-1,4
+1,4
@@
-# Copyright (c) 202
0
Cisco and/or its affiliates.
+# Copyright (c) 202
4
Cisco and/or its affiliates.
# 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:
# 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:
@@
-207,10
+207,7
@@
class SRv6:
:type node: dict
"""
cmd = u"sr_localsids_dump"
:type node: dict
"""
cmd = u"sr_localsids_dump"
- err_msg = f"Failed to get SR localSID dump on host {node[u'host']}"
-
- with PapiSocketExecutor(node) as papi_exec:
- papi_exec.add(cmd).get_details(err_msg)
+ PapiSocketExecutor.dump_and_log(node, (cmd,))
@staticmethod
def configure_sr_policy(node, bsid, sid_list, mode=u"encap"):
@staticmethod
def configure_sr_policy(node, bsid, sid_list, mode=u"encap"):
@@
-225,13
+222,14
@@
class SRv6:
:type sid_list: list
:type mode: str
"""
:type sid_list: list
:type mode: str
"""
- cmd = u"sr_policy_add"
+ cmd = u"sr_policy_add
_v2
"
args = dict(
bsid_addr=IPv6Address(bsid).packed,
weight=1,
is_encap=bool(mode == u"encap"),
args = dict(
bsid_addr=IPv6Address(bsid).packed,
weight=1,
is_encap=bool(mode == u"encap"),
- is_spray=False,
- sids=SRv6.create_srv6_sid_list(sid_list)
+ type=0, # Neither SPRAY nor TEF are needed yet.
+ sids=SRv6.create_srv6_sid_list(sid_list),
+ # encap_src is optional, do not set yet.
)
err_msg = f"Failed to add SR policy for BindingSID {bsid} " \
f"on host {node[u'host']}"
)
err_msg = f"Failed to add SR policy for BindingSID {bsid} " \
f"on host {node[u'host']}"
@@
-246,11
+244,8
@@
class SRv6:
:param node: Given node to show SRv6 policies on.
:type node: dict
"""
:param node: Given node to show SRv6 policies on.
:type node: dict
"""
- cmd = u"sr_policies_dump"
- err_msg = f"Failed to get SR policies dump on host {node[u'host']}"
-
- with PapiSocketExecutor(node) as papi_exec:
- papi_exec.add(cmd).get_details(err_msg)
+ cmd = u"sr_policies_v2_dump"
+ PapiSocketExecutor.dump_and_log(node, (cmd,))
@staticmethod
def _get_sr_steer_policy_args(
@staticmethod
def _get_sr_steer_policy_args(
@@
-298,10
+293,10
@@
class SRv6:
ip_addr = ip_address(ip_addr)
prefix = IPUtil.create_prefix_object(ip_addr, int(prefix))
traffic_type = getattr(
ip_addr = ip_address(ip_addr)
prefix = IPUtil.create_prefix_object(ip_addr, int(prefix))
traffic_type = getattr(
-
SRv6PolicySteeringTypes, u"SR_STEER_IPV4"
-
).value if ip_addr.version == 4 else getattr(
-
SRv6PolicySteeringTypes, u"SR_STEER_IPV6"
-
).value
+ SRv6PolicySteeringTypes, u"SR_STEER_IPV4"
+ ).value if ip_addr.version == 4 else getattr(
+ SRv6PolicySteeringTypes, u"SR_STEER_IPV6"
+ ).value
else:
raise ValueError(f"Unsupported mode: {mode}")
else:
raise ValueError(f"Unsupported mode: {mode}")
@@
-332,8
+327,8
@@
class SRv6:
is missing.
"""
sw_if_index, prefix, traffic_type = SRv6._get_sr_steer_policy_args(
is missing.
"""
sw_if_index, prefix, traffic_type = SRv6._get_sr_steer_policy_args(
-
node, mode, interface, ip_addr, prefix
-
)
+ node, mode, interface, ip_addr, prefix
+ )
cmd = u"sr_steering_add_del"
args = dict(
cmd = u"sr_steering_add_del"
args = dict(
@@
-359,10
+354,7
@@
class SRv6:
:type node: dict
"""
cmd = u"sr_steering_pol_dump"
:type node: dict
"""
cmd = u"sr_steering_pol_dump"
- err_msg = f"Failed to get SR localSID dump on host {node[u'host']}"
-
- with PapiSocketExecutor(node) as papi_exec:
- papi_exec.add(cmd).get_details(err_msg)
+ PapiSocketExecutor.dump_and_log(node, (cmd,))
@staticmethod
def set_sr_encaps_source_address(node, ip6_addr):
@staticmethod
def set_sr_encaps_source_address(node, ip6_addr):