devices module

class devices.Devices(db_path_name)

Bases: dbparam.DbParam

Devices worker to operate DB on table devices (list, add, modify and delete methods).

Device names has to be alphanumeric and less than 20 characters. At the DB all the spaces " " will be replaced by underscores "_".

_OS_LIST = ['ios', 'iosxr', 'nxos', 'eos', 'junos', 'f5', 'win', 'linux']
static _check_value(value)

Verifies the value to be alphanumeric string and less than 20 characters.

Parameters:value – string to verify
Returns:True if the value is a valid string otherwise returns False
add()

Add a device.

Returns:Dev_name added or False if there was an error.
delete()

Delete a device.

Returns:dev_name of the delete device, or False it there was an error.
list()

List the table devices ordered alphabetically, and filtered according the selected options (customer, site, IP, device name, or OS.

Returns:True if the devices were listed, or False if there is no match between the conditions selected.
modify()

Modify a device.

Returns:Dev_name original and new_dev_name of the modified device, or False if there was an error.