Agents, namespaces and interfaces relations

Overview

Definition of test API to manage the configurator subtree /local/host. More…

// typedefs

typedef te_errno (*tapi_host_ns_if_cb_func)(
    const char *ta,
    const char *ifname,
    void *opaque
    );

// global functions

bool tapi_host_ns_enabled(void);
te_errno tapi_host_ns_get_host(const char* ta, char** host);
te_errno tapi_host_ns_agent_add(const char* host, const char* ta, const char* netns);
te_errno tapi_host_ns_agent_del(const char* ta);
te_errno tapi_host_ns_if_add(const char* ta, const char* ifname, const char* parent_ifname);
te_errno tapi_host_ns_if_del(const char* ta, const char* ifname, bool del_refs);
te_errno tapi_host_ns_if_parent_add(const char* ta, const char* ifname, const char* parent_ta, const char* parent_ifname);
te_errno tapi_host_ns_if_parent_del(const char* ta, const char* ifname, const char* parent_ta, const char* parent_ifname);
te_errno tapi_host_ns_if_change_ns(const char* ta, const char* ifname, const char* ns_name, const char* ns_ta);
te_errno tapi_host_ns_if_child_iter(const char* ta, const char* ifname, tapi_host_ns_if_cb_func cb, void* opaque);
te_errno tapi_host_ns_if_parent_iter(const char* ta, const char* ifname, tapi_host_ns_if_cb_func cb, void* opaque);
te_errno tapi_host_ns_if_ta_iter(const char* ta, tapi_host_ns_if_cb_func cb, void* opaque);
te_errno tapi_host_ns_if_host_iter(const char* host, tapi_host_ns_if_cb_func cb, void* opaque);
te_errno tapi_host_ns_agent_default(const char* ta, char** ta_default);

Detailed Documentation

Definition of test API to manage the configurator subtree /local/host. (storage/cm/cm_local.xml)

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

Typedefs

typedef te_errno (*tapi_host_ns_if_cb_func)(
    const char *ta,
    const char *ifname,
    void *opaque
    )

Type of callback function which can be passed to tapi_host_ns_if_child_iter() or tapi_host_ns_if_parent_iter().

Parameters:

ta

Test agent name

ifname

Interface name

opaque

Opaque user data

Returns:

Status code. Also see tapi_host_ns_if_child_iter() and tapi_host_ns_if_parent_iter() description for details.

Global Functions

bool tapi_host_ns_enabled(void)

Consider this API is enabled if Configurator object /local/host is registered.

Returns:

true if the test API is enabled.

te_errno tapi_host_ns_get_host(const char* ta, char** host)

Get hostname of test agent ta.

Parameters:

ta

Test agent name

host

Hostname

Returns:

Status code.

te_errno tapi_host_ns_agent_add(const char* host, const char* ta, const char* netns)

Register test agent in the configuration tree /local/host.

Parameters:

host

Hostname

ta

Test agent name

netns

Network namespace name

Returns:

Status code.

te_errno tapi_host_ns_agent_del(const char* ta)

Delete test agent from the configuration tree /local/host.

Parameters:

ta

Test agent name

Returns:

Status code.

te_errno tapi_host_ns_if_add(const char* ta, const char* ifname, const char* parent_ifname)

Add interface to the agent subtree.

Parameters:

ta

Test agent name

ifname

Interface name

parent_ifname

Parent interface name or NULL

Returns:

Status code.

te_errno tapi_host_ns_if_del(const char* ta, const char* ifname, bool del_refs)

Delete interface from the agent subtree.

Parameters:

ta

Test agent name

ifname

Interface name

del_refs

Delete all parent referencesto this interface if true

Returns:

Status code.

te_errno tapi_host_ns_if_parent_add(const char* ta, const char* ifname, const char* parent_ta, const char* parent_ifname)

Add reference to a parent interface.

Parameters:

ta

Test agent name

ifname

Interface name

parent_ta

Owner agent of the parent interface

parent_ifname

Parent interface name

Returns:

Status code.

te_errno tapi_host_ns_if_parent_del(const char* ta, const char* ifname, const char* parent_ta, const char* parent_ifname)

Delete reference to a parent interface.

Parameters:

ta

Test agent name

ifname

Interface name

parent_ta

Owner agent of the parent interface

parent_ifname

Parent interface name

Returns:

Status code.

te_errno tapi_host_ns_if_change_ns(const char* ta, const char* ifname, const char* ns_name, const char* ns_ta)

Change interface net namespace and update all parents references accordingly.

Parameters:

ta

Test agent name

ifname

Interface name

ns_name

Network namespace name

ns_ta

Test agent in the namespace - new owner of the interface

Returns:

Status code.

te_errno tapi_host_ns_if_child_iter(const char* ta, const char* ifname, tapi_host_ns_if_cb_func cb, void* opaque)

Iterate by child interfaces.

Parameters:

ta

Test agent name

ifname

Interface name

opaque

Opaque user data

cb

A callback function

Returns:

Status code. The function stops iterating if cb returns non-zero value.

te_errno tapi_host_ns_if_parent_iter(const char* ta, const char* ifname, tapi_host_ns_if_cb_func cb, void* opaque)

Iterate by parent interfaces.

Parameters:

ta

Test agent name

ifname

Interface name

opaque

Opaque user data

cb

A callback function

Returns:

Status code. The function stops iterating if cb returns non-zero value.

te_errno tapi_host_ns_if_ta_iter(const char* ta, tapi_host_ns_if_cb_func cb, void* opaque)

Iterate by all grabbed interfaces on ta.

Parameters:

ta

Test agent name

opaque

Opaque user data

cb

A callback function

Returns:

Status code. The function stops iterating if cb returns non-zero value.

te_errno tapi_host_ns_if_host_iter(const char* host, tapi_host_ns_if_cb_func cb, void* opaque)

Iterate by all grabbed interfaces on the host.

Parameters:

host

Host name

opaque

Opaque user data

cb

A callback function

Returns:

Status code. The function stops iterating if cb returns non-zero value.

te_errno tapi_host_ns_agent_default(const char* ta, char** ta_default)

Get name of test agent which is in default net namespace on the same host where ta is located.

Parameters:

ta

Test agent name

ta_default

Name of the agent in default net namespace

Returns:

Status code.