mgmt module

The mgmt module offers high-level functions for managing test chassis, modules, and ports.

reserve_tester(tester[, force])

Reserve a tester regardless whether it is owned by others or not.

release_tester(tester[, ...])

Free a tester.

get_chassis_sys_uptime(tester)

Get chassis system uptime in seconds

obtain_modules_by_ids(tester, module_ids)

Get the module objects of the tester specified by module index ids

reserve_modules(modules[, force])

Reserve modules regardless whether they are owned by others or not.

release_modules(modules[, should_release_ports])

Free modules.

get_module_supported_configs(module)

Get the module's supported configurations in a list.

set_module_configs(module_configs[, force])

Configure multiple modules with specified media, port count and port speed.

set_module_config(module, media, port_count, ...)

Change the module configuration to the target media, port count and port speed.

get_module_eol_date(module)

Get module's End-of-Life date

get_module_eol_days(module)

Get days until module's End-of-Life date

get_cage_insertions(module)

Get module cage insertion count of each cage

get_cage_count(module)

Get module cage count

obtain_ports_by_ids(tester, port_ids[, ...])

Get ports of the tester specified by port ids

obtain_port_by_id(tester, port_id[, separator])

Get a port of the module

reserve_ports(ports[, force, reset])

Reserve a port regardless whether it is owned by others or not.

release_ports(ports)

Free a port.

reset_ports(ports)

Reset a list of ports.

remove_streams(port)

Remove all streams on a port witout resetting the port.

Module Contents

The resource management high-level function module, including testers, modules, ports, and streams.

async reserve_tester(tester, force=True)[source]

Reserve a tester regardless whether it is owned by others or not.

Parameters:
  • tester (L23Tester) – The tester to reserve

  • force (boolean) – Should force reserve the tester

Returns:

Return type:

None

async release_tester(tester, should_release_modules_ports=False)[source]

Free a tester. If the tester is reserved by you, release the tester. If the tester is reserved by others, relinquish the tester. The tester should have no owner afterwards.

Parameters:
  • tester (L23Tester) – The tester to free

  • should_release_modules_ports (bool, optional) – should modules and ports also be freed, defaults to False

Returns:

Return type:

None

async get_chassis_sys_uptime(tester)[source]

Get chassis system uptime in seconds

Parameters:

tester (L23Tester) – The tester to free

Returns:

Chassis system uptime in seconds

Return type:

int

obtain_modules_by_ids(tester, module_ids)[source]

Get the module objects of the tester specified by module index ids

Parameters:
  • tester (L23Tester) – The tester object

  • module_ids – the index ids of the modules.

Use “*” to get all modules.

If the list is empty, return all modules of the tester

Raises:

NoSuchModuleError – No such a module index on the tester

Returns:

module objects

Return type:

List[GenericAnyModule]

async reserve_modules(modules, force=True)[source]

Reserve modules regardless whether they are owned by others or not.

Parameters:
  • modules (List[GenericAnyModule]) – The modules to reserve

  • force (boolean) – Should force reserve the module, defaults to True

Returns:

Return type:

None

async release_modules(modules, should_release_ports=False)[source]

Free modules. If a module is reserved by you, release the module. If a module is reserved by others, relinquish the module. The modules should have no owner afterwards. :param module: The module to free :type module: GenericAnyModule :param should_release_ports: should ports also be freed, defaults to False :type should_release_ports: bool, optional :return: :rtype: None

get_module_supported_configs(module)[source]

Get the module’s supported configurations in a list.

Parameters:

module (Union[GenericL23Module, ModuleChimera]) – The module object

Returns:

List of tuple(supported media, port count, port speed) (The port speed in Mbps, e.g. 40000 for 40G)

Return type:

List[Tuple[MediaConfigurationType, int, int]]

async set_module_configs(module_configs, force=True)[source]

Configure multiple modules with specified media, port count and port speed.

