Skip to content

Commit

Permalink
Merge pull request #172 from CiscoDevNet/2.2.0
Browse files Browse the repository at this point in the history
Release 2.2.0
  • Loading branch information
praveenramoorthy authored Oct 14, 2022
2 parents 6180e55 + 0c08fe2 commit 5e35e07
Show file tree
Hide file tree
Showing 59 changed files with 24,267 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Name | Description
--- | ---
[cisco.dcnm.dcnm_interface](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_interface_module.rst)|DCNM Ansible Module for managing interfaces.
[cisco.dcnm.dcnm_inventory](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_inventory_module.rst)|Add and remove Switches from a DCNM managed VXLAN fabric.
[cisco.dcnm.dcnm_links](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_links_module.rst)|DCNM ansible module for managing Links.
[cisco.dcnm.dcnm_network](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_network_module.rst)|Add and remove Networks from a DCNM managed VXLAN fabric.
[cisco.dcnm.dcnm_policy](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_policy_module.rst)|DCNM Ansible Module for managing policies.
[cisco.dcnm.dcnm_resource_manager](https://github.com/CiscoDevNet/ansible-dcnm/blob/main/docs/cisco.dcnm.dcnm_resource_manager_module.rst)|DCNM ansible module for managing resources.
Expand All @@ -60,7 +61,7 @@ You can also include it in a `requirements.yml` file and install it with `ansibl
---
collections:
- name: cisco.dcnm
version: 2.1.1
version: 2.2.0
```
## Using this collection
Expand Down
1,284 changes: 1,284 additions & 0 deletions docs/cisco.dcnm.dcnm_links_module.rst

Large diffs are not rendered by default.

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: dcnm
version: 2.1.1
version: 2.2.0
readme: README.md
authors:
- Shrishail Kariyappanavar <nkshrishail>
Expand Down
3,326 changes: 3,326 additions & 0 deletions plugins/modules/dcnm_links.py

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions plugins/modules/dcnm_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,9 @@ def validate_input(self):
net["attach"], att_spec
)
net["attach"] = valid_att
for attach in net["attach"]:
if attach.get("ports"):
attach["ports"] = [port.capitalize() for port in attach["ports"]]
invalid_params.extend(invalid_att)

if state != "deleted":
Expand Down Expand Up @@ -2316,7 +2319,7 @@ def handle_response(self, resp, op):
return False, False

# Responses to all other operations POST and PUT are handled here.
if res.get("MESSAGE") != "OK":
if res.get("MESSAGE") != "OK" or res["RETURN_CODE"] != 200:
fail = True
changed = False
return fail, changed
Expand All @@ -2336,6 +2339,12 @@ def handle_response(self, resp, op):

def failure(self, resp):

# Donot Rollback for Multi-site fabrics
if self.is_ms_fabric:
self.failed_to_rollback = True
self.module.fail_json(msg=resp)
return

# Implementing a per task rollback logic here so that we rollback DCNM to the have state
# whenever there is a failure in any of the APIs.
# The idea would be to run overridden state with want=have and have=dcnm_state
Expand Down Expand Up @@ -2406,9 +2415,9 @@ def dcnm_update_network_information(self, want, have, cfg):

if cfg.get("is_l2only", None) is None:
json_to_dict_want["isLayer2Only"] = json_to_dict_have["isLayer2Only"]
if json_to_dict_want["isLayer2Only"].lower() == "true":
if str(json_to_dict_want["isLayer2Only"]).lower() == "true":
json_to_dict_want["isLayer2Only"] = True
elif json_to_dict_want["isLayer2Only"].lower() == "false":
elif str(json_to_dict_want["isLayer2Only"]).lower() == "false":
json_to_dict_want["isLayer2Only"] = False

if cfg.get("vlan_name", None) is None:
Expand All @@ -2424,9 +2433,9 @@ def dcnm_update_network_information(self, want, have, cfg):

if cfg.get("arp_suppress", None) is None:
json_to_dict_want["suppressArp"] = json_to_dict_have["suppressArp"]
if json_to_dict_want["suppressArp"].lower() == "true":
if str(json_to_dict_want["suppressArp"]).lower() == "true":
json_to_dict_want["suppressArp"] = True
elif json_to_dict_want["suppressArp"].lower() == "false":
elif str(json_to_dict_want["suppressArp"]).lower() == "false":
json_to_dict_want["suppressArp"] = False

if cfg.get("dhcp_srvr1_ip", None) is None:
Expand Down
8 changes: 7 additions & 1 deletion plugins/modules/dcnm_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,7 @@ def handle_response(self, res, op):
return False, False

# Responses to all other operations POST and PUT are handled here.
if res.get("MESSAGE") != "OK":
if res.get("MESSAGE") != "OK" or res["RETURN_CODE"] != 200:
fail = True
changed = False
return fail, changed
Expand All @@ -2054,6 +2054,12 @@ def handle_response(self, res, op):

def failure(self, resp):

# Donot Rollback for Multi-site fabrics
if self.fabric_type == "MFD":
self.failed_to_rollback = True
self.module.fail_json(msg=resp)
return

# Implementing a per task rollback logic here so that we rollback DCNM to the have state
# whenever there is a failure in any of the APIs.
# The idea would be to run overridden state with want=have and have=dcnm_state
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/targets/dcnm_links/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
testcase: "*"
1 change: 1 addition & 0 deletions tests/integration/targets/dcnm_links/meta/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dependencies: [prepare_dcnm_links]
20 changes: 20 additions & 0 deletions tests/integration/targets/dcnm_links/tasks/dcnm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: collect dcnm test cases
find:
paths: "{{ role_path }}/tests/dcnm"
patterns: "{{ testcase }}.yaml"
connection: local
register: dcnm_cases

- set_fact:
test_cases:
files: "{{ dcnm_cases.files }}"

- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"

- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
2 changes: 2 additions & 0 deletions tests/integration/targets/dcnm_links/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- { include: dcnm.yaml, tags: ['dcnm'] }
Loading

0 comments on commit 5e35e07

Please sign in to comment.