Skip to content

Commit

Permalink
Merge pull request #16 from cisco-en-programmability/develop
Browse files Browse the repository at this point in the history
Develop - bug fixes
  • Loading branch information
wastorga authored Sep 20, 2021
2 parents e2963d8 + d245827 commit 28827a9
Show file tree
Hide file tree
Showing 46 changed files with 668 additions and 462 deletions.
10 changes: 9 additions & 1 deletion changelogs/changelogs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,12 @@ releases:
changes:
release_summary: Fixes internal 'exists' comparison
bugfixes:
- Changes the comparison from value to keys
- Changes the comparison from value to keys
3.1.6:
release_date: '2021-09-20'
changes:
release_summary: Fixes get_object_by_name issues
bugfixes:
- Add try catch/except to dnac execution
- Update get for wireless_dynamic_interface, change key that has name
- Update get for wireless_enterprise_ssid, obtain item.ssidDetails from items
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: cisco
name: dnac
version: 3.1.5
version: 3.1.6
readme: README.md
authors:
- Rafael Campos <[email protected]>
Expand Down
34 changes: 34 additions & 0 deletions playbooks/wireless_enterprise_ssid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- hosts: dnac_servers
vars_files:
- credentials.yml
gather_facts: no
tasks:
- name: Create Wirelesss Enterprise SSID
cisco.dnac.wireless_enterprise_ssid:
dnac_host: "{{dnac_host}}"
dnac_username: "{{dnac_username}}"
dnac_password: "{{dnac_password}}"
dnac_verify: "{{dnac_verify}}"
dnac_port: "{{dnac_port}}"
dnac_version: "{{dnac_version}}"
dnac_debug: "{{dnac_debug}}"
state: present
validate_response_schema: false
basicServiceSetClientIdleTimeout: 0
clientExclusionTimeout: 0
enableBasicServiceSetMaxIdle: true
enableBroadcastSSID: true
enableClientExclusion: true
enableDirectedMulticastService: true
enableFastLane: true
enableMACFiltering: true
enableNeighborList: true
enableSessionTimeOut: true
fastTransition: "Adaptive"
mfpClientProtection: "Optional"
name: "Test"
passphrase: ""
radioPolicy: "Dual band operation (2.4GHz and 5GHz)"
securityLevel: "WPA2_ENTERPRISE"
sessionTimeOut: 0
trafficType: "voicedata"
21 changes: 12 additions & 9 deletions plugins/action/application_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ def delete_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="application_policy",
function="get_application_sets",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="application_policy",
function="get_application_sets",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method or it is in another action
items = self.dnac.exec(
family="application_policy",
function="get_applications",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="application_policy",
function="get_applications",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
42 changes: 24 additions & 18 deletions plugins/action/cli_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,34 @@ def update_all_params(self):

def get_object_by_name(self, name):
result = None
items = self.dnac.exec(
family="discovery",
function="get_global_credentials",
params={'credential_sub_type': 'CLI'},
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'description', name) or get_dict_result(items, 'username', name)
try:
items = self.dnac.exec(
family="discovery",
function="get_global_credentials",
params={'credential_sub_type': 'CLI'},
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'description', name) or get_dict_result(items, 'username', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
result = None
items = self.dnac.exec(
family="discovery",
function="get_global_credentials",
params={'credential_sub_type': 'CLI'},
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'id', id)
try:
items = self.dnac.exec(
family="discovery",
function="get_global_credentials",
params={'credential_sub_type': 'CLI'},
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'id', id)
except Exception:
result = None
return result

def exists(self):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/configuration_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="configuration_templates",
function="gets_the_templates_available",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="configuration_templates",
function="gets_the_templates_available",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/configuration_template_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method or it is in another action
items = self.dnac.exec(
family="configuration_templates",
function="get_projects",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="configuration_templates",
function="get_projects",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/device_replacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="device_replacement",
function="return_replacement_devices_with_details",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="device_replacement",
function="return_replacement_devices_with_details",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/event_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method or it is in another action
items = self.dnac.exec(
family="event_management",
function="get_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="event_management",
function="get_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/event_subscription_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="event_management",
function="get_email_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="event_management",
function="get_email_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/event_subscription_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="event_management",
function="get_rest_webhook_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="event_management",
function="get_rest_webhook_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
21 changes: 12 additions & 9 deletions plugins/action/event_subscription_syslog.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ def update_all_params(self):
def get_object_by_name(self, name):
result = None
# NOTICE: Does not have a get by name method, using get all
items = self.dnac.exec(
family="event_management",
function="get_syslog_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
try:
items = self.dnac.exec(
family="event_management",
function="get_syslog_event_subscriptions",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
except Exception:
result = None
return result

def get_object_by_id(self, id):
Expand Down
Loading

0 comments on commit 28827a9

Please sign in to comment.