+ beh = behavior.replace(u".", u"_").upper()
+ # There is no SRv6Behaviour enum defined for functions from SRv6 plugins
+ # so we need to use CLI command to configure it.
+ if beh in (getattr(SRv6Behavior, u"END_AD").name,
+ getattr(SRv6Behavior, u"END_AS").name,
+ getattr(SRv6Behavior, u"END_AM").name):
+ if beh == getattr(SRv6Behavior, u"END_AS").name:
+ if next_hop is None or out_if is None or in_if is None or \
+ src_addr is None or sid_list is None:
+ raise ValueError(
+ f"Required parameter(s) missing.\n"
+ f"next_hop:{next_hop}\n "
+ f"out_if:{out_if}\n"
+ f"in_if:{in_if}\n"
+ f"src_addr:{src_addr}\n"
+ f"sid_list:{sid_list}"
+ )
+ sid_conf = f"next {u' next '.join(sid_list)}"
+ params = f"nh {next_hop} oif {out_if} iif {in_if} " \
+ f"src {src_addr} {sid_conf}"
+ else:
+ if next_hop is None or out_if is None or in_if is None:
+ raise ValueError(
+ f"Required parameter(s) missing.\n"
+ f"next_hop:{next_hop}\n"
+ f"out_if:{out_if}\n"
+ f"in_if:{in_if}"
+ )
+ params = f"nh {next_hop} oif {out_if} iif {in_if}"
+
+ cli_cmd = f"sr localsid address {local_sid} behavior {behavior} " \
+ f"{params}"
+
+ PapiSocketExecutor.run_cli_cmd(node, cli_cmd)
+ return
+
+ cmd = u"sr_localsid_add_del"
+ args = dict(
+ is_del=False,
+ localsid=IPv6Address(local_sid).packed,
+ end_psp=False,
+ behavior=getattr(SRv6Behavior, beh).value,
+ sw_if_index=Constants.BITWISE_NON_ZERO,
+ vlan_index=0,
+ fib_table=0,
+ nh_addr=0
+ )
+ err_msg = f"Failed to add SR localSID {local_sid} " \
+ f"host {node[u'host']}"
+ if beh in (getattr(SRv6Behavior, u"END_X").name,
+ getattr(SRv6Behavior, u"END_DX4").name,
+ getattr(SRv6Behavior, u"END_DX6").name):