2.120. vpp_papi_provider module

class vpp_papi_provider.QOS_SOURCE

Bases: object

EXT = 0
IP = 3
MPLS = 2
VLAN = 1
class vpp_papi_provider.SYSLOG_SEVERITY

Bases: object

ALERT = 1
CRIT = 2
DBG = 7
EMERG = 0
ERR = 3
INFO = 6
NOTICE = 5
WARN = 4
exception vpp_papi_provider.UnexpectedApiReturnValueError

Bases: Exception

exception raised when the API return value is unexpected

class vpp_papi_provider.VppPapiProvider(name, shm_prefix, test_class, read_timeout)

Bases: object

VPP-api provider using vpp-papi

@property hook: hook object providing before and after api/cli hooks

acl_add_replace(acl_index, r, tag='', expected_retval=0)

Add/replace an ACL :param int acl_index: ACL index to replace, 2^32-1 to create new ACL. :param acl_rule r: ACL rules array. :param str tag: symbolic tag (description) for this ACL. :param int count: number of rules.

acl_del(acl_index, expected_retval=0)
Parameters

acl_index

Returns

acl_dump(acl_index, expected_retval=0)
acl_interface_add_del(sw_if_index, acl_index, is_add=1)

Add/Delete ACL to/from interface

Parameters
  • sw_if_index

  • acl_index

  • is_add – (Default value = 1)

acl_interface_list_dump(sw_if_index=4294967295, expected_retval=0)
acl_interface_set_acl_list(sw_if_index, n_input, acls, expected_retval=0)
acl_interface_set_etype_whitelist(sw_if_index, n_input, whitelist, expected_retval=0)
api(api_fn, api_args, expected_retval=0)

Call API function and check it’s return value. Call the appropriate hooks before and after the API call

Parameters
  • api_fn – API function to call

  • api_args – tuple of API function arguments

  • expected_retval – Expected return value (Default value = 0)

Returns

reply from the API

app_namespace_add_del(namespace_id, ip4_fib_id=0, ip6_fib_id=0, sw_if_index=4294967295, secret=0)
assert_negative_api_retval()

Expect API failure - used with with, e.g.: with self.vapi.assert_negative_api_retval():

self.vapi.<api call expected to fail>

assert_zero_api_retval()

Expect API success - used with with, e.g.: with self.vapi.assert_negative_api_retval():

self.vapi.<api call expected to succeed>

note: this is useful only inside another with block

as success is the default expected value

bfd_auth_set_key(conf_key_id, auth_type, key)
bfd_udp_add(sw_if_index, desired_min_tx, required_min_rx, detect_mult, local_addr, peer_addr, is_ipv6=0, bfd_key_id=None, conf_key_id=None)
bfd_udp_auth_activate(sw_if_index, local_addr, peer_addr, is_ipv6=0, bfd_key_id=None, conf_key_id=None, is_delayed=False)
bfd_udp_mod(sw_if_index, desired_min_tx, required_min_rx, detect_mult, local_addr, peer_addr, is_ipv6=0)
bfd_udp_session_set_flags(admin_up_down, sw_if_index, local_addr, peer_addr, is_ipv6=0)
bier_disp_entry_add_del(bdti, bp, payload_proto, next_hop_afi, next_hop, next_hop_tbl_id=0, next_hop_rpf_id=-1, next_hop_is_ip4=1, is_add=1)

BIER Route add/del

bier_disp_entry_dump(bdti)
bier_disp_table_add_del(bdti, is_add=1)

BIER Disposition Table add/del

bier_disp_table_dump()
bier_imp_add(bti, src, ibytes, is_add=1)

BIER Imposition Add

bier_imp_del(bi_index)

BIER Imposition del

bier_imp_dump()
bier_route_add_del(bti, bp, paths, is_add=1, is_replace=0)

BIER Route add/del

bier_route_dump(bti)
bier_table_add_del(bti, mpls_label, is_add=1)

BIER Table add/del

bier_table_dump()
bond_create(mode, lb, use_custom_mac, mac_address='', interface_id=4294967295)
Parameters
  • mode – mode

  • lb – load balance

  • use_custom_mac – use custom mac

  • mac_address – mac address

  • interface_id – custom interface ID

