Skip to content

pyntc

Kickoff functions for getting instance of device objects.

pyntc.ntc_device(device_type, *args, **kwargs)

Instantiate an instance of a pyntc.devices.BaseDevice by device_type.

The *args and **kwargs are passed directly to the device initializer.

Parameters:

Name Type Description Default
device_type str

A valid device_type listed in pyntc.devices.supported_devices

required
args tuple

Positional arguments to pass to the device initializer.

()
kwargs dict

Keyword arguments to pass to the device initializer.

{}

Returns:

Type Description
BaseDevice

An instance of a subclass of pyntc.devices.BaseDevice.

Raises:

Type Description
UnsupportedDeviceError

if the device_type is unsupported.

pyntc.ntc_device_by_name(name, filename=None)

Instantiate an instance of a pyntc.devices.BaseDevice from ntc.conf file.

If no filename is given the environment variable PYNTC_CONF is checked for a path, and then ~/.ntc.conf.

Parameters:

Name Type Description Default
name string

Name of the device as listed in teh NTC configuration file.

required
filename string

(Optional) Path to NTC configuration file that includes the name argument as section header.

None

Raises:

Type Description
DeviceNameNotFoundError

If the name is not found in the NTC configuration file.

ConfFileNotFoundError

If no NTC configuration can be found.