2.104. vpp_papi_provider module¶
-
exception
vpp_papi_provider.
CliFailedCommandError
¶ Bases:
Exception
cli command failed.
-
exception
vpp_papi_provider.
CliSyntaxError
¶ Bases:
Exception
cli command had a syntax error.
-
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, numa_only, use_custom_mac, mac_address='', interface_id=4294967295)¶ - Parameters
mode – mode
lb – load balance
numa_only – tx on local numa node for lacp mode
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, dscp=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
-
factory
(name, apifn)¶
-
gbp_bridge_domain_add
(bd_id, rd_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_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, flags)¶ 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, scope, 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_tunnel_add_del
(src, dst, outer_fib_id=0, tunnel_type=0, instance=4294967295, session_id=0, is_add=1)¶ 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
(table_id, prefix, e_flags, rpf_id, paths, is_add=1, is_multipath=1)¶ IP Multicast Route add/del
-
ip_mroute_dump
(table_id, is_ip6=False)¶
-
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)¶
-
ip_route_dump
(table_id, is_ip6=False)¶
-
ip_table_add_del
(table_id, is_add=1, is_ipv6=0)¶ :param table_id :param is_add: (Default value = 1) :param is_ipv6: (Default value = 0)
-
ip_table_dump
()¶
-
ipsec_backend_dump
()¶
-
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, salt=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, salt=0, anti_replay=1, renumber=0, udp_encap=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)
-
mfib_signal_dump
()¶
-
mpls_ip_bind_unbind
(label, prefix, table_id=0, ip_table_id=0, is_bind=1)¶
-
mpls_route_add_del
(table_id, label, eos, eos_proto, is_multicast, paths, is_add, is_multipath)¶ MPLS Route add/del
-
mpls_route_dump
(table_id)¶
-
mpls_table_add_del
(table_id, is_add=1)¶ :param table_id :param is_add: (Default value = 1)
-
mpls_table_dump
()¶
-
mpls_tunnel_add_del
(tun_sw_if_index, paths, is_add=1, l2_only=0, is_multicast=0)¶
-
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
(reg)¶ Unregister punt socket
-
punt_socket_register
(reg, pathname, header_version=1)¶ Register punt socket
-
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)
-
udp_encap_del
(id)¶
-
udp_encap_dump
()¶
-
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)¶
-
want_udp_encap_stats
(enable=1)¶
-