classify_add_del_session(is_add, table_index, match, opaque_index=4294967295, hit_next_index=4294967295, advance=0, action=0, metadata=0)
Parameters
  • is_add

  • table_index

  • match

  • opaque_index – (Default value = 0xFFFFFFFF)

  • hit_next_index – (Default value = 0xFFFFFFFF)

  • advance – (Default value = 0)

  • action – (Default value = 0)

  • metadata – (Default value = 0)

classify_add_del_table(is_add, mask, match_n_vectors=1, table_index=4294967295, nbuckets=2, memory_size=2097152, skip_n_vectors=0, next_table_index=4294967295, miss_next_index=4294967295, current_data_flag=0, current_data_offset=0)
Parameters
  • is_add

  • mask

  • match_n_vectors – (Default value = 1)

  • table_index – (Default value = 0xFFFFFFFF)

  • nbuckets – (Default value = 2)

  • memory_size – (Default value = 2097152)

  • skip_n_vectors – (Default value = 0)

  • next_table_index – (Default value = 0xFFFFFFFF)

  • miss_next_index – (Default value = 0xFFFFFFFF)

  • current_data_flag – (Default value = 0)

  • current_data_offset – (Default value = 0)

cli(cli)

Execute a CLI, calling the before/after hooks appropriately.

Parameters

cli – CLI to execute

Returns

CLI output

collect_events()

Collect all events from the internal queue and clear the queue.

connect()

Connect the API to VPP

create_loopback(mac='')
Parameters

mac – (Optional)

create_vlan_subif(sw_if_index, vlan)
Parameters
  • vlan

  • sw_if_index

dhcp6_client_enable_disable(sw_if_index, prefix_group='', enable=1)
dhcp6_pd_client_enable_disable(sw_if_index, prefix_group='', enable=1)
dhcp6_pd_send_client_message(msg_type, sw_if_index, T1, T2, prefixes, server_index=4294967295, irt=0, mrt=0, mrc=1, mrd=0, stop=0)
dhcp_client_config(sw_if_index, hostname, client_id='', is_add=1, set_broadcast_flag=1, want_dhcp_events=0)
dhcp_proxy_config(dhcp_server, dhcp_src_address, rx_table_id=0, server_table_id=0, is_add=1, is_ipv6=0)
dhcp_proxy_set_vss(table_id, vss_type=255, vpn_ascii_id='', oui=0, vpn_index=0, is_add=1, is_ip6=0)
disconnect()

Disconnect the API from VPP

dslite_set_aftr_addr(ip6, ip4)

Set DS-Lite AFTR addresses

Parameters
  • ip4 – IPv4 address

  • ip6 – IPv6 address

dslite_set_b4_addr(ip6, ip4)

Set DS-Lite B4 IPv6 address

Parameters
  • ip4 – IPv4 address

  • ip6 – IPv6 address

factory(name, apifn)
gbp_bridge_domain_add(bd_id, flags, bvi_sw_if_index, uu_fwd_sw_if_index, bm_flood_sw_if_index)

GBP bridge-domain Add

gbp_bridge_domain_del(bd_id)

GBP bridge-domain Del

gbp_contract_add_del(is_add, sclass, dclass, acl_index, rules, allowed_ethertypes)

GBP contract Add/Del

gbp_contract_dump()

GBP contract Dump

gbp_endpoint_add(sw_if_index, ips, mac, sclass, flags, tun_src, tun_dst)

GBP endpoint Add

gbp_endpoint_del(handle)

GBP endpoint Del

gbp_endpoint_dump()

GBP endpoint Dump

gbp_endpoint_group_add(vnid, sclass, bd, rd, uplink_sw_if_index, retention)

GBP endpoint group Add

gbp_endpoint_group_del(sclass)

GBP endpoint group Del

gbp_ext_itf_add_del(is_add, sw_if_index, bd_id, rd_id)

GBP recirc Add/Del

gbp_ext_itf_dump()

GBP recirc Dump

gbp_recirc_add_del(is_add, sw_if_index, sclass, is_ext)

GBP recirc Add/Del

gbp_recirc_dump()

GBP recirc Dump

gbp_route_domain_add(rd_id, ip4_table_id, ip6_table_id, ip4_uu_sw_if_index, ip6_uu_sw_if_index)

GBP route-domain Add

gbp_route_domain_del(rd_id)

GBP route-domain Del

gbp_subnet_add_del(is_add, rd_id, prefix, type, sw_if_index=4294967295, sclass=65535)

GBP Subnet Add/Del