Parameters:

module_configs – List of module configuration tuples.

Each tuple contains (module object, target media, target port count, target port speed in Mbps, should forcibly reserve the module)

Parameters:

force (bool, optional) – should forcibly reserve the modules, defaults to True

Raises:

NotSupportMediaPortSpeed – one of the provided media, port count and port speed configuration is not supported by the corresponding module.

async set_module_config(module, media, port_count, port_speed, force=True)[source]

Change the module configuration to the target media, port count and port speed.

Parameters:
  • module (Union[GenericL23Module, ModuleChimera]) – the module object

  • media (enums.MediaConfigurationType) – the target media for the module

  • port_count (int) – the target port count

  • port_speed (int) – the target port speed in Mbps, e.g. 40000 for 40G

  • force (bool, optional) – should forcibly reserve the module, defaults to True

Raises:

NotSupportMediaPortSpeed – the provided media, port count and port speed configuration is not supported by the module

async get_module_eol_date(module)[source]

Get module’s End-of-Life date

Parameters:

module (GenericAnyModule) – The module object

Returns:

Module’s EOL date

Return type:

str

async get_module_eol_days(module)[source]

Get days until module’s End-of-Life date

Parameters:

module (GenericAnyModule) – The module object

Returns:

days until module’s End-of-Life date

Return type:

int

async get_cage_insertions(module)[source]

Get module cage insertion count of each cage

Parameters:

module (Union[Z800FreyaModule, Z1600EdunModule]) – The Z800 Freya/Z1600 Edun module object

Returns:

Insertion count of each cage

Return type:

Tuple[int, …]

async get_cage_count(module)[source]

Get module cage count

Parameters:

module (Union[Z800FreyaModule, Z1600EdunModule]) – The Z800 Freya/Z1600 Edun module object

Returns:

The number of cages in the module

Return type:

int

obtain_ports_by_ids(tester, port_ids, separator='/')[source]

Get ports of the tester specified by port ids

Parameters:
  • tester (L23Tester) – The tester object

  • port_ids (List[str]) –

    The port ids.

    The port index with format m/p, m is module index, p is port index, e.g. [“1/3”, “2/4”].

    Use 1/* to get all ports of module 1.

    Use */1 to get port 1 of all modules.

    Use *, or */* to get all ports of all modules.

    Use an empty list to get all ports of all modules.

  • separator (str, optional) – The separator between module index and port index in port id, defaults to /

Returns:

List of port objects

Return type:

tuple[GenericAnyPort]

obtain_port_by_id(tester, port_id, separator='/')[source]

Get a port of the module

Parameters:
  • tester (L23Tester) – The tester object

  • port_id (str) – The port index with format “m/p”, m is module index, p is port index, e.g. “1/3”. Wildcard “*” is not allowed.

  • separator (str, optional) – The separator between module index and port index in port id, defaults to “/”

Raises:

NoSuchPortError – No port found with the index

Returns:

The port object

Return type:

GenericAnyPort

async reserve_ports(ports, force=True, reset=False)[source]

Reserve a port regardless whether it is owned by others or not.

Parameters:
  • ports (list[GenericAnyPort]) – The ports to reserve

  • force (boolean, optional) – Should force reserve the ports, defaults to True

  • reset (boolean, optional) – Should reset the ports after reserving, defaults to False

Returns:

Return type:

None

async release_ports(ports)[source]

Free a port. If the port is reserved by you, release the port. If the port is reserved by others, relinquish the port. The port should have no owner afterwards.

Parameters:

port (GenericAnyPort) – The port to free

Returns:

Return type:

None

async reset_ports(ports)[source]

Reset a list of ports.

Parameters:

ports (List[GenericAnyPort]) – The ports to reset

Returns:

Return type:

None

async remove_streams(port)[source]

Remove all streams on a port witout resetting the port.

Parameters:

port (GenericL23Port) – The port object