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

dcnm_network: Fix key not found issue #339

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions playbooks/roles/dcnm_network/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
# This ansible.cfg file is only used for testing purposes in this directory.
roles_path = <path to targets>/collections/ansible_collections/cisco/dcnm/tests/integration/targets
15 changes: 15 additions & 0 deletions playbooks/roles/dcnm_network/dcnm_hosts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
all:
vars:
ansible_user: "admin"
ansible_password: "password-secret"
ansible_python_interpreter: python
ansible_httpapi_validate_certs: False
ansible_httpapi_use_ssl: True
children:
dcnm:
vars:
ansible_connection: ansible.netcommon.httpapi
ansible_network_os: cisco.dcnm.dcnm
hosts:
nac-ndfc1:
ansible_host: 10.10.5.1
35 changes: 35 additions & 0 deletions playbooks/roles/dcnm_network/dcnm_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# This playbook can be used to execute integration tests for
# the role located in:
#
# tests/integration/targets/dcnm_network
#
# Modify the vars section with details for your testing setup.
#
# NOTES:
# 1. Ensure that the switches defined by ansible_switch1 and ansible_switch2 are
# not vPC Pairs.
- hosts: dcnm
gather_facts: no
connection: ansible.netcommon.httpapi

vars:
# Uncomment testcase to run a specific test
# testcase: replaced_net_all
test_fabric: nac-ndfc1
ansible_switch1: 192.168.1.1
ansible_switch2: 192.168.1.2
ansible_sw1_int1: Ethernet1/15
ansible_sw1_int2: Ethernet1/16
ansible_sw1_int3: Ethernet1/17
ansible_sw1_int4: Ethernet1/18
#---
ansible_sw2_int1: Ethernet1/15
ansible_sw2_int2: Ethernet1/16
ansible_sw2_int3: Ethernet1/17
ansible_sw2_int4: Ethernet1/18
ansible_sw2_int5: Ethernet1/19
ansible_sw2_int6: Ethernet1/20

roles:
- dcnm_network
4 changes: 2 additions & 2 deletions plugins/modules/dcnm_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ def diff_for_attach_deploy(self, want_a, have_a, replace=False):
if bool(want["is_deploy"]):
dep_net = True

if bool(want["is_deploy"]) is not bool(have["is_deploy"]):
if bool(want["is_deploy"]):
if bool(want.get("is_deploy")) is not bool(have.get("is_deploy")):
if bool(want.get("is_deploy")):
dep_net = True

if not found:
Expand Down
Loading