Network Interface configuration

Overview

// typedefs

typedef struct tapi_cfg_base_loadavg tapi_cfg_base_loadavg;

// enums

enum te_interface_kind;

// structs

struct tapi_cfg_base_loadavg;

// global functions

int tapi_cfg_get_son_mac(const char* father, const char* subid, const char* name, uint8_t* p_mac);
int tapi_cfg_get_hwaddr(const char* ta, const char* ifname, void* hwaddr, size_t* hwaddr_len);
te_errno tapi_cfg_set_bcast_hwaddr(const char* ta, const char* ifname, const void* hwaddr, unsigned int hwaddr_len);
int tapi_cfg_get_bcast_hwaddr(const char* ta, const char* ifname, void* hwaddr, size_t* hwaddr_len);
te_errno tapi_cfg_set_hwaddr(const char* ta, const char* ifname, const void* hwaddr, unsigned int hwaddr_len);
te_errno tapi_cfg_get_if_kind(const char* ta, const char* ifname, te_interface_kind* kind);
te_errno tapi_cfg_get_if_parent(const char* ta, const char* ifname, char* parent_ifname, size_t len);
te_errno tapi_cfg_get_if_last_ancestor(const char* ta, const char* ifname, char* ancestor_ifname, size_t len);
int tapi_cfg_base_if_get_mac(const char* oid, uint8_t* mac);
int tapi_cfg_base_if_set_mac(const char* oid, const uint8_t* mac);
int tapi_cfg_base_if_get_bcast_mac(const char* oid, uint8_t* bcast_mac);
int tapi_cfg_base_if_set_bcast_mac(const char* oid, const uint8_t* bcast_mac);
int tapi_cfg_base_if_add_mcast_mac(const char* oid, const uint8_t* mcast_mac);
int tapi_cfg_base_if_del_mcast_mac(const char* oid, const uint8_t* mcast_mac);
int tapi_cfg_base_if_get_link_addr(const char* ta, const char* dev, struct sockaddr* link_addr);
int tapi_cfg_base_if_get_mtu(const char* oid, unsigned int* p_mtu);
int tapi_cfg_base_add_net_addr(const char* oid, const struct sockaddr* addr, int prefix, bool set_bcast, cfg_handle* cfg_hndl);
static int tapi_cfg_base_if_add_net_addr(const char* ta, const char* ifname, const struct sockaddr* addr, int prefix, bool set_bcast, cfg_handle* cfg_hndl);
te_errno tapi_cfg_del_if_ip4_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save);
te_errno tapi_cfg_save_del_if_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count, int addr_fam);
te_errno tapi_cfg_save_del_if_ip4_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count);
te_errno tapi_cfg_del_if_ip6_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save);
te_errno tapi_cfg_save_del_if_ip6_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count);
te_errno tapi_cfg_restore_if_ip4_addresses(const char* ta, const char* if_name, struct sockaddr* saved_addrs, int* saved_prefixes, bool* saved_broadcasts, int saved_count);
te_errno tapi_cfg_restore_if_addresses(const char* ta, const char* if_name, struct sockaddr* saved_addrs, int* saved_prefixes, bool* saved_broadcasts, int saved_count);
static te_errno tapi_cfg_base_if_up(const char* ta, const char* iface);
static te_errno tapi_cfg_base_if_down(const char* ta, const char* iface);
te_errno tapi_cfg_base_if_await_link_up(const char* ta, const char* iface, unsigned int nb_attempts, unsigned int wait_int_ms, unsigned int after_up_ms);
static te_errno tapi_cfg_base_if_arp_enable(const char* ta, const char* iface);
static te_errno tapi_cfg_base_if_arp_disable(const char* ta, const char* iface);
static te_errno tapi_cfg_base_if_set_promisc(const char* ta, const char* ifname, bool enable);
static te_errno tapi_cfg_base_if_get_promisc(const char* ta, const char* ifname, bool* enabled);
te_errno tapi_cfg_base_if_del_vlan(const char* ta, const char* if_name, uint16_t vid);
te_errno tapi_cfg_base_if_add_vlan(const char* ta, const char* if_name, uint16_t vid, char** vlan_ifname);
static te_errno tapi_cfg_base_if_add_get_vlan(const char* ta, const char* if_name, uint16_t vid, char** vlan_ifname);
te_errno tapi_cfg_base_if_add_rsrc(const char* ta, const char* ifname);
te_errno tapi_cfg_base_if_check_add_rsrc(const char* ta, const char* ifname);
te_errno tapi_cfg_base_if_del_rsrc(const char* ta, const char* ifname);
te_errno tapi_cfg_base_if_add_macvlan(const char* ta, const char* link, const char* ifname, const char* mode);
te_errno tapi_cfg_base_if_del_macvlan(const char* ta, const char* link, const char* ifname);
te_errno tapi_cfg_base_if_get_macvlan_mode(const char* ta, const char* link, const char* ifname, char** mode);
te_errno tapi_cfg_base_if_set_macvlan_mode(const char* ta, const char* link, const char* ifname, const char* mode);
te_errno tapi_cfg_base_if_add_ipvlan(const char* ta, const char* link, const char* ifname, const char* mode, const char* flag);
te_errno tapi_cfg_base_if_del_ipvlan(const char* ta, const char* link, const char* ifname);
te_errno tapi_cfg_base_if_get_ipvlan_mode(const char* ta, const char* link, const char* ifname, char** mode, char** flag);
te_errno tapi_cfg_base_if_set_ipvlan_mode(const char* ta, const char* link, const char* ifname, const char* mode, const char* flag);
te_errno tapi_cfg_base_if_add_veth(const char* ta, const char* ifname, const char* peer);
te_errno tapi_cfg_base_if_del_veth(const char* ta, const char* ifname);
te_errno tapi_cfg_base_if_get_veth_peer(const char* ta, const char* ifname, char** peer);
te_errno tapi_cfg_base_if_get_mtu_u(const char* agent, const char* interface, int* mtu);
te_errno tapi_cfg_base_if_set_mtu_ext(const char* agent, const char* interface, int mtu, int* old_mtu, bool fast);
static te_errno tapi_cfg_base_if_set_mtu(const char* agent, const char* interface, int mtu, int* old_mtu);
te_errno tapi_cfg_base_if_set_mtu_leastwise(const char* ta, const char* ifname, unsigned int mtu);
te_errno tapi_cfg_base_if_down_up(const char* agent, const char* interface);
te_errno tapi_cfg_base_get_loadavg(const char* agent, tapi_cfg_base_loadavg* loadavg);
te_errno tapi_cfg_base_get_proc_number(const char* agent, uint64_t* runnable, uint64_t* total);
te_errno tapi_cfg_base_get_latest_pid(const char* agent, uint64_t* latest_pid);

