Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop - 6.7.5 #117

Merged
merged 21 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4fc0835
Documentation changes in the example
Jun 14, 2023
7cd74af
network intent playbook
Jun 26, 2023
16d3330
network intent module
Jun 26, 2023
abfd282
network setting modules global pool(full), reserve ip pool(full), net…
Jun 30, 2023
af34046
Update network_intent.yml - Module Name
MUTHU-RAKESH-27 Jul 13, 2023
c690102
Merge branch 'cisco-en-programmability:main' into main
madhansansel Aug 2, 2023
3c4ed49
Changes to create and delete project and other bug fixes
akabhask Aug 20, 2023
e235b9f
Merge pull request #1 from madhansansel/akabhask.template_intent_code…
akabhask Aug 21, 2023
be07851
adding project description support
akabhask Aug 28, 2023
cfbceec
Merge pull request #2 from madhansansel/akabhask.template_intent_code…
akabhask Aug 29, 2023
8ac93fb
Moving generic api's to library and optimising intent modules
akabhask Aug 29, 2023
b299e3b
Merge pull request #3 from madhansansel/akash.template_intent_code_op…
akabhask Aug 30, 2023
d19c777
Merge pull request #4 from cisco-en-programmability/main
madhansansel Aug 30, 2023
2b30129
Delete network_intent.py
madhansansel Aug 31, 2023
a94547b
Delete network_intent.yml
madhansansel Aug 31, 2023
2f7d9a0
ansible-test error fixes
akabhask Aug 31, 2023
6ac883b
Merge pull request #6 from madhansansel/akash.template_intent_fixes
akabhask Aug 31, 2023
2f72371
Merge pull request #115 from madhansansel/main
wastorga Sep 1, 2023
47ef92b
Updated different function names
DbarrantesE Sep 14, 2023
a9cf4b4
Merge branch 'develop' of https://github.com/cisco-en-programmability…
DbarrantesE Sep 14, 2023
f8d86a3
Release date updated
DbarrantesE Sep 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.4 | 2.6.0 |
| 2.3.5.3 | 6.7.5 | 2.6.0 |

If your Ansible collection is older please consider updating it first.

Expand Down
11 changes: 10 additions & 1 deletion changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -703,4 +703,13 @@ releases:
changes:
release_summary: Updated sanity test.
minor_changes:
- Updated test/sanity and remove unnecessary
- Updated test/sanity and remove unnecessary
6.7.5:
release_date: "2023-09-25"
changes:
release_summary: Updated different function names.
bugfixes:
- Updated from get_permissions_ap_i to get_permissions_api
- Updated from get_roles_ap_i to get_roles_api
- Updated from get_users_ap_i to get_users_api
- Updated from get_external_authentication_servers_ap_i to get_external_authentication_servers_api
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: 6.7.4
version: 6.7.5
readme: README.md
authors:
- Rafael Campos <[email protected]>
Expand Down
18 changes: 18 additions & 0 deletions playbooks/user_info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- hosts: dnac_servers
vars_files:
- credentials.yml
gather_facts: false
connection: local
tasks:
- name: Get all User
cisco.dnac.user_info:
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}}"
#headers: "{{my_headers | from_json}}"
invokeSource: string
register: result
4 changes: 2 additions & 2 deletions plugins/action/role_permissions_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def run(self, tmp=None, task_vars=None):
dnac = DNACSDK(params=self._task.args)

response = dnac.exec(
family="userand_roles",
function='get_permissions_ap_i',
family="user_and_roles",
function='get_permissions_api',
params=self.get_object(self._task.args),
)
self._result.update(dict(dnac_response=response))
Expand Down
4 changes: 2 additions & 2 deletions plugins/action/roles_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def run(self, tmp=None, task_vars=None):
dnac = DNACSDK(params=self._task.args)

response = dnac.exec(
family="userand_roles",
function='get_roles_ap_i',
family="user_and_roles",
function='get_roles_api',
params=self.get_object(self._task.args),
)
self._result.update(dict(dnac_response=response))
Expand Down
12 changes: 6 additions & 6 deletions plugins/action/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def get_object_by_name(self, name):
# NOTE: Does not have a get by name method, using get all
try:
items = self.dnac.exec(
family="userand_roles",
function="get_users_ap_i",
family="user_and_roles",
function="get_users_api",
params=self.get_all_params(name=name),
)
if isinstance(items, dict):
Expand Down Expand Up @@ -148,8 +148,8 @@ def requires_update(self, current_obj):

