Welcome to Python viptela’s documentation!¶
python-viptela provides a PYthon SDK for interacting with Cisco SDWAN (formerly Viptela).
API Reference¶
This page contains auto-generated API reference documentation 1.
__main__
¶
api
¶
Submodules¶
api.authentication
¶
Cisco vManage Authentication API Methods.
Module Contents¶
-
class
api.authentication.
Authentication
(host=None, user=None, password=None, port=443, validate_certs=False, timeout=10)[source]¶ Bases:
object
vManage Authentication API
Responsible for retrieving the JSESSIONID after a username/password has been authenticated. If the vManage version is >= 19.2.0 then the X-XSRF-TOKEN will be retrieved and added to the header. An HTTP(S) Request session object will be returned.
-
login
(self)[source]¶ Executes login tasks against vManage to retrieve token(s).
- Parameters
None. –
- Returns
a Requests session with JSESSIONID and an X-XSRF-TOKEN for vManage version >= 19.2.0.
- Return type
self.session
- Raises
LoginFailure – If the username/password are incorrect.
RequestException – If the host is not accessible.
-
api.central_policy
¶
Cisco vManage Centralized Policy API Methods.
Module Contents¶
-
class
api.central_policy.
CentralPolicy
(session, host, port=443)[source]¶ Bases:
object
vManage Central Policy API
Responsible for DELETE, GET, POST, PUT methods against vManage Central Policy.
-
activate_central_policy
(self, policy_name, policy_id)[source]¶ Activates the current active centralized policy
- Parameters
policyId (str) – ID of the active centralized policy
- Returns
The Action ID from the activation.
- Return type
result (str)
-
deactivate_central_policy
(self, policy_id)[source]¶ Deactivates the current active centralized policy
- Parameters
policyId (str) – ID of the deactive centralized policy
- Returns
The Action ID from the activation.
- Return type
result (str)
-
add_central_policy
(self, policy)[source]¶ Delete a Central Policy from vManage.
- Parameters
policy – The Central Policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
update_central_policy
(self, policy, policy_id)[source]¶ Update a Central from vManage.
- Parameters
policy – The Central Policy
policy_id – The ID of the Central Policy to update
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_central_policy
(self, policyId)[source]¶ Deletes the specified centralized policy
- Parameters
policyId (str) – ID of the active centralized policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_central_policy_list
(self)[source]¶ Get all Central Policies from vManage.
- Returns
- A list of all policy lists currently
in vManage.
- Return type
response (dict)
-
api.centralized_policy
¶
Cisco vManage Centralized Policy API Methods.
Module Contents¶
-
class
api.centralized_policy.
CentralizedPolicy
(session, host, port=443)[source]¶ Bases:
object
vManage Centralized Policy API
Responsible for DELETE, GET, POST, PUT methods against vManage Centralized Policy.
-
deactivate_centralized_policy
(self, policyId)[source]¶ Deactivates the current active centralized policy
- Parameters
policyId (str) – ID of the active centralized policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_centralized_policy
(self, policyId)[source]¶ Deletes the specified centralized policy
- Parameters
policyId (str) – ID of the active centralized policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_policy_definition
(self, definition, definitionId)[source]¶ Deletes the specified policy definition which include: ‘control’,’mesh’,’hubandspoke’,’vpnmembershipgroup’, ‘approute’,’data’,’cflowd’
- Parameters
definition (str) – One of the above policy types
definitionId (str) – ID of the policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_centralized_policy
(self)[source]¶ Obtain a list of all configured centralized policies
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_policy_definition
(self, definition)[source]¶ Obtain a list of various policy definitions which include: ‘control’,’mesh’,’hubandspoke’,’vpnmembershipgroup’, ‘approute’,’data’,’cflowd’
- Parameters
definition (str) – One of the above policy types
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.certificate
¶
Cisco vManage Certificate API Methods.
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_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)
-
api.device_inventory
¶
Cisco vManage Device Inventory API Methods.
Module Contents¶
-
class
api.device_inventory.
DeviceInventory
(session, host, port=443)[source]¶ Bases:
object
vManage Device Inventory API
Responsible for DELETE, GET, POST, PUT methods against vManage Device Inventory.
api.device_templates
¶
Cisco vManage Device Templates API Methods.
Module Contents¶
-
class
api.device_templates.
DeviceTemplates
(session, host, port=443)[source]¶ Bases:
object
vManage Device Templates API
Responsible for DELETE, GET, POST, PUT methods against vManage Device Templates.
-
delete_device_template
(self, templateId)[source]¶ Obtain a list of all configured device templates.
- Parameters
templateId (str) – Object ID for device template
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_device_templates
(self)[source]¶ Obtain a list of all configured device templates.
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_device_template_object
(self, template_id)[source]¶ Obtain a device template object.
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_device_template_list
(self, factory_default=False, name_list=None)[source]¶ Get the list of device templates.
- Parameters
factory_default (bool) – Include factory default
name_list (list of strings) – A list of template names to retreive.
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_device_template_dict
(self, factory_default=False, key_name='templateName', remove_key=True, name_list=None)[source]¶ Obtain a dictionary of all configured device templates.
- Parameters
factory_default (bool) – Wheter to return factory default templates
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_template_attachments
(self, template_id, key='host-name')[source]¶ Get the devices that a template is attached to.
- Parameters
template_id (string) – Template ID
key (string) – The key of the device to put in the list (default: host-name)
- Returns
List of keys.
- Return type
result (list)
-
get_template_input
(self, template_id, device_id_list=None)[source]¶ Get the input associated with a device attachment.
- Parameters
template_id (string) – Template ID
- Returns
All data associated with a response.
- Return type
result (dict)
-
add_device_template
(self, device_template)[source]¶ Add a single device template to Vmanage.
- Parameters
device_template (dict) – Device Template
- Returns
Response from Vmanage
- Return type
result (list)
-
update_device_template
(self, device_template)[source]¶ Update a single device template to Vmanage.
- Parameters
device_template (dict) – Device Template
- Returns
Response from Vmanage
- Return type
result (list)
-
import_device_template_list
(self, device_template_list, check_mode=False, update=False)[source]¶ Import a list of feature templates to vManage.
- Parameters
check_mode (bool) – Only check to see if changes would be made
update (bool) – Update the template if it exists
- Returns
Returns the diffs of the updates.
- Return type
result (list)
-
import_attachment_list
(self, attachment_list, check_mode=False, update=False)[source]¶ Import a list of device attachments to vManage.
- Parameters
check_mode (bool) – Only check to see if changes would be made
update (bool) – Update the template if it exists
- Returns
Returns the diffs of the updates.
- Return type
result (list)
-
attach_to_template
(self, template_id, uuid, system_ip, host_name, site_id, variables)[source]¶ Attach and device to a template
- Parameters
template_id (str) – The template ID to attach to
uuid (str) – The UUID of the device to attach
system_ip (str) – The System IP of the system to attach
host_name (str) – The host-name of the device to attach
variables (dict) – The variables needed by the template
- Returns
Returns the action id of the attachment
- Return type
action_id (str)
-
detach_from_template
(self, uuid, device_ip, device_type)[source]¶ Detach a device from a template (i.e. Put in CLI mode)
- Parameters
uuid (str) – The UUID of the device to detach
system_ip (str) – The System IP of the system to detach
device_type (str) – The device type of the device to detach
- Returns
Returns the action id of the attachment
- Return type
action_id (str)
-
get_attachments
(self, template_id, key='host-name')[source]¶ Get a list of attachments to a particular template.
- Parameters
template_id (str) – Template ID of the template
key (str) – The key of the elements to return
- Returns
Returns the specified key of the attached devices.
- Return type
result (list)
-
api.feature_templates
¶
Cisco vManage Feature Templates API Methods.
Module Contents¶
-
class
api.feature_templates.
FeatureTemplates
(session, host, port=443)[source]¶ Bases:
object
vManage Feature Templates API
Responsible for DELETE, GET, POST, PUT methods against vManage Feature Templates.
-
delete_feature_template
(self, templateId)[source]¶ Obtain a list of all configured feature templates.
- Parameters
templateId (str) – Object ID for feature template
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_feature_templates
(self)[source]¶ Obtain a list of all configured feature templates.
- Returns
All data associated with a response.
- Return type
result (dict)
-
add_feature_template
(self, feature_template)[source]¶ Add a feature template to Vmanage.
- Parameters
feature_template (dict) – Feature Template
- Returns
Response from Vmanage
- Return type
result (list)
-
update_feature_template
(self, feature_template)[source]¶ Add a feature template to Vmanage.
- Parameters
feature_template (dict) – Feature Template
- Returns
Response from Vmanage
- Return type
result (list)
-
get_feature_template_list
(self, factory_default=False, name_list=None)[source]¶ Obtain a list of all configured feature templates.
- Parameters
factory_default (bool) – Wheter to return factory default templates
name_list (list of strings) – A list of the template names to return
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_feature_template_dict
(self, factory_default=False, key_name='templateName', remove_key=True, name_list=None)[source]¶ Obtain a dictionary of all configured feature templates.
- Parameters
factory_default (bool) – Wheter to return factory default templates
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)
-
import_feature_template_list
(self, feature_template_list, check_mode=False, update=False)[source]¶ Add a list of feature templates to vManage.
- Parameters
check_mode (bool) – Only check to see if changes would be made
update (bool) – Update the template if it exists
- Returns
Returns the diffs of the updates.
- Return type
result (list)
-
api.http_methods
¶
Module Contents¶
-
class
api.http_methods.
HttpMethods
(session, url)[source]¶ Bases:
object
HTTP Methods for vManage API Interaction
Provides a consistent interaction with the vManage REST API. Contains error handling for common HTTP interaction issues.
-
request
(self, method, headers=None, payload=None, files=None)[source]¶ Performs HTTP REST API Call.
- Parameters
method (str) – DELETE, GET, POST, PUT
headers (dict) – Use standard vManage header provided in module or custom header for specific API interaction
payload (str) – A formatted string to be delivered to vManage via POST or PUT REST call
file (obj) – A file to be sent to vManage
- Returns
- A parsable dictionary containing the full
response from vManage for an interaction
- Return type
result (dict)
- Raises
JSONDecodeError – Payload format error.
ConnectionError – Connection error.
HTTPError – An HTTP error occurred.
URLRequired – A valid URL is required to make a request.
TooManyRedirects – Too many redirects.
Timeout – The request timed out.
RequestException – There was an ambiguous exception.
-
api.local_policy
¶
Cisco vManage Localized Policy API Methods.
Module Contents¶
-
class
api.local_policy.
LocalPolicy
(session, host, port=443)[source]¶ Bases:
object
vManage Local Policy API
Responsible for DELETE, GET, POST, PUT methods against vManage Local Policy.
-
add_local_policy
(self, policy)[source]¶ Delete a Central Policy from vManage.
- Parameters
policy – The Central Policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
update_local_policy
(self, policy, policy_id)[source]¶ Update a Central from vManage.
- Parameters
policy – The Central Policy
policy_id – The ID of the Central Policy to update
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_localized_policy
(self, policy_id)[source]¶ Deletes the specified local policy
- Parameters
policyId (str) – ID of the active local policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.localized_policy
¶
Cisco vManage Localized Policy API Methods.
Module Contents¶
-
class
api.localized_policy.
LocalizedPolicy
(session, host, port=443)[source]¶ Bases:
object
vManage Localized Policy API
Responsible for DELETE, GET, POST, PUT methods against vManage Localized Policy.
-
delete_localized_definition
(self, definition, definitionId)[source]¶ Deletes the specified policy definition which include: ‘qosmap’,’rewriterule’,’acl’,’aclv6’,’vedgeroute’
- Parameters
definition (str) – One of the above policy types
definitionId (str) – ID of the policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_localized_policy
(self, policy_id)[source]¶ Deletes the specified localized policy
- Parameters
policyId (str) – ID of the active localized policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.monitor_network
¶
Cisco vManage Monitor Networks API Methods.
Module Contents¶
-
class
api.monitor_network.
MonitorNetwork
(session, host, port=443)[source]¶ Bases:
object
vManage Monitor Networks API
Responsible for GET methods against vManage Real Time Monitoring for network devices.
-
get_control_connections
(self, system_ip)[source]¶ Provides current control connections for device.
- Parameters
system_ip (str) – Device System IP
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_control_connections_history
(self, system_ip)[source]¶ Provides control connections history for device.
- Parameters
system_ip (str) – Device System IP
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.policy_definitions
¶
Cisco vManage Policy Definitions API Methods.
Module Contents¶
-
class
api.policy_definitions.
PolicyDefinitions
(session, host, port=443)[source]¶ Bases:
object
vManage Policy Definitions API
Responsible for DELETE, GET, POST, PUT methods against vManage Policy Definitions used in Centralized, Localized, and Security Policy.
-
delete_policy_definition
(self, definition_type, definition_id)[source]¶ Delete a Policy Definition from vManage.
- Parameters
definition_type (str) – The defintion type of the requested policy definition
definition_id (str) – The defintion ID of the requested policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
add_policy_definition
(self, policy_definition)[source]¶ Delete a Policy Definition from vManage.
- Parameters
definition_type (str) – The defintion type of the requested policy definition
definition_id (str) – The defintion ID of the requested policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
update_policy_definition
(self, policy_definition, policy_definition_id)[source]¶ Update a Policy Definition from vManage.
- Parameters
definition_type (str) – The defintion type of the requested policy definition
definition_id (str) – The defintion ID of the requested policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_policy_definition
(self, definition_type, definition_id)[source]¶ Get a Policy Definition from vManage.
- Parameters
definition_type (str) – The defintion type of the requested policy definition
definition_id (str) – The defintion ID of the requested policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.policy_lists
¶
Cisco vManage Policy Lists API Methods.
Module Contents¶
-
class
api.policy_lists.
PolicyLists
(session, host, port=443)[source]¶ Bases:
object
vManage Policy Lists API
Responsible for DELETE, GET, POST, PUT methods against vManage Policy Lists used in Centralized, Localized, and Security Policy.
-
delete_data_prefix_list
(self, listid)[source]¶ Delete a Data Prefix List from vManage.
- Parameters
listid (str) – vManaged assigned list identifier
- Returns
Results from deletion attempt.
- Return type
response (dict)
-
get_data_prefix_list
(self)[source]¶ Get all Data Prefix Lists from vManage.
- Returns
- A list of all data prefix lists currently
in vManage.
- Return type
response (dict)
-
get_policy_list_all
(self)[source]¶ Get all Policy Lists from vManage.
- Returns
- A list of all policy lists currently
in vManage.
- Return type
response (dict)
-
post_data_prefix_list
(self, name, entries)[source]¶ Add a new Data Prefix List to vManage.
- Parameters
name (str) – name of the data prefix list
entries (list) – a list of prefixes to add to the list
- Returns
- Results from attempting to add a new
data prefix list.
- Return type
response (dict)
-
put_data_prefix_list
(self, name, listid, entries)[source]¶ Update an existing Data Prefix List on vManage.
- Parameters
name (str) – name of the data prefix list
listid (str) – vManaged assigned list identifier
entries (list) – a list of prefixes to add to the list
- Returns
- Results from attempting to update an
existing data prefix list.
- Return type
response (dict)
-
delete_policy_list
(self, listType, listId)[source]¶ Deletes the specified policy list type
- Parameters
listType (str) – Policy list type
listId (str) – ID of the policy list
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_policy_list_list
(self, policy_list_type='all', cache=True)[source]¶ Get a list of policy lists
- Parameters
policy_list_type (str) – Policy list type
cache (bool) – Whether to cache the response
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_policy_list_dict
(self, policy_list_type='all', key_name='name', remove_key=False, cache=True)[source]¶
-
add_policy_list
(self, policy_list)[source]¶ Add a new Policy List to vManage.
- Parameters
policy_list (dict) – The Policy List
- Returns
- Results from attempting to add a new
prefix list.
- Return type
response (dict)
-
update_policy_list
(self, policy_list)[source]¶ Update an existing Policy List on vManage.
- Parameters
policy_list (dict) – The Policy List
- Returns
- Results from attempting to update an
existing data prefix list.
- Return type
response (dict)
-
import_policy_list_list
(self, policy_list_list, push=False, update=False, check_mode=False, force=False)[source]¶ Import a list of policy lists into vManage
- Parameters
policy_list_list – A list of polcies
push (bool) – Whether to push a change out
update (bool) – Whether to update when the list exists
check_mode (bool) – Report what updates would happen, but don’t update
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.security_policy
¶
Cisco vManage Security Policy API Methods.
Module Contents¶
-
class
api.security_policy.
SecurityPolicy
(session, host, port=443)[source]¶ Bases:
object
vManage Security Policy API
Responsible for DELETE, GET, POST, PUT methods against vManage Security Policy.
-
delete_security_definition
(self, definition, definitionId)[source]¶ Deletes the specified policy definition which include: ‘zonebasedfw’,’urlfiltering’, ‘dnssecurity’,’intrusionprevention’, ‘advancedMalwareProtection’ for 18.4.0 or greater and ‘zonebasedfw’ for
- Parameters
definition (str) – One of the above policy types
definitionId (str) – ID of the policy definition
- Returns
All data associated with a response.
- Return type
result (dict)
-
delete_security_policy
(self, policyId)[source]¶ Deletes the specified security policy
- Parameters
policyId (str) – ID of the active security policy
- Returns
All data associated with a response.
- Return type
result (dict)
-
get_security_definition
(self, definition)[source]¶ Obtain a list of various security definitions which include: ‘zonebasedfw’,’urlfiltering’,’intrusionprevention’, ‘advancedMalwareProtection’, ‘dnssecurity’
- Parameters
definition (str) – One of the above policy types
- Returns
All data associated with a response.
- Return type
result (dict)
-
api.utilities
¶
Cisco vManage Utilities API Methods.
Module Contents¶
-
class
api.utilities.
Utilities
(session, host, port=443)[source]¶ Bases:
object
Access to Various vManage Utilitiesinstance.
vManage has several utilities that are needed for correct execution of applications against the API. For example, this includes waiting for an action to complete before moving onto the next task.
apps
¶
Submodules¶
apps.files
¶
Cisco vManage Files API Methods.
Module Contents¶
-
class
apps.files.
Files
(session, host, port=443)[source]¶ Bases:
object
Access to Various vManage Utilitiesinstance.
vManage has several utilities that are needed for correct execution of applications against the API. For example, this includes waiting for an action to complete before moving onto the next task.
data
¶
Submodules¶
data.parse_methods
¶
Parse Methods for Data Returned by Cisco vManage.
Module Contents¶
-
class
data.parse_methods.
ParseMethods
[source]¶ Reset all configuratios on a vManage instance.
Executes the necessary REST calls in specific order to remove configurations applied to a vManage instance.
cli
¶
Subpackages¶
cli.activate
¶
Submodules¶
cli.deactivate
¶
Submodules¶
cli.import_cmd
¶
cli.show
¶
Submodules¶
cli.show.policies
¶- 1
Created with sphinx-autoapi