veritasInventory

Module Contents

Classes

VeritasInventory

VeritasInventory is a class to create a nornir inventory from a veritas SOT

Functions

_get_connection_options(→ Dict[str, ...)

return ConnectionOptions object containung all parameter that are needed to connect to a device

_get_defaults(→ nornir.core.inventory.Defaults)

return Defaults object depending on the data

_get_inventory_element(→ nornir.core.inventory.HostOrGroup)

return either a Host or a Group object that contains the data

veritasInventory._get_connection_options(data: Dict[str, Any]) Dict[str, nornir.core.inventory.ConnectionOptions]

return ConnectionOptions object containung all parameter that are needed to connect to a device

Parameters:

data (Dict[str, Any]) – the data to add

Returns:

the ConnectionOptions options

Return type:

Dict[str, ConnectionOptions]

veritasInventory._get_defaults(data: Dict[str, Any]) nornir.core.inventory.Defaults

return Defaults object depending on the data

Parameters:

data (Dict[str, Any]) – the data to add to the object

Returns:

Defaults object

Return type:

Defaults

veritasInventory._get_inventory_element(type_: Type[nornir.core.inventory.HostOrGroup], data: Dict[str, Any], name: str, defaults: nornir.core.inventory.Defaults) nornir.core.inventory.HostOrGroup

return either a Host or a Group object that contains the data

Parameters:
  • type (Type[HostOrGroup]) – The type of the object to return

  • data (Dict[str, Any]) – the data to add to the object

  • name (str) – the name of the object

  • defaults (Defaults) – the default values of the object

Returns:

Either a Host or a Group

Return type:

HostOrGroup

class veritasInventory.VeritasInventory(sot: veritas.sot.sot, where: str, use_primary_ip: bool = True, username: str = '', password: str = '', connection_options: Dict[str, Any] = {}, data: Dict[str, Any] = {}, select: list = [], host_groups: list = [], defaults: Dict[str, Any] = {}, groups: Dict[str, Any] = {})

VeritasInventory is a class to create a nornir inventory from a veritas SOT

Parameters:
  • sot (veritas_sot) – The veritas sot object

  • where (str) – The where clause to filter the devices

  • use_primary_ip (bool) – Use the primary IP address as the hostname

  • username (str) – The default username

  • password (str) – The default password

  • connection_options (Dict[str, Any]) – The default connection options

  • data (Dict[str, Any]) – The default data

  • select (list) – Additional select values

  • host_groups (list) – Additional host groups

  • defaults (Dict[str, Any]) – The default values

  • groups (Dict[str, Any]) – The groups

  • Note (Improtant) –

  • format (group must be the following) – groups = {‘net’: {‘data’: {‘key’: ‘value’} }}

  • host. (Otherwise the data is not automatically added to the) –

  • code (You can get the group data by using the following) – nr.inventory.groups[‘net’].items()

  • use (The group data is added to the host. To get a list of all items of the host) – nr.inventory.hosts[‘lab.local’].items()

load() nornir.core.inventory.Inventory

load inventory

Execute a query to get all devices and data from the SOT and create a nornir inventory

Returns:

The Inventoty object containing the hosts, the groups and the default values

Return type:

Inventory