def create(self):
result = self.dnac.exec(
family="userand_roles",
function="add_user_ap_i",
family="user_and_roles",
function="add_user_api",
params=self.create_params(),
op_modifies=True,
)
Expand All @@ -160,8 +160,8 @@ def update(self):
name = self.new_object.get("name")
result = None
result = self.dnac.exec(
family="userand_roles",
function="update_user_ap_i",
family="user_and_roles",
function="update_user_api",
params=self.update_all_params(),
op_modifies=True,
)
Expand Down
4 changes: 2 additions & 2 deletions plugins/action/user_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def run(self, tmp=None, task_vars=None):
dnac = DNACSDK(params=self._task.args)

response = dnac.exec(
family="userand_roles",
function='get_users_ap_i',
family="user_and_roles",
function='get_users_api',
params=self.get_object(self._task.args),
)
self._result.update(dict(dnac_response=response))
Expand Down
4 changes: 2 additions & 2 deletions plugins/action/users_external_servers_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def run(self, tmp=None, task_vars=None):
dnac = DNACSDK(params=self._task.args)

response = dnac.exec(
family="userand_roles",
function='get_external_authentication_servers_ap_i',
family="user_and_roles",
function='get_external_authentication_servers_api',
params=self.get_object(self._task.args),
)
self._result.update(dict(dnac_response=response))
Expand Down
80 changes: 78 additions & 2 deletions plugins/module_utils/dnac.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,89 @@
else:
LOGGING_IN_STANDARD = True
import os.path
import copy
import datetime
import inspect


def log(msg):
class DnacBase:
"""Class contains members which can be reused for all intent modules"""
def __init__(self, module):
self.module = module
self.params = module.params
self.config = copy.deepcopy(module.params.get("config"))
self.have_create = {}
self.want_create = {}
self.validated_config = []
self.msg = ""
self.status = "success"
dnac_params = self.get_dnac_params(self.params)
self.dnac = DNACSDK(params=dnac_params)
self.dnac_apply = {'exec': self.dnac._exec}
self.get_diff_state_apply = {'merged': self.get_diff_merged,
'deleted': self.get_diff_deleted}
self.dnac_log = dnac_params.get("dnac_log")
self.log(str(dnac_params))
self.supported_states = ["merged", "deleted"]
self.result = {"changed": False, "diff": [], "response": [], "warnings": []}

def log(self, message, frameIncrement=0):
"""Log messages into dnac.log file"""

if self.dnac_log:
message = "Module: " + self.__class__.__name__ + ", " + message
log(message, (1 + frameIncrement))

def check_return_status(self):
"""API to check the return status value and exit/fail the module"""

self.log("status: {0}, msg:{1}".format(self.status, self.msg), frameIncrement=1)
if "failed" in self.status:
self.module.fail_json(msg=self.msg, response=[])
elif "exited" in self.status:
self.module.exit_json(**self.result)
elif "invalid" in self.status:
self.module.fail_json(msg=self.msg, response=[])

def get_dnac_params(self, params):
"""Store the DNAC parameters from the playbook"""

dnac_params = {"dnac_host": params.get("dnac_host"),
"dnac_port": params.get("dnac_port"),
"dnac_username": params.get("dnac_username"),
"dnac_password": params.get("dnac_password"),
"dnac_verify": params.get("dnac_verify"),
"dnac_debug": params.get("dnac_debug"),
"dnac_log": params.get("dnac_log")
}
return dnac_params

def get_task_details(self, task_id):
"""Check if the task performed is sucessfull or not"""

result = None
response = self.dnac_apply['exec'](
family="task",
function="get_task_by_id",
params={"task_id": task_id},
)

self.log(str(response))
if isinstance(response, dict):
result = response.get("response")

return result

def reset_values(self):
"""Reset all neccessary attributes to default values"""

self.have_create.clear()
self.want_create.clear()


def log(msg, frameIncrement=0):
with open('dnac.log', 'a') as of:
callerframerecord = inspect.stack()[1]
callerframerecord = inspect.stack()[1 + frameIncrement]
frame = callerframerecord[0]
info = inspect.getframeinfo(frame)
d = datetime.datetime.now().replace(microsecond=0).isoformat()
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/role_permissions_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
link: https://developer.cisco.com/docs/dna-center/#!get-permissions-api
notes:
- SDK Method used are
userand_roles.UserandRoles.get_permissions_ap_i,
user_and_roles.UserandRoles.get_permissions_ap_i,

- Paths used are
get /dna/system/api/v1/role/permissions,
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/roles_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
link: https://developer.cisco.com/docs/dna-center/#!get-roles-api
notes:
- SDK Method used are
userand_roles.UserandRoles.get_roles_ap_i,
user_and_roles.UserandRoles.get_roles_ap_i,

- Paths used are
get /dna/system/api/v1/roles,
Expand Down
Loading