+ beh = behavior.replace('.', '_').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, 'END_AD').name,
+ getattr(SRv6Behavior, 'END_AS').name,
+ getattr(SRv6Behavior, 'END_AM').name):
+ if beh == getattr(SRv6Behavior, '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(
+ 'Required parameter(s) missing.\n'
+ 'next_hop:{nh}\n'
+ 'out_if:{oif}\n'
+ 'in_if:{iif}\n'
+ 'src_addr:{saddr}\n'
+ 'sid_list:{sids}'.format(
+ nh=next_hop, oif=out_if, iif=in_if, saddr=src_addr,
+ sids=sid_list))
+ sid_conf = 'next ' + ' next '.join(sid_list)
+ params = 'nh {nh} oif {oif} iif {iif} src {saddr} {sids}'.\
+ format(nh=next_hop, oif=out_if, iif=in_if, saddr=src_addr,
+ sids=sid_conf)
+ else:
+ if next_hop is None or out_if is None or in_if is None:
+ raise ValueError(
+ 'Required parameter(s) missing.\nnext_hop:{0}\n'
+ 'out_if:{1}\nin_if:{2}'.format(next_hop, out_if, in_if))
+ params = 'nh {0} oif {1} iif {2}'.format(
+ next_hop, out_if, in_if)
+
+ cli_cmd = 'sr localsid address {l_sid} behavior {beh} {params}'.\
+ format(l_sid=local_sid, beh=behavior, params=params)
+
+ PapiSocketExecutor.run_cli_cmd(node, cli_cmd)
+ return
+
+ cmd = 'sr_localsid_add_del'
+ args = dict(
+ is_del=0,
+ localsid=SRv6.create_srv6_sid_object(local_sid),
+ end_psp=0,
+ behavior=getattr(SRv6Behavior, beh).value,
+ sw_if_index=Constants.BITWISE_NON_ZERO,
+ vlan_index=0,
+ fib_table=0,
+ nh_addr6=0,
+ nh_addr4=0
+ )
+ err_msg = 'Failed to add SR localSID {lsid} on host {host}'.format(
+ lsid=local_sid, host=node['host'])
+
+ if beh in (getattr(SRv6Behavior, 'END_X').name,
+ getattr(SRv6Behavior, 'END_DX4').name,
+ getattr(SRv6Behavior, 'END_DX6').name):