Skip to content

Commit

Permalink
Merge pull request #143 from cisco-en-programmability/develop
Browse files Browse the repository at this point in the history
Develop 2.6.11
  • Loading branch information
fmunozmiranda authored Jan 10, 2024
2 parents 73ec2e0 + 892eabd commit 9e71edb
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 11 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.6.11] - 2023-01-10
### Fixed
- Configuration template import template - check_type error #142 - Fixing required schema.
- Updating request version. Issue #132

## [2.6.10] - 2023-11-10
### Fixed
- Fixed params in 2.3.5.3 claim_a_device_to_a_site from interfaceName to ipInterfaceName
Expand Down Expand Up @@ -464,4 +469,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[2.6.8]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.7...v2.6.8
[2.6.9]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.8...v2.6.9
[2.6.10]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.9...v2.6.10
[Unreleased]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.10...develop
[2.6.11]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.10...v2.6.11
[Unreleased]: https://github.com/cisco-en-programmability/dnacentersdk/compare/v2.6.11...develop
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages] # Here goes your package requirements for running the application and its versions (which packages you will use when running the application).
requests = ">=2.27.1, <=2.28"
requests = ">=2.27.1, <=2.40.0"
requests-toolbelt = ">=1.0.0"
future = ">=0.18.3"
fastjsonschema = ">=2.16.2"
Expand Down
115 changes: 112 additions & 3 deletions dnacentersdk/api/v2_3_5_3/configuration_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,68 @@ def export_projects(self,

def imports_the_templates_provided(self,
project_name,
author=None,
composite=None,
containingTemplates=None,
createTime=None,
customParamsOrder=None,
description=None,
deviceTypes=None,
do_version=None,
failurePolicy=None,
id=None,
language=None,
lastUpdateTime=None,
latestVersionTime=None,
name=None,
parentTemplateId=None,
projectId=None,
projectName=None,
rollbackTemplateContent=None,
rollbackTemplateParams=None,
softwareType=None,
softwareVariant=None,
softwareVersion=None,
tags=None,
templateContent=None,
templateParams=None,
validationErrors=None,
version=None,
headers=None,
payload=None,
active_validation=True,
**request_parameters):
"""Imports the templates provided in the DTO by project Name .
Args:
author(string): Configuration Templates's Author of template .
composite(boolean): Configuration Templates's Is it composite template .
containingTemplates(list): Configuration Templates's containingTemplates (list of objects).
createTime(integer): Configuration Templates's Create time of template .
customParamsOrder(boolean): Configuration Templates's Custom Params Order .
description(string): Configuration Templates's Description of template .
deviceTypes(list): Configuration Templates's deviceTypes (list of objects).
failurePolicy(string): Configuration Templates's Define failure policy if template provisioning fails .
Available values are 'ABORT_ON_ERROR', 'CONTINUE_ON_ERROR', 'ROLLBACK_ON_ERROR',
'ROLLBACK_TARGET_ON_ERROR' and 'ABORT_TARGET_ON_ERROR'.
id(string): Configuration Templates's UUID of template .
language(string): Configuration Templates's Template language (JINJA or VELOCITY) .
lastUpdateTime(integer): Configuration Templates's Update time of template .
latestVersionTime(integer): Configuration Templates's Latest versioned template time .
name(string): Configuration Templates's Name of template .
parentTemplateId(string): Configuration Templates's Parent templateID .
projectId(string): Configuration Templates's Project UUID .
projectName(string): Configuration Templates's Project name .
rollbackTemplateContent(string): Configuration Templates's Rollback template content .
rollbackTemplateParams(list): Configuration Templates's rollbackTemplateParams (list of objects).
softwareType(string): Configuration Templates's Applicable device software type .
softwareVariant(string): Configuration Templates's Applicable device software variant .
softwareVersion(string): Configuration Templates's Applicable device software version .
tags(list): Configuration Templates's tags (list of objects).
templateContent(string): Configuration Templates's Template content .
templateParams(list): Configuration Templates's templateParams (list of objects).
validationErrors(object): Configuration Templates's validationErrors.
version(string): Configuration Templates's Current version of template .
project_name(basestring): projectName path parameter. Project name to create template under the project
.
do_version(bool): doVersion query parameter. If this flag is true then it creates a new version of the
Expand All @@ -565,7 +619,7 @@ def imports_the_templates_provided(self,
already exists' error .
headers(dict): Dictionary of HTTP Headers to send with the Request
.
payload(list): A JSON serializable Python object to send in the
payload(dict): A JSON serializable Python object to send in the
body of the Request.
active_validation(bool): Enable/Disable payload validation.
Defaults to True.
Expand All @@ -584,7 +638,7 @@ def imports_the_templates_provided(self,
https://developer.cisco.com/docs/dna-center/#!imports-the-templates-provided
"""
check_type(headers, dict)
check_type(payload, list)
check_type(payload, dict)
check_type(do_version, bool)
check_type(project_name, basestring,
may_be_none=False)
Expand All @@ -606,7 +660,62 @@ def imports_the_templates_provided(self,
path_params = {
'projectName': project_name,
}
_payload = payload or []
_payload = {
'tags':
tags,
'author':
author,
'composite':
composite,
'containingTemplates':
containingTemplates,
'createTime':
createTime,
'customParamsOrder':
customParamsOrder,
'description':
description,
'deviceTypes':
deviceTypes,
'failurePolicy':
failurePolicy,
'id':
id,
'language':
language,
'lastUpdateTime':
lastUpdateTime,
'latestVersionTime':
latestVersionTime,
'name':
name,
'parentTemplateId':
parentTemplateId,
'projectId':
projectId,
'projectName':
projectName,
'rollbackTemplateContent':
rollbackTemplateContent,
'rollbackTemplateParams':
rollbackTemplateParams,
'softwareType':
softwareType,
'softwareVariant':
softwareVariant,
'softwareVersion':
softwareVersion,
'templateContent':
templateContent,
'templateParams':
templateParams,
'validationErrors':
validationErrors,
'version':
version,
}
_payload.update(payload or {})
_payload = dict_from_items_with_values(_payload)
if active_validation:
self._request_validator('jsd_db7b6c4f0542aab9fe7cf5c995f83_v2_3_5_3')\
.validate(_payload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(self):
self._validator = fastjsonschema.compile(json.loads(
'''{
"$schema": "http://json-schema.org/draft-04/schema#",
"items": {
"properties": {
"author": {
"type": "string"
Expand Down Expand Up @@ -643,8 +642,6 @@ def __init__(self):
}
},
"type": "object"
},
"type": "array"
}'''.replace("\n" + ' ' * 16, '')
))

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.rst"

[tool.poetry.dependencies]
python = "^3.6"
requests = ">=2.27.1, <=2.28"
requests = ">=2.27.1, <=2.40.0"
fastjsonschema = "^2.16.2"
future = "^0.18.3"
requests-toolbelt = "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ idna==3.4 ; python_version >= "3.6" and python_version < "4.0" \
requests-toolbelt==1.0.0 ; python_version >= "3.6" and python_version < "4.0" \
--hash=sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6 \
--hash=sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06
requests==2.27.1 ; python_version >= "3.6" and python_version < "4.0" \
requests==2.31.0 ; python_version >= "3.6" and python_version < "4.0" \
--hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 \
--hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d
urllib3==1.26.16 ; python_version >= "3.6" and python_version < "4.0" \
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

INSTALLATION_REQUIREMENTS = [
'future>=0.18.3',
'requests>=2.27.1,<=2.28',
'requests>=2.27.1,<=2.40.0',
'fastjsonschema>=2.16.2',
'requests-toolbelt>=1.0.0',
]
Expand Down
23 changes: 23 additions & 0 deletions test_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from dnacentersdk import api

# Create a DNACenterAPI connection object;
# it uses DNA Center sandbox URL, username and password, with DNA Center API version 2.3.5.3.
# and requests to verify the server's TLS certificate with verify=True.
dnac = api.DNACenterAPI(username="devnetuser",
password="Cisco123!",
base_url="https://sandboxdnac.cisco.com:443",
version='2.3.5.3',
verify=True)

# Find all devices that have 'Switches and Hubs' in their family
devices = dnac.devices.get_device_list(family='Switches and Hubs')

# Print all of demo devices
for device in devices.response:
print('{:20s}{}'.format(device.hostname, device.upTime))

# Find all tags
all_tags = dnac.tag.get_tag(sort_by='name', order='des')
demo_tags = [tag for tag in all_tags.response if 'Demo' in tag.name ]

print(all_tags)

0 comments on commit 9e71edb

Please sign in to comment.