From 29b301fe7b6f2621f61bcbe30705634f9d12a5ff Mon Sep 17 00:00:00 2001 From: fmunoz Date: Mon, 12 Jun 2023 13:31:40 -0600 Subject: [PATCH 1/3] - The global credentials create implementation need to be fixed #103 - Discovery playbook has hardcoded credentials id and seed IP #102 --- playbooks/discovery.yml | 14 +++++++------- playbooks/global_credentials.yml | 6 +++--- plugins/action/cli_credential.py | 2 +- plugins/action/http_read_credential.py | 2 +- plugins/action/http_write_credential.py | 2 +- plugins/action/netconf_credential.py | 2 +- plugins/action/snmpv2_read_community_credential.py | 2 +- .../action/snmpv2_write_community_credential.py | 2 +- plugins/action/snmpv3_credential.py | 5 ++++- 9 files changed, 20 insertions(+), 17 deletions(-) diff --git a/playbooks/discovery.yml b/playbooks/discovery.yml index d05d201a35..ce9a387705 100644 --- a/playbooks/discovery.yml +++ b/playbooks/discovery.yml @@ -1,5 +1,9 @@ --- - hosts: dnac_servers + vars: + globalCredentialIdList: + - "90acbab8-03d5-4726-9c19-e1e51a40b3cd" + - "f979d842-f6fd-456a-8137-2cb5113cd2e8" vars_files: - credentials.yml gather_facts: false @@ -17,7 +21,7 @@ - name: Set fact of filtered discoveries ansible.builtin.set_fact: - discoveries_filtered: "{{ discovery_range_result.dnac_response.response | selectattr('name', 'equalto', 'start_discovery_test2')}}" + discoveries_filtered: "{{ discovery_range_result.dnac_response.response | selectattr('name', 'equalto', 'DMZ Lab 2')}}" when: - discovery_range_result is defined - discovery_range_result.dnac_response is defined @@ -54,9 +58,7 @@ state: present cdpLevel: 16 discoveryType: CDP - globalCredentialIdList: - - 90acbab8-03d5-4726-9c19-e1e51a40b3cd - - f979d842-f6fd-456a-8137-2cb5113cd2e8 + globalCredentialIdList: "{{globalCredentialIdList}}" ipAddressList: 10.10.22.22 name: start_discovery_test2 protocolOrder: ssh @@ -93,9 +95,7 @@ state: present cdpLevel: 16 discoveryType: CDP - globalCredentialIdList: - - 90acbab8-03d5-4726-9c19-e1e51a40b3cd, - - f979d842-f6fd-456a-8137-2cb5113cd2e8, + globalCredentialIdList: "{{globalCredentialIdList}}" ipAddressList: 10.10.22.22 name: start_discovery_test2 protocolOrder: ssh diff --git a/playbooks/global_credentials.yml b/playbooks/global_credentials.yml index c485e5d209..dca7df37c0 100644 --- a/playbooks/global_credentials.yml +++ b/playbooks/global_credentials.yml @@ -17,8 +17,8 @@ validate_response_schema: false enablePassword: C2sco456! username: Test2 - password: C2sco456! - description: Test2 + password: C2sco456!2 + description: Test2 Ansible - name: Create SNMPV3 Credential cisco.dnac.snmpv3_credential: @@ -33,4 +33,4 @@ validate_response_schema: false username: user2 snmpMode: NOAUTHNOPRIV - description: user2 cred + description: user2 222 diff --git a/plugins/action/cli_credential.py b/plugins/action/cli_credential.py index d10c90049a..2b42190fa3 100644 --- a/plugins/action/cli_credential.py +++ b/plugins/action/cli_credential.py @@ -127,7 +127,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/http_read_credential.py b/plugins/action/http_read_credential.py index 1d1ac0acd2..c73050be86 100644 --- a/plugins/action/http_read_credential.py +++ b/plugins/action/http_read_credential.py @@ -130,7 +130,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/http_write_credential.py b/plugins/action/http_write_credential.py index 5a63c0d5e5..7ae396a1b7 100644 --- a/plugins/action/http_write_credential.py +++ b/plugins/action/http_write_credential.py @@ -130,7 +130,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/netconf_credential.py b/plugins/action/netconf_credential.py index 08aa9d19c0..5ea30373d9 100644 --- a/plugins/action/netconf_credential.py +++ b/plugins/action/netconf_credential.py @@ -121,7 +121,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/snmpv2_read_community_credential.py b/plugins/action/snmpv2_read_community_credential.py index 60edf5c833..cda2e0c06e 100644 --- a/plugins/action/snmpv2_read_community_credential.py +++ b/plugins/action/snmpv2_read_community_credential.py @@ -115,7 +115,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/snmpv2_write_community_credential.py b/plugins/action/snmpv2_write_community_credential.py index 97982d2c71..2ff190d75a 100644 --- a/plugins/action/snmpv2_write_community_credential.py +++ b/plugins/action/snmpv2_write_community_credential.py @@ -115,7 +115,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) diff --git a/plugins/action/snmpv3_credential.py b/plugins/action/snmpv3_credential.py index 480c82e66d..3130877154 100644 --- a/plugins/action/snmpv3_credential.py +++ b/plugins/action/snmpv3_credential.py @@ -137,7 +137,7 @@ def exists(self): id_exists = False name_exists = False o_id = self.new_object.get("id") - name = self.new_object.get("description") or self.new_object.get("username") + name = self.new_object.get("username") or self.new_object.get("description") if o_id: prev_obj = self.get_object_by_id(o_id) id_exists = prev_obj is not None and isinstance(prev_obj, dict) @@ -167,6 +167,9 @@ def requires_update(self, current_obj): ("snmpMode", "snmpMode"), ("username", "username"), ] + + print("requested_obj: ", requested_obj) + print("current_obj: ", current_obj) # Method 1. Params present in request (Ansible) obj are the same as the current (ISE) params # If any does not have eq params, it requires update return any(not dnac_compare_equality(current_obj.get(dnac_param), From 996ce7e14fc5a23a38bba69e14ecdfe0a2239c87 Mon Sep 17 00:00:00 2001 From: William Astorga Date: Tue, 27 Jun 2023 10:54:44 -0600 Subject: [PATCH 2/3] documentation changes in example of site_intent adding commit 4fc0835 of pull request #107 --- plugins/modules/site_intent.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/modules/site_intent.py b/plugins/modules/site_intent.py index 1ce7446932..887db6b8c2 100644 --- a/plugins/modules/site_intent.py +++ b/plugins/modules/site_intent.py @@ -123,14 +123,14 @@ dnac_debug: "{{dnac_debug}}" dnac_log: "{{dnac_log}}" config: - site: - building: - address: string - latitude: 0 - longitude: 0 - name: string - parentName: string - type: string + - site: + building: + address: string + latitude: 0 + longitude: 0 + name: string + parentName: string + type: string """ RETURN = r""" From 4c4b61e8990ed64476db5a9eefc3773cec6062dd Mon Sep 17 00:00:00 2001 From: fmunoz Date: Tue, 27 Jun 2023 11:07:36 -0600 Subject: [PATCH 3/3] 6.7.3: release_date: "2023-06-27" changes: release_summary: Updating documentation and fixing global credentials. minor_changes: - Documentation changes in example of site_intent - The global credentials create implementation fixed. - Discovery playbook has no hardcoded credentials id and seed IP. --- README.md | 2 +- changelogs/changelog.yaml | 10 +++++++++- galaxy.yml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f9e5f11f1..5a41ec1c7c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The following table shows the supported versions. | 2.2.2.3 | 3.3.1 | 2.3.3 | | 2.2.3.3 | 6.4.0 | 2.4.11 | | 2.3.3.0 | 6.6.4 | 2.5.5 | -| 2.3.5.3 | 6.7.2 | 2.6.0 | +| 2.3.5.3 | 6.7.3 | 2.6.0 | If your Ansible collection is older please consider updating it first. diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index e8f9f436aa..649cb96a01 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -689,4 +689,12 @@ releases: changes: release_summary: Adding documentation for 2.3.5.3 API minor_changes: - - Updating documentation, collection supports 2.3.5.3 DNA Center API Version. \ No newline at end of file + - Updating documentation, collection supports 2.3.5.3 DNA Center API Version. + 6.7.3: + release_date: "2023-06-27" + changes: + release_summary: Updating documentation and fixing global credentials. + minor_changes: + - Documentation changes in example of site_intent + - The global credentials create implementation fixed. + - Discovery playbook has no hardcoded credentials id and seed IP. \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index c60a114fe1..6e071737d2 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: cisco name: dnac -version: 6.7.2 +version: 6.7.3 readme: README.md authors: - Rafael Campos