// macros

#define TEST_GET_TE_INTERFACE_KIND_PARAM(_var_name)
#define TEST_TE_INTERFACE_KIND_PARAM(_name)
#define TE_INTERFACE_KIND_MAPPING_LIST

Detailed Documentation

Typedefs

typedef struct tapi_cfg_base_loadavg tapi_cfg_base_loadavg

Storage for getting loadavg stats

Global Functions

int tapi_cfg_get_son_mac(const char* father, const char* subid, const char* name, uint8_t* p_mac)

Get son of configuration node with MAC address value.

Parameters:

father

father’s OID

subid

son subidentifier

name

name of the son or “” (empty string)

p_mac

location for MAC address (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_get_hwaddr(const char* ta, const char* ifname, void* hwaddr, size_t* hwaddr_len)

Returns hardware address of specified interface on a particular test agent.

Parameters:

ta

Test agent name

ifname

Interface name whose hardware address is obtained

hwaddr

Hardware address - link-layer address (OUT)

hwaddr_len

Length of ‘hwaddr’ buffer (IN/OUT)

0

on success

TE_EMSGSIZE

Buffer is too short to fit the hardware address

Returns:

Status of the oprtation

te_errno tapi_cfg_set_bcast_hwaddr(const char* ta, const char* ifname, const void* hwaddr, unsigned int hwaddr_len)

Sets broadcast hardware address of specified interface on a particular test agent.

Parameters:

ta

Test agent name

ifname

Interface name whose hardware address should be set

hwaddr

Hardware address - link-layer address

hwaddr_len

Length of ‘hwaddr’

0

on success

TE_EMSGSIZE

Buffer is too short to fit the hardware address

Returns:

Status of the oprtation

int tapi_cfg_get_bcast_hwaddr(const char* ta, const char* ifname, void* hwaddr, size_t* hwaddr_len)

Returns broadcast hardware address of specified interface on a particular test agent.

Parameters:

ta

Test agent name

ifname

Interface name whose hardware address is obtained

hwaddr

Hardware address - link-layer address (OUT)

hwaddr_len

Length of ‘hwaddr’ buffer (IN/OUT)

0

on success

TE_EMSGSIZE

Buffer is too short to fit the hardware address

Returns:

Status of the oprtation

te_errno tapi_cfg_set_hwaddr(const char* ta, const char* ifname, const void* hwaddr, unsigned int hwaddr_len)

Sets hardware address of specified interface on a particular test agent.

Parameters:

ta

Test agent name

ifname

Interface name whose hardware address should be set

hwaddr

Hardware address - link-layer address

hwaddr_len

Length of ‘hwaddr’

0

on success

TE_EMSGSIZE

Buffer is too short to fit the hardware address

Returns:

Status of the oprtation

te_errno tapi_cfg_get_if_kind(const char* ta, const char* ifname, te_interface_kind* kind)

Get kind of an interface.

Parameters:

ta

Test agent name.

ifname

Interface name.

kind

Where to save the interface type.

Returns:

Status code.

te_errno tapi_cfg_get_if_parent(const char* ta, const char* ifname, char* parent_ifname, size_t len)

Get name of an interface on which the given interface is based.

Parameters:

ta

Test agent name.

ifname

Interface name.

parent_ifname

Where to save the name of the “parent” interface.

len

Available space in parent_ifname.

Returns:

Status code.

te_errno tapi_cfg_get_if_last_ancestor(const char* ta, const char* ifname, char* ancestor_ifname, size_t len)

Get name of the last known ancestor of a given interface (for example, if interface is eth3.macvlan.100, this function should return “eth3”).

If the interface has no ancestors, this function returns its name.

Parameters:

ta

Test agent name.

ifname

Interface name.

ancestor_ifname

Where to save the name of the “ancestor” interface.

len

Available space in ancestor_ifname.

Returns:

Status code.

int tapi_cfg_base_if_get_mac(const char* oid, uint8_t* mac)

Get MAC address of TA interface.

Parameters:

oid

instance OID of TA interface

mac

location for MAC address (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_base_if_set_mac(const char* oid, const uint8_t* mac)

Set MAC address of TA interface.

Parameters:

oid

instance OID of TA interface

mac

location of MAC address to be set (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_base_if_get_bcast_mac(const char* oid, uint8_t* bcast_mac)

Get broadcast MAC address of TA interface.

Parameters:

oid

instance OID of TA interface

bcast_mac

location for broadcast MAC address (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_base_if_set_bcast_mac(const char* oid, const uint8_t* bcast_mac)

Set broadcast MAC address of TA interface.

Parameters:

oid

instance OID of TA interface

bcast_mac

location of broadcast MAC address to be set (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_base_if_add_mcast_mac(const char* oid, const uint8_t* mcast_mac)

Add multicast MAC address to a TA interface

Parameters:

oid

instance OID of TA interface

mcast_mac

multicast MAC address to be added (at least ETHER_ADDR_LEN)

Returns:

Status code.

int tapi_cfg_base_if_del_mcast_mac(const char* oid, const uint8_t* mcast_mac)

Delete multicast MAC address from a TA interface

Parameters:

oid

instance OID of TA interface

mcast_mac

multicast MAC address to be deleted (at least ETHER_ADDR_LEN) If NULL, then all multicast addresses are deleted

Returns:

Status code.

int tapi_cfg_base_if_get_link_addr(const char* ta, const char* dev, struct sockaddr* link_addr)

Get link address of TA interface.

Parameters:

ta

Test Agent

dev

interface name

link_addr

Location for link address

Returns:

Status code

int tapi_cfg_base_if_get_mtu(const char* oid, unsigned int* p_mtu)

Get MTU (layer 2 payload) of the Test Agent interface.

Parameters:

oid

TA interface oid, e.g. /agent:A/interface:eth0

p_mtu

location for MTU

Returns:

Status code.

int tapi_cfg_base_add_net_addr(const char* oid, const struct sockaddr* addr, int prefix, bool set_bcast, cfg_handle* cfg_hndl)

Add network address (/net_addr:).

Parameters:

oid

TA interface oid, e.g. /agent:A/interface:eth0

addr

Address to add

prefix

Address prefix length (0 - default, -1 - do not set)

set_bcast

Set broadcast address or not

cfg_hndl

Configurator handle of the new address

TE_EAFNOSUPPORT

Address family is not supported

TE_EEXIST

Address already exist

Returns:

Status code.

static int tapi_cfg_base_if_add_net_addr(const char* ta, const char* ifname, const struct sockaddr* addr, int prefix, bool set_bcast, cfg_handle* cfg_hndl)

Wrapper over tapi_cfg_base_add_net_addr() function.

Parameters:

ta

Test agent name

ifname

Interface name on the Agent

addr

Address to add

prefix

Address prefix length (0 - default, -1 - do not set)

set_bcast

Set broadcast address or not

cfg_hndl

Configurator handle of the new address

Returns:

See return value of tapi_cfg_base_add_net_addr()

te_errno tapi_cfg_del_if_ip4_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save)

Delete all IPv4 addresses on a given interface, except of addr_to_save or the first address in acquired list.

Parameters:

ta

Test Agent name

if_name

interface name

addr_to_save

address to save on interface. If this parameter is NULL, then save the first address in address list returned by ‘ip addr list’ output. If one need to delete all addresses on interface, he have to pass sockaddr with family ‘AF_INET’ and address ‘INADDR_ANY’.

Returns:

Status code

te_errno tapi_cfg_save_del_if_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count, int addr_fam)

Save and delete addresses of chosen address family on a given interface, except for addr_to_save or the first address in acquired list.

Parameters:

ta

Test Agent name

if_name

interface name

addr_to_save

address to save on the interface. If this parameter is NULL, then save the first address in address list returned by ip addr list output. If one needs to delete all addresses on the interface, one should pass sockaddr with family from addr_fam and address INADDR_ANY.

save_first

If addr_to_save is NULL but save_first is true, do not delete first address from acquired list.

saved_addrs

Where address of array of deleted addresses should be placed

saved_prefixes

Where address of array of deleted addresses’ prefixes should be placed

saved_broadcasts

Where address of array of deleted addresses’ broadcasts should be placed

saved_count

Where count of saved and deleted addresses should be placed

addr_fam

Address family of deleted addresses

Returns:

Status code

te_errno tapi_cfg_save_del_if_ip4_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count)

Save and delete all IPv4 addresses on a given interface, except of addr_to_save or the first address in acquired list (if save_first is true).

Parameters:

ta

Test Agent name

if_name

interface name

addr_to_save

address to save on interface. If this parameter is NULL, then save the first address in address list returned by ‘ip addr list’ output. If one need to delete all addresses on interface, he has to pass sockaddr with family ‘AF_INET’ and address ‘INADDR_ANY’.

save_first

If addr_to_save is NULL but save_first is true, do not delete first address from acquired list.

saved_addrs

Where address of array of deleted addresses should be placed

saved_prefixes

Where address of array of deleted addresses’ prefixes should be placed

saved_broadcasts

Where address of array of deleted addresses’ broadcasts should be placed

saved_count

Where count of saved and deleted addresses should be placed

Returns:

Status code

te_errno tapi_cfg_del_if_ip6_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save)

Delete all IPv6 addresses on a given interface, except for addr_to_save or the first address in acquired list.

Parameters:

ta

Test Agent name

if_name

interface name

addr_to_save

address to save on interface. If this parameter is NULL, then save the first address in address list returned by ‘ip addr list’ output. If one need to delete all addresses on interface, he has to pass sockaddr with family AF_INET6 and address INADDR_ANY.

Returns:

Status code

te_errno tapi_cfg_save_del_if_ip6_addresses(const char* ta, const char* if_name, const struct sockaddr* addr_to_save, bool save_first, struct sockaddr** saved_addrs, int** saved_prefixes, bool** saved_broadcasts, int* saved_count)

Save and delete all IPv6 addresses on a given interface, except for addr_to_save or the first address in acquired list (if save_first is true).

Parameters:

ta

Test Agent name

if_name

interface name

addr_to_save

address to save on interface. If this parameter is NULL, then save the first address in address list returned by ‘ip addr list’ output. If one need to delete all addresses on interface, he has to pass sockaddr with family AF_INET6 and address INADDR_ANY.

save_first

If addr_to_save is NULL but save_first is true, do not delete first address from acquired list.

saved_addrs

Where address of array of deleted addresses should be placed

saved_prefixes

Where address of array of deleted addresses’ prefixes should be placed

saved_broadcasts

Where address of array of deleted addresses’ broadcasts should be placed

saved_count

Where count of saved and deleted addresses should be placed

Returns:

Status code

te_errno tapi_cfg_restore_if_ip4_addresses(const char* ta, const char* if_name, struct sockaddr* saved_addrs, int* saved_prefixes, bool* saved_broadcasts, int saved_count)

Restore previously removed IPv4 addresses on a given interface

Deprecated It is same as function tapi_cfg_restore_if_addresses

Parameters:

ta

Test Agent name

if_name

interface name

saved_addrs

Where address of array of deleted addresses should be placed

saved_prefixes

Where address of array of deleted addresses’ prefixes should be placed

saved_broadcasts

Where address of array of deleted addresses’ broadcasts should be placed

saved_count

Where count of saved and deleted addresses should be placed

Returns:

Status code

te_errno tapi_cfg_restore_if_addresses(const char* ta, const char* if_name, struct sockaddr* saved_addrs, int* saved_prefixes, bool* saved_broadcasts, int saved_count)

Restore previously removed addresses on a given interface

Parameters:

ta

Test Agent name

if_name

interface name

saved_addrs

Pointer to array of deleted addresses

saved_prefixes

Pointer to array of deleted addresses’ prefixes

saved_broadcasts

Pointer to array of deleted addresses’ broadcasts

saved_count

Count of saved and deleted addresses

Returns:

Status code

te_errno tapi_cfg_base_if_await_link_up(const char* ta, const char* iface, unsigned int nb_attempts, unsigned int wait_int_ms, unsigned int after_up_ms)

Await for interface to become up.

Parameters:

ta

Test Agent name

iface

Interface name

nb_attempts

The number of attempts to check link status

wait_int_ms

The amount of time which shall elapse prior attempt (ms)

after_up_ms

The amount of time which shall elapse after link UP has been detected in order to wait for the other resources to become ready (ms)

Returns:

Status code

static te_errno tapi_cfg_base_if_set_promisc(const char* ta, const char* ifname, bool enable)

Set promiscuous mode for an interface.

Parameters:

ta

Test Agent name.

ifname

Interface name.

enable

Whether to enable or to disable promiscuous mode.

Returns:

Status code.

static te_errno tapi_cfg_base_if_get_promisc(const char* ta, const char* ifname, bool* enabled)

Get promiscuous mode for an interface.

Parameters:

ta

Test Agent name.

ifname

Interface name.

enabled

Will be set to true if promiscuous mode is enabled and to false otherwise.

Returns:

Status code.

te_errno tapi_cfg_base_if_del_vlan(const char* ta, const char* if_name, uint16_t vid)

Delete VLAN interface.

Parameters:

ta

Test Agent name

if_name

interface name

vid

VLAN ID to create

Returns:

Status code

te_errno tapi_cfg_base_if_add_vlan(const char* ta, const char* if_name, uint16_t vid, char** vlan_ifname)

Add VLAN interface and get its name. The new interface is grabbed just after creation.

MTU of the new VLAN interface is OS-dependent. For example, Linux makes this MTU equal to the master interface MTU; Solaris creates VLAN interface with maximum allowed MTU independently from the master interface settings. Caller should care about MTU himself.

Parameters:

ta

Test Agent name

if_name

interface name

vid

VLAN ID to create

vlan_ifname

pointer to return the name of new interface

Returns:

Status code

static te_errno tapi_cfg_base_if_add_get_vlan(const char* ta, const char* if_name, uint16_t vid, char** vlan_ifname)

Delete VLAN if it exists and add VLAN interface and get its name if possible.

MTU of the new VLAN interface is OS-dependent. For example, Linux makes this MTU equal to the master interface MTU; Solaris creates VLAN interface with maximum allowed MTU independently from the master interface settings. Caller should care about MTU himself.

Parameters:

ta

Test Agent name

if_name

interface name

vid

VLAN ID to get the name

vlan_ifname

pointer to return the name of new interface

Returns:

Status code

te_errno tapi_cfg_base_if_add_rsrc(const char* ta, const char* ifname)

Add interface ifname to the agent ta resources.

Returns:

Status code

te_errno tapi_cfg_base_if_check_add_rsrc(const char* ta, const char* ifname)

Add interface ifname to the agent ta resources, if it is not done already.

Parameters:

ta

Test Agent name.

ifname

Interface name.

Returns:

Status code.

te_errno tapi_cfg_base_if_del_rsrc(const char* ta, const char* ifname)

Delete interface ifname from the agent ta resources.

Returns:

Status code

te_errno tapi_cfg_base_if_add_macvlan(const char* ta, const char* link, const char* ifname, const char* mode)

Add MAC VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

MAC VLAN interface name

mode

MAC VLAN mode or NULL to use default

Returns:

Status code

te_errno tapi_cfg_base_if_del_macvlan(const char* ta, const char* link, const char* ifname)

Delete MAC VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

MAC VLAN interface name

Returns:

Status code

te_errno tapi_cfg_base_if_get_macvlan_mode(const char* ta, const char* link, const char* ifname, char** mode)

Get MAC VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

MAC VLAN interface name

mode

MAC VLAN mode location

Returns:

Status code

te_errno tapi_cfg_base_if_set_macvlan_mode(const char* ta, const char* link, const char* ifname, const char* mode)

Set MAC VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

MAC VLAN interface name

mode

MAC VLAN mode

Returns:

Status code

te_errno tapi_cfg_base_if_add_ipvlan(const char* ta, const char* link, const char* ifname, const char* mode, const char* flag)

Add IP VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

IP VLAN interface name

mode

IP VLAN mode or NULL to use default mode value TAPI_CFG_IPVLAN_MODE_DEFAULT

flag

IP VLAN flag or NULL to use default flag value TAPI_CFG_IPVLAN_FLAG_DEFAULT

Returns:

Status code

te_errno tapi_cfg_base_if_del_ipvlan(const char* ta, const char* link, const char* ifname)

Delete IP VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

IP VLAN interface name

Returns:

Status code

te_errno tapi_cfg_base_if_get_ipvlan_mode(const char* ta, const char* link, const char* ifname, char** mode, char** flag)

Get IP VLAN interface.

: values mode and flag are allocated by this function and should be freed by user

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

IP VLAN interface name

mode

IP VLAN mode location

flag

IP VLAN flag location

Returns:

Status code

te_errno tapi_cfg_base_if_set_ipvlan_mode(const char* ta, const char* link, const char* ifname, const char* mode, const char* flag)

Set IP VLAN interface.

Parameters:

ta

Test Agent name

link

Parent (link) interface name

ifname

IP VLAN interface name

mode

IP VLAN mode or NULL to use default mode value TAPI_CFG_IPVLAN_MODE_DEFAULT

flag

IP VLAN flag or NULL to use default flag value TAPI_CFG_IPVLAN_FLAG_DEFAULT

Returns:

Status code

te_errno tapi_cfg_base_if_add_veth(const char* ta, const char* ifname, const char* peer)

Add veth interfaces pair.

Parameters:

ta

Test Agent name

ifname

The interface name

peer

The peer interface name

Returns:

Status code

te_errno tapi_cfg_base_if_del_veth(const char* ta, const char* ifname)

Delete veth interfaces pair.

Parameters:

ta

Test Agent name

ifname

The interface name

Returns:

Status code

te_errno tapi_cfg_base_if_get_veth_peer(const char* ta, const char* ifname, char** peer)

Get veth peer interface name.

Parameters:

ta

Test Agent name

ifname

The interface name

peer

The peer interface name (allocated from the heap)

Returns:

Status code

te_errno tapi_cfg_base_if_get_mtu_u(const char* agent, const char* interface, int* mtu)

It is the same function as tapi_cfg_base_if_get_mtu, but it is more user-friendly to use it in tests.

Parameters:

agent

Agent name

interface

Interface name

mtu

Location for MTU value

Returns:

Status code

te_errno tapi_cfg_base_if_set_mtu_ext(const char* agent, const char* interface, int mtu, int* old_mtu, bool fast)

Set new MTU value.

Consider using tapi_cfg_base_if_set_mtu_leastwise() instead.

Parameters:

agent

Agent name

interface

Interface name

mtu

MTU value

old_mtu

Location for old MTU value or NULL

fast

Don’t sleep long time after interface restart if true

Returns:

Status code

static te_errno tapi_cfg_base_if_set_mtu(const char* agent, const char* interface, int mtu, int* old_mtu)

Set new MTU value.

Consider using tapi_cfg_base_if_set_mtu_leastwise() instead.

Parameters:

agent

Agent name

interface

Interface name

mtu

MTU value

old_mtu

Location for old MTU value or NULL

Returns:

Status code

te_errno tapi_cfg_base_if_set_mtu_leastwise(const char* ta, const char* ifname, unsigned int mtu)

Ensure that interface ifname on the host running TA ta can receive frames up to MTU mtu. It increases the interface MTU if required, but never decreases.

Parameters:

ta

Agent name

ifname

Interface name

mtu

MTU value

Returns:

Status code.

te_errno tapi_cfg_base_if_down_up(const char* agent, const char* interface)

Down up interface.

Caller should take care about wait for the interface to be raised.

Parameters:

agent

Agent name

interface

Interface name

Returns:

Status code

te_errno tapi_cfg_base_get_loadavg(const char* agent, tapi_cfg_base_loadavg* loadavg)

Get loadavg stats from a given agent.

Parameters:

agent

agent name

loadavg

resulting loadavg stats

Returns:

status code

te_errno tapi_cfg_base_get_proc_number(const char* agent, uint64_t* runnable, uint64_t* total)

Get kernel scheduler figures from a given agent.

Parameters:

agent

agent name

runnable

number of runnable processes

total

total number of processes

Returns:

status code

te_errno tapi_cfg_base_get_latest_pid(const char* agent, uint64_t* latest_pid)

Get latest PID from a given agent.

Parameters:

agent

agent name

latest_pid

obtained PID pointer

Returns:

status code

Macros

#define TEST_GET_TE_INTERFACE_KIND_PARAM(_var_name)

Get value of a test parameter of type te_interface_kind. Should be used like te_interface_kind if_kind; TEST_GET_TE_INTERFACE_KIND_PARAM(if_kind);

Parameters:

_var_name

Parameter name (should be the same as name of the variable in which obtained value is stored).

#define TEST_TE_INTERFACE_KIND_PARAM(_name)

Get value of a test parameter of type te_interface_kind. Should be used like te_interface_kind var; var = TEST_TE_INTERFACE_KIND_PARAM(if_kind)

Parameters:

_name

Parameter name

#define TE_INTERFACE_KIND_MAPPING_LIST

Mapping list for TEST_GET_ENUM_PARAM