gbp_subnet_dump()

GBP Subnet Dump

gbp_vxlan_tunnel_add(vni, bd_rd_id, mode, src)

GBP VXLAN tunnel add

gbp_vxlan_tunnel_del(vni)

GBP VXLAN tunnel del

gbp_vxlan_tunnel_dump()

GBP VXLAN tunnel add/del

gre_add_del_tunnel(src_address, dst_address, outer_fib_id=0, tunnel_type=0, instance=4294967295, session_id=0, is_add=1, is_ip6=0)

Add a GRE tunnel

Parameters
  • src_address

  • dst_address

  • outer_fib_id – (Default value = 0)

  • tunnel_type – (Default value = 0)

  • instance – (Default value = 0xFFFFFFFF)

  • session_id – (Default value = 0)

  • is_add – (Default value = 1)

  • is_ipv6 – (Default value = 0)

gtpu_add_del_tunnel(src_addr, dst_addr, is_add=1, is_ipv6=0, mcast_sw_if_index=4294967295, encap_vrf_id=0, decap_next_index=4294967295, teid=0)
Parameters
  • is_add – (Default value = 1)

  • is_ipv6 – (Default value = 0)

  • src_addr

  • dst_addr

  • mcast_sw_if_index – (Default value = 0xFFFFFFFF)

  • encap_vrf_id – (Default value = 0)

  • decap_next_index – (Default value = 0xFFFFFFFF)

  • teid – (Default value = 0)

igmp_clear_interface(sw_if_index)

Remove all (S,G)s from specified interface doesn’t send IGMP report!

igmp_enable_disable(sw_if_index, enable, host)

Enable/disable IGMP on a given interface

igmp_listen(filter, sw_if_index, saddrs, gaddr)

Listen for new (S,G) on specified interface

Parameters
  • enable – add/del

  • sw_if_index – interface sw index

  • saddr – source ip4 addr

  • gaddr – group ip4 addr

igmp_proxy_device_add_del(vrf_id, sw_if_index, add)

Add/del IGMP proxy device

igmp_proxy_device_add_del_interface(vrf_id, sw_if_index, add)

Add/del interface to/from IGMP proxy device

input_acl_set_interface(is_add, sw_if_index, ip4_table_index=4294967295, ip6_table_index=4294967295, l2_table_index=4294967295)
Parameters
  • is_add

  • sw_if_index

  • ip4_table_index – (Default value = 0xFFFFFFFF)

  • ip6_table_index – (Default value = 0xFFFFFFFF)

  • l2_table_index – (Default value = 0xFFFFFFFF)

ip6_add_del_address_using_prefix(sw_if_index, address, prefix_length, prefix_group, is_add=1)
ip6nd_send_router_solicitation(sw_if_index, irt=1, mrt=120, mrc=0, mrd=0)
ip_mroute_add_del(src_address, grp_address, grp_address_length, e_flags, next_hop_afi, next_hop_sw_if_index, next_hop_address, i_flags, bier_imp=0, rpf_id=0, table_id=0, is_add=1, is_ipv6=0, is_local=0)

IP Multicast Route add/del

ip_neighbor_add_del(sw_if_index, mac_address, ip_address, is_add=1, flags=0)

Add neighbor MAC to IPv4 or IPv6 address.

Parameters
  • sw_if_index

  • mac_address

  • dst_address

  • is_add – (Default value = 1)

  • flags – (Default value = 0/NONE)

ip_punt_police(policer_index, is_ip6=0, is_add=1)
ip_punt_redirect(rx_sw_if_index, tx_sw_if_index, address, is_add=1)
ip_punt_redirect_dump(sw_if_index, is_ipv6=0)
ipsec_backend_dump()
ipsec_gre_tunnel_add_del(local_ip, remote_ip, sa_out, sa_in, is_add=1)
ipsec_interface_add_del_spd(spd_id, sw_if_index, is_add=1)

IPSEC interface SPD add/del - Wrapper to associate/disassociate SPD to interface in VPP Sample CLI : ‘set interface ipsec spd GigabitEthernet0/6/0 1’

:param spd_id - SPD ID to associate with the interface . mandatory :param sw_if_index - Interface Index which needs to ipsec association mandatory :param is_add - add(1) or del(0) association with interface (Default 1 - add) . optional :returns: reply from the API

