Agent namespaces configuration

Overview

Definition of test API for linux namespaces configuration model (doc/cm/cm_namespace.xml). More…

// global functions

te_errno tapi_netns_add_rsrc(const char* ta, const char* ns_name);
te_errno tapi_netns_del_rsrc(const char* ta, const char* ns_name);
te_errno tapi_netns_add(const char* ta, const char* ns_name);
te_errno tapi_netns_del(const char* ta, const char* ns_name);
te_errno tapi_netns_if_set(const char* ta, const char* ns_name, const char* if_name);
te_errno tapi_netns_if_unset(const char* ta, const char* ns_name, const char* if_name);
te_errno tapi_netns_create_ns_with_net_channel(const char* ta, const char* ns_name, const char* veth1, const char* veth2, const char* ctl_if, int rcfport);
te_errno tapi_netns_add_ta(const char* host, const char* ns_name, const char* ta_name, const char* ta_type, int rcfport, const char* ta_conn, const char* ld_preload, te_bool ext_rcf_listener);
te_errno tapi_netns_create_ns_with_macvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* macvlan_if, char* addr, size_t addr_len);
te_errno tapi_netns_destroy_ns_with_macvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* macvlan_if);
te_errno tapi_netns_create_ns_with_ipvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* ipvlan_if, char* addr, size_t addr_len);
te_errno tapi_netns_destroy_ns_with_ipvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* ipvlan_if);

Detailed Documentation

Definition of test API for linux namespaces configuration model (doc/cm/cm_namespace.xml).

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Global Functions

te_errno tapi_netns_add_rsrc(const char* ta, const char* ns_name)

Add network namespace ns_name to the agent ta resources.

Returns:

Status code.

te_errno tapi_netns_del_rsrc(const char* ta, const char* ns_name)

Delete network namespace ns_name from the agent ta resources.

Returns:

Status code.

te_errno tapi_netns_add(const char* ta, const char* ns_name)

Add network namespace ns_name to agent ta and grab it as the resource.

Returns:

Status code.

te_errno tapi_netns_del(const char* ta, const char* ns_name)

Delete network namespace ns_name from the agent ta and from its reources.

Returns:

Status code.

te_errno tapi_netns_if_set(const char* ta, const char* ns_name, const char* if_name)

Move network interface if_name to namespace ns_name.

Status code.

Parameters:

ta

Test agent.

ns_name

The namespace name.

if_name

The interface name.

te_errno tapi_netns_if_unset(const char* ta, const char* ns_name, const char* if_name)

Move network interface if_name from namespace ns_name.

Status code.

Parameters:

ta

Test agent.

ns_name

The namespace name.

if_name

The interface name.

te_errno tapi_netns_create_ns_with_net_channel(const char* ta, const char* ns_name, const char* veth1, const char* veth2, const char* ctl_if, int rcfport)

Create network namespace and configure control network channel using veth interfaces and iptables to route control traffic.

Parameters:

ta

Test agent name

ns_name

The network namespace name

veth1

Veth interface name

veth2

Veth interface peer name

ctl_if

Control interface name on the test agent

rcfport

Port number to communicate with RCF

Returns:

Status code.

te_errno tapi_netns_add_ta(const char* host, const char* ns_name, const char* ta_name, const char* ta_type, int rcfport, const char* ta_conn, const char* ld_preload, te_bool ext_rcf_listener)

Add new test agent located in the specified network namespace ns_name.

Parameters:

host

The target hostname

ns_name

The network namespace name

ta_name

The test agent name

ta_type

The test agent type

rcfport

Port number to communicate with RCF

ta_conn

Connection hostname or address or NULL

ld_preload

The LD_PRELOAD variable or NULL

ext_rcf_listener

If TRUE, create listener socket for accepting RCF connection before exec(ta). Such socket will be able to accept connections via interfaces from default network namespace, no additional routes or interfaces in the new namespace will be required.

Returns:

Status code.

te_errno tapi_netns_create_ns_with_macvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* macvlan_if, char* addr, size_t addr_len)

Create network namespace and configure control network channel using auxiliary macvlan interface. IP address is obtained using dhclient.

Parameters:

ta

Test agent name

ns_name

The network namespace name

ctl_if

Control interface name on the test agent

macvlan_if

MAC VLAN interface name

addr

Obtained IP address

addr_len

Length of the buffer addr

Returns:

Status code.

te_errno tapi_netns_destroy_ns_with_macvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* macvlan_if)

Destroy network namespace and undo other configurations applied by function tapi_netns_create_ns_with_macvlan().

Parameters:

ta

Test agent name

ns_name

The network namespace name

ctl_if

Control interface name on the test agent

macvlan_if

MAC VLAN interface name

Returns:

Status code.

te_errno tapi_netns_create_ns_with_ipvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* ipvlan_if, char* addr, size_t addr_len)

Create network namespace and configure control network channel using auxiliary ipvlan interface. IP address is obtained using dhclient.

Parameters:

ta

Test agent name

ns_name

The network namespace name

ctl_if

Control interface name on the test agent

ipvlan_if

IP VLAN interface name

addr

Obtained IP address

addr_len

Length of the buffer addr

Returns:

Status code.

te_errno tapi_netns_destroy_ns_with_ipvlan(const char* ta, const char* ns_name, const char* ctl_if, const char* ipvlan_if)

Destroy network namespace and undo other configurations applied by function tapi_netns_create_ns_with_ipvlan().

Parameters:

ta

Test agent name

ns_name

The network namespace name

ctl_if

Control interface name on the test agent

ipvlan_if

IP VLAN interface name

Returns:

Status code.