- sw_if_index, mask_width, prefix_addr, traffic_type = \
- SRv6._get_sr_steer_policy_args(
- node, mode, interface, ip_addr, prefix)
-
- cmd = 'sr_steering_add_del'
- args = dict(
- is_del=0,
- bsid_addr=IPv6Address(unicode(bsid)).packed,
- sr_policy_index=0,
- table_id=0,
- prefix_addr=prefix_addr,
- mask_width=mask_width,
- sw_if_index=sw_if_index,
- traffic_type=traffic_type
- )
- err_msg = 'Failed to add SRv6 steering policy for BindingSID {bsid} ' \
- 'on host {host}'.format(bsid=bsid, host=node['host'])
-
- with PapiSocketExecutor(node) as papi_exec:
- papi_exec.add(cmd, **args).get_reply(err_msg)
-
- @staticmethod
- def delete_sr_steer(
- node, mode, bsid, interface=None, ip_addr=None, mask=None):
- """Delete SRv6 steering policy on the given node.
-
- :param node: Given node to delete steering policy on.
- :param mode: Mode of operation - L2 or L3.
- :param bsid: BindingSID - local SID IPv6 address.
- :param interface: Interface name (Optional, required in case of
- L2 mode).
- :param ip_addr: IPv4/IPv6 address (Optional, required in case of L3
- mode).
- :param mask: IP address mask (Optional, required in case of L3 mode).
- :type node: dict
- :type mode: str
- :type bsid: str
- :type interface: str
- :type ip_addr: str
- :type mask: int
- :raises ValueError: If unsupported mode used or required parameter
- is missing.
- """
- sw_if_index, mask_width, prefix_addr, traffic_type = \
- SRv6._get_sr_steer_policy_args(node, mode, interface, ip_addr, mask)