ipsec_sa_dump(sa_id=None)
ipsec_sad_entry_add_del(sad_id, spi, integrity_algorithm, integrity_key, crypto_algorithm, crypto_key, protocol, tunnel_src_address='', tunnel_dst_address='', flags=0, is_add=1)

IPSEC SA add/del :param sad_id: security association ID :param spi: security param index of the SA in decimal :param integrity_algorithm: :param integrity_key: :param crypto_algorithm: :param crypto_key: :param protocol: AH(0) or ESP(1) protocol :param tunnel_src_address: tunnel mode outer src address :param tunnel_dst_address: tunnel mode outer dst address :param is_add: :param is_tunnel: :** reference /vpp/src/vnet/ipsec/ipsec.h file for enum values of

crypto and ipsec algorithms

ipsec_select_backend(protocol, index)
ipsec_spd_add_del(spd_id, is_add=1)

SPD add/del - Wrapper to add or del ipsec SPD Sample CLI : ‘ipsec spd add 1’

:param spd_id - SPD ID to be created in the vpp . mandatory :param is_add - create (1) or delete(0) SPD (Default 1 - add) .

optional

Returns

reply from the API

ipsec_spd_dump(spd_id, sa_id=4294967295)
ipsec_spd_entry_add_del(spd_id, sa_id, local_address_start, local_address_stop, remote_address_start, remote_address_stop, local_port_start=0, local_port_stop=65535, remote_port_start=0, remote_port_stop=65535, protocol=0, policy=0, priority=100, is_outbound=1, is_add=1, is_ipv6=0, is_ip_any=0)
IPSEC policy SPD add/del -

Wrapper to configure ipsec SPD policy entries in VPP

Parameters
  • spd_id – SPD ID for the policy

  • local_address_start – local-ip-range start address

:param local_address_stop : local-ip-range stop address :param remote_address_start: remote-ip-range start address :param remote_address_stop : remote-ip-range stop address :param local_port_start: (Default value = 0) :param local_port_stop: (Default value = 65535) :param remote_port_start: (Default value = 0) :param remote_port_stop: (Default value = 65535) :param protocol: Any(0), AH(51) & ESP(50) protocol (Default value = 0) :param sa_id: Security Association ID for mapping it to SPD :param policy: bypass(0), discard(1), resolve(2) or protect(3) action

(Default value = 0)

Parameters
  • priority – value for the spd action (Default value = 100)

  • is_outbound – flag for inbound(0) or outbound(1) (Default value = 1)

  • is_add – (Default value = 1)

ipsec_spd_interface_dump(spd_index=None)
ipsec_spds_dump()
ipsec_tunnel_if_add_del(local_ip, remote_ip, local_spi, remote_spi, crypto_alg, local_crypto_key, remote_crypto_key, integ_alg, local_integ_key, remote_integ_key, is_add=1, esn=0, anti_replay=1, renumber=0, show_instance=0)
lisp_add_del_adjacency(leid, reid, leid_len, reid_len, eid_type, is_add=1, vni=0)
lisp_add_del_local_eid(ls_name, eid_type, eid, prefix_len, vni=0, key_id=0, key='', is_add=1)
lisp_add_del_locator(ls_name, sw_if_index, priority=1, weight=1, is_add=1)
lisp_add_del_locator_set(ls_name, is_add=1)
lisp_add_del_remote_mapping(eid_type, eid, eid_prefix_len=0, vni=0, rlocs=[], rlocs_num=0, is_src_dst=0, is_add=1)
lisp_eid_table_dump(eid_set=0, prefix_length=0, vni=0, eid_type=0, eid=None, filter_opt=0)
lisp_enable_disable(is_enabled)
lisp_locator_dump(is_index_set, ls_name=None, ls_index=0)
macip_acl_add(rules, tag='')

Add MACIP acl

Parameters
  • rules – list of rules for given acl

  • tag – acl tag

macip_acl_add_replace(rules, acl_index=4294967295, tag='')

Add MACIP acl

Parameters
  • rules – list of rules for given acl

  • tag – acl tag

macip_acl_dump(acl_index=4294967295)

Return MACIP acl dump

macip_acl_interface_add_del(sw_if_index, acl_index, is_add=1)

Add MACIP acl to interface

Parameters
  • sw_if_index

  • acl_index

  • is_add – (Default value = 1)

