api.device

Cisco vManage Device Inventory API Methods.

Module Contents

class api.device.Device(session, host, port=443)[source]

Bases: object

vManage Device Inventory API

Responsible for DELETE, GET, POST, PUT methods against vManage Device Inventory.

get_device_list(self, category)[source]

Obtain a list of specified device type

Parameters

category (str) – vedges or controllers

Returns

All data associated with a response.

Return type

result (dict)

post_device_cli_mode(self, deviceId, deviceType)[source]

Update a device to CLI mode

Parameters
  • deviceId (str) – uuid for device object

  • deviceType (str) – vedge or controller

get_device_status_list(self)[source]

Obtain a list of specified device type

Args: None

Returns

Device status

Return type

result (list)

get_device_status_dict(self, key_name='host-name', remove_key=False)[source]

Obtain a dict of specified device type

Parameters

category (str) – vedges or controllers

Returns

Device status

Return type

result (dict)

get_device_status(self, value, key='system-ip')[source]

Get the status of a specific device

Parameters
  • string (value) – The value of the key to match

  • key (string) – The key on which to match (e.g. system-ip)

Returns

Device status

Return type

result (dict)

get_device_config(self, device_type, value, key='system-ip')[source]

Get the config of a specific device

Parameters
  • string (value) – The value of the key to match

  • key (string) – The key on which to match (e.g. system-ip)

Returns

Device config

Return type

result (dict)

get_device_config_list(self, device_type)[source]
Get the config status of a list of devices. When ‘all’ is specified, it concatenats

the vedges and controller together to provide a single method to retrieve status in the same way as get_device_status_list.

Parameters

device_type (str) – ‘vedges’, ‘controllers’, or ‘all’

Returns

All data associated with a response.

Return type

result (list)

get_device_config_dict(self, device_type, key_name='host-name', remove_key=False)[source]

Get the config status of a list of devices as a dictionary

Parameters
  • device_type (str) – vedge or controller

  • key_name (string) – The name of the attribute to use as the dictionary key

  • remove_key (boolean) – remove the search key from the element

Returns

All data associated with a response.

Return type

result (dict)

get_device_data(self, path, device_ip)[source]

Get the data from a device

Parameters
  • path (str) – The path of the data

  • device_ip (str) – The IP address of the device

Returns

All data associated with a response.

Return type

result (dict)

put_device_decommission(self, device_id)[source]

Decommission a device

Parameters

device_id (str) – uuid for device object

Returns

Device status

Return type

result (list)

post_device(self, device_ip, personality, username, password)[source]

Add control plane device

Parameters
  • device_ip (str) – device interface IP

  • personality (str) – controller type (vmanage, vsmart, vbond)

  • username (str) – device username

  • password (str) – device password

Returns

Device status

Return type

result (list)

post_reset_interface(self, device_ip, vpn_id, ifname)[source]

Reset an Interface :param device_ip: device IP for device object :type device_ip: str :param vpn_id: VPN Id for Interface :type vpn_id: int :param ifname: Interface name to reset :type ifname: str

Returns

HTTP response status

Return type

result (int)