veritas.sot.getter

Module Contents

Classes

Getter

Getter class to get properties from nautobot

class veritas.sot.getter.Getter(sot)

Bases: object

Getter class to get properties from nautobot

Parameters:

sot (Sot) – the sot object

nautobot()

return nautobot object

device(name: str, by_id: bool = False) pynautobot.models.dcim.Devices

get device from nautobot

Parameters:
  • name (str) – name of the device

  • by_id (bool, optional) – get device by id, by default False

Returns:

device – the device object

Return type:

Endppoint

device_by_ip(ip: str, cast: bool = False) pynautobot.models.dcim.Devices | str

get device by using an ip address

Parameters:
  • ip (str) – ip address

  • cast (bool, optional) – if true return name of device otherwise return Endpoint, by default False

Returns:

device – name or Endpoint of the device

Return type:

Endpoint | str

primary_ip4(name: str, cast: bool = False) pynautobot.models.ipam.IpAddresses | str

get primary IP4 of the device

Parameters:
  • name (str) – name of the device

  • cast (bool, optional) – if true return name of device otherwise Endpoint, by default False

Returns:

device – name of device or Endpoint

Return type:

Endpoint | str

primary_ip6(name: str, cast: bool = False) pynautobot.models.ipam.IpAddresses | str

get primary IP6 of the device

Parameters:
  • name (str) – name of the device

  • cast (bool, optional) – if true return name of devie otherwise Endpoint, by default False

Returns:

devide – name of device or Endpoint

Return type:

models.ipam.IpAddresses | str

address(address: str, by_id: bool = False) pynautobot.models.ipam.IpAddresses

get address object by using its address or id

Parameters:
  • address (str) – address or id of the address

  • by_id (bool, optional) – if true address is an id otherwise the representation of an ip, by default False

Returns:

ipaddress – ipaddress object

Return type:

models.ipam.IpAddresses

interface(device, interface_name, device_id=None)

returns interface of device

interface_by_device_id(device_id: str, interface_name: str) pynautobot.models.dcim.Interfaces

get uinterface by device id and interface name

Parameters:
  • device_id (str) – device id

  • interface_name (str) – interface name

Returns:

interface – the interface object

Return type:

models.dcim.Interfaces

interfaces(device: str, device_id: str) pynautobot.models.dcim.Interfaces

get all interfaces by device or device_id

Parameters:
  • device (str) – name of the device

  • device_id (str) – device id

Returns:

interfaces – all interfaces of the device

Return type:

models.dcim.Interfaces

vlans(*unnamed: list, **named: dict) list

get vlans from nautobot

This method calls the sot.ipam.get_vlans method

Returns:

vlans – a list of vlans

Return type:

list

hldm(device: str, get_id: bool = True) dict

get HLDM (high level data model) of device

Parameters:
  • device (str) – name of the device

  • get_id (bool, optional) – if true get id from device, by default True

Returns:

the HLDM of the device

Return type:

dict

changes(*unnamed, **named)
all_custom_fields_type(get_list: bool = False) dict | list

return a list or dict of all custom_fields_type

Parameters:

get_list (bool, optional) – if true return list, by default False

Returns:

custom_fields_type – list or dict of custom_fields_types

Return type:

dict | list

all_device_types(get_list: bool = False) dict | list

get a list or dict of all device types

Parameters:

get_list (bool, optional) – if true return list of device types, by default False

Returns:

device_types – list or dict of device types

Return type:

dict | list

get_all_roles(get_list: bool = False) dict | list

get all roles from nautobot

Parameters:

get_list (bool, optional) – if true return list otherwise dict, by default False

Returns:

roles – list or dict of roles

Return type:

dict | list

all_platforms(get_list: bool = False) dict | list

return all platforms from nautobot

Parameters:

get_list (bool, optional) – if true return list of platforms, by default False

Returns:

platforms – get list or dict of platforms

Return type:

dict | list

all_locations(location_type: str = None, get_list: bool = False) dict | list

return all locations (by location_type) from nautobot

Parameters:
  • location_type (str, optional) – location type, by default None

  • get_list (bool, optional) – if true return list otherwise dict, by default False

Returns:

locations – list or dict of locations

Return type:

dict | list

query(select: list, using: str, where: str, mode: str = 'sql', transform: list = []) dict

query nautobot

Parameters:
  • select (list) – the list of all values to get from nautobot

  • using (str) – the name of the “table” to use

  • where (str) – the where clause

  • mode (str, optional) – either sql or gql (graphql), by default ‘sql’

  • transform (list, optional) – list of transformations, by default []

Returns:

the resukt of the query

Return type:

dict

This method calls either the sot.queries._execute_sql_query or the sot.queries._execute_gql_query method

get_ipam_choices() dict

return IPAM choices

Returns:

choices – IPAM choices

Return type:

dict

get_interface_type_choices() dict

return interface type choices

Returns:

choices – Interface type choices

Return type:

dict