memif_create(role, mode, rx_queues=None, tx_queues=None, _id=None, socket_id=None, secret=None, ring_size=None, buffer_size=None, hw_addr=None)
mpls_ip_bind_unbind(label, dst_address, dst_address_length, table_id=0, ip_table_id=0, is_ip4=1, is_bind=1)
mpls_table_add_del(table_id, is_add=1)

:param table_id :param is_add: (Default value = 1)

mpls_tunnel_add_del(tun_sw_if_index, next_hop_proto_is_ip4, next_hop_address, next_hop_sw_if_index=4294967295, next_hop_table_id=0, next_hop_weight=1, next_hop_n_out_labels=0, next_hop_out_label_stack=[], next_hop_via_label=1048576, is_add=1, l2_only=0, is_multicast=0)
Parameters
  • dst_address_length

  • next_hop_sw_if_index – (Default value = 0xFFFFFFFF)

  • dst_address

  • next_hop_address

  • next_hop_sw_if_index – (Default value = 0xFFFFFFFF)

  • vrf_id – (Default value = 0)

  • lookup_in_vrf – (Default value = 0)

  • classify_table_index – (Default value = 0xFFFFFFFF)

  • is_add – (Default value = 1)

  • is_drop – (Default value = 0)

  • is_ipv6 – (Default value = 0)

  • is_local – (Default value = 0)

  • is_classify – (Default value = 0)

  • is_multipath – (Default value = 0)

  • is_resolve_host – (Default value = 0)

  • is_resolve_attached – (Default value = 0)

  • next_hop_weight – (Default value = 1)

  • is_multicast – (Default value = 0)

nat44_add_del_address_range(first_ip_address, last_ip_address, is_add=1, vrf_id=4294967295, twice_nat=0)

Add/del NAT44 address range

Parameters
  • first_ip_address – First IP address

  • last_ip_address – Last IP address

  • vrf_id – VRF id for the address range

  • twice_nat – twice NAT address for extenral hosts

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_add_del_identity_mapping(ip=b'0', sw_if_index=4294967295, port=0, addr_only=1, vrf_id=0, protocol=0, tag='', is_add=1)

Add/delete NAT44 identity mapping

Parameters
  • ip – IP address (Default value = 0)

  • sw_if_index – Interface instead of IP address

  • port – Port number (Default value = 0)

  • addr_only – 1 if address only mapping, 0 if address and port

  • vrf_id – VRF ID

  • protocol – IP protocol (Default value = 0)

  • tag – Opaque string tag

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_add_del_interface_addr(sw_if_index, twice_nat=0, is_add=1)

Add/del NAT44 address from interface

Parameters
  • sw_if_index – Software index of the interface

  • twice_nat – twice NAT address for external hosts

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_add_del_lb_static_mapping(external_addr, external_port, protocol, twice_nat=0, self_twice_nat=0, out2in_only=0, tag='', affinity=0, local_num=0, locals=[], is_add=1)

Add/delete NAT44 load balancing static mapping

Parameters
  • twice_nat – 1 if translate external host address and port

  • tag – Opaque string tag

  • affinity – if 0 disabled, otherwise client IP affinity timeout

:param is_add - 1 if add, 0 if delete

nat44_add_del_static_mapping(local_ip, external_ip=0, external_sw_if_index=4294967295, local_port=0, external_port=0, addr_only=1, vrf_id=0, protocol=0, twice_nat=0, self_twice_nat=0, out2in_only=0, tag='', is_add=1)

Add/delete NAT44 static mapping

Parameters
  • local_ip – Local IP address

  • external_ip – External IP address

  • external_sw_if_index – External interface instead of IP address

  • local_port – Local port number (Default value = 0)

  • external_port – External port number (Default value = 0)

  • addr_only – 1 if address only mapping, 0 if address and port

  • vrf_id – VRF ID

  • protocol – IP protocol (Default value = 0)

  • twice_nat – 1 if translate external host address and port

  • self_twice_nat – 1 if translate external host address and port whenever external host address equals local address of internal host

  • out2in_only – if 1 rule is matching only out2in direction

  • tag – Opaque string tag

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_del_session(addr, port, protocol, vrf_id=0, is_in=1, ext_host_address=None, ext_host_port=0)

Delete NAT44 session

Parameters
  • addr – IPv4 address

  • por – port number

  • protocol – IP protocol number

  • vrf_id – VRF ID

  • is_in – 1 if inside network address and port pair, 0 if outside

  • ext_host_address – external host IPv4 address

  • ext_host_port – external host port

nat44_forwarding_enable_disable(enable)

Enable/disable forwarding for NAT44

Parameters

enable – 1 for enable, 0 for disable

nat44_interface_add_del_feature(sw_if_index, is_inside=1, is_add=1)

Enable/disable NAT44 feature on the interface

Parameters
  • sw_if_index – Software index of the interface

  • is_inside – 1 if inside, 0 if outside (Default value = 1)

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_interface_add_del_output_feature(sw_if_index, is_inside=1, is_add=1)

Enable/disable NAT44 output feature on the interface

Parameters
  • sw_if_index – Software index of the interface

  • is_inside – 1 if inside, 0 if outside (Default value = 1)

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat44_lb_static_mapping_add_del_local(external_addr, external_port, local_addr, local_port, protocol, probability, vrf_id=0, is_add=1)

Add/delete NAT44 load-balancing static mapping rule backend

Parameters
  • external_addr – external IPv4 address of the service

  • external_port – external L4 port number of the service

  • local_addr – IPv4 address of the internal node

  • local_port – L4 port number of the internal node

  • protocol – IP protocol number

  • probability – probability of the internal node

  • vrf_id – VRF id of the internal node

  • is_add – 1 if add, 0 if delete

nat64_add_del_interface(sw_if_index, is_inside=1, is_add=1)

Enable/disable NAT64 feature on the interface :param sw_if_index: Index of the interface :param is_inside: 1 if inside, 0 if outside (Default value = 1) :param is_add: 1 if add, 0 if delete (Default value = 1)

nat64_add_del_interface_addr(sw_if_index, is_add=1)

Add/del NAT64 address from interface

Parameters
  • sw_if_index – Software index of the interface

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat64_add_del_prefix(prefix, plen, vrf_id=0, is_add=1)

Add/del NAT64 prefix

Parameters
  • prefix – NAT64 prefix

  • plen – NAT64 prefix length

  • vrf_id – VRF id of tenant (Default 0)

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat64_add_del_static_bib(in_ip, out_ip, in_port, out_port, protocol, vrf_id=0, is_add=1)

Add/delete S-NAT static BIB entry

Parameters
  • in_ip – Inside IPv6 address

  • out_ip – Outside IPv4 address

  • in_port – Inside port number

  • out_port – Outside port number

  • protocol – IP protocol

  • vrf_id – VRF ID (Default value = 0)

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat64_bib_dump(protocol=255)

Dump NAT64 BIB

Parameters

protocol – IP protocol (Default value = 255, all BIBs)

Returns

Dictionary of NAT64 BIB entries

nat64_st_dump(protocol=255)

Dump NAT64 session table

Parameters

protocol – IP protocol (Default value = 255, all STs)

Returns

Dictionary of NAT64 session table entries

nat66_add_del_interface(sw_if_index, is_inside=1, is_add=1)

Enable/disable NAT66 feature on the interface :param sw_if_index: Index of the interface :param is_inside: 1 if inside, 0 if outside (Default value = 1) :param is_add: 1 if add, 0 if delete (Default value = 1)

nat66_add_del_static_mapping(in_ip, out_ip, vrf_id=0, is_add=1)

Add/delete NAT66 static mapping

Parameters
  • in_ip – Inside IPv6 address

  • out_ip – Outside IPv6 address

  • vrf_id – VRF ID (Default value = 0)

  • is_add – 1 if add, 0 if delete (Default value = 1)

nat_det_add_del_map(in_addr, in_plen, out_addr, out_plen, is_add=1)

Add/delete deterministic NAT mapping

:param is_add - 1 if add, 0 if delete :param in_addr - inside IP address :param in_plen - inside IP address prefix length :param out_addr - outside IP address :param out_plen - outside IP address prefix length

nat_det_close_session_in(in_addr, in_port, ext_addr, ext_port)

Close deterministic NAT session using inside address and port

:param in_addr - inside IP address :param in_port - inside port :param ext_addr - external host IP address :param ext_port - external host port

nat_det_forward(in_addr)

Get outside address and port range from inside address

:param in_addr - inside IP address

nat_det_map_dump()

Dump deterministic NAT mappings

Returns

Dictionary of deterministic NAT mappings

nat_det_reverse(out_addr, out_port)

Get inside address from outside address and port

:param out_addr - outside IP address :param out_port - outside port

nat_det_session_dump(user_addr)

Dump deterministic NAT sessions belonging to a user

:param user_addr - inside IP address of the user :return: Dictionary of deterministic NAT sessions

nat_ha_get_listener()

Get HA listener/local configuration

nat_ha_resync(want_resync_event=1)

Resync HA (resend existing sessions to new failover) :param want_resync_event: if non-zero resync completed event sent

nat_ha_set_failover(addr, port, refresh=10)

Set HA failover (remote settings)

Parameters
  • addr – failover IP4 address

  • port – failover UDP port number

  • refresh – number of seconds after which to send session refresh

nat_ha_set_listener(addr, port, path_mtu=512)

Set HA listener (local settings)

Parameters
  • addr – local IP4 address

  • port – local UDP port number

  • path_mtu – path MTU (Default value = 512)

nat_set_mss_clamping(enable=0, mss_value=1500)

Set TCP MSS rewriting configuration

Parameters
  • enable – disable(0)/enable(1) MSS rewriting feature

  • mss_value – MSS value to be used for MSS rewriting

output_acl_set_interface(is_add, sw_if_index, ip4_table_index=4294967295, ip6_table_index=4294967295, l2_table_index=4294967295)
Parameters
  • is_add

  • sw_if_index

  • ip4_table_index – (Default value = 0xFFFFFFFF)

  • ip6_table_index – (Default value = 0xFFFFFFFF)

  • l2_table_index – (Default value = 0xFFFFFFFF)

p2p_ethernet_add(sw_if_index, remote_mac, subif_id)

Create p2p ethernet subinterface

Parameters
  • sw_if_index – main (parent) interface

  • remote_mac – client (remote) mac address

p2p_ethernet_del(sw_if_index, remote_mac)

Delete p2p ethernet subinterface

Parameters
  • sw_if_index – main (parent) interface

  • remote_mac – client (remote) mac address

pipe_delete(parent_sw_if_index)
policer_add_del(name, cir, eir, cb, eb, is_add=1, rate_type=0, round_type=0, ptype=0, color_aware=0, conform_action_type=1, conform_dscp=0, exceed_action_type=0, exceed_dscp=0, violate_action_type=0, violate_dscp=0)
ppcli(cli)

Helper method to print CLI command in case of info logging level.

Parameters

cli – CLI to execute

Returns

CLI output

pppoe_add_del_session(client_ip, client_mac, session_id=0, is_add=1, is_ipv6=0, decap_vrf_id=0)
Parameters
  • is_add – (Default value = 1)

  • is_ipv6 – (Default value = 0)

  • client_ip

  • session_id – (Default value = 0)

  • client_mac

  • decap_vrf_id – (Default value = 0)

proxy_arp_add_del(low, hi, table_id=0, is_add=1)

Config Proxy Arp Range.

Parameters
  • low_address – Start address in the rnage to Proxy for

  • hi_address – End address in the rnage to Proxy for

  • vrf_id – The VRF/table in which to proxy

proxy_arp_intfc_enable_disable(sw_if_index, is_enable=1)

Enable/Disable an interface for proxy ARP requests

Parameters
  • sw_if_index – Interface

  • enable_disable – Enable/Disable

punt_socket_deregister(port, protocol=17, is_ip4=1)

Unregister punt socket

punt_socket_dump(is_ip6=1)

Dump punt socket

punt_socket_register(port, pathname, protocol=17, header_version=1, is_ip4=1)

Register punt socket

qos_egress_map_delete(id)

QOS egress map delete

qos_egress_map_update(id, outputs)

QOS egress map update

qos_mark_enable_disable(sw_if_index, output_source, map_id, enable)

QOS Mark Enable/Disable

register_hook(hook)

Replace hook registration with new hook

Parameters

hook

session_enable_disable(is_enabled)
set_ipfix_exporter(collector_address, src_address, path_mtu, template_interval, vrf_id=0, collector_port=4739, udp_checksum=0)
sr_localsid_add_del(localsid, behavior, nh_addr4, nh_addr6, is_del=0, end_psp=0, sw_if_index=4294967295, vlan_index=0, fib_table=0)

Add/del IPv6 SR local-SID.

Parameters
  • localsid

  • behavior – END=1; END.X=2; END.DX2=4; END.DX6=5;

  • behavior – END.DX4=6; END.DT6=7; END.DT4=8

  • nh_addr4

  • nh_addr6

  • is_del – (Default value = 0)

  • end_psp – (Default value = 0)

  • sw_if_index – (Default value = 0xFFFFFFFF)

  • vlan_index – (Default value = 0)

  • fib_table – (Default value = 0)

sr_mpls_policy_add(bsid, weight, type, segments)
sr_mpls_policy_del(bsid)
sr_policy_add(bsid_addr, weight=1, is_encap=1, type=0, fib_table=0, n_segments=0, segments=[])
Parameters
  • bsid_addr – bindingSID of the SR Policy

  • weight – weight of the sid list. optional. (default: 1)

  • is_encap – (bool) whether SR policy should Encap or SRH insert (default: Encap)

  • type – type/behavior of the SR policy. (default or spray) (default: default)

  • fib_table – VRF where to install the FIB entry for the BSID (default: 0)

  • n_segments – number of segments (default: 0)

  • segments – a vector of IPv6 address composing the segment list (default: [])

sr_policy_del(bsid_addr, sr_policy_index=0)
Parameters
  • bsid – bindingSID of the SR Policy

  • sr_policy_index – index of the sr policy (default: 0)

sr_steering_add_del(is_del, bsid_addr, sr_policy_index, table_id, prefix_addr, mask_width, sw_if_index, traffic_type)

Steer traffic L2 and L3 traffic through a given SR policy

Parameters
  • is_del – delete or add

  • bsid_addr – bindingSID of the SR Policy (alt to sr_policy_index)

  • sr_policy – is the index of the SR Policy (alt to bsid)

  • table_id – is the VRF where to install the FIB entry for the BSID

  • prefix_addr – is the IPv4/v6 address for L3 traffic type

  • mask_width – is the mask for L3 traffic type

  • sw_if_index – is the incoming interface for L2 traffic

  • traffic_type – type of traffic (IPv4: 4, IPv6: 6, L2: 2)

svs_enable_disable(af, table_id, sw_if_index, is_enable=1)
svs_route_add_del(table_id, prefix, src_table_id, is_add=1)
svs_table_add_del(af, table_id, is_add=1)
sw_interface_set_mac_address(sw_if_index, mac)
udp_encap_add(src_ip, dst_ip, src_port, dst_port, table_id=0)

Add a GRE tunnel :param src_ip: :param dst_ip: :param src_port: :param dst_port: :param outer_fib_id: (Default value = 0)

vxlan_gbp_tunnel_add_del(src, dst, mcast_sw_if_index=4294967295, is_add=1, is_ipv6=0, encap_table_id=0, vni=0, mode=1, instance=4294967295)
Parameters
  • dst_addr

  • src_addr

  • is_add – (Default value = 1)

  • is_ipv6 – (Default value = 0)

  • encap_table_id – (Default value = 0)

  • decap_next_index – (Default value = 0xFFFFFFFF)

  • mcast_sw_if_index – (Default value = 0xFFFFFFFF)

  • vni – (Default value = 0)

  • instance – (Default value = 0xFFFFFFFF)

vxlan_gbp_tunnel_dump(sw_if_index=4294967295)
vxlan_gpe_add_del_tunnel(src_addr, dst_addr, mcast_sw_if_index=4294967295, is_add=1, is_ipv6=0, encap_vrf_id=0, decap_vrf_id=0, protocol=3, vni=0)
Parameters
  • local

  • remote

  • is_add – (Default value = 1)

  • is_ipv6 – (Default value = 0)

  • encap_vrf_id – (Default value = 0)

  • decap_vrf_id – (Default value = 0)

  • mcast_sw_if_index – (Default value = 0xFFFFFFFF)

  • protocol – (Default value = 3)

  • vni – (Default value = 0)

wait_for_event(timeout, name=None)

Wait for and return next event.

want_bfd_events(enable_disable=1)
want_dhcp6_pd_reply_events(enable_disable=1)
want_dhcp6_reply_events(enable_disable=1)
want_igmp_events(enable=1)
want_interface_events(enable_disable=1)
want_ip4_arp_events(enable_disable=1, ip='0.0.0.0')
want_ip6_nd_events(enable_disable=1, ip='::')
want_ip6_ra_events(enable_disable=1)
want_l2_macs_events(enable_disable=1, scan_delay=0, max_macs_in_event=0, learn_limit=0)