diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 87f39e76f..621daa2a0 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -21,15 +21,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- ansible: [2.15.12, 2.16.7]
+ ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
steps:
- name: Check out code
uses: actions/checkout@v2
- - name: Set up Python "3.10"
+ - name: Set up Python "3.11"
uses: actions/setup-python@v1
with:
- python-version: "3.10"
+ python-version: "3.11"
- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
@@ -52,11 +52,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- ansible: [2.15.12, 2.16.7]
+ ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
python: ["3.9", "3.10", "3.11"]
exclude:
- - ansible: 2.16.7
+ - ansible: 2.16.14
python: "3.9"
+ - ansible: 2.17.12
+ python: "3.9"
+ - ansible: 2.18.6
+ python: "3.9"
+ - ansible: 2.18.6
+ python: "3.10"
steps:
- name: Set up Python (v${{ matrix.python }})
uses: actions/setup-python@v1
@@ -87,15 +93,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- ansible: [2.15.12, 2.16.7]
+ ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
steps:
- - name: Set up Python "3.10"
+ - name: Set up Python "3.11"
uses: actions/setup-python@v1
with:
- python-version: "3.10"
+ python-version: "3.11"
- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
+
+ - name: Install Pydantic (v2)
+ run: pip install pydantic==2.11.4
+
+ - name: Install DeepDiff (v8.5.0)
+ run: pip install deepdiff==8.5.0
- name: Install coverage (v7.3.4)
run: pip install coverage==7.3.4
@@ -120,4 +132,4 @@ jobs:
- name: Generate coverage report
run: coverage report
- working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
+ working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 41aee7d78..c1155ddad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,4 +79,5 @@ venv.bak/
.mypy_cache/
# Ignore Integration Tests Files Directories
-tests/integration/targets/ndfc_interface/files
\ No newline at end of file
+tests/integration/targets/ndfc_interface/files
+tests/integration/targets/dcnm_network/files
\ No newline at end of file
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index fc677aaa8..4ad4c5906 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,29 @@ This project adheres to `Semantic Versioning `_.
.. contents:: ``Release Versions``
+`3.8.1`_
+=====================
+
+**Release Date:** ``2025-07-02``
+
+Added
+-----
+
+- Enhanced integration tests for the `dcnm_network` and `dcnm_interface` modules
+- Refactored support for breakout interfaces to fix workflow issues in the dcnm_interface module
+
+Fixed
+-----
+
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/80
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/149
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/216
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/239
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/279
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/407
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/428
+- https://github.com/CiscoDevNet/ansible-dcnm/issues/436
+
`3.8.0`_
=====================
@@ -563,6 +586,7 @@ The Ansible Cisco Data Center Network Manager (DCNM) collection includes modules
- cisco.dcnm.dcnm_network - Add and remove Networks from a DCNM managed VXLAN fabric.
- cisco.dcnm.dcnm_interface - DCNM Ansible Module for managing interfaces.
+.. _3.8.1: https://github.com/CiscoDevNet/ansible-dcnm/compare/3.8.0...3.8.1
.. _3.8.0: https://github.com/CiscoDevNet/ansible-dcnm/compare/3.7.0...3.8.0
.. _3.7.0: https://github.com/CiscoDevNet/ansible-dcnm/compare/3.6.0...3.7.0
.. _3.6.0: https://github.com/CiscoDevNet/ansible-dcnm/compare/3.5.1...3.6.0
diff --git a/README.md b/README.md
index ba008ae84..3f49fb3fb 100644
--- a/README.md
+++ b/README.md
@@ -71,7 +71,7 @@ You can also include it in a `requirements.yml` file and install it with `ansibl
---
collections:
- name: cisco.dcnm
- version: 3.8.0
+ version: 3.8.1
```
## Using this collection
diff --git a/docs/cisco.dcnm.dcnm_interface_module.rst b/docs/cisco.dcnm.dcnm_interface_module.rst
index 9efd317e9..e0764f565 100644
--- a/docs/cisco.dcnm.dcnm_interface_module.rst
+++ b/docs/cisco.dcnm.dcnm_interface_module.rst
@@ -540,6 +540,28 @@ Parameters
Description of the interface
+
+ |
+ |
+
+
+ duplex
+
+
+ string
+
+ |
+
+ Choices:
+ auto ←
+ - full
+ - half
+
+ |
+
+ Duplex of the interface. Speed must be set to use duplex.
+ |
+
|
|
@@ -696,6 +718,27 @@ Parameters
Vlan used as native vlan. This option is applicable only for interfaces whose 'mode' is 'trunk'.
+
+ |
+ |
+
+
+ orphan_port
+
+
+ boolean
+
+ |
+
+
+ |
+
+ interface orphan port behavior when switch is in vPC
+ |
+
|
|
@@ -1040,6 +1083,28 @@ Parameters
Description of the interface
+
+ |
+ |
+
+
+ duplex
+
+
+ string
+
+ |
+
+ Choices:
+ auto ←
+ - full
+ - half
+
+ |
+
+ Duplex of the interface. Speed must be set to use duplex.
+ |
+
|
|
@@ -1157,6 +1222,27 @@ Parameters
Vlan used as native vlan. This option is applicable only for interfaces whose 'mode' is 'trunk'.
+
+ |
+ |
+
+
+ orphan_port
+
+
+ boolean
+
+ |
+
+
+ |
+
+ interface orphan port behavior when switch is in vPC
+ |
+
|
|
@@ -1577,6 +1663,24 @@ Parameters
Minimum Value (567), Maximum Value (9216)
+
+ |
+ |
+
+
+ route_tag
+
+
+ string
+
+ |
+
+ Default:
""
+ |
+
+ Route tag associated with the interface IP.
+ |
+
|
|
diff --git a/galaxy.yml b/galaxy.yml
index 5ca35c965..43ab97746 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -1,7 +1,7 @@
---
namespace: cisco
name: dcnm
-version: 3.8.0
+version: 3.8.1
readme: README.md
authors:
- Shrishail Kariyappanavar
diff --git a/playbooks/roles/dcnm_interface/ansible.cfg b/playbooks/roles/dcnm_interface/ansible.cfg
new file mode 100644
index 000000000..7cdd2e0ea
--- /dev/null
+++ b/playbooks/roles/dcnm_interface/ansible.cfg
@@ -0,0 +1,3 @@
+[defaults]
+# This ansible.cfg file is only used for testing purposes in this directory.
+roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targetslh
diff --git a/playbooks/roles/dcnm_interface/dcnm_tests.yaml b/playbooks/roles/dcnm_interface/dcnm_tests.yaml
index b895c8098..03e3122a4 100644
--- a/playbooks/roles/dcnm_interface/dcnm_tests.yaml
+++ b/playbooks/roles/dcnm_interface/dcnm_tests.yaml
@@ -39,6 +39,8 @@
ansible_eth_intf22: Ethernet1/22
ansible_eth_intf23: Ethernet1/23
ansible_eth_intf24: Ethernet1/24
+ ansible_parent_intf1: Ethernet1/25
+ ansible_sub_intf1: Ethernet1/25.100
roles:
- dcnm_interface
\ No newline at end of file
diff --git a/playbooks/roles/dcnm_network/dcnm_tests.yaml b/playbooks/roles/dcnm_network/dcnm_tests.yaml
index f348e54bd..bae7aceaa 100644
--- a/playbooks/roles/dcnm_network/dcnm_tests.yaml
+++ b/playbooks/roles/dcnm_network/dcnm_tests.yaml
@@ -7,29 +7,71 @@
# Modify the vars section with details for your testing setup.
#
# NOTES:
-# 1. Ensure that the switches defined by ansible_switch1 and ansible_switch2 are
+# 1. Ensure that the switches defined by switch1 and 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
-
+ test_data_common:
+ #---
+ fabric: fabric-stage
+ deploy: false
+ #---
+ # Resources
+ #---
+ sw1: 192.168.1.1
+ sw2: 192.168.1.2
+ #---
+ # Common VRF setup
+ #---
+ vrf_1: ansible-vrf-int1
+ vrf_1_id: 9008011
+ vrf_1_vlan_id: 500
+ #---
+ vrf_2: Tenant-1
+ vrf_2_id: 9008012
+ vrf_2_vlan_id: 501
+ #---
+ vrf_3: Tenant-2
+ vrf_3_id: 9008013
+ vrf_3_vlan_id: 502
+ #---
+ # Interfaces
+ #---
+ sw1_int1: Ethernet1/15
+ sw1_int2: Ethernet1/16
+ sw1_int3: Ethernet1/17
+ sw1_int4: Ethernet1/18
+ #---
+ sw2_int1: Ethernet1/15
+ sw2_int2: Ethernet1/16
+ sw2_int3: Ethernet1/17
+ sw2_int4: Ethernet1/18
+ sw2_int5: Ethernet1/19
+ sw2_int6: Ethernet1/20
+ #---
+ net1: ansible-net13
+ net1_net_id: 7005
+ net1_default_net_template: Default_Network_Universal
+ net1_net_extension_template: Default_Network_Extension_Universal
+ net1_vlan_id: 1500
+ net1_gw_ip_subnet: '192.168.30.1/24'
+ #---
+ net2: ansible-net12
+ net2_net_id: 7002
+ net2_default_net_template: Default_Network_Universal
+ net2_net_extension_template: Default_Network_Extension_Universal
+ net2_vlan_id: 151
+ net2_gw_ip_subnet: '192.168.40.1/24'
+ #---
+ net1_vrf: Tenant-1
+ net2_vrf: Tenant-2
+
roles:
- dcnm_network
diff --git a/playbooks/roles/ndfc_interface/ndfc_tests.yaml b/playbooks/roles/ndfc_interface/ndfc_tests.yaml
index 7341b9cc8..e6c99396a 100644
--- a/playbooks/roles/ndfc_interface/ndfc_tests.yaml
+++ b/playbooks/roles/ndfc_interface/ndfc_tests.yaml
@@ -39,6 +39,7 @@
port_channel_1: port-channel801
port_channel_2: port-channel802
port_channel_3: port-channel803
+ port_channel_4: port-channel804
roles:
- ndfc_interface
diff --git a/plugins/action/tests/__init__.py b/plugins/action/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/plugins/action/tests/integration/ndfc_network_validate.py b/plugins/action/tests/integration/ndfc_network_validate.py
new file mode 100644
index 000000000..cc491cba0
--- /dev/null
+++ b/plugins/action/tests/integration/ndfc_network_validate.py
@@ -0,0 +1,140 @@
+from __future__ import absolute_import, division, print_function
+
+
+__metaclass__ = type
+
+from pprint import pprint
+import json
+from ansible.utils.display import Display
+from ansible.plugins.action import ActionBase
+from ansible.module_utils.six import raise_from
+from ansible.errors import AnsibleError
+from ansible.module_utils.common.text.converters import to_native
+from ..plugin_utils.tools import load_yaml_file, process_deepdiff
+from ..plugin_utils.pydantic_schemas.dcnm_network.schemas import DcnmNetworkQuerySchema
+
+try:
+ from deepdiff import DeepDiff
+except ImportError as imp_exc:
+ DEEPDIFF_IMPORT_ERROR = imp_exc
+else:
+ DEEPDIFF_IMPORT_ERROR = None
+
+if DEEPDIFF_IMPORT_ERROR:
+ raise_from(
+ AnsibleError('DeepDiff must be installed to use this plugin. Use pip or install test-requirements.'),
+ DEEPDIFF_IMPORT_ERROR)
+
+display = Display()
+
+
+class ActionModule(ActionBase):
+
+ def verify_deleted(self, results, check_deleted, expected_data, ndfc_data, config_path):
+ if not check_deleted:
+ return None
+ existing_networks = set()
+ for network in ndfc_data["response"]:
+ existing_networks.add(network["parent"]["networkName"])
+
+ if config_path == "":
+ # check for full delete
+ if not ndfc_data["failed"] and len(existing_networks) == 0:
+ results['msg'] = 'All networks are deleted'
+ else:
+ print("Networks still existing: ")
+ print(existing_networks)
+ results['failed'] = True
+ results['msg'] = 'Error: Expected full delete as config_path is empty but networks still exist.'
+ if ndfc_data["failed"]:
+ results['msg'] += '\n\nError: ' + ndfc_data["error"]
+ return results
+ return results
+ # checks for a partial delete
+ deleted_networks = set()
+ for network in expected_data["response"]:
+ deleted_networks.add(network["parent"]["networkName"])
+
+ remaining_networks = existing_networks.intersection(deleted_networks)
+ if len(remaining_networks) > 0:
+ results['failed'] = True
+ print("Expected networks to be deleted: ")
+ print(deleted_networks)
+ print("\nNetworks present in NDFC: ")
+ print(existing_networks)
+ print("\nNetworks still not deleted: ")
+ print(remaining_networks)
+ results['msg'] = 'All networks are not deleted'
+ return results
+
+ print("Expected networks to be deleted: ")
+ print(deleted_networks)
+ print("\n\nNetworks present in NDFC: ")
+ print(existing_networks)
+ print("Networks still not deleted: ")
+ print(remaining_networks)
+ results['failed'] = False
+ results['msg'] = 'Provided networks are deleted'
+ return results
+
+ def run(self, tmp=None, task_vars=None):
+ results = super(ActionModule, self).run(tmp, task_vars)
+ results['failed'] = False
+
+ ndfc_data = self._task.args.get('ndfc_data', None)
+ test_data = self._task.args.get('test_data', None)
+ config_path = self._task.args.get('config_path', None)
+ check_deleted = self._task.args.get('check_deleted', False)
+ ignore_fields = list(self._task.args.get('ignore_fields', []))
+ for input_item in [ndfc_data, test_data, config_path]:
+ if input_item is None:
+ results['failed'] = True
+ results['msg'] = f"Required input parameter not found: '{input_item}'"
+ return results
+
+ # removes ansible embeddings and converts to native python types
+ native_ndfc_data = json.loads(json.dumps(ndfc_data, default=to_native))
+
+ test_fabric = test_data['fabric']
+
+ expected_data_parsed = None
+ if config_path != "":
+ # only parse if config file exists
+ expected_config_data = load_yaml_file(config_path)
+ expected_data = DcnmNetworkQuerySchema.yaml_config_to_dict(expected_config_data, test_fabric)
+
+ expected_data_parsed = DcnmNetworkQuerySchema.model_validate(expected_data).model_dump(exclude_none=True)
+
+ ndfc_data_parsed = DcnmNetworkQuerySchema.model_validate(native_ndfc_data).model_dump(exclude_none=True)
+
+ if deleted_results := self.verify_deleted(results, check_deleted, expected_data_parsed, ndfc_data_parsed, config_path):
+ return deleted_results
+
+ validity = DeepDiff(
+ expected_data_parsed,
+ ndfc_data_parsed,
+ ignore_order=True,
+ cutoff_distance_for_pairs=0,
+ cutoff_intersection_for_pairs=0,
+ report_repetition=True
+ )
+ # Process the output of deepdiff to make it easier to read
+ # Effects the iterable_item_added and iterable_item_removed to remove unneeded fields
+ # ignore_extra_fields=True will ignore dictionary_item_added changes
+ # This is useful when the the actual data has more fields than the expected data
+ # keys_to_ignore is a list of fields to ignore, useful for auto provisioned fields which are not known
+ processed_validity = process_deepdiff(validity, keys_to_ignore=ignore_fields, ignore_extra_fields=True)
+ if processed_validity == {}:
+ results['failed'] = False
+ results['msg'] = f'Data is valid. \n\n Expected data: \n\n{expected_data}\n\nActual data: \n\n{ndfc_data_parsed}'
+ else:
+ results['failed'] = True
+ print("\n\nExpected: ")
+ pprint(expected_data_parsed)
+ print("\n\nActual: ")
+ pprint(ndfc_data_parsed)
+ print("\n\nDifferences: ")
+ pprint(processed_validity)
+ results['msg'] = 'Data is not valid.'
+
+ return results
diff --git a/plugins/action/tests/unit/ndfc_pc_members_validate.py b/plugins/action/tests/integration/ndfc_pc_members_validate.py
similarity index 100%
rename from plugins/action/tests/unit/ndfc_pc_members_validate.py
rename to plugins/action/tests/integration/ndfc_pc_members_validate.py
diff --git a/plugins/action/tests/plugin_utils/__init__.py b/plugins/action/tests/plugin_utils/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/plugins/action/tests/plugin_utils/pydantic_schemas/__init__.py b/plugins/action/tests/plugin_utils/pydantic_schemas/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/__init__.py b/plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py b/plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py
new file mode 100644
index 000000000..15b568dda
--- /dev/null
+++ b/plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py
@@ -0,0 +1,182 @@
+from __future__ import absolute_import, division, print_function
+from typing import List, Optional, Annotated
+from ansible.module_utils.six import raise_from
+from ansible.errors import AnsibleError
+
+try:
+ from pydantic import BaseModel, model_validator, BeforeValidator
+except ImportError as imp_exc:
+ PYDANTIC_IMPORT_ERROR = imp_exc
+else:
+ PYDANTIC_IMPORT_ERROR = None
+
+if PYDANTIC_IMPORT_ERROR:
+ raise_from(
+ AnsibleError('Pydantic must be installed to use this plugin. Use pip or install test-requirements.'),
+ PYDANTIC_IMPORT_ERROR)
+
+# Top level schema
+# Format: ModuleMethodSchema
+# 1. DcnmNetworkQuerySchema
+
+# replace None with default value if it throws an error
+# this can happen if fields are unevenly defined across different networks
+# eg: in one network, vrf is defined, in the other it is not
+
+
+def coerce_int_to_str(data):
+ """Transform input int to str, return other types as is"""
+ if isinstance(data, int):
+ return str(data)
+ return data
+
+
+CoercedStr = Annotated[str, BeforeValidator(coerce_int_to_str)]
+
+
+class DcnmNetworkQuerySchema(BaseModel):
+
+ class SwitchAttach(BaseModel):
+ ipAddress: Optional[str] = None
+ portNames: Optional[str] = None
+ fabricName: Optional[str] = None
+ networkId: Optional[CoercedStr] = None
+ networkName: Optional[str] = None
+ vlanId: Optional[CoercedStr] = None
+ lanAttachState: Optional[str] = None
+
+ @model_validator(mode="after")
+ @classmethod
+ def sort_portNames(cls, values):
+ if getattr(values, "portNames") is not None:
+ if getattr(values, "portNames") == "":
+ setattr(values, "portNames", None)
+ else:
+ setattr(values, "portNames", ",".join(sorted(getattr(values, "portNames").split(","))))
+ return values
+
+ class NetworkTemplateConfig(BaseModel):
+ gatewayIpAddress: Optional[str] = None
+ vlanId: Optional[CoercedStr] = None
+ vrfName: Optional[str] = "NA"
+ dhcpServerAddr1: Optional[str] = None
+ dhcpServerAddr2: Optional[str] = None
+ dhcpServerAddr3: Optional[str] = None
+ vrfDhcp: Optional[str] = None
+ vrfDhcp2: Optional[str] = None
+ vrfDhcp3: Optional[str] = None
+ surpressArp: Optional[bool] = None
+ isLayer2Only: Optional[bool] = False
+ mtu: Optional[CoercedStr] = ""
+ vlanName: Optional[str] = None
+ intfDescription: Optional[str] = None
+ tag: Optional[CoercedStr] = None
+ secondaryGW1: Optional[str] = None
+ secondaryGW2: Optional[str] = None
+ secondaryGW3: Optional[str] = None
+ secondaryGW4: Optional[str] = None
+ gatewayIpV6Address: Optional[str] = None
+ enableL3OnBorder: Optional[bool] = None
+ loopbackId: Optional[CoercedStr] = None
+
+ class Parent(BaseModel):
+ fabric: Optional[str] = None
+ networkId: Optional[CoercedStr] = None
+ networkName: Optional[str] = None
+ networkTemplate: Optional[str] = None
+ networkTemplateConfig: Optional["DcnmNetworkQuerySchema.NetworkTemplateConfig"] = None
+ networkStatus: Optional[str] = None
+ vrf: Optional[str] = "NA"
+
+ class Network(BaseModel):
+ attach: Optional[List["DcnmNetworkQuerySchema.SwitchAttach"]] = None
+ parent: Optional["DcnmNetworkQuerySchema.Parent"] = None
+
+ @model_validator(mode="after")
+ @classmethod
+ def remove_none(cls, values):
+ if getattr(values, "attach") is not None:
+ setattr(values, "attach", [sw for sw in getattr(values, "attach") if sw.portNames is not None])
+ return values
+
+ failed: Optional[bool] = None
+ response: Optional[List[Network]] = None
+
+ @classmethod
+ def yaml_config_to_dict(cls, expected_config_data, test_fabric):
+
+ # Mapping of fields in the yaml config to the fields in the DCNM API response
+ # Format: {yaml_field: api_field}
+ # adding fields places them in pydantic model and is checked by deepdiff
+ # removing/commenting fields removes them from pydantic model
+ # response.parent
+ network_parent_fields = {
+ "net_id": "networkId",
+ "net_name": "networkName",
+ "net_template": "networkTemplate",
+ "vrf_name": "vrf",
+ # "deploy": "networkStatus"
+ }
+ # response.parent.networkTemplateConfig
+ network_template_config_fields = {
+ "gw_ip_subnet": "gatewayIpAddress",
+ "vlan_id": "vlanId",
+ "vrf_name": "vrfName",
+ "dhcp_srvr1_ip": "dhcpServerAddr1",
+ "dhcp_srvr2_ip": "dhcpServerAddr2",
+ "dhcp_srvr3_ip": "dhcpServerAddr3",
+ "dhcp_srvr1_vrf": "vrfDhcp",
+ "dhcp_srvr2_vrf": "vrfDhcp2",
+ "dhcp_srvr3_vrf": "vrfDhcp3",
+ "arp_surpress": "surpressArp",
+ "is_l2only": "isLayer2Only",
+ "mtu_l3intf": "mtu",
+ "vlan_name": "vlanName",
+ "int_desc": "intfDescription",
+ "routing_tag": "tag",
+ "secondary_ip_gw1": "secondaryGW1",
+ "secondary_ip_gw2": "secondaryGW2",
+ "secondary_ip_gw3": "secondaryGW3",
+ "secondary_ip_gw4": "secondaryGW4",
+ "gw_ipv6_subnet": "gatewayIpV6Address",
+ "l3gw_on_border": "enableL3OnBorder",
+ "dhcp_loopback_id": "loopbackId"
+ }
+ # response.attach
+ network_attach_fields = {
+ "ip_address": "ipAddress",
+ "fabric": "fabricName",
+ "net_id": "networkId",
+ "net_name": "networkName",
+ "vlan_id": "vlanId",
+ # "lan_attach_state": "lanAttachState"
+ }
+ expected_data = {}
+ expected_data["failed"] = False
+ expected_data["response"] = []
+ for network in expected_config_data:
+ network_dict = {}
+ network_dict["attach"] = []
+ for switch in network.get('attach', []):
+ switch_dict = {}
+ switch_dict["fabricName"] = test_fabric
+ if 'ports' in switch:
+ switch_dict["portNames"] = ",".join(switch['ports'])
+ for key, value in network_attach_fields.items():
+ if key in switch:
+ switch_dict[value] = switch[key]
+
+ network_dict["attach"].append(switch_dict)
+ network_dict["parent"] = {}
+ network_dict["parent"]["fabric"] = test_fabric
+ for key, value in network_parent_fields.items():
+ if key in network:
+ network_dict["parent"][value] = network[key]
+
+ network_dict["parent"]["networkTemplateConfig"] = {}
+ for key, value in network_template_config_fields.items():
+ if key in network:
+ network_dict["parent"]["networkTemplateConfig"][value] = network[key]
+
+ expected_data["response"].append(network_dict)
+ return expected_data
diff --git a/plugins/action/tests/plugin_utils/tools.py b/plugins/action/tests/plugin_utils/tools.py
new file mode 100644
index 000000000..ff46cf9b7
--- /dev/null
+++ b/plugins/action/tests/plugin_utils/tools.py
@@ -0,0 +1,154 @@
+from __future__ import absolute_import, division, print_function
+
+import yaml
+import os
+
+
+def load_yaml_file(file_path):
+ """
+ Load a YAML file from the given path and return its content as a Python object.
+ """
+ if not os.path.exists(file_path):
+ raise FileNotFoundError(f"The file '{file_path}' does not exist.")
+
+ with open(file_path, 'r', encoding='utf-8') as yaml_file:
+ try:
+ return yaml.safe_load(yaml_file)
+ except yaml.YAMLError as e:
+ raise ValueError(f"Error parsing YAML file '{file_path}': {e}") from e
+
+
+def process_deepdiff(deepdiff_output, keys_to_ignore, ignore_extra_fields=False):
+ """
+ Process deepdiff output to extract paths ignoring indices and find differences.
+ Returns a dictionary with the same structure as deepdiff output but with
+ processed iterable items for easier comparison.
+ Stores values in a "path" -> List["value"] mapping to find differences.
+ Args:
+ deepdiff_output: The output from DeepDiff
+ ignore_extra_fields: When True, ignores dictionary_item_added changes (default: False)
+ """
+ def normalize_path(path):
+ """Remove indexes from paths to make them comparable."""
+ parts = []
+ for part in path.replace("root", "").replace("'", "").replace('"', '').strip("[]").split("]["):
+ # We want to ignore numeric indexes to make it order agnostic
+ if not part.isdigit():
+ parts.append(part)
+ return "[" + "][".join(parts) + "]"
+
+ def extract_values(data, current_path="", values=None):
+ """Extract all values with their normalized paths."""
+ if values is None:
+ values = {}
+
+ if isinstance(data, dict):
+ for key, value in data.items():
+ new_path = f"{current_path}['{key}']" if current_path else f"['{key}']"
+ extract_values(value, new_path, values)
+ elif isinstance(data, list):
+ for i, item in enumerate(data):
+ # We include index in the internal path but will normalize later
+ new_path = f"{current_path}[{i}]"
+ extract_values(item, new_path, values)
+ else:
+ # Store the path with its value
+ norm_path = normalize_path(current_path)
+ if norm_path not in values:
+ values[norm_path] = []
+ values[norm_path].append(str(data))
+ return values
+
+ processed_diff = {}
+
+ # Copy all items except iterable_item_added and iterable_item_removed
+ # If ignore_extra_fields is True, also exclude dictionary_item_added
+ for diff_type, diff_data in deepdiff_output.items():
+ if diff_type not in ['iterable_item_added', 'iterable_item_removed']:
+ if ignore_extra_fields and diff_type == 'dictionary_item_added':
+ continue
+ processed_diff[diff_type] = diff_data
+
+ added_values = {}
+ removed_values = {}
+
+ # Extract added items
+ if 'iterable_item_added' in deepdiff_output:
+ for root_path, data in deepdiff_output['iterable_item_added'].items():
+ values = extract_values(data, root_path)
+ for path, vals in values.items():
+ if path not in added_values:
+ added_values[path] = []
+ added_values[path].extend(vals)
+
+ # Extract removed items
+ if 'iterable_item_removed' in deepdiff_output:
+ for root_path, data in deepdiff_output['iterable_item_removed'].items():
+ values = extract_values(data, root_path)
+ for path, vals in values.items():
+ if path not in removed_values:
+ removed_values[path] = []
+ removed_values[path].extend(vals)
+
+ # Process and add the paths with differences
+ diff_paths = {}
+
+ # Compare added and removed values
+ all_paths = set(list(added_values.keys()) + list(removed_values.keys()))
+
+ for path in all_paths:
+ removed = removed_values.get(path, [])
+ added = added_values.get(path, [])
+
+ remaining_removed = removed.copy()
+ remaining_added = added.copy()
+
+ # Find matching values by checking them as key in the remaining_added dict
+ for val in removed[:]:
+ if val in remaining_added:
+ remaining_added.remove(val)
+ remaining_removed.remove(val)
+
+ # Add differences to diff_paths
+ for val in remaining_removed:
+ if 'removed_values' not in diff_paths:
+ diff_paths['removed_values'] = {}
+ if path not in diff_paths['removed_values']:
+ diff_paths['removed_values'][path] = []
+ diff_paths['removed_values'][path].append(val)
+
+ for val in remaining_added:
+ if 'added_values' not in diff_paths:
+ diff_paths['added_values'] = {}
+ if path not in diff_paths['added_values']:
+ diff_paths['added_values'][path] = []
+ diff_paths['added_values'][path].append(val)
+
+ # Filter out added paths that don't have a corresponding path in removed_values
+ # This is because these paths do not need to be checked as expected data does not have them
+ if 'added_values' in diff_paths:
+ paths_to_remove = []
+ for path in diff_paths['added_values']:
+ if path not in removed_values:
+ paths_to_remove.append(path)
+
+ for path in paths_to_remove:
+ del diff_paths['added_values'][path]
+
+ diff_paths_keys = list(diff_paths['added_values'].keys())
+ for path in diff_paths_keys:
+ for field in keys_to_ignore:
+ if field in path:
+ del diff_paths['added_values'][path]
+
+ # Remove added_values if it becomes empty after filtering
+ if not diff_paths['added_values']:
+ del diff_paths['added_values']
+
+ if diff_paths:
+ if 'added_values' in diff_paths:
+ processed_diff['iterable_item_added'] = diff_paths['added_values']
+ if 'removed_values' in diff_paths:
+ processed_diff['iterable_item_removed'] = diff_paths['removed_values']
+
+ return processed_diff
diff --git a/plugins/module_utils/fabric/query.py b/plugins/module_utils/fabric/query.py
index 0bd47e9db..b4343f9de 100644
--- a/plugins/module_utils/fabric/query.py
+++ b/plugins/module_utils/fabric/query.py
@@ -219,4 +219,14 @@ def commit(self):
self.results.result_current = copy.deepcopy(
self.fabric_details.results.result_current
)
+
+ if not add_to_diff:
+ msg = f"No fabric details found for {self.fabric_names}."
+ self.log.debug(msg)
+ self.results.result_current["found"] = False
+ self.results.result_current["success"] = False
+ else:
+ msg = f"Found fabric details for {self.fabric_names}."
+ self.log.debug(msg)
+
self.results.register_task_result()
diff --git a/plugins/modules/dcnm_interface.py b/plugins/modules/dcnm_interface.py
index 034402cde..93270e778 100644
--- a/plugins/modules/dcnm_interface.py
+++ b/plugins/modules/dcnm_interface.py
@@ -1779,6 +1779,7 @@ class DcnmIntf:
"INTERFACE": "/rest/interface",
"IF_MARK_DELETE": "/rest/interface/markdelete",
"FABRIC_ACCESS_MODE": "/rest/control/fabrics/{}/accessmode",
+ "BREAKOUT": "/rest/interface/breakout",
},
12: {
"VPC_SNO": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface/vpcpair_serial_number?serial_number={}",
@@ -1812,6 +1813,10 @@ def __init__(self, module):
self.diff_replace = []
self.diff_delete = [[], [], [], [], [], [], [], [], []]
self.diff_delete_deploy = [[], [], [], [], [], [], [], [], []]
+ self.breakout = []
+ self.want_breakout = []
+ self.diff_create_breakout = []
+ self.diff_delete_breakout = []
self.diff_deploy = []
self.diff_query = []
self.fd = None
@@ -2013,9 +2018,43 @@ def __init__(self, module):
"BREAKOUT": 8,
}
+ # Build breakout list in config
+ for interface in self.config:
+ if interface.get("type") and interface["type"] == "breakout":
+ self.breakout.append(interface["name"])
+
msg = "ENTERED DcnmIntf: "
self.log.debug(msg)
+ def dcnm_intf_breakout_format(self, if_name):
+ # Define the pattern to match '1/x/y' where x and y are integers
+ pattern = r'^ethernet1/\d+/\d+$'
+
+ # Perform the pattern matching
+ if re.match(pattern, if_name.lower()):
+ # Split the interface name into parts
+ intf = if_name.split("/")
+ # Return True and the formatted interface string
+ return True, f"{intf[0]}/{intf[1]}"
+
+ # Return False and None if the pattern does not match
+ return False, None
+
+ def dcnm_intf_get_parent(self, cfg, name):
+ # Extract the parent interface ID (e.g., "1/2" from "1/2/3")
+ match = re.search(r"(\d+/\d+)/\d+", name)
+ if not match:
+ return False, None # Return early if the pattern doesn't match
+
+ parent_port_id = f"ethernet{match.group(1)}"
+
+ # Search for the parent interface in the configuration
+ for interface in cfg:
+ if interface.get("name").lower() == parent_port_id:
+ return True, interface.get("type", None)
+
+ return False, None
+
def dcnm_intf_dump_have_all(self):
lhave_all = []
@@ -3658,8 +3697,20 @@ def dcnm_intf_get_want(self):
if any("profile" in key for key in delem):
for sw in delem["switch"]:
intf_payload = self.dcnm_get_intf_payload(delem, sw)
- if intf_payload not in self.want:
- self.want.append(intf_payload)
+ if intf_payload["policy"] == "breakout_interface":
+ # Add to self.want_breakout if it's a breakout_interface and not already in self.want
+ if intf_payload not in self.want:
+ self.want_breakout.append(intf_payload)
+ else:
+ # Process non-breakout_interface policies
+ if intf_payload not in self.want:
+ intf = intf_payload["interfaces"][0]["ifName"]
+ is_valid_format, formatted_interface = self.dcnm_intf_breakout_format(intf)
+
+ # Add to self.want only if the interface does not match invalid breakout conditions
+ if not (is_valid_format and formatted_interface not in self.breakout):
+
+ self.want.append(intf_payload)
def dcnm_intf_get_intf_info(self, ifName, serialNumber, ifType):
@@ -3741,7 +3792,6 @@ def dcnm_intf_get_have(self):
# Fetch the information from DCNM w.r.t to the interafce that we have in self.want
intf_payload = self.dcnm_intf_get_intf_info_from_dcnm(intf)
-
if intf_payload:
self.have.append(intf_payload)
@@ -3834,6 +3884,11 @@ def dcnm_intf_compare_elements(
else:
t_e2 = e2
+ if k == 'ENABLE_ORPHAN_PORT':
+ # This is a special case where the value is a boolean and we need to compare it as such
+ t_e1 = str(t_e1).lower()
+ t_e2 = str(t_e2).lower()
+
if t_e1 != t_e2:
if (state == "replaced") or (state == "overridden"):
@@ -4005,6 +4060,39 @@ def dcnm_intf_compare_want_and_have(self, state):
break
# --------------------------------------------------------------------------------------------------------------------
+
+ # workflow to manage breakout interfaces
+ # Append to self.diff_create_breakout to create breakout
+ # Append to self.diff_delete_breakout to delete breakout
+ if state != "deleted":
+ for want_breakout in self.want_breakout:
+ want_intf = want_breakout["interfaces"][0]["ifName"]
+ match_create = False
+ for have_intf in self.have_all:
+ is_valid, intf = self.dcnm_intf_breakout_format(have_intf['ifName'])
+ if is_valid and want_intf == intf:
+ match_create = True
+
+ # If interface in want_breakout and interface e1/x/y not present
+ # add to diff_create_breakout
+ if not match_create:
+ want_breakout["interfaces"][0].pop("fabricName")
+ want_breakout["interfaces"][0].pop("interfaceType")
+ self.diff_create_breakout.append(want_breakout["interfaces"])
+
+ if state == "deleted" or state == "overridden":
+ for have in self.have_all:
+ have_intf = have['ifName']
+ if re.search(r"\d+\/\d+\/\d+", have_intf):
+ found, parent_type = self.dcnm_intf_get_parent(self.config, have_intf)
+ # If have not in want breakout and if match to E1/x/1 add to dict
+ # Else if match E1/x/2, etc. silently ignore, because we delete the breakout
+ # with the first sub if.
+ if re.search(r"\d+\/\d+\/1$", have_intf) and not found:
+ payload = {'serialNumber': have['serialNo'],
+ 'ifName': have['ifName']}
+ self.diff_delete_breakout.append(payload)
+
for want in self.want:
delem = {}
@@ -4027,10 +4115,6 @@ def dcnm_intf_compare_want_and_have(self, state):
]
if not match_have:
- # Match when interface is a breakout, is not possible because
- # parent interface doesn't exist.
- if "breakout_interface" in want['policy']:
- continue
changed_dict = copy.deepcopy(want)
if (
@@ -4449,21 +4533,6 @@ def dcnm_intf_process_config(self, cfg):
):
self.dcnm_intf_get_have_all(sw)
- def dcnm_intf_get_parent(self, cfg, name):
- # Extract the parent interface ID (e.g., "1/2" from "1/2/3")
- match = re.search(r"(\d+/\d+)/\d+", name)
- if not match:
- return False, None # Return early if the pattern doesn't match
-
- parent_port_id = f"ethernet{match.group(1)}"
-
- # Search for the parent interface in the configuration
- for interface in cfg:
- if interface.get("name") == parent_port_id:
- return True, interface.get("type", None)
-
- return False, None
-
def dcnm_intf_get_diff_overridden(self, cfg):
deploy = False
@@ -4609,10 +4678,15 @@ def dcnm_intf_get_diff_overridden(self, cfg):
delem["ifName"] = name
delem["fabricName"] = self.fabric
if str(deploy).lower() == "true":
- self.diff_deploy.append(delem)
- self.changed_dict[0]["deploy"].append(
- copy.deepcopy(delem)
- )
+ # Do not create interface E1/x/y, interface is created with breakout
+ pattern = r'^Ethernet1/\d+/\d+$'
+ if_name = delem.get('ifName')
+
+ if not re.match(pattern, if_name):
+ self.diff_deploy.append(delem)
+ self.changed_dict[0]["deploy"].append(
+ copy.deepcopy(delem)
+ )
# Sub-interafces are returned as INTERFACE_ETHERNET in have_all. So do an
# additional check to see if it is physical. If not assume it to be sub-interface
# for now. We will have to re-visit this check if there are additional non-physical
@@ -4780,7 +4854,21 @@ def dcnm_intf_get_diff_deleted(self):
self.dcnm_intf_get_diff_overridden(self.config)
elif self.config:
for cfg in self.config:
- if cfg.get("name", None) is not None:
+ if cfg.get("name", None) is not None and cfg.get("type") == "breakout":
+ self.dcnm_intf_get_have_all(cfg["switch"][0])
+
+ for have in self.have_all:
+ have_intf = have['ifName']
+ if re.search(r"\d+\/\d+\/\d+", have_intf):
+ found, parent_type = self.dcnm_intf_get_parent(self.config, have_intf)
+ # If have in want breakout and if match to E1/x/1 add to dict
+ # Else if match E1/x/2, etc. silently ignore, because we delete the breakout
+ # with the first sub if.
+ if re.search(r"\d+\/\d+\/1$", have_intf) and found:
+ payload = {'serialNumber': have['serialNo'],
+ 'ifName': have['ifName']}
+ self.diff_delete_breakout.append(payload)
+ elif cfg.get("name", None) is not None:
processed = []
have_all = []
@@ -4798,27 +4886,6 @@ def dcnm_intf_get_diff_deleted(self):
intf = {}
delem = {}
- # If interface type is breakout, we rewrite payload.
- # We append "/1" to the parent interface to create delete payload.
- # Delete payload:
- # [
- # {
- # "serialNumber": "xxxxxx",
- # "ifName": "Ethernet1/100/1"
- # }
- # ]
- if cfg.get("type", None) is not None:
- if cfg['type'] == "breakout":
- payload = {"serialNumber": self.ip_sn[sw],
- "ifName": cfg["name"] + "/1"}
- if_type = cfg['type']
- self.diff_delete[
- self.int_index[self.int_types[cfg['type']]]
- ].append(payload)
- self.changed_dict[0]["deleted"].append(
- copy.deepcopy(payload)
- )
- continue
if_name, if_type = self.dcnm_extract_if_name(cfg)
# Check if the interface is present in DCNM
@@ -5329,20 +5396,27 @@ def dcnm_intf_send_message_to_dcnm(self):
self.result["response"].append(resp)
resp = None
+
+ # Add Breakout creation from self.want_breakout
+ path = self.paths["BREAKOUT"]
+ for payload in self.diff_create_breakout:
+ json_payload = json.dumps(payload)
+ resp = dcnm_send(self.module, "POST", path, json_payload)
+ self.result["response"].append(resp)
+ if (resp.get("MESSAGE") != "OK") or (
+ resp.get("RETURN_CODE") != 200
+ ):
+ resp["CHANGED"] = self.changed_dict
+ self.module.fail_json(msg=resp)
+ else:
+ replace = True
+
+ # Update interfaces
path = self.paths["INTERFACE"]
for payload in self.diff_replace:
- # breakout interface
- if "breakout_interface" in payload["policy"]:
- path = self.paths["BREAKOUT"]
- for breakout in payload['interfaces']:
- breakout.pop("fabricName")
- breakout.pop("interfaceType")
- json_payload = json.dumps(payload['interfaces'])
- resp = dcnm_send(self.module, "POST", path, json_payload)
- else:
- path = self.paths["INTERFACE"]
- json_payload = json.dumps(payload)
- resp = dcnm_send(self.module, "PUT", path, json_payload)
+ json_payload = json.dumps(payload)
+
+ resp = dcnm_send(self.module, "PUT", path, json_payload)
self.result["response"].append(resp)
@@ -5356,6 +5430,21 @@ def dcnm_intf_send_message_to_dcnm(self):
resp = None
+ # Delete Breakout interface
+ if len(self.diff_delete_breakout) > 0:
+ json_payload = json.dumps(self.diff_delete_breakout)
+ resp = dcnm_send(self.module, "DELETE", path, json_payload)
+ self.result["response"].append(resp)
+
+ if (resp.get("MESSAGE") != "OK") or (
+ resp.get("RETURN_CODE") != 200
+ ):
+ resp["CHANGED"] = self.changed_dict
+ self.module.fail_json(msg=resp)
+ else:
+ replace = True
+
+ resp = None
path = self.paths["GLOBAL_IF"]
for payload in self.diff_create:
# Do not create interface E1/x/y directly.
diff --git a/plugins/modules/dcnm_inventory.py b/plugins/modules/dcnm_inventory.py
index 0fd465d37..13e552c9d 100644
--- a/plugins/modules/dcnm_inventory.py
+++ b/plugins/modules/dcnm_inventory.py
@@ -849,12 +849,30 @@ def get_diff_replace_delete(self):
diff_delete = []
+ def check_have_c_in_want_list(have_c):
+ for want_c in self.want_create:
+ if have_c["switches"][0]["ipaddr"] == want_c["switches"][0]["ipaddr"]:
+ return True
+
+ return False
+
def have_in_want(have_c):
match_found = False
+
+ # Check to see if have is in the want list and if not return match_found(False)
+ if not check_have_c_in_want_list(have_c):
+ return match_found
for want_c in self.want_create:
match = re.search(r"\S+\((\S+)\)", want_c["switches"][0]["deviceIndex"])
if match is None:
- continue
+ # If we get here this is typically because the device was pre-provisioned
+ # and the regex expression above will not match in this case.
+ # We need to make an additionl check using ipaddr to see if the device
+ # is already part of the fabric.
+ if have_c["switches"][0]["ipaddr"] == want_c["switches"][0]["ipaddr"]:
+ match = re.search(r"\S+\((\S+)\)", have_c["switches"][0]["deviceIndex"])
+ if match is None:
+ return match_found
want_serial_num = match.groups()[0]
if have_c["switches"][0]["serialNumber"] == want_serial_num:
if (
@@ -883,7 +901,6 @@ def have_in_want(have_c):
def get_diff_delete(self):
diff_delete = []
-
if self.config:
for want_c in self.want_create:
for have_c in self.have_create:
@@ -905,8 +922,21 @@ def get_diff_merge(self):
found = False
match = re.search(r"\S+\((\S+)\)", want_c["switches"][0]["deviceIndex"])
if match is None:
- msg = "Switch with IP {0} is not reachable or is not a valid IP".format(want_c["seedIP"])
- self.module.fail_json(msg=msg)
+ # If we don't have a match that means one of the following:
+ # (1) The device has not been discovered and is not reachable or the IP address is not a valid IP
+ # (2) The device has been discovered and added to the fabric but is currently not reachable
+ # due to it being pre-provisioned or some other reason.
+ want_c_already_discovered = False
+ for have_c in self.have_create:
+ # Check the have list to see if the device has already been discovered and if so
+ # don't error but use the have list to create the match.
+ if have_c["switches"][0]["ipaddr"] == want_c["switches"][0]["ipaddr"]:
+ want_c_already_discovered = True
+ match = re.search(r"\S+\((\S+)\)", have_c["switches"][0]["deviceIndex"])
+ # Device is not part of the fabric so return the error.
+ if not want_c_already_discovered:
+ msg = "Switch with IP {0} is not reachable or is not a valid IP".format(want_c["seedIP"])
+ self.module.fail_json(msg=msg)
serial_num = match.groups()[0]
for have_c in self.have_create:
if (
diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py
index c3188e779..285e9b72c 100644
--- a/plugins/modules/dcnm_network.py
+++ b/plugins/modules/dcnm_network.py
@@ -1268,8 +1268,11 @@ def update_create_params(self, net):
template_conf["vrfDhcp3"] = ""
if template_conf["loopbackId"] is None:
template_conf["loopbackId"] = ""
- if template_conf["mcastGroup"] is None:
- template_conf["mcastGroup"] = ""
+ if self.is_ms_fabric is True:
+ template_conf.pop("mcastGroup")
+ else:
+ if template_conf["mcastGroup"] is None:
+ template_conf["mcastGroup"] = ""
if template_conf["gatewayIpV6Address"] is None:
template_conf["gatewayIpV6Address"] = ""
if template_conf["secondaryGW1"] is None:
@@ -1378,6 +1381,10 @@ def get_have(self):
t_conf.update(SVI_NETFLOW_MONITOR=json_to_dict.get("SVI_NETFLOW_MONITOR", ""))
t_conf.update(VLAN_NETFLOW_MONITOR=json_to_dict.get("VLAN_NETFLOW_MONITOR", ""))
+ # Remove mcastGroup when Fabric is MSD
+ if "mcastGroup" not in json_to_dict:
+ del t_conf["mcastGroup"]
+
net.update({"networkTemplateConfig": json.dumps(t_conf)})
del net["displayName"]
del net["serviceNetworkTemplate"]
@@ -1905,7 +1912,8 @@ def get_diff_merge(self, replace=False):
dhcp2_vrf_changed.update({want_c["networkName"]: dhcp2_vrf_chg})
dhcp3_vrf_changed.update({want_c["networkName"]: dhcp3_vrf_chg})
dhcp_loopback_changed.update({want_c["networkName"]: dhcp_loopbk_chg})
- multicast_group_address_changed.update({want_c["networkName"]: mcast_grp_chg})
+ if self.is_ms_fabric is False:
+ multicast_group_address_changed.update({want_c["networkName"]: mcast_grp_chg})
gwv6_changed.update({want_c["networkName"]: gwv6_chg})
sec_gw1_changed.update({want_c["networkName"]: sec_gw1_chg})
sec_gw2_changed.update({want_c["networkName"]: sec_gw2_chg})
@@ -2605,7 +2613,7 @@ def validate_input(self):
)
att_spec = dict(
ip_address=dict(required=True, type="str"),
- ports=dict(required=True, type="list", default=[]),
+ ports=dict(type="list", default=[]),
deploy=dict(type="bool", default=True),
)
@@ -2671,7 +2679,7 @@ def validate_input(self):
)
att_spec = dict(
ip_address=dict(required=True, type="str"),
- ports=dict(required=True, type="list"),
+ ports=dict(type="list", default=[]),
deploy=dict(type="bool", default=True),
tor_ports=dict(required=False, type="list", elements="dict"),
)
@@ -2902,8 +2910,9 @@ def dcnm_update_network_information(self, want, have, cfg):
if cfg.get("dhcp_loopback_id", None) is None:
json_to_dict_want["loopbackId"] = json_to_dict_have["loopbackId"]
- if cfg.get("multicast_group_address", None) is None:
- json_to_dict_want["mcastGroup"] = json_to_dict_have["mcastGroup"]
+ if self.is_ms_fabric is False:
+ if cfg.get("multicast_group_address", None) is None:
+ json_to_dict_want["mcastGroup"] = json_to_dict_have["mcastGroup"]
if cfg.get("gw_ipv6_subnet", None) is None:
json_to_dict_want["gatewayIpV6Address"] = json_to_dict_have["gatewayIpV6Address"]
diff --git a/test-requirements.txt b/test-requirements.txt
index 50ad63c51..d7a90f825 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,3 +4,5 @@ pexpect
yamllint
pytest-xdist
coverage==4.5.4
+deepdiff==8.5.0
+pydantic==2.11.4
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml b/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml
index 5756e7d43..72427a281 100644
--- a/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml
+++ b/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml
@@ -17,7 +17,7 @@
tags: sanity
- name: run test cases (connection=httpapi)
- include: "{{ test_case_to_run }}"
+ ansible.builtin.include_tasks: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
@@ -43,7 +43,7 @@
method: DELETE
path: "{{ [vpc_delete_path[controller_version], ansible_vxlan_fabric_sno1] | join ('') }}"
register: result
- ignore_errors: yes
+ ignore_errors: true
when: (ansible_vxlan_fabric is defined and ansible_vxlan_fabric_sno1 is defined and ansible_vxlan_fabric_sno2 is defined)
- name: Wait for 10 secs
@@ -61,7 +61,7 @@
path: "{{ vxlan_config_save_path[controller_version] }}"
register: result
when: (ansible_vxlan_fabric is defined and ansible_vxlan_fabric_sno1 is defined and ansible_vxlan_fabric_sno2 is defined)
- ignore_errors: yes
+ ignore_errors: true
##############################################
## DEPLOY VXLAN VPC PAIR ##
@@ -75,7 +75,7 @@
with_sequence: count=1
loop_control:
pause: 5
- ignore_errors: yes
+ ignore_errors: true
when: (ansible_vxlan_fabric is defined and ansible_vxlan_fabric_sno1 is defined and ansible_vxlan_fabric_sno2 is defined)
##############################################
@@ -86,7 +86,7 @@
method: DELETE
path: "{{ [vpc_delete_path[controller_version], ansible_cxt_fabric_sno1] | join ('') }}"
register: result
- ignore_errors: yes
+ ignore_errors: true
when: (ansible_cxt_fabric is defined and ansible_cxt_fabric_sno1 is defined and ansible_cxt_fabric_sno2 is defined)
- name: Wait for 10 secs
@@ -104,7 +104,7 @@
path: "{{ cxt_config_save_path[controller_version] }}"
register: result
when: (ansible_cxt_fabric is defined and ansible_cxt_fabric_sno1 is defined and ansible_cxt_fabric_sno2 is defined)
- ignore_errors: yes
+ ignore_errors: true
##############################################
## DEPLOY CXT VPC PAIR ##
@@ -118,7 +118,7 @@
with_sequence: count=1
loop_control:
pause: 5
- ignore_errors: yes
+ ignore_errors: true
when: (ansible_cxt_fabric is defined and ansible_cxt_fabric_sno1 is defined and ansible_cxt_fabric_sno2 is defined)
- name: Final Cleanup - delete my_vpc my_lacp my_interface_vlan and my_hsrp policies that we created during init
@@ -160,4 +160,4 @@
that:
- 'item["RETURN_CODE"] == 200'
loop: '{{ result.response }}'
- tags: sanity
+ tags: sanity
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml
index 78c5fb834..390715438 100644
--- a/tests/integration/targets/dcnm_interface/tasks/main.yaml
+++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml
@@ -1,2 +1,2 @@
---
-- { include: dcnm.yaml, tags: ['dcnm'] }
\ No newline at end of file
+- { ansible.builtin.include_tasks: dcnm.yaml, tags: ['dcnm'] }
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml
index ddd1ce1e1..d1174a1a9 100644
--- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml
+++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml
@@ -22,9 +22,26 @@
##############################################
## MERGE ##
##############################################
+
+ - name: Put Parent Interface for Sub-Interface into routed mode
+ cisco.dcnm.dcnm_interface:
+ check_deploy: False
+ fabric: "{{ ansible_it_fabric }}"
+ state: merged # only choose form [merged, replaced, deleted, overridden, query]
+ config:
+ - name: "{{ ansible_parent_intf1 }}" # should be of the form eth
+ type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi]
+ switch:
+ - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
+ deploy: false # choose from [true, false]
+ profile:
+ admin_state: true # choose from [true, false]
+ mode: routed # choose from [trunk, access, routed, monitor, epl_routed]
+ description: "Parent Interface for Sub-Interface test"
+
- name: Create interfaces to check various delete form 1
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: merged # only choose form [merged, replaced, deleted, overridden, query]
config:
@@ -32,7 +49,7 @@
type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: trunk # choose from [trunk, access, l3, monitor]
@@ -40,7 +57,7 @@
type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: subint # choose from [subint]
vlan: 100 # vlan ID [min:2, max:3967]
@@ -51,7 +68,7 @@
type: lo # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch where to deploy the config
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: lo # choose from [lo]
ipv4_addr: 193.168.2.1 # ipv4 address for the loopback interface
@@ -61,7 +78,7 @@
switch: # provide switches of vPC pair
- "{{ ansible_switch1 }}"
- "{{ ansible_switch2 }}"
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
admin_state: true # choose from [true, false]
mode: trunk # choose from [trunk, access]
@@ -88,7 +105,7 @@
- '(result["diff"][0]["deleted"] | length) == 0'
- '(result["diff"][0]["replaced"] | length) == 0'
- '(result["diff"][0]["overridden"] | length) == 0'
- - '(result["diff"][0]["deploy"] | length) == 4'
+ - '(result["diff"][0]["deploy"] | length) == 0'
- assert:
that:
@@ -101,7 +118,7 @@
- name: Delete all interfaces form 1
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: deleted # only choose form [merged, replaced, deleted, overridden,query]
register: result
@@ -124,9 +141,25 @@
## MERGE ##
##############################################
+ - name: Put Parent Interface for Sub-Interface into routed mode
+ cisco.dcnm.dcnm_interface:
+ check_deploy: False
+ fabric: "{{ ansible_it_fabric }}"
+ state: merged # only choose form [merged, replaced, deleted, overridden, query]
+ config:
+ - name: "{{ ansible_parent_intf1 }}" # should be of the form eth
+ type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi]
+ switch:
+ - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
+ deploy: false # choose from [true, false]
+ profile:
+ admin_state: true # choose from [true, false]
+ mode: routed # choose from [trunk, access, routed, monitor, epl_routed]
+ description: "Parent Interface for Sub-Interface test"
+
- name: Create all interfaces to check delete form 2
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: merged # only choose form [merged, replaced, deleted, overridden, query]
config:
@@ -134,7 +167,7 @@
type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: trunk # choose from [trunk, access, l3, monitor]
@@ -142,7 +175,7 @@
type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: subint # choose from [subint]
vlan: 100 # vlan ID [min:2, max:3967]
@@ -153,7 +186,7 @@
type: lo # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch where to deploy the config
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: lo # choose from [lo]
ipv4_addr: 193.168.2.1 # ipv4 address for the loopback interface
@@ -163,7 +196,7 @@
switch: # provide switches of vPC pair
- "{{ ansible_switch1 }}"
- "{{ ansible_switch2 }}"
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
admin_state: true # choose from [true, false]
mode: trunk # choose from [trunk, access]
@@ -190,7 +223,7 @@
- '(result["diff"][0]["deleted"] | length) == 0'
- '(result["diff"][0]["replaced"] | length) == 0'
- '(result["diff"][0]["overridden"] | length) == 0'
- - '(result["diff"][0]["deploy"] | length) == 4'
+ - '(result["diff"][0]["deploy"] | length) == 0'
- assert:
that:
@@ -203,13 +236,11 @@
- name: Delete all interfaces form 2
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: deleted # only choose form [merged, replaced, deleted, overridden,query]
config:
- switch:
- - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- - "{{ ansible_switch1 }}"
- "{{ ansible_switch2 }}" # provide the switch where to deploy the config
register: result
@@ -220,7 +251,7 @@
- '(result["diff"][0]["deleted"] | length) == 4'
- '(result["diff"][0]["replaced"] | length) != 0'
- '(result["diff"][0]["overridden"] | length) == 0'
- - '(result["diff"][0]["deploy"] | length) != 0'
+ - '(result["diff"][0]["deploy"] | length) == 0'
- assert:
that:
@@ -231,9 +262,25 @@
## MERGE ##
##############################################
+ - name: Put Parent Interface for Sub-Interface into routed mode
+ cisco.dcnm.dcnm_interface:
+ check_deploy: False
+ fabric: "{{ ansible_it_fabric }}"
+ state: merged # only choose form [merged, replaced, deleted, overridden, query]
+ config:
+ - name: "{{ ansible_parent_intf1 }}" # should be of the form eth
+ type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi]
+ switch:
+ - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
+ deploy: false # choose from [true, false]
+ profile:
+ admin_state: true # choose from [true, false]
+ mode: routed # choose from [trunk, access, routed, monitor, epl_routed]
+ description: "Parent Interface for Sub-Interface test"
+
- name: Create all interfaces to check delete form 3
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: merged # only choose form [merged, replaced, deleted, overridden, query]
config:
@@ -241,7 +288,7 @@
type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: trunk # choose from [trunk, access, l3, monitor]
@@ -249,7 +296,7 @@
type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: subint # choose from [subint]
vlan: 100 # vlan ID [min:2, max:3967]
@@ -260,7 +307,7 @@
type: lo # choose from this list [pc, vpc, sub_int, lo, eth, svi]
switch:
- "{{ ansible_switch1 }}" # provide the switch where to deploy the config
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
mode: lo # choose from [lo]
ipv4_addr: 193.168.2.1 # ipv4 address for the loopback interface
@@ -270,7 +317,7 @@
switch: # provide switches of vPC pair
- "{{ ansible_switch1 }}"
- "{{ ansible_switch2 }}"
- deploy: true # choose from [true, false]
+ deploy: false # choose from [true, false]
profile:
admin_state: true # choose from [true, false]
mode: trunk # choose from [trunk, access]
@@ -297,7 +344,7 @@
- '(result["diff"][0]["deleted"] | length) == 0'
- '(result["diff"][0]["replaced"] | length) == 0'
- '(result["diff"][0]["overridden"] | length) == 0'
- - '(result["diff"][0]["deploy"] | length) == 4'
+ - '(result["diff"][0]["deploy"] | length) == 0'
- assert:
that:
@@ -310,7 +357,7 @@
- name: Delete all interfaces form 3
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: deleted # only choose form [merged, replaced, deleted, overridden,query]
config:
@@ -351,7 +398,7 @@
- name: Put fabric to default state
cisco.dcnm.dcnm_interface:
- check_deploy: True
+ check_deploy: False
fabric: "{{ ansible_it_fabric }}"
state: overridden # only choose form [merged, replaced, deleted, overridden, query]
register: result
@@ -361,4 +408,4 @@
that:
- 'item["RETURN_CODE"] == 200'
loop: '{{ result.response }}'
- when: IT_CONTEXT is not defined
+ when: IT_CONTEXT is not defined
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/files/.gitkeep b/tests/integration/targets/dcnm_network/files/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml b/tests/integration/targets/dcnm_network/tasks/dcnm.yaml
deleted file mode 100644
index 8a842e5c1..000000000
--- a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-- name: collect dcnm test cases
- find:
- paths: ["{{ role_path }}/tests/dcnm", "{{ role_path }}/tests/dcnm/self-contained-tests"]
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: dcnm_cases
- tags: sanity
-
-- set_fact:
- test_cases:
- files: "{{ dcnm_cases.files }}"
- tags: sanity
-
-- name: set test_items
- set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- tags: sanity
-
-- name: run test cases (connection=httpapi)
- include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- tags: sanity
-
-- name: DELETED - Clean up any existing vrfs
- cisco.dcnm.dcnm_vrf:
- fabric: "{{ test_fabric }}"
- state: deleted
- tags: sanity
diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml
index 1a3cdfccc..1c9e5973d 100644
--- a/tests/integration/targets/dcnm_network/tasks/main.yaml
+++ b/tests/integration/targets/dcnm_network/tasks/main.yaml
@@ -1,8 +1,20 @@
---
+- name: MAIN - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_setup:
+ #----------------------------------
+ # config template for vrf setup
+ #----------------------------------
+ vrf_conf_template: "dcnm_network_setup_vrf_conf.j2"
+ vrf_conf_file: "{{ role_path }}/files/dcnm_network_setup_vrf_conf.yaml"
+ #----------------------------------
+ delegate_to: localhost
+ tags: always
+# maintaining backward compatibility until all test cases are updated
- set_fact:
controller_version: "Unable to determine controller version"
- tags: sanity
+ tags: always
- name: Determine version of DCNM or NDFC
cisco.dcnm.dcnm_rest:
@@ -10,13 +22,13 @@
path: /appcenter/cisco/ndfc/api/about/version
register: result
ignore_errors: yes
- tags: sanity
+ tags: always
- set_fact:
controller_version: "{{ result.response['DATA']['version'][0:2] | int }}"
when: ( result.response['DATA']['version'] is search("\d\d.\d+") )
ignore_errors: yes
- tags: sanity
+ tags: always
- name: Determine version of DCNM or NDFC
cisco.dcnm.dcnm_rest:
@@ -24,52 +36,87 @@
path: /fm/fmrest/about/version
register: result
ignore_errors: yes
- tags: sanity
+ tags: always
- set_fact:
controller_version: "{{ result.response['DATA']['version'][0:2] | int }}"
when: ( result.response['DATA']['version'] is search("\d\d.\d+") )
ignore_errors: yes
- tags: sanity
+ tags: always
+
-# No need to continue if we cannot determine the DCNM/NDFC controller version
- assert:
that:
- 'controller_version != "Unable to determine controller version"'
- tags: sanity
+ tags: always
-- name: Remove all existing networks to start with a clean state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: deleted
- tags: sanity
+# new version below
+
+- name: MAIN - QUERY - Verify Fabric Deployment
+ cisco.dcnm.dcnm_fabric:
+ state: query
+ config:
+ - FABRIC_NAME: "{{ test_data_common.fabric }}"
+ register: result
+ tags: always
+
+- name: MAIN - ASSERT - Fabric Found
+ assert:
+ that:
+ - result.result[0].found == true
+ fail_msg: "Fabric '{{ test_data_common.fabric }}' not found."
+ tags: always
+
+- name: MAIN - Create VRF Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_setup.vrf_conf_template }}"
+ dest: "{{ test_data_setup.vrf_conf_file }}"
+ delegate_to: localhost
+ tags: always
+
+- name: MAIN - Load VRF Configuration
+ ansible.builtin.set_fact:
+ dcnm_network_setup_vrf_conf: "{{ lookup('file', '{{ test_data_setup.vrf_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: always
-- name: Create vrfs required for this test and remove all other vrfs
+- name: MAIN - OVERRIDDEN - Create vrfs required for this test and remove all other vrfs
cisco.dcnm.dcnm_vrf:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: overridden
- config:
- - vrf_name: ansible-vrf-int1
- vrf_id: 9008011
- vlan_id: 500
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- - ip_address: "{{ ansible_switch2 }}"
- deploy: true
- - vrf_name: Tenant-1
- vrf_id: 9008012
- vlan_id: 501
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- - ip_address: "{{ ansible_switch2 }}"
- deploy: true
- - vrf_name: Tenant-2
- vrf_id: 9008013
- vlan_id: 502
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- - ip_address: "{{ ansible_switch2 }}"
- deploy: true
- tags: sanity
-
-- { include_tasks: dcnm.yaml, tags: ['dcnm'] }
+ config: "{{ dcnm_network_setup_vrf_conf }}"
+ tags: always
+
+- name: MAIN - Collect DCNM Network Test Cases
+ find:
+ paths: ["{{ role_path }}/tests/dcnm", "{{ role_path }}/tests/dcnm/self-contained-tests"]
+ patterns: "{{ testcase }}.yaml"
+ connection: local
+ register: dcnm_cases
+ delegate_to: localhost
+ tags: always
+
+- name: MAIN - Set Test Cases Fact
+ set_fact:
+ test_cases:
+ files: "{{ dcnm_cases.files }}"
+ delegate_to: localhost
+ tags: always
+
+- name: MAIN - Build List of Test Items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+ delegate_to: localhost
+ tags: always
+
+- name: MAIN - Run Test Cases
+ include_tasks: "{{ test_case_to_run }}"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
+ tags: always
+
+- name: MAIN - DELETED - Clean Up Any Existing VRFs
+ cisco.dcnm.dcnm_vrf:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ tags: always
diff --git a/tests/integration/targets/dcnm_network/templates/dcnm_network_setup_vrf_conf.j2 b/tests/integration/targets/dcnm_network/templates/dcnm_network_setup_vrf_conf.j2
new file mode 100644
index 000000000..ffe3cecc5
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/dcnm_network_setup_vrf_conf.j2
@@ -0,0 +1,38 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Vrf 1
+# ------------------------------
+- vrf_name: "{{ test_data_common.vrf_1 }}"
+ vrf_id: {{ test_data_common.vrf_1_id }}
+ vlan_id: {{ test_data_common.vrf_1_vlan_id }}
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ - ip_address: "{{ test_data_common.sw2 }}"
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Vrf 2
+# ------------------------------
+- vrf_name: "{{ test_data_common.vrf_2 }}"
+ vrf_id: {{ test_data_common.vrf_2_id }}
+ vlan_id: {{ test_data_common.vrf_2_vlan_id }}
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ - ip_address: "{{ test_data_common.sw2 }}"
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Vrf 3
+# ------------------------------
+- vrf_name: "{{ test_data_common.vrf_3 }}"
+ vrf_id: {{ test_data_common.vrf_3_id }}
+ vlan_id: {{ test_data_common.vrf_3_vlan_id }}
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ - ip_address: "{{ test_data_common.sw2 }}"
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_double_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_double_net_conf.j2
new file mode 100644
index 000000000..0e7654530
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_double_net_conf.j2
@@ -0,0 +1,37 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2_l3_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2_l3_net_conf.j2
new file mode 100644
index 000000000..06efa3cda
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2_l3_net_conf.j2
@@ -0,0 +1,53 @@
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ arp_suppress: False
+ int_desc: 'test interface 1'
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2only_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2only_net_conf.j2
new file mode 100644
index 000000000..3d18b57aa
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_l2only_net_conf.j2
@@ -0,0 +1,30 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# L2 only Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: True
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net1_conf.j2 b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net1_conf.j2
new file mode 100644
index 000000000..a9a46ff5e
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net1_conf.j2
@@ -0,0 +1,24 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+
diff --git a/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net2_conf.j2 b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net2_conf.j2
new file mode 100644
index 000000000..aca75eb7e
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/deleted/dcnm_network_deleted_net2_conf.j2
@@ -0,0 +1,16 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_auto_vlan_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_auto_vlan_conf.j2
new file mode 100644
index 000000000..1c4ccaac6
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_auto_vlan_conf.j2
@@ -0,0 +1,34 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_conf.j2
new file mode 100644
index 000000000..e976484c8
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_double_net_conf.j2
@@ -0,0 +1,35 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2_l3_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2_l3_net_conf.j2
new file mode 100644
index 000000000..06efa3cda
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2_l3_net_conf.j2
@@ -0,0 +1,53 @@
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ arp_suppress: False
+ int_desc: 'test interface 1'
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2only_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2only_net_conf.j2
new file mode 100644
index 000000000..3d18b57aa
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l2only_net_conf.j2
@@ -0,0 +1,30 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# L2 only Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: True
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_conf.j2
new file mode 100644
index 000000000..4b7b3b003
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_conf.j2
@@ -0,0 +1,25 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ int_desc: 'test interface'
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_final_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_final_conf.j2
new file mode 100644
index 000000000..7d2270bed
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_final_conf.j2
@@ -0,0 +1,28 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ int_desc: 'test interface'
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_only_attach_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_only_attach_conf.j2
new file mode 100644
index 000000000..f5d21e5d9
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_l3_net_only_attach_conf.j2
@@ -0,0 +1,15 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# L2 only Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_conf.j2
new file mode 100644
index 000000000..6de7f73ff
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_conf.j2
@@ -0,0 +1,22 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ deploy_local | bool }}
+
+
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_multi_attach_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_multi_attach_conf.j2
new file mode 100644
index 000000000..a21036a48
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_multi_attach_conf.j2
@@ -0,0 +1,24 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ deploy_local | bool }}
+
+
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_no_attach_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_no_attach_conf.j2
new file mode 100644
index 000000000..f64ccb034
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_no_attach_conf.j2
@@ -0,0 +1,19 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ deploy: {{ deploy_local | bool }}
+
+
diff --git a/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_routing_tag_conf.j2 b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_routing_tag_conf.j2
new file mode 100644
index 000000000..fc60a7c3c
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/merged/dcnm_network_merged_net1_routing_tag_conf.j2
@@ -0,0 +1,23 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ routing_tag: 321
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_double_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_double_net_conf.j2
new file mode 100644
index 000000000..9bd31b98a
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_double_net_conf.j2
@@ -0,0 +1,37 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_changed_conf.j2
new file mode 100644
index 000000000..99a97fdc0
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_changed_conf.j2
@@ -0,0 +1,30 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: ansible-net14
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_conf.j2
new file mode 100644
index 000000000..41cd02425
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_l2_l3_net_conf.j2
@@ -0,0 +1,54 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 8600
+ int_desc: 'test interface 1'
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_net1_conf.j2 b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_net1_conf.j2
new file mode 100644
index 000000000..94edccba6
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/overridden/dcnm_network_overridden_net1_conf.j2
@@ -0,0 +1,14 @@
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int3 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_changed_conf.j2
new file mode 100644
index 000000000..1cb807d7a
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_changed_conf.j2
@@ -0,0 +1,29 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_conf.j2
new file mode 100644
index 000000000..066a25cec
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_double_net_conf.j2
@@ -0,0 +1,37 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_changed_conf.j2
new file mode 100644
index 000000000..391a8ec60
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_changed_conf.j2
@@ -0,0 +1,47 @@
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ arp_suppress: False
+ int_desc: 'test interface 1'
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_conf.j2 b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_conf.j2
new file mode 100644
index 000000000..434e9f13e
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/replaced/dcnm_network_replaced_l2_l3_net_conf.j2
@@ -0,0 +1,55 @@
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ int_desc: 'test interface'
+ is_l2only: True
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ # Leave 'arp_suppress' this false to avoid TCAM issue
+ # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
+ arp_suppress: False
+ int_desc: 'test interface 1'
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_merged_conf.j2 b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_merged_conf.j2
new file mode 100644
index 000000000..05c68aad6
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_merged_conf.j2
@@ -0,0 +1,37 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int3 }}", "{{ test_data_common.sw2_int4 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int5 }}", "{{ test_data_common.sw2_int6 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_overridden_conf.j2 b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_overridden_conf.j2
new file mode 100644
index 000000000..25c758dcd
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_overridden_conf.j2
@@ -0,0 +1,20 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_replaced_conf.j2 b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_replaced_conf.j2
new file mode 100644
index 000000000..1cb807d7a
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/sanity/dcnm_network_sanity_replaced_conf.j2
@@ -0,0 +1,29 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+# ------------------------------
+# Network 1
+# ------------------------------
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ deploy: {{ test_data_common.deploy | bool }}
+
+# ------------------------------
+# Network 2
+# ------------------------------
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ deploy: {{ test_data_common.deploy | bool }}
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_changed_conf.j2
new file mode 100644
index 000000000..f3deefabf
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_changed_conf.j2
@@ -0,0 +1,28 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan2
+ dhcp_srvr1_ip: '55.11.11.11'
+ dhcp_srvr2_ip: '55.22.22.22'
+ dhcp_srvr3_ip: '55.33.33.33'
+ dhcp_srvr1_vrf: eleven
+ dhcp_srvr2_vrf: twelve
+ dhcp_srvr3_vrf: thirteen
+ dhcp_loopback_id: 55
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy }}"
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_conf.j2
new file mode 100644
index 000000000..86dd66b7f
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_dhcp_conf.j2
@@ -0,0 +1,53 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan1
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ dhcp_loopback_id: 1022
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy }}"
+
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan2
+ dhcp_srvr1_ip: '11.11.11.11'
+ dhcp_srvr2_ip: '22.22.22.22'
+ dhcp_srvr3_ip: '33.33.33.33'
+ dhcp_srvr1_vrf: eleven
+ dhcp_srvr2_vrf: twelve
+ dhcp_srvr3_vrf: thirteen
+ dhcp_loopback_id: 1023
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy }}"
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_changed_conf.j2
new file mode 100644
index 000000000..2ef543aa5
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_changed_conf.j2
@@ -0,0 +1,23 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan2
+ multicast_group_address: '238.55.66.124'
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_conf.j2
new file mode 100644
index 000000000..a77e1ae93
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/double_net_mcast_conf.j2
@@ -0,0 +1,41 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan1
+ multicast_group_address: '230.101.134.144'
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
+
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan2
+ multicast_group_address: '234.55.66.188'
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_changed_conf.j2
new file mode 100644
index 000000000..dfdd7fed8
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_changed_conf.j2
@@ -0,0 +1,24 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ gw_ipv6_subnet: '2001::1/64'
+ secondary_ip_gw1: '192.0.3.1/24'
+ secondary_ip_gw2: '192.1.3.1/24'
+ secondary_ip_gw3: '192.2.3.1/24'
+ secondary_ip_gw4: '192.3.3.1/24'
+ route_target_both: true
+ l3gw_on_border: true
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int3 }}", "{{ test_data_common.sw1_int4 }}"]
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_conf.j2
new file mode 100644
index 000000000..9a82de0e6
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_conf.j2
@@ -0,0 +1,24 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ gw_ipv6_subnet: '2001::1/64'
+ secondary_ip_gw1: '192.0.2.1/24'
+ secondary_ip_gw2: '192.1.2.1/24'
+ secondary_ip_gw3: '192.2.2.1/24'
+ secondary_ip_gw4: '192.3.2.1/24'
+ route_target_both: true
+ l3gw_on_border: true
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_changed_conf.j2
new file mode 100644
index 000000000..05a67e73f
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_changed_conf.j2
@@ -0,0 +1,29 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.55.55'
+ dhcp_srvr2_ip: '2.2.55.55'
+ dhcp_srvr3_ip: '3.3.55.55'
+ dhcp_srvr1_vrf: one_fifty_five
+ dhcp_srvr2_vrf: two_fifty_five
+ dhcp_srvr3_vrf: three_fifty_five
+ dhcp_loopback_id: 0
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_conf.j2
new file mode 100644
index 000000000..922dabb26
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_dhcp_conf.j2
@@ -0,0 +1,29 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan
+ dhcp_srvr1_ip: '1.1.1.1'
+ dhcp_srvr2_ip: '2.2.2.2'
+ dhcp_srvr3_ip: '3.3.3.3'
+ dhcp_srvr1_vrf: one
+ dhcp_srvr2_vrf: two
+ dhcp_srvr3_vrf: three
+ dhcp_loopback_id: 0
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: false
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_changed_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_changed_conf.j2
new file mode 100644
index 000000000..3f2b422ec
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_changed_conf.j2
@@ -0,0 +1,23 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan
+ multicast_group_address: '230.55.24.155'
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_conf.j2
new file mode 100644
index 000000000..76d755378
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net1_mcast_conf.j2
@@ -0,0 +1,23 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net1 }}"
+ vrf_name: "{{ test_data_common.net1_vrf }}"
+ net_id: "{{ test_data_common.net1_net_id }}"
+ net_template: "{{ test_data_common.net1_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net1_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net1_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net1_gw_ip_subnet }}"
+ mtu_l3intf: 7600
+ arp_suppress: False
+ int_desc: 'test interface'
+ is_l2only: False
+ vlan_name: testvlan
+ multicast_group_address: '224.5.5.5'
+ attach:
+ - ip_address: "{{ test_data_common.sw1 }}"
+ ports: []
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/net2_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net2_conf.j2
new file mode 100644
index 000000000..f0196fb0e
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/net2_conf.j2
@@ -0,0 +1,24 @@
+---
+# This NDFC test data structure is auto-generated
+# DO NOT EDIT MANUALLY
+#
+
+
+- net_name: "{{ test_data_common.net2 }}"
+ vrf_name: "{{ test_data_common.net2_vrf }}"
+ net_id: "{{ test_data_common.net2_net_id }}"
+ net_template: "{{ test_data_common.net2_default_net_template }}"
+ net_extension_template: "{{ test_data_common.net2_net_extension_template }}"
+ vlan_id: "{{ test_data_common.net2_vlan_id }}"
+ gw_ip_subnet: "{{ test_data_common.net2_gw_ip_subnet }}"
+ gw_ipv6_subnet: '2001::1/64'
+ secondary_ip_gw1: '192.0.3.1/24'
+ secondary_ip_gw2: '192.1.3.1/24'
+ secondary_ip_gw3: '192.2.3.1/24'
+ secondary_ip_gw4: '192.3.3.1/24'
+ route_target_both: true
+ l3gw_on_border: true
+ attach:
+ - ip_address: "{{ test_data_common.sw2 }}"
+ ports: ["{{ test_data_common.sw2_int1 }}", "{{ test_data_common.sw2_int2 }}"]
+ deploy: "{{ test_data_common.deploy | bool }}"
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/templates/self-contained-tests/scale_conf.j2 b/tests/integration/targets/dcnm_network/templates/self-contained-tests/scale_conf.j2
new file mode 100644
index 000000000..3cbba48ad
--- /dev/null
+++ b/tests/integration/targets/dcnm_network/templates/self-contained-tests/scale_conf.j2
@@ -0,0 +1,8 @@
+{% for i in range(801) %}
+- net_name: "TEST_NET{{ "%03d"|format(i + 1) }}"
+ vrf_name: "Tenant-1"
+ deploy: false
+ net_id: {{ 50001 + i }}
+ vlan_id: {{ 2001 + i }}
+ attach: []
+{% endfor %}
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml
index 9bb8b2433..d296f6497 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml
@@ -2,679 +2,521 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
-
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
-
-- name: DELETED - Verify if fabric - Fabric1 is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
+- name: DELETED - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+ tags: deleted
-- name: debug
- debug:
- var: result
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: DELETED - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_deleted:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # COMMON - Create, Attach and Deploy Single Network with multiple switch Attach
+ net1_conf_template: "deleted/dcnm_network_deleted_net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/dcnm_network_deleted_net1_conf.yaml"
+ # TC1 - Delete Single Network with deleted state
+ net2_conf_template: "deleted/dcnm_network_deleted_net2_conf.j2"
+ net2_conf_file: "{{ role_path }}/files/dcnm_network_deleted_net2_conf.yaml"
+ # TC2 - Delete Single Network with deleted state and verify other network is still there
+ double_net_conf_template: "deleted/dcnm_network_deleted_double_net_conf.j2"
+ double_net_conf_file: "{{ role_path }}/files/dcnm_network_deleted_double_net_conf.yaml"
+ # TC4 - Create L2 only networks along with all dhcp, arp options
+ l2only_net_conf_template: "deleted/dcnm_network_deleted_l2only_net_conf.j2"
+ l2only_net_conf_file: "{{ role_path }}/files/dcnm_network_deleted_l2only_net_conf.yaml"
+ # TC5 - Create a L2 only and L3 networks along with all dhcp, arp options
+ l2_l3_net_conf_template: "deleted/dcnm_network_deleted_l2_l3_net_conf.j2"
+ l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_deleted_l2_l3_net_conf.yaml"
+ delegate_to: localhost
+ tags: deleted
-- assert:
- that:
- - result.response.DATA != None
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
+
+- name: DELETED - COMMON - Create Module Payloads using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_deleted.net1_conf_template }}"
+ dest: "{{ test_data_deleted.net1_conf_file }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC1 - Create Module Payloads using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_deleted.net2_conf_template }}"
+ dest: "{{ test_data_deleted.net2_conf_file }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - Create Module Payloads using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_deleted.double_net_conf_template }}"
+ dest: "{{ test_data_deleted.double_net_conf_file }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC4 - Create Module Payloads using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_deleted.l2only_net_conf_template }}"
+ dest: "{{ test_data_deleted.l2only_net_conf_file }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC5 - Create Module Payloads using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_deleted.l2_l3_net_conf_template }}"
+ dest: "{{ test_data_deleted.l2_l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: deleted
+
+###############################################
+### DELETED ##
+###############################################
+
+# TC1
+- name: DELETED - TC1 - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_net1_conf: "{{ lookup('file', '{{ test_data_deleted.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
-- name: DELETED - setup - Clean up any existing networks
+- name: DELETED - TC1 - DELETED - Delete all the networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: deleted
-- name: DELETED - Create, Attach and Deploy Single Network with multiple switch Attach
+- name: DELETED - TC1 - MERGED - Create, Attach and Deploy Single Network with multiple switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_deleted_net1_conf }}"
register: result
+ tags: deleted
+
+- name: DELETED - TC1 - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - 'result.changed == true'
+ tags: deleted
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: DELETED - TC1 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
-- name: debug
- debug:
- var: result
+- name: DELETED - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: deleted
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[1].DATA|dict2items)[1].value == "SUCCESS"
-###############################################
-### DELETED ##
-###############################################
-
-- name: DELETED - Delete Single Network with deleted state
+- name: DELETED - TC1 - DELETED - Delete Single Network with deleted state
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
+ config: "{{ dcnm_network_deleted_net1_conf }}"
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC1 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[0].attach[1].deploy == false
- - result.diff[0].net_name == "ansible-net13"
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[2].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: DELETED - conf - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC1 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC1 - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC1 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- - result.diff|length == 0
- - result.response|length == 0
-
-- name: DELETED - Create, Attach and Deploy Multiple Network with single switch Attach
+ tags: deleted
+
+# TC2
+- name: DELETED - TC2 - Load Double Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_double_net_conf: "{{ lookup('file', '{{ test_data_deleted.double_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - Load Network 2 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_net2_conf: "{{ lookup('file', '{{ test_data_deleted.net2_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - MERGED - Create, Attach and Deploy Multiple Network with single switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_deleted_double_net_conf }}"
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC2 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: DELETED - Delete Single Network with deleted state and verify other network is still there
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.double_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - DELETED - Delete Single Network with deleted state and verify other network is still there
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
- config:
- - net_name: ansible-net12
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
+ config: "{{ dcnm_network_deleted_net2_conf }}"
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch2 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[2].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.diff[0].attach[0].deploy == false
- - result.diff[0].net_name == "ansible-net12"
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: DELETED - conf - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC2 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC1 - VALIDITY CHECK - Verify network is deleted in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.net2_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - VALIDITY CHECK - Verify other network is still present in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - conf - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC2 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- - result.diff|length == 0
- - result.response|length == 0
+ tags: deleted
-- name: DELETED - Delete the other Single Network with deleted state and verify no network is present now
+- name: DELETED - TC2 - Delete the other Single Network with deleted state
cisco.dcnm.dcnm_network: &conf2
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
+ config: "{{ dcnm_network_deleted_net1_conf }}"
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[0].net_name == "ansible-net13"
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[2].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: DELETED - conf - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC2 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC2 - VALIDITY CHECK - Verify all networks are deleted in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: ""
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC2 - conf - Idempotence
cisco.dcnm.dcnm_network: *conf2
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC2 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- - result.diff|length == 0
- - result.response|length == 0
+ tags: deleted
+
+# TC3
-- name: DELETED - Create, Attach and Deploy Multiple Network with single switch Attach
+- name: DELETED - TC3 - MERGED - Create, Attach and Deploy Multiple Network with single switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
- register: result
+ config: "{{ dcnm_network_deleted_double_net_conf }}"
+ tags: deleted
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: DELETED - TC3 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: DELETED - Delete all the networks
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.double_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: deleted
+
+- name: DELETED - TC3 - DELETED - Delete all the networks
cisco.dcnm.dcnm_network: &conf3
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC3 - ASSERT - Check changed flag is true
+ assert:
that:
- - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name'
- - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name'
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[3].MESSAGE == "OK"
- - result.response[3].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: DELETED - conf3 - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC3 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: ""
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ tags: deleted
+
+- name: DELETED - TC3 - conf3 - Idempotence
cisco.dcnm.dcnm_network: *conf3
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC3 - ASSERT - Check changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
- - 'result.diff|length == 0'
+ - result.changed == false
+ tags: deleted
-- name: DELETED - Create L2 only networks along with all dhcp, arp options
+
+# TC4
+- name: DELETED - TC4 - Load L2 only Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_l2only_net_conf: "{{ lookup('file', '{{ test_data_deleted.l2only_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC4 - MERGED - Create L2 only networks along with all dhcp, arp options
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: True
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
+ config: "{{ dcnm_network_deleted_l2only_net_conf }}"
+
register: result
+ tags: deleted
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: DELETED - TC4 - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC4 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.diff[0].arp_suppress == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[0].int_desc == "test interface"
- - result.diff[0].is_l2only == true
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[0].net_id == 7009
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[0].vrf_name == "NA"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: DELETED - setup - Clean up l2_only existing network
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC4 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.l2only_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC4 - DELETED - Clean up l2_only existing network
cisco.dcnm.dcnm_network: &conf4
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: True
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
+ config: "{{ dcnm_network_deleted_l2only_net_conf }}"
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC4 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[0].net_name == "ansible-net13"
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[2].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: DELETED - conf4 - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC4 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC4 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.l2only_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC4 - conf4 - Idempotence
cisco.dcnm.dcnm_network: *conf4
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC4 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- - result.diff|length == 0
- - result.response|length == 0
+ tags: deleted
+
+# TC5
+- name: DELETED - TC5 - Load L2 and L3 Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_l2_l3_net_conf: "{{ lookup('file', '{{ test_data_deleted.l2_l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
-- name: DELETED - Create a L2 only and L3 networks along with all dhcp, arp options
+- name: DELETED - TC5 - MERGED - Create a L2 only and L3 networks along with all dhcp, arp options
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- # Leave 'arp_suppress' this false to avoid TCAM issue
- # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7010
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3505
- gw_ip_subnet: '162.168.30.1/24'
- mtu_l3intf: 7600
- # Leave 'arp_suppress' this false to avoid TCAM issue
- # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
- arp_suppress: False
- int_desc: 'test interface 1'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: True
+ config: "{{ dcnm_network_deleted_l2_l3_net_conf }}"
register: result
+ tags: deleted
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: DELETED - TC5 - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC5 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].arp_suppress == false
- - result.diff[1].arp_suppress == false
- - result.diff[0].int_desc == "test interface"
- - result.diff[1].int_desc == "test interface 1"
- - result.diff[0].is_l2only == true
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[1].mtu_l3intf == 7600
- - result.diff[0].net_id == 7009
- - result.diff[1].net_id == 7010
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[1].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[1].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[1].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[1].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[1].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[1].dhcp_srvr3_vrf == "three"
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[1].vlan_name == "testvlan1"
- - result.diff[0].vrf_name == "NA"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: DELETED - Delete all the networks
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC5 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_deleted.l2_l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - DELETED - Delete all the networks
cisco.dcnm.dcnm_network: &conf5
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - conf5 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.diff[0].net_name == "ansible-net12"
- - result.diff[1].net_name == "ansible-net13"
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[3].MESSAGE == "OK"
- - result.response[3].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: DELETED - conf5 - Idempotence
+ - 'result.changed == true'
+ tags: deleted
+
+- name: DELETED - TC5 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: deleted
+
+- name: DELETED - TC5 - VALIDITY CHECK - Verify if everything is deleted
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: ""
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: deleted
+
+- name: DELETED - TC5 - conf5 - Idempotence
cisco.dcnm.dcnm_network: *conf5
register: result
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC5 - conf5 - ASSERT - Check changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
- - 'result.diff|length == 0'
+ - result.changed == false
+ tags: deleted
-- name: DELETED - Delete Single Network with no network name
+# TC6 - invalid configs
+- name: DELETED - TC6 - Delete Single Network with no network name
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
config:
- net_name:
@@ -685,22 +527,21 @@
gw_ip_subnet: '192.168.30.1/24'
register: result
ignore_errors: yes
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC6 - ASSERT - Check changed flag is false
+ assert:
that:
- '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg'
- result.changed == false
+ tags: deleted
-- name: DELETED - Delete Single Network with invalid network name which is not configured
+- name: DELETED - TC6 - Delete Single Network with invalid network name which is not configured
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
config:
- - net_name: network
+ - net_name: invalid-name
net_id: 7005
net_template: Default_Network_Universal
net_extension_template: Default_Network_Extension_Universal
@@ -708,21 +549,21 @@
gw_ip_subnet: '192.168.30.1/24'
register: result
ignore_errors: yes
+ tags: deleted
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: DELETED - TC6 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- result.response|length == 0
+ tags: deleted
###############################################
### CLEAN-UP ##
###############################################
-- name: DELETED - Cleanup - remove networks
+- name: DELETED - END - remove networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml
index 3f4377542..663d69df4 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml
@@ -2,843 +2,743 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
-
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
-
-- name: MERGED - Verify if fabric is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
+- name: MERGED - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+ tags: merged
-- name: debug
- debug:
- var: result
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: MERGED - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ # some cases are for a specific deploy state
+ deploy_local: false
+
+ test_data_merged:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # TC1
+ net1_no_attach_conf_template: "merged/dcnm_network_merged_net1_no_attach_conf.j2"
+ # undeployed
+ net1_no_attach_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_no_attach_conf.yaml"
+ # deployed
+ net1_no_attach_conf_deployed_file: "{{ role_path }}/files/dcnm_network_merged_net1_no_attach_conf_deployed.yaml"
+ #----------------------------------
+ # TC3
+ net1_conf_template: "merged/dcnm_network_merged_net1_conf.j2"
+ # undeployed
+ net1_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_conf.yaml"
+ # deployed
+ net1_conf_deployed_file: "{{ role_path }}/files/dcnm_network_merged_net1_conf_deployed.yaml"
+ #----------------------------------
+ # TC5
+ double_net_conf_template: "merged/dcnm_network_merged_double_net_conf.j2"
+ double_let_conf_file: "{{ role_path }}/files/dcnm_network_merged_double_net_conf.yaml"
+ # TC6
+ net1_multi_attach_conf_template: "merged/dcnm_network_merged_net1_multi_attach_conf.j2"
+ net1_multi_attach_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_multi_attach_conf.yaml"
+ # TC7
+ double_net_auto_vlan_conf: "merged/dcnm_network_merged_double_net_auto_vlan_conf.j2"
+ double_net_auto_vlan_file: "{{ role_path }}/files/dcnm_network_merged_double_net_auto_vlan_conf.yaml"
+ # TC8
+ net1_routing_tag_conf_template: "merged/dcnm_network_merged_net1_routing_tag_conf.j2"
+ net1_routing_tag_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_routing_tag_conf.yaml"
+ # TC9
+ l2only_net_conf_template: "merged/dcnm_network_merged_l2only_net_conf.j2"
+ l2only_net_conf_file: "{{ role_path }}/files/dcnm_network_merged_l2only_net_conf.yaml"
+ # TC10
+ l2_l3_net_conf_template: "merged/dcnm_network_merged_l2_l3_net_conf.j2"
+ l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_merged_l2_l3_net_conf.yaml"
+ # TC11
+ # no attachments
+ l3_net_conf_template: "merged/dcnm_network_merged_l3_net_conf.j2"
+ l3_net_conf_file: "{{ role_path }}/files/dcnm_network_merged_l3_net_conf.yaml"
+ # only attachments
+ l3_net_only_attach_conf_template: "merged/dcnm_network_merged_l3_net_only_attach_conf.j2"
+ l3_net_only_attach_conf_file: "{{ role_path }}/files/dcnm_network_merged_l3_net_only_attach_conf.yaml"
+ # final config
+ l3_net_final_conf_template: "merged/dcnm_network_merged_l3_net_final_conf.j2"
+ l3_net_final_conf_file: "{{ role_path }}/files/dcnm_network_merged_l3_net_final_conf.yaml"
+ delegate_to: localhost
+ tags: merged
-- assert:
- that:
- - result.response.DATA != None
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
+
+- name: MERGED - Create Config file from j2 without Deploy
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_no_attach_conf_template }}"
+ dest: "{{ test_data_merged.net1_no_attach_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2 with Attach and without deploy
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_conf_template }}"
+ dest: "{{ test_data_merged.net1_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+# flip deploy
+- name: MERGED - change deploy to true
+ ansible.builtin.set_fact:
+ deploy_local: true
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2 with Deploy
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_no_attach_conf_template }}"
+ dest: "{{ test_data_merged.net1_no_attach_conf_deployed_file}}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2 with Attach and global deploy
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_conf_template }}"
+ dest: "{{ test_data_merged.net1_conf_deployed_file }}"
+ delegate_to: localhost
+ tags: merged
+
+# uses global deploy now
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.double_net_conf_template }}"
+ dest: "{{ test_data_merged.double_let_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_multi_attach_conf_template }}"
+ dest: "{{ test_data_merged.net1_multi_attach_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.double_net_auto_vlan_conf }}"
+ dest: "{{ test_data_merged.double_net_auto_vlan_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.net1_routing_tag_conf_template }}"
+ dest: "{{ test_data_merged.net1_routing_tag_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.l2only_net_conf_template }}"
+ dest: "{{ test_data_merged.l2only_net_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.l2_l3_net_conf_template }}"
+ dest: "{{ test_data_merged.l2_l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.l3_net_conf_template }}"
+ dest: "{{ test_data_merged.l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.l3_net_only_attach_conf_template }}"
+ dest: "{{ test_data_merged.l3_net_only_attach_conf_file }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - Create Config file from j2
+ ansible.builtin.template:
+ src: "{{ test_data_merged.l3_net_final_conf_template }}"
+ dest: "{{ test_data_merged.l3_net_final_conf_file }}"
+ delegate_to: localhost
+ tags: merged
-- name: MERGED - setup - Clean up any existing networks
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: deleted
##############################################
## MERGED ##
##############################################
-- name: MERGED - Create New Network without Deploy
+# TC1
+- name: MERGED - TC1 - DELETED - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ tags: merged
+
+- name: MERGED - TC1 - Load Network Config File without deploy
+ ansible.builtin.set_fact:
+ dcnm_network_net1_no_attach_conf: "{{ lookup('file', '{{ test_data_merged.net1_no_attach_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC1 - MERGED - Create New Network without Deploy
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- deploy: False
+ config: "{{ dcnm_network_net1_no_attach_conf }}"
register: result
+ tags: merged
-- name: Query fabric for creation of Network Object
+- name: MERGED - TC1 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+- name: MERGED - TC1 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- retries: 5
- delay: 2
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
-- name: debug
- debug:
- var: result
+- name: MERGED - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.net1_no_attach_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
-- assert:
- that:
- - result.changed == true
- - result.diff[0].attach|length == 0
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
-
-- name: MERGED - setup - Clean up any existing networks
+# TC2
+- name: MERGED - TC2 - DELETED - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
+
+- name: MERGED - TC2 - Load Network Config File with deploy
+ ansible.builtin.set_fact:
+ dcnm_network_net1_no_attach_conf_deployed: "{{ lookup('file', '{{ test_data_merged.net1_no_attach_conf_deployed_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
-- name: MERGED - Create New Network with Deploy
+- name: MERGED - TC2 - MERGED - Create New Network with Deploy
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- deploy: True
+ config: "{{ dcnm_network_net1_no_attach_conf_deployed }}"
register: result
+ tags: merged
-- name: Query fabric for creation of Network Object
+- name: MERGED - TC2 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+# state does not change to DEPLOYED without attachment
+- name: MERGED - TC2 - Query fabric state until networkStatus transitions to DEPLOYED state
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
+ register: verify_result
until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- retries: 5
- delay: 2
+ - "verify_result.response[0].parent.networkStatus is search('DEPLOYED|NA')"
+ retries: 30
+ delay: 5
+ tags: merged
-- name: debug
- debug:
- var: result
+- name: MERGED - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.net1_no_attach_conf_deployed_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
-- assert:
- that:
- - result.diff[0].attach|length == 0
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.changed == true
- - result.response[0].RETURN_CODE == 200
-
-- name: MERGED - setup - Clean up any existing networks
+# TC3
+- name: MERGED - TC3 - setup - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create New Network with Attach and global deploy
+- name: MERGED - TC3 - Load Network Config File with deploy
+ ansible.builtin.set_fact:
+ dcnm_network_net1_conf_deployed: "{{ lookup('file', '{{ test_data_merged.net1_conf_deployed_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC3 - MERGED - Create New Network with Attach and global deploy
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
+ config: "{{ dcnm_network_net1_conf_deployed }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: MERGED - TC3 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+- name: MERGED - TC3 - Query fabric state until networkStatus transitions to DEPLOYED state
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
+ register: verify_result
until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
+ - "verify_result.response[0].parent.networkStatus is search('DEPLOYED')"
retries: 30
- delay: 2
+ delay: 5
+ tags: merged
-- name: debug
- debug:
- var: result
+- name: MERGED - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.net1_conf_deployed_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: MERGED - setup - Clean up any existing networks
+# TC4
+- name: MERGED - TC4 - DELETED - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
+
+- name: MERGED - TC4 - Load Network Config File without deploy
+ ansible.builtin.set_fact:
+ dcnm_network_net1_conf: "{{ lookup('file', '{{ test_data_merged.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
-- name: MERGED - Create New Network with no deploy
+- name: MERGED - TC4 - MERGED - Create New Network with no deploy
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: False
+ config: "{{ dcnm_network_net1_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to PENDING state
+- name: MERGED - TC4 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+- name: MERGED - TC4 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - result.changed == true
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].net_id == 7005
- - result.diff[0].vrf_name == "Tenant-1"
-
-- name: MERGED - conf - Idempotence
+- name: MERGED - TC4 - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC4 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: merged
-- name: MERGED - setup - Clean up any existing network
+# TC5
+- name: MERGED - TC5 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: MERGED - TC5 - Load Network Config File with deploy
+ ansible.builtin.set_fact:
+ dcnm_network_double_net_conf: "{{ lookup('file', '{{ test_data_merged.double_let_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC5 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: false
+ config: "{{ dcnm_network_double_net_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC5 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: MERGED - conf1 - Idempotence
+ tags: merged
+
+- name: MERGED - TC5 - QUERY - Verify network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
+
+- name: MERGED - TC5 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.double_let_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
+
+- name: MERGED - TC5 - conf1 - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC5 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: merged
-- name: MERGED - setup - Clean up any existing network
+# TC6
+- name: MERGED - TC6 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create, Attach and Deploy Single Network with Multiple Switch Attach
+- name: MERGED - TC6 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_net1_multi_attach_conf: "{{ lookup('file', '{{ test_data_merged.net1_multi_attach_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC6 - MERGED - Create, Attach Single Network with Multiple Switch Attach
cisco.dcnm.dcnm_network: &conf2
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: True
+ config: "{{ dcnm_network_net1_multi_attach_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: MERGED - TC6 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+- name: MERGED - TC6 - QUERY - Verify network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].net_id == 7005
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[1].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: MERGED - conf2 - Idempotence
+- name: MERGED - TC6 - conf2 - Idempotence
cisco.dcnm.dcnm_network: *conf2
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC6 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: merged
-- name: MERGED - setup - Clean up any existing network
+# TC7
+- name: MERGED - TC7 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create, Attach and Deploy Multiple Network with Multiple Switch Attach - Automatic Vlan Proposed
+- name: MERGED - TC7 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_double_net_auto_vlan_conf: "{{ lookup('file', '{{ test_data_merged.double_net_auto_vlan_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC7 - Create, Attach Multiple Network with Multiple Switch Attach - Automatic Vlan Proposed
cisco.dcnm.dcnm_network: &conf3
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- vlan_id: 1500
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1c }}", "{{ interface_1d }}"]
- deploy: True
+ config: "{{ dcnm_network_double_net_auto_vlan_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC7 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[2].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[3].value == "SUCCESS"
-
-- name: MERGED - conf3 - Idempotence
+ tags: merged
+
+- name: MERGED - TC7 - QUERY - Verify network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
+
+- name: MERGED - TC7 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.double_net_auto_vlan_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ ignore_fields:
+ - "vlanId"
+ tags: merged
+
+- name: MERGED - TC7 - conf3 - Idempotence
cisco.dcnm.dcnm_network: *conf3
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC7 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: merged
-- name: MERGED - setup - Clean up any existing network
+# TC8
+- name: MERGED - TC8 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create, Attach and Deploy Single Network with Multiple Switch Attach - Routing Tag Specified
+- name: MERGED - TC8 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_net1_routing_tag_conf: "{{ lookup('file', '{{ test_data_merged.net1_routing_tag_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC8 - MERGED - Create, Attach Single Network with Multiple Switch Attach - Routing Tag Specified
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- routing_tag: 321
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
+ config: "{{ dcnm_network_net1_routing_tag_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: MERGED - TC8 - ASSERT - Check if changed flag is true
+ assert:
+ that:
+ - result.changed == true
+ tags: merged
+
+- name: MERGED - TC8 - QUERY - Verify network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
-- name: debug
- debug:
- var: result
+- name: MERGED - TC8 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.net1_routing_tag_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[1].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: MERGED - setup - Clean up any existing network
+# TC9
+- name: MERGED - TC9 - DELETED- Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
+
+- name: MERGED - TC9 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l2only_net_conf: "{{ lookup('file', '{{ test_data_merged.l2only_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
-- name: MERGED - Create L2 only networks along with all dhcp, arp options
+- name: MERGED - TC9 - MERGED - Create L2 only networks along with all dhcp, arp options
cisco.dcnm.dcnm_network: &conf4
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: True
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
+ config: "{{ dcnm_network_l2only_net_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC9 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- result.changed == true
- - result.diff[0].arp_suppress == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[0].int_desc == "test interface"
- - result.diff[0].is_l2only == true
- - result.diff[0].net_id == 7009
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[0].vrf_name == "NA"
- - result.diff[0].vlan_name == "testvlan"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: MERGED - conf4 - Idempotence
+ tags: merged
+
+- name: MERGED - TC9 - QUERY - Verify network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
+
+- name: MERGED - TC9 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.l2only_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
+
+- name: MERGED - TC9 - conf4 - Idempotence
cisco.dcnm.dcnm_network: *conf4
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC9 - ASSERT - Check if changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
+ - result.changed == false
+ tags: merged
+
-- name: MERGED - setup - Clean up any existing network
+# TC10
+- name: MERGED - TC10 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create L3 networks along with all dhcp, arp options
+- name: MERGED - TC10 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l2_l3_net_conf: "{{ lookup('file', '{{ test_data_merged.l2_l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC10 - MERGED - Create L3 networks along with all dhcp, arp options
cisco.dcnm.dcnm_network: &conf5
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- # Leave 'arp_suppress' this false to avoid TCAM issue
- # Please configure TCAM region for Ingress ARP-Ether ACL before configuring ARP supression
- arp_suppress: False
- int_desc: 'test interface'
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
+ config: "{{ dcnm_network_l2_l3_net_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC10 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- result.changed == true
- - result.diff[0].arp_suppress == false
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[0].int_desc == "test interface"
- - result.diff[0].is_l2only == false
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].net_id == 7009
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: MERGED - conf5 - Idempotence
+ tags: merged
+
+- name: MERGED - TC10 - QUERY - Verify network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
+
+- name: MERGED - TC10 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.l2_l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
+
+- name: MERGED - TC10 - conf5 - Idempotence
cisco.dcnm.dcnm_network: *conf5
register: result
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC10 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: merged
-- name: MERGED - setup - Clean up any existing network
+# TC11
+- name: MERGED - TC11 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
+
+- name: MERGED - TC11 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l3_net_conf: "{{ lookup('file', '{{ test_data_merged.l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
-- name: MERGED - Create L3 networks along with all dhcp, arp options without attach
+- name: MERGED - TC11 - Create L3 networks along with all dhcp, arp options without attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
+ config: "{{ dcnm_network_l3_net_conf }}"
register: result
+ tags: merged
-- name: Query fabric state until networkName is present
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkName is search('ansible-net13')"
- retries: 5
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC11 - ASSERT - Check if changed flag is true
+ assert:
that:
- result.changed == true
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[0].int_desc == "test interface"
- - result.diff[0].is_l2only == false
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[0].net_id == 7009
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[0].vlan_name == "testvlan"
- - result.response[0].RETURN_CODE == 200
-
-- name: MERGED - attach networks to already created network
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- register: result
+ tags: merged
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: MERGED - TC11 - QUERY - Verify network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
+
+- name: MERGED - TC11 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
+
+- name: MERGED - TC11 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l3_net_only_attach_conf: "{{ lookup('file', '{{ test_data_merged.l3_net_only_attach_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC11 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l3_net_final_conf: "{{ lookup('file', '{{ test_data_merged.l3_net_final_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: merged
+
+- name: MERGED - TC11 - attach networks to already created network
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: merged
+ config: "{{ dcnm_network_l3_net_only_attach_conf }}"
+ register: result
+ tags: merged
-- assert:
+- name: MERGED - TC11 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: MERGED - Query the Network to check for configs
+ tags: merged
+
+- name: MERGED - TC11 - QUERY - Verify network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: result
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: merged
-- name: debug
- debug:
- var: result
+- name: MERGED - TC11 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_merged.l3_net_final_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: merged
-- assert:
- that:
- - ansible_switch1 or ansible_switch2 in result.response[0].attach[0].ipAddress
- - ansible_switch1 or ansible_switch2 in result.response[0].attach[1].ipAddress
- - result.changed == false
- - result.response[0].attach[0].isLanAttached== true
- - result.response[0].attach[1].isLanAttached== true
- - result.response[0].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[1].lanAttachState== "DEPLOYED"
- - result.response[0].attach[0].networkName== "ansible-net13"
- - result.response[0].attach[1].networkName== "ansible-net13"
- - result.response[0].parent.networkId == 7009
- - result.response[0].parent.networkName == "ansible-net13"
- - result.response[0].parent.networkTemplate == "Default_Network_Universal"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 == "1.1.1.1"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 == "2.2.2.2"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 == "3.3.3.3"
- - result.response[0].parent.networkTemplateConfig.intfDescription == "test interface"
- - result.response[0].parent.networkTemplateConfig.isLayer2Only == "false"
- - result.response[0].parent.networkTemplateConfig.mtu == "7600"
- - result.response[0].parent.networkTemplateConfig.suppressArp == "false"
- - result.response[0].parent.networkTemplateConfig.vlanId == "3504"
- - result.response[0].parent.networkTemplateConfig.vlanName == "testvlan"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp == "one"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp2 == "two"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp3 == "three"
- - result.response[0].parent.networkTemplateConfig.vrfName == "Tenant-1"
- - result.response[0].parent.vrf == "Tenant-1"
-
-- name: MERGED - setup - Clean up any existing network
+# TC12 Invalid test cases
+- name: MERGED - TC12 - DELETED - Clean up any existing network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
-- name: MERGED - Create Network with invalid network name
+- name: MERGED - TC12 - Create Network with invalid network name
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name:
@@ -851,19 +751,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid network name
+ assert:
that:
- '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create Network with invalid VRF name
+- name: MERGED - TC12 - Create Network with invalid VRF name
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -876,19 +775,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid VRF name
+ assert:
that:
- '"VRF: Tenant-10000 is missing in fabric:" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create Network with invalid vlan id
+- name: MERGED - TC12 - Create Network with invalid vlan id
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -901,19 +799,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid vlan id
+ assert:
that:
- '"Invalid parameters in playbook: vlan_id:15000 : The item exceeds the allowed range of max 4094" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create Network and deploy in invalid switch
+- name: MERGED - TC12 - Create Network and deploy in invalid switch
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -925,23 +822,22 @@
gw_ip_subnet: '192.168.30.1/24'
attach:
- ip_address:
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
+ ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"]
deploy: false
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid switch
+ assert:
that:
- '"Invalid parameters in playbook: ip_address : Required parameter not found" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create Network and deploy in switch with null interface
+- name: MERGED - TC12 - Create Network and deploy in switch with null interface
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -952,24 +848,23 @@
vlan_id: 1500
gw_ip_subnet: '192.168.30.1/24'
attach:
- - ip_address: "{{ ansible_switch1 }}"
+ - ip_address: "{{ test_data_common.sw1 }}"
ports:
deploy: false
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid switch
+ assert:
that:
- '"Invalid parameters in playbook: ports : Required parameter not found" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create Network with out of range routing tag
+- name: MERGED - TC12 - Create Network with out of range routing tag
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -983,19 +878,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid routing tag
+ assert:
that:
- '"routing_tag:4294967296 : The item exceeds the allowed range of max 4294967295" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create L2 only Network with a vrf name
+- name: MERGED - TC12 - Create L2 only Network with a vrf name
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -1009,19 +903,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid vrf name
+ assert:
that:
- '"Invalid parameters in playbook: vrf_name should not be specified for L2 Networks" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create L3 Network without a vrf name
+- name: MERGED - TC12 - Create L3 Network without a vrf name
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -1033,19 +926,18 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid vrf name
+ assert:
that:
- '"Invalid parameters in playbook: vrf_name is required for L3 Networks" in result.msg'
- result.changed == false
+ tags: merged
-- name: MERGED - Create L3 Network with DHCP server IP alone
+- name: MERGED - TC12 - Create L3 Network with DHCP server IP alone
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
config:
- net_name: ansible-net13
@@ -1059,21 +951,21 @@
deploy: true
register: result
ignore_errors: yes
+ tags: merged
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: MERGED - TC12 - ASSERT - Check invalid vrf name
+ assert:
that:
- '"Invalid parameters in playbook: DHCP server IP should be specified along with DHCP server VRF" in result.msg'
- result.changed == false
+ tags: merged
##############################################
## CLEAN-UP ##
##############################################
-- name: MERGED - Cleanup - remove networks
+- name: MERGED - END - remove networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: merged
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml
index 06ba69f10..a1fcff90d 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml
@@ -2,378 +2,257 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
-
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
-
-- name: OVERRIDDEN - Verify if fabric is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
+- name: OVERRIDDEN - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+ tags: overridden
-- name: debug
- debug:
- var: result
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: OVERRIDDEN - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_overridden:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # TC1 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
+ double_net_conf_template: "overridden/dcnm_network_overridden_double_net_conf.j2"
+ double_net_conf_file: "{{ role_path }}/files/dcnm_network_overridden_double_net_conf.yaml"
+ #----------------------------------
+ net1_conf_template: "overridden/dcnm_network_overridden_net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/dcnm_network_overridden_net1_conf.yaml"
+ # TC2 - OVERRIDDEN - MERGED - Create, Attach and Deploy L2. L3 Network with Switch Attach
+ l2_l3_net_conf_template: "overridden/dcnm_network_overridden_l2_l3_net_conf.j2"
+ l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_overridden_l2_l3_net_conf.yaml"
+ #----------------------------------
+ l2_l3_net_changed_conf_template: "overridden/dcnm_network_overridden_l2_l3_net_changed_conf.j2"
+ l2_l3_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_overridden_l2_l3_net_changed_conf.yaml"
+ #----------------------------------
+
+ delegate_to: localhost
+ tags: overridden
-- assert:
- that:
- - 'result.response.DATA != None'
-- name: OVERRIDDEN - setup - Clean up any existing networks
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
+- name: OVERRIDDEN - TC1 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_overridden.double_net_conf_template }}"
+ dest: "{{ test_data_overridden.double_net_conf_file }}"
+ delegate_to: localhost
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_overridden.net1_conf_template }}"
+ dest: "{{ test_data_overridden.net1_conf_file }}"
+ delegate_to: localhost
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_overridden.l2_l3_net_conf_template }}"
+ dest: "{{ test_data_overridden.l2_l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_overridden.l2_l3_net_changed_conf_template }}"
+ dest: "{{ test_data_overridden.l2_l3_net_changed_conf_file }}"
+ delegate_to: localhost
+ tags: overridden
+
+##############################################
+## OVERRIDDEN ##
+##############################################
+- name: OVERRIDDEN - TC1 - remove all networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: overridden
-- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: OVERRIDDEN - TC1 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_double_net_conf: "{{ lookup('file', '{{ test_data_overridden.double_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_overridden_double_net_conf }}"
register: result
+ tags: overridden
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: OVERRIDDEN - TC1 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
+ tags: overridden
-##############################################
-## OVERRIDDEN ##
-##############################################
-
-- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: OVERRIDDEN - TC1 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_overridden.double_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - Load Network Config File with different connections
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_net1_conf: "{{ lookup('file', '{{ test_data_overridden.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: overridden
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 150
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- # Replace the ports with new ports
- ports: ["{{ interface_1a }}", "{{ interface_1c }}"]
- deploy: true
- # delete the second network
+ config: "{{ dcnm_network_overridden_net1_conf }}"
register: result
+ tags: overridden
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: OVERRIDDEN - TC1 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch1 in result.diff[0].attach[1].ip_address
- - ansible_switch2 in result.diff[0].attach[2].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[0].attach[1].deploy == true
- - result.diff[0].attach[2].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.response[3].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - result.response[4].RETURN_CODE == 200
- - result.response[5].RETURN_CODE == 200
- - (result.response[1].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[4].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[4].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: OVERRIDDEN - conf1 - Idempotence
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_overridden.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: overridden
+
+- name: OVERRIDDEN - TC1 - conf1 - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - 'result.changed == false'
- # TODO: Do we really need this check?
- # The length does not come back as 0 with the following message
- # "status": "No switches PENDING for deployment."
- # - 'result.response|length == 0'
-
-- name: OVERRIDDEN - remove all networks
+ tags: overridden
+
+# when deploy is set to false, the other network shows in the diff and changed is true
+# - name: OVERRIDDEN - TC1 - ASSERT - Check changed flag is false
+# assert:
+# that:
+# - 'result.changed == false'
+# # TODO: Do we really need this check?
+# # The length does not come back as 0 with the following message
+# # "status": "No switches PENDING for deployment."
+# # - 'result.response|length == 0'
+# tags: overridden
+
+# TC2
+- name: OVERRIDDEN - TC2 - DELETED - remove all networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_l2_l3_net_conf: "{{ lookup('file', '{{ test_data_overridden.l2_l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: overridden
-- name: OVERRIDDEN- Create, Attach and Deploy L2. L3 Network with Switch Attach
+- name: OVERRIDDEN - TC2 - MERGED - Create, Attach and Deploy L2. L3 Network with Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1501
- gw_ip_subnet: '192.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- is_l2only: True
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1511
- gw_ip_subnet: '192.168.40.1/24'
- mtu_l3intf: 8600
- int_desc: 'test interface'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_overridden_l2_l3_net_conf }}"
register: result
+ tags: overridden
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].is_l2only == true
- - result.diff[1].is_l2only == false
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[1].vlan_name == "testvlan1"
- - result.diff[0].vrf_name == "NA"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_overridden.l2_l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - Load Network Config File with a new L2 network
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_l2_l3_net_changed_conf: "{{ lookup('file', '{{ test_data_overridden.l2_l3_net_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: overridden
- name: OVERRIDDEN - Override L2, L3 Networks with a new L2 network
cisco.dcnm.dcnm_network: &conf2
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: overridden
- config:
- - net_name: ansible-net14
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- is_l2only: True
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_overridden_l2_l3_net_changed_conf }}"
+
register: result
-
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[1].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[2].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == false
- - result.diff[2].attach[0].deploy == false
- - result.diff[2].attach[1].deploy == false
- - result.diff[0].net_id == 7005
- - result.diff[0].net_name == "ansible-net14"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "NA"
- - result.diff[2].net_name == "ansible-net13"
- - result.response[2].METHOD == "DELETE"
- - result.response[3].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - result.response[4].RETURN_CODE == 200
- - result.response[5].RETURN_CODE == 200
- - result.response[6].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[2].value == "SUCCESS"
- - (result.response[5].DATA|dict2items)[0].value == "SUCCESS"
-
-- name: OVERRIDDEN - conf2 - Idempotence
- cisco.dcnm.dcnm_network: *conf2
- register: result
+ tags: overridden
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - 'result.changed == false'
- - 'result.response|length == 0'
-
-- name: OVERRIDDEN - Check for networks in fabric
+- name: OVERRIDDEN - TC2 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_overridden.l2_l3_net_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: overridden
+
+- name: OVERRIDDEN - TC2 - conf2 - Idempotence
+ cisco.dcnm.dcnm_network: *conf2
register: result
+ tags: overridden
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is false
+ assert:
that:
- - 'result.response|length == 1'
- - 'result.response[0].parent.displayName == "ansible-net14"'
+ - result.changed == false
+ tags: overridden
+
##############################################
## CLEAN-UP ##
##############################################
-- name: OVERRIDDEN - Cleanup - remove networks
+- name: OVERRIDDEN - END - remove networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: overridden
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml
index adc2634e1..fd68e8447 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml
@@ -2,514 +2,197 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
+- name: QUERY - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+ tags: query
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
-
-- name: Verify if fabric - Fabric1 is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - 'result.response.DATA != None'
-
-- name: Setup - Clean up any existing networks
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: deleted
- register: result
- until:
- - "result.response | length == 0"
- retries: 30
- delay: 2
-
-- name: Create, Attach and Deploy Multiple Network with Single Switch Attach
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- register: result
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: QUERY - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_query:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # TC1 - QUERY
+ merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2"
+ merged_conf_file: "{{ role_path }}/files/dcnm_network_sanity_merged_conf.yaml"
+ # TC5 - L2only and L3 network with dhcp, arp options
+ l2_l3_net_conf_template: "deleted/dcnm_network_deleted_l2_l3_net_conf.j2"
+ l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_deleted_l2_l3_net_conf.yaml"
+ #----------------------------------
+
+ delegate_to: localhost
+ tags: query
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
-- name: debug
- debug:
- var: result
+- name: QUERY - TC1 - Create Network Config File using J2 Template (Merged)
+ ansible.builtin.template:
+ src: "{{ test_data_query.merged_conf_template }}"
+ dest: "{{ test_data_query.merged_conf_file }}"
+ delegate_to: localhost
+ tags: query
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)
- - result.diff[1].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
+- name: QUERY - TC5 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_query.l2_l3_net_conf_template }}"
+ dest: "{{ test_data_query.l2_l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: query
###############################################
### QUERY ##
###############################################
-- name: QUERY - Query the Network
+- name: QUERY - TC1 - DELETED - remove all networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- register: result
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ tags: query
-- name: debug
- debug:
- var: result
+- name: DELETED - TC2 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_conf: "{{ lookup('file', '{{ test_data_query.merged_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: deleted
-- assert:
- that:
- - result.changed == false
- - result.response[0].attach[0].isLanAttached== true
- - result.response[0].attach[1].isLanAttached== false
- - result.response[1].attach[0].isLanAttached== true
- - result.response[1].attach[1].isLanAttached== false
- - result.response[0].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[1].lanAttachState== "NA"
- - result.response[1].attach[0].lanAttachState== "DEPLOYED"
- - result.response[1].attach[1].lanAttachState== "NA"
- - result.response[0].attach[0].networkName== "ansible-net13"
- - result.response[0].attach[1].networkName== "ansible-net13"
- - result.response[1].attach[0].networkName== "ansible-net12"
- - result.response[1].attach[1].networkName== "ansible-net12"
- - result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)
- - result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)
- - result.response[0].parent.networkName == "ansible-net13"
- - result.response[1].parent.networkName == "ansible-net12"
- - result.response[0].parent.networkTemplate == "Default_Network_Universal"
- - result.response[1].parent.networkTemplate == "Default_Network_Universal"
- - result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
- - result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
-- name: QUERY - Query the Network without the config element
+- name: QUERY - TC1 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
+ fabric: "{{ test_data_common.fabric }}"
+ state: merged
+ config: "{{ dcnm_network_merged_conf }}"
register: result
+ tags: query
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: QUERY - TC1 - ASSERT - Check changed flag is true
+ assert:
that:
- - result.changed == false
- - result.response[0].attach[0].isLanAttached== true
- - result.response[0].attach[1].isLanAttached== false
- - result.response[1].attach[0].isLanAttached== true
- - result.response[1].attach[1].isLanAttached== false
- - result.response[0].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[1].lanAttachState== "NA"
- - result.response[1].attach[0].lanAttachState== "DEPLOYED"
- - result.response[1].attach[1].lanAttachState== "NA"
- - result.response[0].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)
- - result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)
- - result.response[0].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkTemplate == "Default_Network_Universal"
- - result.response[1].parent.networkTemplate == "Default_Network_Universal"
- - result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
- - result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
+ - 'result.changed == true'
+ tags: query
-- name: Delete all the networks
+- name: QUERY - TC1 - QUERY - Get network state in NDFC using config
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ config: "{{ dcnm_network_merged_conf }}"
+ register: verify_result
+ tags: query
+
+- name: QUERY - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_query.merged_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: query
+
+# TC2
+- name: QUERY - TC2 - QUERY - Get network state in NDFC without config
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: query
+
+- name: QUERY - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_query.merged_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: query
+
+# TC3
+- name: QUERY - TC3 - DELETED - Delete all the networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
- register: result
+ tags: query
-- name: Query fabric state until all networks are deleted
+- name: QUERY - TC3 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response | length == 0"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name'
- - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name'
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.response[0].MESSAGE == "OK"
- - result.response[1].MESSAGE == "OK"
- - result.response[2].MESSAGE == "OK"
- - result.response[3].MESSAGE == "OK"
- - result.response[3].METHOD == "DELETE"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
-
-
-- name: QUERY - Query the non available Network
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: query
+
+- name: QUERY - TC3 - VALIDITY CHECK - Verify network state in NDFC (all deleted)
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: ""
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+ tags: query
+
+
+# TC4
+- name: QUERY - TC4 - Query the non available Network
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-2
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
+ config: "{{ dcnm_network_merged_conf }}"
register: result
+ tags: query
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: QUERY - TC4 - ASSERT - Check changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: query
+
+# TC5
+- name: QUERY - TC5 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l2_l3_net_conf: "{{ lookup('file', '{{ test_data_query.l2_l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: query
-- name: Create a L2 only and L3 networks along with all dhcp, arp options
+- name: QUERY - TC5 - MERGED - Create a L2 only and L3 networks along with all dhcp, arp options
cisco.dcnm.dcnm_network: &conf3
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: True
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- deploy: True
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7010
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3505
- gw_ip_subnet: '162.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface 1'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: True
+ config: "{{ dcnm_network_l2_l3_net_conf }}"
register: result
+ tags: query
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].arp_suppress == true
- - result.diff[0].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[1].dhcp_srvr1_ip == "1.1.1.1"
- - result.diff[0].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[1].dhcp_srvr2_ip == "2.2.2.2"
- - result.diff[0].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[1].dhcp_srvr3_ip == "3.3.3.3"
- - result.diff[0].dhcp_srvr1_vrf == "one"
- - result.diff[1].dhcp_srvr1_vrf == "one"
- - result.diff[0].dhcp_srvr2_vrf == "two"
- - result.diff[1].dhcp_srvr2_vrf == "two"
- - result.diff[0].dhcp_srvr3_vrf == "three"
- - result.diff[1].dhcp_srvr3_vrf == "three"
- - result.diff[0].int_desc == "test interface"
- - result.diff[1].int_desc == "test interface 1"
- - result.diff[0].is_l2only == true
- - result.diff[0].mtu_l3intf == 7600
- - result.diff[1].mtu_l3intf == 7600
- - result.diff[0].net_id == 7009
- - result.diff[1].net_id == 7010
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[1].vlan_name == "testvlan1"
- - result.diff[0].vrf_name == "NA"
- - result.diff[1].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: QUERY - Query the L2 and L3 Network
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- config:
- - net_name: ansible-net13
- net_id: 7009
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3504
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: True
- int_desc: 'test interface'
- is_l2only: True
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7010
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 3505
- gw_ip_subnet: '162.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface 1'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- register: result
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: QUERY - TC5 - ASSERT - Check changed flag is true
+ assert:
that:
- - result.changed == false
- - result.response[1].attach[0].isLanAttached== true
- - result.response[0].attach[0].isLanAttached== true
- - result.response[0].attach[1].isLanAttached== false
- - result.response[1].attach[1].isLanAttached== false
- - result.response[0].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[1].lanAttachState== "NA"
- - result.response[1].attach[0].lanAttachState== "DEPLOYED"
- - result.response[1].attach[1].lanAttachState== "NA"
- - result.response[0].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkId | regex_search("70[0|1][0|9]", ignorecase=True)
- - result.response[1].parent.networkId | regex_search("70[0|1][0|9]", ignorecase=True)
- - result.response[0].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkTemplate == "Default_Network_Universal"
- - result.response[1].parent.networkTemplate == "Default_Network_Universal"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 == "1.1.1.1"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr1 == "1.1.1.1"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 == "2.2.2.2"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr2 == "2.2.2.2"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 == "3.3.3.3"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr3 == "3.3.3.3"
- - result.response[0].parent.networkTemplateConfig.intfDescription == "test interface"
- - result.response[1].parent.networkTemplateConfig.intfDescription == "test interface 1"
- - result.response[0].parent.networkTemplateConfig.isLayer2Only == "true"
- - result.response[1].parent.networkTemplateConfig.isLayer2Only == "false"
- - result.response[0].parent.networkTemplateConfig.suppressArp == "true"
- - result.response[1].parent.networkTemplateConfig.suppressArp == "false"
- - result.response[0].parent.networkTemplateConfig.vlanName == "testvlan"
- - result.response[1].parent.networkTemplateConfig.vlanName == "testvlan1"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp == "one"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp == "one"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp2 == "two"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp2 == "two"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp3 == "three"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp3 == "three"
- - result.response[0].parent.networkTemplateConfig.vrfName == "NA"
- - result.response[1].parent.networkTemplateConfig.vrfName == "Tenant-2"
- - result.response[0].parent.vrf == "NA"
- - result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
+ - 'result.changed == true'
+ tags: query
-- name: QUERY - Query L2 and L3 the Network without the config element
+- name: QUERY - TC5 - Query the L2 and L3 Network with config
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - result.changed == false
- - result.response[0].attach[0].isLanAttached== true
- - result.response[0].attach[1].isLanAttached== false
- - result.response[1].attach[0].isLanAttached== true
- - result.response[1].attach[1].isLanAttached== false
- - result.response[1].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[0].lanAttachState== "DEPLOYED"
- - result.response[0].attach[1].lanAttachState== "NA"
- - result.response[1].attach[1].lanAttachState== "NA"
- - result.response[0].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkId | regex_search("70[0|1][0|9]", ignorecase=True)
- - result.response[1].parent.networkId | regex_search("70[0|1][0|9]", ignorecase=True)
- - result.response[0].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[1].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)
- - result.response[0].parent.networkTemplate == "Default_Network_Universal"
- - result.response[1].parent.networkTemplate == "Default_Network_Universal"
- - result.response[0].parent.networkTemplateConfig.isLayer2Only == "true"
- - result.response[1].parent.networkTemplateConfig.isLayer2Only == "false"
- - result.response[0].parent.networkTemplateConfig.intfDescription == "test interface"
- - result.response[1].parent.networkTemplateConfig.intfDescription == "test interface 1"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 == "1.1.1.1"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr1 == "1.1.1.1"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 == "2.2.2.2"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr2 == "2.2.2.2"
- - result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 == "3.3.3.3"
- - result.response[1].parent.networkTemplateConfig.dhcpServerAddr3 == "3.3.3.3"
- - result.response[0].parent.networkTemplateConfig.suppressArp == "true"
- - result.response[1].parent.networkTemplateConfig.suppressArp == "false"
- - result.response[0].parent.networkTemplateConfig.vlanName == "testvlan"
- - result.response[1].parent.networkTemplateConfig.vlanName == "testvlan1"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp == "one"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp == "one"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp2 == "two"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp2 == "two"
- - result.response[0].parent.networkTemplateConfig.vrfDhcp3 == "three"
- - result.response[1].parent.networkTemplateConfig.vrfDhcp3 == "three"
- - result.response[0].parent.networkTemplateConfig.vrfName == "NA"
- - result.response[1].parent.networkTemplateConfig.vrfName == "Tenant-2"
- - result.response[0].parent.vrf | regex_search("NA|Tenant-[1|2]", ignorecase=True)
- - result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)
+ config: "{{ dcnm_network_l2_l3_net_conf }}"
+ register: verify_result
+ tags: query
+
+- name: QUERY - TC5 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_query.l2_l3_net_conf_file}}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+ tags: query
###############################################
### CLEAN-UP ##
###############################################
-- name: QUERY - Cleanup - remove networks
+- name: QUERY - END - remove networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: query
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml
index 6ec9e3971..409369366 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml
@@ -2,523 +2,335 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
-
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
-
-- name: REPLACED - Verify if fabric is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
+- name: REPLACED - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+ tags: replaced
-- name: debug
- debug:
- var: result
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: REPLACED - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_replaced:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # TC1
+ double_net_conf_template: "replaced/dcnm_network_replaced_double_net_conf.j2"
+ double_net_conf_file: "{{ role_path }}/files/dcnm_network_replaced_double_net_conf.yaml"
+ #----------------------------------
+ double_net_changed_conf_template: "replaced/dcnm_network_replaced_double_net_changed_conf.j2"
+ double_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_replaced_double_net_changed_conf.yaml"
+ #----------------------------------
+ # TC3
+ l2_l3_net_conf_template: "replaced/dcnm_network_replaced_l2_l3_net_conf.j2"
+ l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_replaced_l2_l3_net_conf.yaml"
+ #----------------------------------
+ l2_l3_net_changed_conf_template: "replaced/dcnm_network_replaced_l2_l3_net_changed_conf.j2"
+ l2_l3_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_replaced_l2_l3_net_changed_conf.yaml"
+ #----------------------------------
+ delegate_to: localhost
+ tags: replaced
-- assert:
- that:
- - 'result.response.DATA != None'
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
+
+- name: REPLACED - TC1 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_replaced.double_net_conf_template }}"
+ dest: "{{ test_data_replaced.double_net_conf_file }}"
+ delegate_to: localhost
+ tags: replaced
+
+- name: REPLACED - TC1 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_replaced.double_net_changed_conf_template }}"
+ dest: "{{ test_data_replaced.double_net_changed_conf_file }}"
+ delegate_to: localhost
+ tags: replaced
+
+- name: REPLACED - TC3 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_replaced.l2_l3_net_conf_template }}"
+ dest: "{{ test_data_replaced.l2_l3_net_conf_file }}"
+ delegate_to: localhost
+ tags: replaced
+
+- name: REPLACED - TC3 - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data_replaced.l2_l3_net_changed_conf_template }}"
+ dest: "{{ test_data_replaced.l2_l3_net_changed_conf_file }}"
+ delegate_to: localhost
+ tags: replaced
-- name: REPLACED - setup - Clean up any existing networks
+##############################################
+## REPLACED ##
+##############################################
+
+# TC1
+- name: REPLACED - TC1 - DELETED - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: replaced
+
+- name: REPLACED - TC1 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_double_net_conf: "{{ lookup('file', '{{ test_data_replaced.double_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: replaced
-- name: REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: REPLACED - TC1 - merged - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric}}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_double_net_conf }}"
register: result
+ tags: replaced
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC1 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vrf_name == "Tenant-1"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-##############################################
-## REPLACED ##
-##############################################
+ tags: replaced
-- name: REPLACED - Update Network using replace - Delete Attachments
+- name: REPLACED - TC1 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.double_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC1 - Load Changed Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_double_net_changed_conf: "{{ lookup('file', '{{ test_data_replaced.double_net_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: replaced
+
+- name: REPLACED - TC1 - REPLACED - Delete Attachments
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: replaced
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- deploy: true
+ config: "{{ dcnm_network_double_net_changed_conf }}"
register: result
+ tags: replaced
+
+# Possible bug, changed flag is not set to true when deleting attachments
+# - name: REPLACED - TC1 - ASSERT - Check if changed flag is true
+# assert:
+# that:
+# - result.changed == true
+# tags: replaced
-- name: Query fabric state until networkStatus transitions to NA state
+- name: REPLACED - TC1 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('NA')"
- - "query_result.response[1].parent.networkStatus is search('NA')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name'
- - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name'
- - ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[1].attach[1].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[2].value == "SUCCESS"
-
-- name: REPLACED - conf1 - Idempotence
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.double_net_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC1 - conf1 - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
+ tags: replaced
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC1 - ASSERT - Check if changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
+ - result.changed == false
+ tags: replaced
-- name: REPLACED - Update Network using replace - Create Attachments
+# TC2
+- name: REPLACED - TC2 - REPLACED - Update Network using replace - Create Attachments
cisco.dcnm.dcnm_network: &conf2
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: replaced
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_double_net_conf }}"
register: result
+ tags: replaced
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC2 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[2].value == "SUCCESS"
-
-- name: REPLACED - conf2 - Idempotence
+ tags: replaced
+
+- name: REPLACED - TC2 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.double_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC2 - conf2 - Idempotence
cisco.dcnm.dcnm_network: *conf2
register: result
+ tags: replaced
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC2 - ASSERT - Check if changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
+ - result.changed == false
+ tags: replaced
-- name: REPLACED - remove all networks
+# TC3
+- name: REPLACED - TC3 - DELETED - remove all networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: replaced
+
+- name: REPLACED - TC3 - Load L2, L3 Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l2_l3_net_conf: "{{ lookup('file', '{{ test_data_replaced.l2_l3_net_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: replaced
-- name: REPLACED - Create, Attach and Deploy L2, L3 Network with Switch Attach
+- name: REPLACED - TC3 - MERGED - Create, Attach and Deploy L2, L3 Network with Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 150
- gw_ip_subnet: '192.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- is_l2only: True
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- mtu_l3intf: 8600
- int_desc: 'test interface'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_l2_l3_net_conf }}"
register: result
+ tags: replaced
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC3 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].is_l2only == true
- - result.diff[1].is_l2only == false
- - result.diff[0].net_id == 7005
- - result.diff[1].net_id == 7002
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.diff[0].vlan_name == "testvlan"
- - result.diff[1].vlan_name == "testvlan1"
- - result.diff[0].vrf_name == "NA"
- - result.diff[1].vrf_name == "Tenant-2"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - result.response[2].RETURN_CODE == 200
- - result.response[3].RETURN_CODE == 200
- - (result.response[2].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[2].DATA|dict2items)[1].value == "SUCCESS"
-
-- name: REPLACED - Update L2, L3 Networks using replace - Delete Attachments
+ tags: replaced
+
+- name: REPLACED - TC3 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.l2_l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC3 - Load Changed L2, L3 Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_l2_l3_net_changed_conf: "{{ lookup('file', '{{ test_data_replaced.l2_l3_net_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: replaced
+
+- name: REPLACED - TC3 - Update L2, L3 Networks using replace - Delete Attachments
cisco.dcnm.dcnm_network: &conf3
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: replaced
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 150
- gw_ip_subnet: '192.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- is_l2only: True
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- mtu_l3intf: 8600
- int_desc: 'test interface'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
+ config: "{{ dcnm_network_l2_l3_net_changed_conf }}"
register: result
+ tags: replaced
+
+# - name: REPLACED - TC3 - ASSERT - Check if changed flag is true
+# assert:
+# that:
+# - result.changed == true
+# tags: replaced
-- name: Query fabric state until networkStatus transitions to NA state
+- name: REPLACED - TC3 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('NA')"
- - "query_result.response[1].parent.networkStatus is search('NA')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
- that:
- - ansible_switch1 or ansible_switch2 in result.diff[0].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[0].ip_address
- - ansible_switch1 or ansible_switch2 in result.diff[1].attach[1].ip_address
- - result.changed == true
- - result.diff[0].attach[0].deploy == false
- - result.diff[1].attach[0].deploy == false
- - result.diff[1].attach[1].deploy == false
- - result.diff[0].net_name == "ansible-net12"
- - result.diff[1].net_name == "ansible-net13"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[2].value == "SUCCESS"
-
-- name: REPLACED - conf3 - Idempotence
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.l2_l3_net_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC3 - conf3 - Idempotence
cisco.dcnm.dcnm_network: *conf3
register: result
+ tags: replaced
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC3 - ASSERT - Check if changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
+ - result.changed == false
+ tags: replaced
-- name: REPLACED - Update L2, L3 Networks using replace - Create Attachments
+# TC4
+- name: REPLACED - TC4 - Update L2, L3 Networks using replace - Create Attachments
cisco.dcnm.dcnm_network: &conf4
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: replaced
- config:
- - net_name: ansible-net13
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 150
- gw_ip_subnet: '192.168.30.1/24'
- mtu_l3intf: 7600
- int_desc: 'test interface'
- vlan_name: testvlan
- is_l2only: True
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ interface_1a }}", "{{ interface_1b }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2a }}", "{{ interface_2b }}"]
- deploy: true
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- mtu_l3intf: 8600
- int_desc: 'test interface'
- vlan_name: testvlan1
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ interface_2c }}", "{{ interface_2d }}"]
- deploy: true
+ config: "{{ dcnm_network_l2_l3_net_conf }}"
register: result
+ tags: replaced
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC4 - ASSERT - Check if changed flag is true
+ assert:
that:
- - ansible_switch1 in result.diff[0].attach[0].ip_address
- - ansible_switch2 in result.diff[0].attach[1].ip_address
- - ansible_switch2 in result.diff[1].attach[0].ip_address
- result.changed == true
- - result.diff[0].attach[0].deploy == true
- - result.diff[0].attach[1].deploy == true
- - result.diff[1].attach[0].deploy == true
- - result.diff[0].net_name == "ansible-net13"
- - result.diff[1].net_name == "ansible-net12"
- - result.response[0].RETURN_CODE == 200
- - result.response[1].RETURN_CODE == 200
- - (result.response[0].DATA|dict2items)[0].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[1].value == "SUCCESS"
- - (result.response[0].DATA|dict2items)[2].value == "SUCCESS"
-
-- name: REPLACED - conf4 - Idempotence
+ tags: replaced
+
+- name: REPLACED - TC4 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: replaced
+
+- name: REPLACED - TC4 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_replaced.l2_l3_net_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: replaced
+
+- name: REPLACED - TC4 - conf4 - Idempotence
cisco.dcnm.dcnm_network: *conf4
register: result
+ tags: replaced
-- name: debug
- debug:
- var: result
-
-- assert:
+- name: REPLACED - TC4 - ASSERT - Check if changed flag is false
+ assert:
that:
- result.changed == false
- - result.response|length == 0
+ tags: replaced
##############################################
## CLEAN-UP ##
##############################################
-- name: REPLACED - Cleanup - remove networks
+- name: REPLACED - END - remove networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ tags: replaced
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml
index 22612fe00..68050b9bf 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml
@@ -2,320 +2,241 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
+- name: SANITY - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
tags: sanity
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SANITY - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data_sanity:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ # TC1 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
+ merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2"
+ merged_conf_file: "{{ role_path }}/files/dcnm_network_sanity_merged_conf.yaml"
+ # TC2 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
+ overridden_conf_template: "sanity/dcnm_network_sanity_overridden_conf.j2"
+ overridden_conf_file: "{{ role_path }}/files/dcnm_network_sanity_overridden_conf.yaml"
+ # TC3 - REPLACED - Update Network using replace - Delete Attachments
+ replaced_conf_template: "sanity/dcnm_network_sanity_replaced_conf.j2"
+ replaced_conf_file: "{{ role_path }}/files/dcnm_network_sanity_replaced_conf.yaml"
+ #----------------------------------
+
+ delegate_to: localhost
tags: sanity
-- name: SANITY- Verify if fabric - Fabric1 is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
+##############################################
+## Create Module Payloads using J2 Template ##
+##############################################
+
+- name: SANITY - TC1 - Create Network Config File using J2 Template (Merged)
+ ansible.builtin.template:
+ src: "{{ test_data_sanity.merged_conf_template }}"
+ dest: "{{ test_data_sanity.merged_conf_file }}"
+ delegate_to: localhost
tags: sanity
-- assert:
- that:
- - 'result.response.DATA != None'
+- name: SANITY - TC2 - Create Network Config File using J2 Template (Overridden)
+ ansible.builtin.template:
+ src: "{{ test_data_sanity.overridden_conf_template }}"
+ dest: "{{ test_data_sanity.overridden_conf_file }}"
+ delegate_to: localhost
tags: sanity
-- name: SANITY- DELETED - setup - Clean up any existing networks
+- name: SANITY - TC3 - Create Network Config File using J2 Template (Replaced)
+ ansible.builtin.template:
+ src: "{{ test_data_sanity.replaced_conf_template }}"
+ dest: "{{ test_data_sanity.replaced_conf_file }}"
+ delegate_to: localhost
+ tags: sanity
+
+##############################################
+## DELETED ##
+##############################################
+
+- name: SANITY - DELETED - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
tags: sanity
-- name: SANITY- MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
+
+##############################################
+## MERGED ##
+##############################################
+
+- name: SANITY - TC1 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_sanity_merged_conf: "{{ lookup('file', '{{ test_data_sanity.merged_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: sanity
+
+- name: SANITY - TC1 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw2_int3 }}", "{{ ansible_sw2_int4 }}"]
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"]
- deploy: true
+ config: "{{ dcnm_network_sanity_merged_conf }}"
register: result
tags: sanity
-- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
- #tags: sanity
-
-- assert:
+- name: SANITY - TC1 - ASSERT - Check changed flag is true
+ assert:
that:
- 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - 'result.response[3].RETURN_CODE == 200'
- - '(result.response[2].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[2].DATA|dict2items)[1].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
- - 'result.diff[1].attach[0].deploy == true'
- - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address'
- - 'result.diff[1].net_name == "ansible-net12"'
- - 'result.diff[1].net_id == 7002'
- - 'result.diff[1].vrf_name == "Tenant-2"'
- #tags: sanity
+ tags: sanity
+
+- name: SANITY - TC1 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: sanity
+
+- name: SANITY - TC1 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_sanity.merged_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: sanity
##############################################
## OVERRIDDEN ##
##############################################
-- name: SANITY- OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: SANITY - TC2 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_sanity_overridden_conf: "{{ lookup('file', '{{ test_data_sanity.overridden_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: sanity
+
+- name: SANITY - TC2 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: overridden
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 150
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- # Replace the ports with new ports
- # ports: [Ethernet1/1, Ethernet1/2]
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int4 }}"]
- deploy: true
- # delete the second network
+ config: "{{ dcnm_network_sanity_overridden_conf }}"
register: result
- #tags: sanity
+ tags: sanity
-- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
- #tags: sanity
-
-- assert:
+- name: SANITY - TC2 - ASSERT - Check changed flag is true
+ assert:
that:
- 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - 'result.response[3].RETURN_CODE == 200'
- - 'result.response[4].RETURN_CODE == 200'
- - 'result.response[5].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[4].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[4].DATA|dict2items)[1].value == "SUCCESS"'
- - 'result.response[3].METHOD == "DELETE"'
- - 'result.diff[0].attach[0].deploy == false'
- - 'result.diff[0].attach[1].deploy == true'
- - 'result.diff[0].attach[2].deploy == false'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[1].ip_address'
- - '"{{ ansible_switch2 }}" in result.diff[0].attach[2].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
- - 'result.diff[1].attach[0].deploy == false'
- - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address'
- - 'result.diff[1].net_name == "ansible-net12"'
- #tags: sanity
-
-- name: OVERRIDDEN - conf1 - Idempotence
+ tags: sanity
+
+- name: SANITY - TC2 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: sanity
+
+- name: SANITY - TC2 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_sanity.overridden_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: sanity
+
+- name: SANITY - TC2 - OVERRIDDEN - conf1 - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
- #tags: sanity
+ tags: sanity
-- assert:
+- name: SANITY - TC2 - ASSERT - Check changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
- #tags: sanity
-
-- name: SANITY- OVERRIDDEN - setup - remove any networks
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: deleted
- #tags: sanity
+ - result.changed == false
+ tags: sanity
+##############################################
+## REPLACED ##
+##############################################
-- name: SANITY- REPLACED - setup - Clean up any existing networks
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: deleted
- #tags: sanity
+- name: SANITY - TC3 - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_sanity_replaced_conf: "{{ lookup('file', '{{ test_data_sanity.replaced_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+ tags: sanity
-- name: SANITY- REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach
+- name: SANITY - TC3 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw2_int3 }}", "{{ ansible_sw2_int4 }}"]
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"]
- deploy: true
+ fabric: "{{ test_data_common.fabric }}"
+ state: overridden
+ config: "{{ dcnm_network_sanity_merged_conf }}"
register: result
- #tags: sanity
+ tags: sanity
-- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
- state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "query_result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
- #tags: sanity
-
-- assert:
+- name: SANITY - TC3 - ASSERT - Check changed flag
+ assert:
that:
- 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - 'result.response[3].RETURN_CODE == 200'
- - '(result.response[2].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[2].DATA|dict2items)[1].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
- - 'result.diff[1].attach[0].deploy == true'
- - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address'
- - 'result.diff[1].net_name == "ansible-net12"'
- - 'result.diff[1].net_id == 7002'
- - 'result.diff[1].vrf_name == "Tenant-2"'
- #tags: sanity
+ tags: sanity
-##############################################
-## REPLACED ##
-##############################################
+- name: SANITY - TC3 - QUERY - Get network state in NDFC
+ cisco.dcnm.dcnm_network:
+ state: query
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: sanity
+
+- name: SANITY - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_sanity.merged_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: sanity
-- name: SANITY- REPLACED - Update Network using replace - Delete Attachments
+- name: SANITY - TC3 - REPLACED - Update Network using replace - Delete Attachments
cisco.dcnm.dcnm_network: &conf2
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: replaced
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- - net_name: ansible-net12
- vrf_name: Tenant-2
- net_id: 7002
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 151
- gw_ip_subnet: '192.168.40.1/24'
- deploy: true
+ config: "{{ dcnm_network_sanity_replaced_conf }}"
register: result
- #tags: sanity
+ tags: sanity
-- name: Query fabric state until networkStatus transitions to NA state
+# This assert is failing
+# This is a bug, the changed flag should be true but is returned as false
+# - name: SANITY - TC3 - ASSERT - Check changed flag is true
+# assert:
+# that:
+# - 'result.changed == true'
+# tags: sanity
+
+- name: SANITY - TC3 - QUERY - Get network state in NDFC
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('NA')"
- - "query_result.response[1].parent.networkStatus is search('NA')"
- retries: 30
- delay: 2
- #tags: sanity
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"'
- - '(result.response[0].DATA|dict2items)[2].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == false'
- - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address'
- - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[1].ip_address'
- - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name'
- - 'result.diff[1].attach[1].deploy == false'
- - 'result.diff[1].attach[0].deploy == false'
- - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address'
- - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name'
- #tags: sanity
-
-- name: SANITY - REPLACED - conf1 - Idempotence
+ fabric: "{{ test_data_common.fabric }}"
+ register: verify_result
+ tags: sanity
+
+- name: SANITY - TC3 - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data_sanity.replaced_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ tags: sanity
+
+- name: SANITY - TC3 - REPLACED - conf1 - Idempotence
cisco.dcnm.dcnm_network: *conf2
register: result
- #tags: sanity
+ tags: sanity
-- assert:
+- name: SANITY - TC3 - ASSERT - Check changed flag is false
+ assert:
that:
- - 'result.changed == false'
- - 'result.response|length == 0'
- #tags: sanity
+ - result.changed == false
+ tags: sanity
-- name: SANITY - DELETED - setup - Clean up any existing networks
+- name: SANITY - END - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
tags: sanity
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml
index 3644901f0..dd4091523 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml
@@ -1,104 +1,116 @@
+##############################################
+## SETUP ##
+##############################################
+
+- name: DELETED_ALL - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: DELETED_ALL - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_conf_template: "self-contained-tests/net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/self_contained_deleted_all_conf.yaml"
+
+- name: DELETED_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_conf_template }}"
+ dest: "{{ test_data.net1_conf_file }}"
+ delegate_to: localhost
+
+
##############################################
## MERGED ##
##############################################
+- name: DELETED_ALL - Delete any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ register: result
+
+- name: DELETED_ALL - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_deleted_net1_conf: "{{ lookup('file', '{{ test_data.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
- name: DELETED_ALL - Create New Network with many params
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2001::1/64'
- secondary_ip_gw1: '192.0.2.1/24'
- secondary_ip_gw2: '192.1.2.1/24'
- secondary_ip_gw3: '192.2.2.1/24'
- secondary_ip_gw4: '192.3.2.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ config: "{{ dcnm_network_deleted_net1_conf }}"
register: result
+- name: DELETED_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
- name: DELETED_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
+ register: verify_result
+
+- name: DELETED_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
- name: DELETED_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
-- assert:
+- name: DELETED_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
-- name: DELETED_ALL - setup - Delete any existing networks
+- name: DELETED_ALL - Delete any existing networks
cisco.dcnm.dcnm_network: &conf1
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
register: result
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - 'result.response[0].MESSAGE == "OK"'
- - 'result.response[1].MESSAGE == "OK"'
- - 'result.response[2].MESSAGE == "OK"'
- - 'result.response[2].METHOD == "DELETE"'
- - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == false'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
-
-- name: DELETED - conf - Idempotence
+- name: DELETED_ALL - Query fabric for deletion of Network Object
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: query
+ register: verify_result
+
+- name: DELETED_ALL - VALIDITY CHECK - Verify deleted network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ check_deleted: true
+ delegate_to: localhost
+
+
+- name: DELETED_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf1
register: result
-- assert:
+- name: DELETED_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
- - 'result.diff|length == 0'
##############################################
## CLEAN-UP ##
##############################################
-- name: DELETED_ALL - setup - Clean up any existing networks
+- name: DELETED_ALL - END - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml
index de8b230f5..8bb7cb73e 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml
@@ -1,73 +1,87 @@
+##############################################
+## SETUP ##
+##############################################
+
+- name: MERGED_ALL - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: MERGED_ALL - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_conf_template: "self-contained-tests/net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/self_contained_deleted_all_conf.yaml"
+
+- name: MERGED_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_conf_template }}"
+ dest: "{{ test_data.net1_conf_file }}"
+ delegate_to: localhost
+
+
##############################################
## MERGED ##
##############################################
+- name: MERGED_ALL - Delete any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ register: result
+
+- name: MERGED_ALL - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_conf: "{{ lookup('file', '{{ test_data.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
- name: MERGED_ALL - Create New Network with many params
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2001::1/64'
- secondary_ip_gw1: '192.0.2.1/24'
- secondary_ip_gw2: '192.1.2.1/24'
- secondary_ip_gw3: '192.2.2.1/24'
- secondary_ip_gw4: '192.3.2.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ config: "{{ dcnm_network_merged_net1_conf }}"
register: result
-- name: MERGED_ALL - Query fabric for creation of Network Object
+- name: MERGED_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: MERGED_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
+ register: verify_result
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
+- name: MERGED_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
- name: MERGED_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
-- assert:
+- name: MERGED_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
+
##############################################
## CLEAN-UP ##
##############################################
-- name: MERGED_ALL - setup - Clean up any existing networks
+- name: MERGED_ALL - END - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml
index 65fdc8ae3..5db4cc299 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml
@@ -1,126 +1,119 @@
+##############################################
+## SETUP ##
+##############################################
+
+- name: OVERRIDDEN_ALL - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: OVERRIDDEN_ALL - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_conf_template: "self-contained-tests/net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/self_contained_overridden_all_net1_conf.yaml"
+ #----------------------------------
+ net2_conf_template: "self-contained-tests/net2_conf.j2"
+ net2_conf_file: "{{ role_path }}/files/self_contained_overridden_all_net2_conf.yaml"
+ #----------------------------------
+
+- name: OVERRIDDEN_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_conf_template }}"
+ dest: "{{ test_data.net1_conf_file }}"
+ delegate_to: localhost
+
+- name: OVERRIDDEN_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net2_conf_template }}"
+ dest: "{{ test_data.net2_conf_file }}"
+ delegate_to: localhost
+
##############################################
## MERGED ##
##############################################
+- name: OVERRIDDEN_ALL - Delete any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ register: result
+
+- name: OVERRIDDEN_ALL - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_net1_conf: "{{ lookup('file', '{{ test_data.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
- name: OVERRIDDEN_ALL - Create New Network with many params
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2001::1/64'
- secondary_ip_gw1: '192.0.2.1/24'
- secondary_ip_gw2: '192.1.2.1/24'
- secondary_ip_gw3: '192.2.2.1/24'
- secondary_ip_gw4: '192.3.2.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ config: "{{ dcnm_network_overridden_net1_conf }}"
register: result
-- name: OVERRIDDEN_ALL Query fabric for creation of Network Object
+- name: OVERRIDDEN_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: OVERRIDDEN_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
+ register: verify_result
+
+- name: OVERRIDDEN_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: OVERRIDDEN_ALL - Load Network 2 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_overridden_net2_conf: "{{ lookup('file', '{{ test_data.net2_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
- name: OVERRIDDEN_ALL - Override Network with many params
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: overridden
- config:
- - net_name: ansible-net14
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2004::1/64'
- secondary_ip_gw1: '192.0.3.1/24'
- secondary_ip_gw2: '192.1.3.1/24'
- secondary_ip_gw3: '192.2.3.1/24'
- secondary_ip_gw4: '192.3.3.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ config: "{{ dcnm_network_overridden_net2_conf }}"
register: result
+- name: OVERRIDDEN_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
- name: OVERRIDDEN_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net14')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - 'result.response[3].RETURN_CODE == 200'
- - 'result.response[4].RETURN_CODE == 200'
- - 'result.response[5].RETURN_CODE == 200'
- - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[4].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - 'result.diff[1].attach[0].deploy == false'
- - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net14"'
- - 'result.diff[1].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
+ register: verify_result
+
+- name: OVERRIDDEN_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net2_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
- name: OVERRIDDEN_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
-- assert:
+- name: OVERRIDDEN_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
##############################################
## CLEAN-UP ##
@@ -128,5 +121,5 @@
- name: OVERRIDDEN_ALL - setup - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml
index 1f4352bb9..02627020b 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml
@@ -1,128 +1,125 @@
+##############################################
+## SETUP ##
+##############################################
+
+- name: REPLACED_ALL - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: REPLACED_ALL - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_conf_template: "self-contained-tests/net1_conf.j2"
+ net1_conf_file: "{{ role_path }}/files/self_contained_replaced_all_net1_conf.yaml"
+ #----------------------------------
+ net1_changed_conf_template: "self-contained-tests/net1_changed_conf.j2"
+ net1_changed_conf_file: "{{ role_path }}/files/self_contained_replaced_all_net1_changed_conf.yaml"
+ #----------------------------------
+
+- name: REPLACED_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_conf_template }}"
+ dest: "{{ test_data.net1_conf_file }}"
+ delegate_to: localhost
+
+- name: REPLACED_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_changed_conf_template }}"
+ dest: "{{ test_data.net1_changed_conf_file }}"
+ delegate_to: localhost
+
##############################################
## MERGED ##
##############################################
+- name: REPLACED_ALL - Delete any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
+ register: result
-- name: REPLACE_ALL - Create New Network with many params
+- name: REPLACED_ALL - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_replaced_net1_conf: "{{ lookup('file', '{{ test_data.net1_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+- name: REPLACED_ALL - Create New Network with many params
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2001::1/64'
- secondary_ip_gw1: '192.0.2.1/24'
- secondary_ip_gw2: '192.1.2.1/24'
- secondary_ip_gw3: '192.2.2.1/24'
- secondary_ip_gw4: '192.3.2.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ config: "{{ dcnm_network_replaced_net1_conf }}"
register: result
-- name: REPLACE_ALL - Query fabric for creation of Network Object
+- name: REPLACED_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: REPLACED_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
-
-- name: REPLACE_ALL - Replace Network with many params
+ register: verify_result
+
+- name: REPLACED_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: REPLACED_ALL - Load Network 2 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_replaced_net1_changed_conf: "{{ lookup('file', '{{ test_data.net1_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+- name: REPLACED_ALL - Override Network with many params
cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
- state: replaced
- config:
- - net_name: ansible-net13
- vrf_name: Tenant-1
- net_id: 7005
- net_template: Default_Network_Universal
- net_extension_template: Default_Network_Extension_Universal
- vlan_id: 1500
- gw_ip_subnet: '192.168.30.1/24'
- gw_ipv6_subnet: '2004::1/64'
- secondary_ip_gw1: '192.0.3.1/24'
- secondary_ip_gw2: '192.1.3.1/24'
- secondary_ip_gw3: '192.2.3.1/24'
- secondary_ip_gw4: '192.3.3.1/24'
- route_target_both: true
- l3gw_on_border: true
- attach:
- - ip_address: "{{ ansible_switch2 }}"
- ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"]
- deploy: true
- deploy: true
+ fabric: "{{ test_data_common.fabric }}"
+ state: overridden
+ config: "{{ dcnm_network_replaced_net1_changed_conf }}"
register: result
-- name: REPLACE_ALL - Query fabric for creation of Network Object
+- name: REPLACED_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: REPLACED_ALL - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.displayName is search('ansible-net13')"
- - "query_result.response[0].parent.networkId is search('7005')"
- - "query_result.response[0].parent.vrf is search('Tenant-1')"
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')"
- retries: 5
- delay: 2
-
-- assert:
- that:
- - 'result.changed == true'
- - 'result.response[0].RETURN_CODE == 200'
- - 'result.response[1].RETURN_CODE == 200'
- - 'result.response[2].RETURN_CODE == 200'
- - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"'
- - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"'
- - 'result.diff[0].attach[0].deploy == true'
- - 'result.diff[0].attach[1].deploy == false'
- - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address'
- - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[0].attach[1].ip_address'
- - 'result.diff[0].net_name == "ansible-net13"'
- - 'result.diff[0].net_id == 7005'
- - 'result.diff[0].vrf_name == "Tenant-1"'
-
-- name: REPLACE_ALL - conf - Idempotence
+ register: verify_result
+
+- name: REPLACED_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: REPLACED_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
-- assert:
+- name: REPLACED_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
##############################################
## CLEAN-UP ##
##############################################
-- name: REPLACE_ALL - setup - Clean up any existing networks
+- name: REPLACED_ALL - setup - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml
index 43c54a138..00a8d502c 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml
@@ -2,65 +2,84 @@
## SETUP ##
##############################################
-- set_fact:
- rest_path: "/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version == "11"
+- name: SCALED_ALL - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
-- set_fact:
- rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}"
- when: controller_version >= "12"
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SCALED_ALL - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ scale_conf_template: "self-contained-tests/scale_conf.j2"
+ scale_conf_file: "{{ role_path }}/files/self_contained_scale_conf.yaml"
+ #----------------------------------
-- name: SCALE - Verify if fabric is deployed.
- cisco.dcnm.dcnm_rest:
- method: GET
- path: "{{ rest_path }}"
- register: result
-- assert:
- that:
- - 'result.response.DATA != None'
+- name: SCALED_ALL - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.scale_conf_template }}"
+ dest: "{{ test_data.scale_conf_file }}"
+ delegate_to: localhost
-- name: SCALE - Clean up any existing networks
+- name: SCALED_ALL - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Dummy set fact for leaf_attach_list
- set_fact:
- leaf_net_attach: []
-
-- name: Build list of Networks to be deployed
- set_fact:
- nets_list: "{{ nets_list|default([]) + [{ 'net_name': 'TEST_NET%03d' | format(item), 'vrf_name': 'Tenant-1', 'deploy': 'no', 'net_id': (item | int + 50000) | int, 'vlan_id': (item | int + 2000) | int, 'attach': leaf_net_attach }] }}"
- loop: '{{ range(0, 800) | list }}'
+- name: SCALED_ALL - Load Scale Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_scale_conf: "{{ lookup('file', '{{ test_data.scale_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
-- name: Push all Networks to DCNM
- cisco.dcnm.dcnm_network:
- fabric: '{{ test_fabric }}'
+- name: SCALED_ALL - Create 800 networks
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config: '{{ nets_list }}'
+ config: "{{ dcnm_network_merged_scale_conf }}"
register: result
-- name: SCALE - Clean up existing networks
- cisco.dcnm.dcnm_network: &conf
- fabric: "{{ test_fabric }}"
- state: deleted
+- name: SCALED_ALL - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SCALED_ALL - Query fabric for creation of Network Object
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: query
+ register: verify_result
-- name: SCALE - conf - Idempotence
+- name: SCALED_ALL - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.scale_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: SCALED_ALL - conf - Idempotence
cisco.dcnm.dcnm_network: *conf
register: result
-- assert:
+- name: SCALED_ALL - ASSERT - Check changed flag is false
+ assert:
that:
- 'result.changed == false'
- - 'result.response|length == 0'
- - 'result.diff|length == 0'
-################################################
-#### CLEAN-UP ##
-################################################
-- name: SCALE - Clean up any existing networks
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SCALED_ALL - END - Clean up any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml
index 0c21699b1..bec852d10 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml
@@ -1,56 +1,90 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SM_DHCP_PARAMS - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SM_DHCP_PARAMS - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_dhcp_conf_template: "self-contained-tests/net1_dhcp_conf.j2"
+ net1_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml"
+
+- name: SM_DHCP_PARAMS - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_dhcp_conf_template }}"
+ dest: "{{ test_data.net1_dhcp_conf_file }}"
+ delegate_to: localhost
+
+
+##############################################
+## MERGED ##
+##############################################
+- name: SM_DHCP_PARAMS - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Test dhcp parameters for state merged
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+- name: SM_DHCP_PARAMS - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_dhcp_conf: "{{ lookup('file', '{{ test_data.net1_dhcp_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SM_DHCP_PARAMS - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- dhcp_loopback_id: 0
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_dhcp_conf }}"
register: result
-- assert:
+- name: SM_DHCP_PARAMS - ASSERT - Check changed flag is true
+ assert:
that:
- - 'result.changed == true'
+ - result.changed == true
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_DHCP_PARAMS - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 is search('1.1.1.1')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 is search('2.2.2.2')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 is search('3.3.3.3')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp is search('one')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp2 is search('two')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp3 is search('three')"
- - "result.response[0].parent.networkTemplateConfig.loopbackId is search('0')"
\ No newline at end of file
+- name: SM_DHCP_PARAMS - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_dhcp_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+# the below deploys even if deploy is set to false
+# it also shows diff if deploy false was used
+# - name: SM_DHCP_PARAMS - conf - Idempotence
+# cisco.dcnm.dcnm_network: *conf
+# register: result
+
+# - name: SM_DHCP_PARAMS - ASSERT - Check changed flag is false
+# assert:
+# that:
+# - 'result.changed == false'
+
+
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SM_DHCP_PARAMS - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml
index 5bfe0b429..254bc9999 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml
@@ -1,100 +1,116 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SM_DHCP_UPDATE - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SM_DHCP_UPDATE - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_dhcp_conf_template: "self-contained-tests/net1_dhcp_conf.j2"
+ net1_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml"
+ #----------------------------------
+ net1_dhcp_changed_conf_template: "self-contained-tests/net1_dhcp_changed_conf.j2"
+ net1_dhcp_changed_conf_file: "{{ role_path }}/files/self_contained_dhcp_changed_conf.yaml"
+
+- name: SM_DHCP_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_dhcp_conf_template }}"
+ dest: "{{ test_data.net1_dhcp_conf_file }}"
+ delegate_to: localhost
+
+- name: SM_DHCP_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_dhcp_changed_conf_template }}"
+ dest: "{{ test_data.net1_dhcp_changed_conf_file }}"
+ delegate_to: localhost
+
+##############################################
+## MERGED ##
+##############################################
+- name: SM_DHCP_UPDATE - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Create network with initial dhcp parameter values
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+- name: SM_DHCP_UPDATE - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_dhcp_conf: "{{ lookup('file', '{{ test_data.net1_dhcp_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SM_DHCP_UPDATE - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- dhcp_loopback_id: 0
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_dhcp_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_DHCP_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SM_DHCP_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 is search('1.1.1.1')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 is search('2.2.2.2')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 is search('3.3.3.3')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp is search('one')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp2 is search('two')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp3 is search('three')"
- - "result.response[0].parent.networkTemplateConfig.loopbackId is search('0')"
-
-- name: Change dhcp parameter values
+- name: SM_DHCP_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_dhcp_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: SM_DHCP_UPDATE - Load Network 1 Changed Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_dhcp_changed_conf: "{{ lookup('file', '{{ test_data.net1_dhcp_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+- name: SM_DHCP_UPDATE - Change dhcp parameter values
cisco.dcnm.dcnm_network:
fabric: "{{ test_fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- dhcp_srvr1_ip: '1.1.55.55'
- dhcp_srvr2_ip: '2.2.55.55'
- dhcp_srvr3_ip: '3.3.55.55'
- dhcp_srvr1_vrf: one_fifty_five
- dhcp_srvr2_vrf: two_fifty_five
- dhcp_srvr3_vrf: three_fifty_five
- dhcp_loopback_id: 55
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_dhcp_changed_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_DHCP_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SM_DHCP_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 is search('1.1.55.55')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 is search('2.2.55.55')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 is search('3.3.55.55')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp is search('one_fifty_five')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp2 is search('two_fifty_five')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp3 is search('three_fifty_five')"
- - "result.response[0].parent.networkTemplateConfig.loopbackId is search('55')"
+- name: SM_DHCP_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_dhcp_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SM_DHCP_UPDATE - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml
index 237140f39..32ee69749 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml
@@ -1,44 +1,88 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SM_MCAST_PARAMS - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SM_MCAST_PARAMS - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_mcast_template: "self-contained-tests/net1_mcast_conf.j2"
+ net1_mcast_file: "{{ role_path }}/files/self_contained_net1_mcast_conf.yaml"
+
+- name: SM_MCAST_PARAMS - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_mcast_template }}"
+ dest: "{{ test_data.net1_mcast_file }}"
+ delegate_to: localhost
+
+
+##############################################
+## MERGED ##
+##############################################
+- name: SM_MCAST_PARAMS - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Test mcast parameters for state merged
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+- name: SM_MCAST_PARAMS - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_mcast: "{{ lookup('file', '{{ test_data.net1_mcast_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SM_MCAST_PARAMS - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- multicast_group_address: '224.5.5.5'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_mcast }}"
register: result
-- assert:
+- name: SM_MCAST_PARAMS - ASSERT - Check changed flag is true
+ assert:
that:
- - 'result.changed == true'
+ - result.changed == true
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_MCAST_PARAMS - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
+ register: verify_result
+
+- name: SM_MCAST_PARAMS - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_mcast_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: SM_MCAST_PARAMS - conf - Idempotence
+ cisco.dcnm.dcnm_network: *conf
register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-- assert:
+- name: SM_MCAST_PARAMS - ASSERT - Check changed flag is false
+ assert:
that:
- - "result.response[0].parent.networkTemplateConfig.mcastGroup is search('224.5.5.5')"
\ No newline at end of file
+ - 'result.changed == false'
+
+
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SM_MCAST_PARAMS - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml
index 5fca584ee..387712211 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml
@@ -1,94 +1,116 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SM_MCAST_UPDATE - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SM_MCAST_UPDATE - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ net1_mcast_conf_template: "self-contained-tests/net1_mcast_conf.j2"
+ net1_mcast_conf_file: "{{ role_path }}/files/self_contained_mcast_conf.yaml"
+ #----------------------------------
+ net1_mcast_changed_conf_template: "self-contained-tests/net1_mcast_changed_conf.j2"
+ net1_mcast_changed_conf_file: "{{ role_path }}/files/self_contained_mcast_changed_conf.yaml"
+
+- name: SM_MCAST_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_mcast_conf_template }}"
+ dest: "{{ test_data.net1_mcast_conf_file }}"
+ delegate_to: localhost
+
+- name: SM_MCAST_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.net1_mcast_changed_conf_template }}"
+ dest: "{{ test_data.net1_mcast_changed_conf_file }}"
+ delegate_to: localhost
+
+##############################################
+## MERGED ##
+##############################################
+- name: SM_MCAST_UPDATE - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Create network with initial DEFAULT mcast parameter value
- cisco.dcnm.dcnm_network: &create
- fabric: "{{ test_fabric }}"
+- name: SM_MCAST_UPDATE - Load Network 1 Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_mcast_conf: "{{ lookup('file', '{{ test_data.net1_mcast_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SM_MCAST_UPDATE - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- dhcp_loopback_id: 0
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_mcast_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_MCAST_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SM_MCAST_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - 'result.changed == true'
- - "query_result.response[0].parent.networkTemplateConfig.mcastGroup is search('239.1.1.1|239.1.1.0')"
-
-- name: Idempotence Check - Create network with initial DEFAULT mcast parameter value
- cisco.dcnm.dcnm_network: *create
- register: result
+- name: SM_MCAST_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_mcast_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
-- assert:
- that:
- - 'result.changed == false'
+- name: SM_MCAST_UPDATE - Load Network 1 Changed Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_net1_mcast_changed_conf: "{{ lookup('file', '{{ test_data.net1_mcast_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
-- name: Change mcast parameter values
- cisco.dcnm.dcnm_network: &change
+- name: SM_MCAST_UPDATE - Change mcast parameter values
+ cisco.dcnm.dcnm_network:
fabric: "{{ test_fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan
- multicast_group_address: '230.55.24.155'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_net1_mcast_changed_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SM_MCAST_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SM_MCAST_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: query_result
- until:
- - "query_result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - 'result.changed == true'
- - "query_result.response[0].parent.networkTemplateConfig.mcastGroup is search('230.55.24.155')"
+- name: SM_MCAST_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.net1_mcast_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
-- name: Idempotence Check - Change mcast parameter values
- cisco.dcnm.dcnm_network: *change
- register: result
+##############################################
+## CLEAN-UP ##
+##############################################
-- assert:
- that:
- - 'result.changed == false'
+- name: SM_MCAST_UPDATE - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml
index bffddbd7c..e74e1dd20 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml
@@ -1,141 +1,116 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SO_DHCP_UPDATE - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SO_DHCP_UPDATE - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ double_net_dhcp_conf_template: "self-contained-tests/double_net_dhcp_conf.j2"
+ double_net_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml"
+ #----------------------------------
+ double_net_dhcp_changed_conf_template: "self-contained-tests/double_net_dhcp_changed_conf.j2"
+ double_net_dhcp_changed_conf_file: "{{ role_path }}/files/self_contained_double_net_dhcp_changed_conf.yaml"
+
+- name: SO_DHCP_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.double_net_dhcp_conf_template }}"
+ dest: "{{ test_data.double_net_dhcp_conf_file }}"
+ delegate_to: localhost
+
+- name: SO_DHCP_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.double_net_dhcp_changed_conf_template }}"
+ dest: "{{ test_data.double_net_dhcp_changed_conf_file }}"
+ delegate_to: localhost
+
+##############################################
+## MERGED ##
+##############################################
+- name: SO_DHCP_UPDATE - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Create network with initial dhcp parameter values
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+- name: SO_DHCP_UPDATE - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_double_net_dhcp_conf: "{{ lookup('file', '{{ test_data.double_net_dhcp_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SO_DHCP_UPDATE - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net13
- dhcp_srvr1_ip: '1.1.1.1'
- dhcp_srvr2_ip: '2.2.2.2'
- dhcp_srvr3_ip: '3.3.3.3'
- dhcp_srvr1_vrf: one
- dhcp_srvr2_vrf: two
- dhcp_srvr3_vrf: three
- dhcp_loopback_id: 1022
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
- - net_name: ansible-net14
- vrf_name: ansible-vrf-int1
- net_id: 7010
- vlan_id: 3506
- gw_ip_subnet: '152.168.31.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net14
- dhcp_srvr1_ip: '11.11.11.11'
- dhcp_srvr2_ip: '12.12.12.12'
- dhcp_srvr3_ip: '13.13.13.13'
- dhcp_srvr1_vrf: eleven
- dhcp_srvr2_vrf: twelve
- dhcp_srvr3_vrf: thirteen
- dhcp_loopback_id: 1023
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_double_net_dhcp_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SO_DHCP_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SO_DHCP_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- set_fact:
- testnet1: "{{ item }}"
- when: "item.parent.displayName is search('ansible-net13')"
- loop: "{{ result.response }}"
-
-- set_fact:
- testnet2: "{{ item }}"
- when: "item.parent.displayName is search('ansible-net14')"
- loop: "{{ result.response }}"
-
-- assert:
- that:
- - "testnet1.parent.networkTemplateConfig.dhcpServerAddr1 is search('1.1.1.1')"
- - "testnet1.parent.networkTemplateConfig.dhcpServerAddr2 is search('2.2.2.2')"
- - "testnet1.parent.networkTemplateConfig.dhcpServerAddr3 is search('3.3.3.3')"
- - "testnet1.parent.networkTemplateConfig.vrfDhcp is search('one')"
- - "testnet1.parent.networkTemplateConfig.vrfDhcp2 is search('two')"
- - "testnet1.parent.networkTemplateConfig.vrfDhcp3 is search('three')"
- - "testnet1.parent.networkTemplateConfig.loopbackId is search('1022')"
- - "testnet2.parent.networkTemplateConfig.dhcpServerAddr1 is search('11.11.11.11')"
- - "testnet2.parent.networkTemplateConfig.dhcpServerAddr2 is search('12.12.12.12')"
- - "testnet2.parent.networkTemplateConfig.dhcpServerAddr3 is search('13.13.13.13')"
- - "testnet2.parent.networkTemplateConfig.vrfDhcp is search('eleven')"
- - "testnet2.parent.networkTemplateConfig.vrfDhcp2 is search('twelve')"
- - "testnet2.parent.networkTemplateConfig.vrfDhcp3 is search('thirteen')"
- - "testnet2.parent.networkTemplateConfig.loopbackId is search('1023')"
-
-
-- name: Override network with a single network and change values within that newtwork
+ register: verify_result
+
+- name: SO_DHCP_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.double_net_dhcp_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+- name: SO_DHCP_UPDATE - Load Network Changed Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_double_net_dhcp_changed_conf: "{{ lookup('file', '{{ test_data.double_net_dhcp_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+- name: SO_DHCP_UPDATE - Override network config
cisco.dcnm.dcnm_network:
fabric: "{{ test_fabric }}"
state: overridden
- config:
- - net_name: ansible-net14
- vrf_name: ansible-vrf-int1
- net_id: 7010
- vlan_id: 3506
- gw_ip_subnet: '152.168.31.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net14
- dhcp_srvr1_ip: '55.11.11.11'
- dhcp_srvr2_ip: '55.12.12.12'
- dhcp_srvr3_ip: '55.13.13.13'
- dhcp_srvr1_vrf: eleven
- dhcp_srvr2_vrf: twelve
- dhcp_srvr3_vrf: thirteen
- dhcp_loopback_id: 55
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_double_net_dhcp_changed_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SO_DHCP_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SO_DHCP_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - "result.response|length == 1"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr1 is search('55.11.11.11')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr2 is search('55.12.12.12')"
- - "result.response[0].parent.networkTemplateConfig.dhcpServerAddr3 is search('55.13.13.13')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp is search('eleven')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp2 is search('twelve')"
- - "result.response[0].parent.networkTemplateConfig.vrfDhcp3 is search('thirteen')"
- - "result.response[0].parent.networkTemplateConfig.loopbackId is search('55')"
+- name: SO_DHCP_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.double_net_dhcp_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SO_DHCP_UPDATE - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
\ No newline at end of file
diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml
index 858797750..8c1c4e52b 100644
--- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml
+++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml
@@ -1,105 +1,116 @@
-- name: Setup - Remove all existing networks
+##############################################
+## SETUP ##
+##############################################
+
+- name: SO_MCAST_UPDATE - Test Entry Point - [ndfc_network]
+ ansible.builtin.debug:
+ msg:
+ - "----------------------------------------------------------------"
+ - "+ Executing Tests - [ndfc_network] +"
+ - "----------------------------------------------------------------"
+
+##############################################
+## Create Dictionary of Test Data ##
+##############################################
+- name: SO_MCAST_UPDATE - Setup Internal TestCase Variables
+ ansible.builtin.set_fact:
+ test_data:
+ #----------------------------------
+ # config templates and auto generated file location for test cases
+ #----------------------------------
+ double_net_mcast_conf_template: "self-contained-tests/double_net_mcast_conf.j2"
+ double_net_mcast_conf_file: "{{ role_path }}/files/self_contained_mcast_conf.yaml"
+ #----------------------------------
+ double_net_mcast_changed_conf_template: "self-contained-tests/double_net_mcast_changed_conf.j2"
+ double_net_mcast_changed_conf_file: "{{ role_path }}/files/self_contained_double_net_mcast_changed_conf.yaml"
+
+- name: SO_MCAST_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.double_net_mcast_conf_template }}"
+ dest: "{{ test_data.double_net_mcast_conf_file }}"
+ delegate_to: localhost
+
+- name: SO_MCAST_UPDATE - Create Network Config File using J2 Template
+ ansible.builtin.template:
+ src: "{{ test_data.double_net_mcast_changed_conf_template }}"
+ dest: "{{ test_data.double_net_mcast_changed_conf_file }}"
+ delegate_to: localhost
+
+##############################################
+## MERGED ##
+##############################################
+- name: SO_MCAST_UPDATE - Delete any existing networks
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: deleted
+ register: result
-- name: Create network with initial mcast parameter value
- cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+- name: SO_MCAST_UPDATE - Load Network Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_double_net_mcast_conf: "{{ lookup('file', '{{ test_data.double_net_mcast_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+# below deploy is true, reason is in comment above idempotence checl
+- name: SO_MCAST_UPDATE - Create New Network with many params
+ cisco.dcnm.dcnm_network: &conf
+ fabric: "{{ test_data_common.fabric }}"
state: merged
- config:
- - net_name: ansible-net13
- vrf_name: ansible-vrf-int1
- net_id: 7009
- vlan_id: 3505
- gw_ip_subnet: '152.168.30.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net13
- multicast_group_address: '230.101.134.144'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
- - net_name: ansible-net14
- vrf_name: ansible-vrf-int1
- net_id: 7010
- vlan_id: 3506
- gw_ip_subnet: '152.168.31.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net14
- multicast_group_address: '234.55.66.188'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_double_net_mcast_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SO_MCAST_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SO_MCAST_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- - "result.response[1].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
-
-- set_fact:
- testnet1: "{{ item }}"
- when: "item.parent.displayName is search('ansible-net13')"
- loop: "{{ result.response }}"
-
-- set_fact:
- testnet2: "{{ item }}"
- when: "item.parent.displayName is search('ansible-net14')"
- loop: "{{ result.response }}"
-
-- assert:
- that:
- - "testnet1.parent.networkTemplateConfig.mcastGroup is search('230.101.134.144')"
- - "testnet2.parent.networkTemplateConfig.mcastGroup is search('234.55.66.188')"
+ register: verify_result
+- name: SO_MCAST_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.double_net_mcast_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
-- name: Override network with a single network and change values within that newtwork
+- name: SO_MCAST_UPDATE - Load Network Changed Config File
+ ansible.builtin.set_fact:
+ dcnm_network_merged_double_net_mcast_changed_conf: "{{ lookup('file', '{{ test_data.double_net_mcast_changed_conf_file }}') | from_yaml }}"
+ delegate_to: localhost
+
+- name: SO_MCAST_UPDATE - Override network config
cisco.dcnm.dcnm_network:
fabric: "{{ test_fabric }}"
state: overridden
- config:
- - net_name: ansible-net14
- vrf_name: ansible-vrf-int1
- net_id: 7010
- vlan_id: 3506
- gw_ip_subnet: '152.168.31.1/24'
- mtu_l3intf: 7600
- arp_suppress: False
- int_desc: 'test interface'
- is_l2only: False
- vlan_name: testvlan_net14
- multicast_group_address: '238.55.66.124'
- attach:
- - ip_address: "{{ ansible_switch1 }}"
- ports: []
- deploy: True
+ config: "{{ dcnm_network_merged_double_net_mcast_changed_conf }}"
register: result
-- name: Query fabric state until networkStatus transitions to DEPLOYED state
+- name: SO_MCAST_UPDATE - ASSERT - Check changed flag is true
+ assert:
+ that:
+ - result.changed == true
+
+- name: SO_MCAST_UPDATE - Query fabric for creation of Network Object
cisco.dcnm.dcnm_network:
- fabric: "{{ test_fabric }}"
+ fabric: "{{ test_data_common.fabric }}"
state: query
- register: result
- until:
- - "result.response[0].parent.networkStatus is search('DEPLOYED')"
- retries: 30
- delay: 2
+ register: verify_result
-- assert:
- that:
- - "result.response|length == 1"
- - "result.response[0].parent.networkTemplateConfig.mcastGroup is search('238.55.66.124')"
\ No newline at end of file
+- name: SO_MCAST_UPDATE - VALIDITY CHECK - Verify network state in NDFC
+ cisco.dcnm.tests.integration.ndfc_network_validate:
+ config_path: "{{ test_data.double_net_mcast_changed_conf_file }}"
+ ndfc_data: "{{ verify_result }}"
+ test_data: "{{ test_data_common }}"
+ delegate_to: localhost
+
+##############################################
+## CLEAN-UP ##
+##############################################
+
+- name: SO_MCAST_UPDATE - END - Clean up any existing networks
+ cisco.dcnm.dcnm_network:
+ fabric: "{{ test_data_common.fabric }}"
+ state: deleted
\ No newline at end of file
diff --git a/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml b/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml
index da9c87332..6256986bb 100644
--- a/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml
+++ b/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml
@@ -105,7 +105,7 @@
# Validate Test Data
# ----------------------------------------------
- name: Validate Test Data
- cisco.dcnm.tests.unit.ndfc_pc_members_validate:
+ cisco.dcnm.tests.integration.ndfc_pc_members_validate:
ndfc_data: "{{ pc_state }}"
test_data: "{{ test_data }}"
register: result
diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt
deleted file mode 100644
index 7fdc2f2cb..000000000
--- a/tests/sanity/ignore-2.10.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.6!skip
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt
deleted file mode 100644
index 6390465d2..000000000
--- a/tests/sanity/ignore-2.11.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.6!skip
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/httpapi/dcnm.py import-2.7!skip
-plugins/httpapi/dcnm.py import-3.5!skip
-plugins/httpapi/dcnm.py import-3.6!skip
-plugins/httpapi/dcnm.py import-3.7!skip
-plugins/httpapi/dcnm.py import-3.8!skip
-plugins/httpapi/dcnm.py import-3.9!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt
deleted file mode 100644
index fb7f3a6aa..000000000
--- a/tests/sanity/ignore-2.12.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.6!skip
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/httpapi/dcnm.py import-3.8!skip
-plugins/httpapi/dcnm.py import-3.9!skip
-plugins/httpapi/dcnm.py import-3.10!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt
deleted file mode 100644
index 58baaeba7..000000000
--- a/tests/sanity/ignore-2.13.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/httpapi/dcnm.py import-3.8!skip
-plugins/httpapi/dcnm.py import-3.9!skip
-plugins/httpapi/dcnm.py import-3.10!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt
deleted file mode 100644
index 04bf43559..000000000
--- a/tests/sanity/ignore-2.14.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/httpapi/dcnm.py import-3.9!skip
-plugins/httpapi/dcnm.py import-3.10!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt
index 9950a8963..03f562703 100644
--- a/tests/sanity/ignore-2.15.txt
+++ b/tests/sanity/ignore-2.15.txt
@@ -1,27 +1,36 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
+plugins/action/tests/integration/ndfc_network_validate.py action-plugin-docs
+plugins/action/tests/integration/ndfc_network_validate.py import-3.9!skip
+plugins/action/tests/integration/ndfc_network_validate.py import-3.10!skip
+plugins/action/tests/integration/ndfc_network_validate.py import-3.11!skip
+plugins/action/tests/integration/ndfc_pc_members_validate.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.9!skip
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.10!skip
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.11!skip
+plugins/action/tests/plugin_utils/tools.py action-plugin-docs
plugins/httpapi/dcnm.py import-3.9!skip
plugins/httpapi/dcnm.py import-3.10!skip
-plugins/module_utils/common/sender_requests.py import-3.9 # TODO remove this if/when requests is added to the standard library
-plugins/module_utils/common/sender_requests.py import-3.10 # TODO remove this if/when requests is added to the standard library
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
-plugins/action/tests/unit/ndfc_pc_members_validate.py action-plugin-docs # action plugin has no matching module to provide documentation
+plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license
+plugins/module_utils/common/sender_requests.py import-3.9
+plugins/module_utils/common/sender_requests.py import-3.10
+plugins/module_utils/common/sender_requests.py import-3.11
+plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license
\ No newline at end of file
diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt
index f573fb4d6..833ac9cc5 100644
--- a/tests/sanity/ignore-2.16.txt
+++ b/tests/sanity/ignore-2.16.txt
@@ -1,24 +1,31 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/module_utils/common/sender_requests.py import-3.10 # TODO remove this if/when requests is added to the standard library
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
-plugins/action/tests/unit/ndfc_pc_members_validate.py action-plugin-docs # action plugin has no matching module to provide documentation
+plugins/action/tests/integration/ndfc_network_validate.py action-plugin-docs
+plugins/action/tests/integration/ndfc_network_validate.py import-3.10!skip
+plugins/action/tests/integration/ndfc_network_validate.py import-3.11!skip
+plugins/action/tests/integration/ndfc_pc_members_validate.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.10!skip
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.11!skip
+plugins/action/tests/plugin_utils/tools.py action-plugin-docs
+plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license
+plugins/module_utils/common/sender_requests.py import-3.10
+plugins/module_utils/common/sender_requests.py import-3.11
+plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license
\ No newline at end of file
diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt
new file mode 100644
index 000000000..833ac9cc5
--- /dev/null
+++ b/tests/sanity/ignore-2.17.txt
@@ -0,0 +1,31 @@
+plugins/action/tests/integration/ndfc_network_validate.py action-plugin-docs
+plugins/action/tests/integration/ndfc_network_validate.py import-3.10!skip
+plugins/action/tests/integration/ndfc_network_validate.py import-3.11!skip
+plugins/action/tests/integration/ndfc_pc_members_validate.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.10!skip
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.11!skip
+plugins/action/tests/plugin_utils/tools.py action-plugin-docs
+plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license
+plugins/module_utils/common/sender_requests.py import-3.10
+plugins/module_utils/common/sender_requests.py import-3.11
+plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license
\ No newline at end of file
diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt
new file mode 100644
index 000000000..0678bbd23
--- /dev/null
+++ b/tests/sanity/ignore-2.18.txt
@@ -0,0 +1,29 @@
+plugins/action/tests/integration/ndfc_network_validate.py action-plugin-docs
+plugins/action/tests/integration/ndfc_network_validate.py import-3.11!skip
+plugins/action/tests/integration/ndfc_pc_members_validate.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py action-plugin-docs
+plugins/action/tests/plugin_utils/pydantic_schemas/dcnm_network/schemas.py import-3.11!skip
+plugins/action/tests/plugin_utils/tools.py action-plugin-docs
+plugins/httpapi/dcnm.py validate-modules:missing-gplv3-license
+plugins/module_utils/common/sender_requests.py import-3.10
+plugins/module_utils/common/sender_requests.py import-3.11
+plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license
+plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license
\ No newline at end of file
diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt
deleted file mode 100644
index 7fdc2f2cb..000000000
--- a/tests/sanity/ignore-2.9.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-plugins/modules/dcnm_vrf.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_network.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upgrade.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_interface.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_inventory.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_node.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_template.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_route_peering.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_service_policy.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_resource_manager.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_links.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_vpc_pair.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_image_upload.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_fabric.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_maintenance_mode.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_bootflash.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_log.py validate-modules:missing-gplv3-license # GPLv3 license header not found in the first 20 lines of the module
-plugins/modules/dcnm_rest.py import-2.6!skip
-plugins/modules/dcnm_rest.py import-2.7!skip
-plugins/module_utils/common/sender_requests.py import-3.11 # TODO remove this if/when requests is added to the standard library
diff --git a/tests/unit/modules/dcnm/dcnm_fabric/test_fabric_query.py b/tests/unit/modules/dcnm/dcnm_fabric/test_fabric_query.py
index 733d32d91..bd4591a38 100644
--- a/tests/unit/modules/dcnm/dcnm_fabric/test_fabric_query.py
+++ b/tests/unit/modules/dcnm/dcnm_fabric/test_fabric_query.py
@@ -410,11 +410,11 @@ def responses():
assert instance.results.diff[0].get("sequence_number", None) == 1
assert instance.results.response[0].get("RETURN_CODE", None) == 200
- assert instance.results.result[0].get("found", None) is True
- assert instance.results.result[0].get("success", None) is True
+ assert instance.results.result[0].get("found", None) is False
+ assert instance.results.result[0].get("success", None) is False
- assert False in instance.results.failed
- assert True not in instance.results.failed
+ assert True in instance.results.failed
+ assert False not in instance.results.failed
assert False in instance.results.changed
assert True not in instance.results.changed
@@ -519,11 +519,11 @@ def responses():
assert instance.results.diff[0].get("sequence_number", None) == 1
assert instance.results.response[0].get("RETURN_CODE", None) == 200
- assert instance.results.result[0].get("found", None) is True
- assert instance.results.result[0].get("success", None) is True
+ assert instance.results.result[0].get("found", None) is False
+ assert instance.results.result[0].get("success", None) is False
- assert False in instance.results.failed
- assert True not in instance.results.failed
+ assert True in instance.results.failed
+ assert False not in instance.results.failed
assert False in instance.results.changed
assert True not in instance.results.changed
diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_network.json b/tests/unit/modules/dcnm/fixtures/dcnm_network.json
index 78fda1700..cb794ed29 100644
--- a/tests/unit/modules/dcnm/fixtures/dcnm_network.json
+++ b/tests/unit/modules/dcnm/fixtures/dcnm_network.json
@@ -719,6 +719,355 @@
"switchRole": "border"
}
},
+ "fabric_details_vxlan_fabric": {
+ "id": 2,
+ "fabricId": "FABRIC-2",
+ "fabricName": "fabric-stage",
+ "fabricType": "Switch_Fabric",
+ "fabricTypeFriendly": "Switch Fabric",
+ "fabricTechnology": "VXLANFabric",
+ "templateFabricType": "Data Center VXLAN EVPN",
+ "fabricTechnologyFriendly": "VXLAN EVPN",
+ "provisionMode": "DCNMTopDown",
+ "deviceType": "n9k",
+ "replicationMode": "Multicast",
+ "operStatus": "MINOR",
+ "asn": "65001",
+ "siteId": "65001",
+ "templateName": "Easy_Fabric",
+ "nvPairs": {
+ "MSO_SITE_ID": "",
+ "PHANTOM_RP_LB_ID1": "",
+ "PHANTOM_RP_LB_ID2": "",
+ "PHANTOM_RP_LB_ID3": "",
+ "IBGP_PEER_TEMPLATE": "",
+ "PHANTOM_RP_LB_ID4": "",
+ "abstract_ospf": "base_ospf",
+ "FEATURE_PTP": "false",
+ "L3_PARTITION_ID_RANGE": "50000-59000",
+ "DHCP_START_INTERNAL": "",
+ "SSPINE_COUNT": "0",
+ "ENABLE_SGT": "false",
+ "ADVERTISE_PIP_BGP": "false",
+ "FABRIC_VPC_QOS_POLICY_NAME": "spine_qos_for_fabric_vpc_peering",
+ "BFD_PIM_ENABLE": "false",
+ "ENABLE_MACSEC_PREV": "false",
+ "NXC_DEST_VRF": "",
+ "DHCP_END": "",
+ "UNDERLAY_IS_V6": "false",
+ "FABRIC_VPC_DOMAIN_ID": "",
+ "SEED_SWITCH_CORE_INTERFACES": "",
+ "ALLOW_NXC_PREV": "true",
+ "FABRIC_MTU_PREV": "9216",
+ "BFD_ISIS_ENABLE": "false",
+ "HD_TIME": "180",
+ "AUTO_UNIQUE_VRF_LITE_IP_PREFIX": "false",
+ "OSPF_AUTH_ENABLE": "false",
+ "LOOPBACK1_IPV6_RANGE": "",
+ "ROUTER_ID_RANGE": "",
+ "ENABLE_MACSEC": "false",
+ "MSO_CONNECTIVITY_DEPLOYED": "",
+ "DEAFULT_QUEUING_POLICY_OTHER": "queuing_policy_default_other",
+ "MACSEC_REPORT_TIMER": "",
+ "UNNUM_DHCP_START_INTERNAL": "",
+ "PFC_WATCH_INT_PREV": "",
+ "MPLS_ISIS_AREA_NUM": "0001",
+ "PREMSO_PARENT_FABRIC": "",
+ "PTP_DOMAIN_ID": "",
+ "UNNUM_DHCP_END_INTERNAL": "",
+ "USE_LINK_LOCAL": "true",
+ "AUTO_SYMMETRIC_VRF_LITE": "false",
+ "BGP_AS_PREV": "65001",
+ "ENABLE_PBR": "false",
+ "DCI_SUBNET_TARGET_MASK": "30",
+ "ENABLE_TRMv6": "false",
+ "VPC_PEER_LINK_PO": "500",
+ "ISIS_AUTH_ENABLE": "false",
+ "PER_VRF_LOOPBACK_AUTO_PROVISION": "false",
+ "REPLICATION_MODE": "Multicast",
+ "ENABLE_DCI_MACSEC_PREV": "false",
+ "SITE_ID_POLICY_ID": "",
+ "SGT_NAME_PREFIX": "",
+ "ANYCAST_RP_IP_RANGE": "10.254.254.0/24",
+ "VPC_ENABLE_IPv6_ND_SYNC": "true",
+ "TCAM_ALLOCATION": "true",
+ "abstract_isis_interface": "isis_interface",
+ "ENABLE_RT_INTF_STATS": "false",
+ "SERVICE_NETWORK_VLAN_RANGE": "3000-3199",
+ "MACSEC_ALGORITHM": "",
+ "ISIS_LEVEL": "level-2",
+ "SUBNET_TARGET_MASK": "30",
+ "abstract_anycast_rp": "anycast_rp",
+ "AUTO_SYMMETRIC_DEFAULT_VRF": "false",
+ "ENABLE_NETFLOW": "false",
+ "DEAFULT_QUEUING_POLICY_R_SERIES": "queuing_policy_default_r_series",
+ "PER_VRF_LOOPBACK_IP_RANGE_V6": "",
+ "BROWNFIELD_NETWORK_NAME_FORMAT": "Auto_Net_VNI$$VNI$$_VLAN$$VLAN_ID$$",
+ "temp_vpc_peer_link": "int_vpc_peer_link_po",
+ "ENABLE_FABRIC_VPC_DOMAIN_ID": "false",
+ "IBGP_PEER_TEMPLATE_LEAF": "",
+ "DCI_SUBNET_RANGE": "10.33.0.0/16",
+ "ENABLE_NXAPI": "true",
+ "VRF_LITE_AUTOCONFIG": "Manual",
+ "MGMT_GW_INTERNAL": "",
+ "GRFIELD_DEBUG_FLAG": "Enable",
+ "VRF_VLAN_RANGE": "2000-2299",
+ "ISIS_AUTH_KEYCHAIN_NAME": "",
+ "vpcTorDelayRestoreTimer": "30",
+ "OBJECT_TRACKING_NUMBER_RANGE": "100-299",
+ "SSPINE_ADD_DEL_DEBUG_FLAG": "Disable",
+ "abstract_bgp_neighbor": "evpn_bgp_rr_neighbor",
+ "OSPF_AUTH_KEY_ID": "",
+ "PIM_HELLO_AUTH_ENABLE": "false",
+ "abstract_feature_leaf": "base_feature_leaf_upg",
+ "BFD_AUTH_ENABLE": "false",
+ "INTF_STAT_LOAD_INTERVAL": "",
+ "preInterfaceConfigSpine": "",
+ "BGP_LB_ID": "0",
+ "LOOPBACK1_IP_RANGE": "10.3.0.0/22",
+ "AGG_ACC_VPC_PO_ID_RANGE": "",
+ "EXTRA_CONF_TOR": "",
+ "AAA_SERVER_CONF": "",
+ "VPC_PEER_KEEP_ALIVE_OPTION": "management",
+ "AUTO_VRFLITE_IFC_DEFAULT_VRF": "false",
+ "enableRealTimeBackup": "",
+ "DCI_MACSEC_KEY_STRING": "",
+ "ENABLE_AI_ML_QOS_POLICY": "false",
+ "V6_SUBNET_TARGET_MASK": "126",
+ "STRICT_CC_MODE": "false",
+ "BROWNFIELD_SKIP_OVERLAY_NETWORK_ATTACHMENTS": "false",
+ "VPC_PEER_LINK_VLAN": "3600",
+ "NXAPI_HTTP_PORT": "80",
+ "abstract_trunk_host": "int_trunk_host",
+ "BGP_AUTH_ENABLE": "false",
+ "MST_INSTANCE_RANGE": "",
+ "PM_ENABLE_PREV": "false",
+ "ENABLE_AGG_ACC_ID_RANGE": "false",
+ "NXC_PROXY_PORT": "8080",
+ "RP_MODE": "asm",
+ "enableScheduledBackup": "",
+ "BFD_OSPF_ENABLE": "false",
+ "abstract_ospf_interface": "ospf_interface_11_1",
+ "MACSEC_FALLBACK_ALGORITHM": "",
+ "UNNUM_DHCP_END": "",
+ "LOOPBACK0_IP_RANGE": "10.2.0.0/22",
+ "ENABLE_AAA": "false",
+ "DEPLOYMENT_FREEZE": "false",
+ "L2_HOST_INTF_MTU_PREV": "9216",
+ "SGT_RECALC_STATUS": "empty",
+ "NETFLOW_MONITOR_LIST": "",
+ "NTP_SERVER_IP_LIST": "",
+ "ENABLE_AGENT": "false",
+ "OVERLAY_MODE": "cli",
+ "MACSEC_FALLBACK_KEY_STRING": "",
+ "PER_VRF_LOOPBACK_AUTO_PROVISION_PREV": "false",
+ "FF": "Easy_Fabric",
+ "STP_ROOT_OPTION": "unmanaged",
+ "ISIS_OVERLOAD_ENABLE": "",
+ "NETFLOW_RECORD_LIST": "",
+ "FABRIC_TYPE": "Switch_Fabric",
+ "PER_VRF_LOOPBACK_AUTO_PROVISION_V6": "false",
+ "SPINE_COUNT": "1",
+ "abstract_extra_config_bootstrap": "extra_config_bootstrap_11_1",
+ "L3VNI_IPv6_MCAST_GROUP": "",
+ "MPLS_LOOPBACK_IP_RANGE": "",
+ "LINK_STATE_ROUTING_TAG_PREV": "UNDERLAY",
+ "DHCP_ENABLE": "false",
+ "preInterfaceConfigTor": "",
+ "BFD_AUTH_KEY_ID": "",
+ "ALLOW_L3VNI_NO_VLAN": "true",
+ "MSO_SITE_GROUP_NAME": "",
+ "MGMT_PREFIX_INTERNAL": "",
+ "DHCP_IPV6_ENABLE_INTERNAL": "",
+ "BGP_AUTH_KEY_TYPE": "3",
+ "SITE_ID": "65001",
+ "temp_anycast_gateway": "anycast_gateway",
+ "BRFIELD_DEBUG_FLAG": "Disable",
+ "BGP_AS": "65001",
+ "BOOTSTRAP_MULTISUBNET": "#Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix",
+ "ISIS_P2P_ENABLE": "",
+ "ENABLE_NGOAM": "true",
+ "CDP_ENABLE": "false",
+ "PTP_LB_ID": "",
+ "DHCP_IPV6_ENABLE": "",
+ "MACSEC_KEY_STRING": "",
+ "TOPDOWN_CONFIG_RM_TRACKING": "notstarted",
+ "ENABLE_L3VNI_NO_VLAN": "false",
+ "KME_SERVER_PORT": "",
+ "OSPF_AUTH_KEY": "",
+ "QKD_PROFILE_NAME": "",
+ "MVPN_VRI_ID_RANGE": "",
+ "ENABLE_FABRIC_VPC_DOMAIN_ID_PREV": "false",
+ "ENABLE_DCI_MACSEC": "false",
+ "EXTRA_CONF_LEAF": "",
+ "ENABLE_AI_ML_QOS_POLICY_FLAP": "false",
+ "vrf_extension_template": "Default_VRF_Extension_Universal",
+ "DHCP_START": "",
+ "ENABLE_TRM": "false",
+ "ENABLE_PVLAN_PREV": "false",
+ "FEATURE_PTP_INTERNAL": "false",
+ "SGT_PREPROV_RECALC_STATUS": "empty",
+ "ENABLE_NXAPI_HTTP": "false",
+ "MPLS_LB_ID": "",
+ "abstract_isis": "base_isis_level2",
+ "FABRIC_VPC_DOMAIN_ID_PREV": "",
+ "ROUTE_MAP_SEQUENCE_NUMBER_RANGE": "1-65534",
+ "NETWORK_VLAN_RANGE": "2300-2999",
+ "STATIC_UNDERLAY_IP_ALLOC": "false",
+ "MGMT_V6PREFIX_INTERNAL": "",
+ "MPLS_HANDOFF": "false",
+ "STP_BRIDGE_PRIORITY": "",
+ "scheduledTime": "",
+ "ANYCAST_LB_ID": "",
+ "MACSEC_CIPHER_SUITE": "",
+ "STP_VLAN_RANGE": "",
+ "MSO_CONTROLER_ID": "",
+ "POWER_REDUNDANCY_MODE": "ps-redundant",
+ "BFD_ENABLE": "false",
+ "abstract_extra_config_leaf": "extra_config_leaf",
+ "ANYCAST_GW_MAC": "2020.0000.00aa",
+ "abstract_dhcp": "base_dhcp",
+ "default_pvlan_sec_network": "",
+ "EXTRA_CONF_SPINE": "",
+ "NTP_SERVER_VRF": "",
+ "SPINE_SWITCH_CORE_INTERFACES": "",
+ "ENABLE_VRI_ID_REALLOC": "false",
+ "LINK_STATE_ROUTING_TAG": "UNDERLAY",
+ "ISIS_OVERLOAD_ELAPSE_TIME": "",
+ "DCI_MACSEC_ALGORITHM": "",
+ "RP_LB_ID": "254",
+ "AI_ML_QOS_POLICY": "AI_Fabric_QOS_400G",
+ "PTP_VLAN_ID": "",
+ "BOOTSTRAP_CONF": "",
+ "PER_VRF_LOOPBACK_AUTO_PROVISION_V6_PREV": "false",
+ "LINK_STATE_ROUTING": "ospf",
+ "ISIS_AUTH_KEY": "",
+ "network_extension_template": "Default_Network_Extension_Universal",
+ "DNS_SERVER_IP_LIST": "",
+ "DOMAIN_NAME_INTERNAL": "",
+ "ENABLE_EVPN": "true",
+ "abstract_multicast": "base_multicast_11_1",
+ "VPC_DELAY_RESTORE_TIME": "60",
+ "BFD_AUTH_KEY": "",
+ "IPv6_MULTICAST_GROUP_SUBNET": "",
+ "AGENT_INTF": "eth0",
+ "FABRIC_MTU": "9216",
+ "L3VNI_MCAST_GROUP": "",
+ "QKD_PROFILE_NAME_PREV": "",
+ "UNNUM_BOOTSTRAP_LB_ID": "",
+ "VPC_DOMAIN_ID_RANGE": "1-1000",
+ "HOST_INTF_ADMIN_STATE": "true",
+ "ALLOW_L3VNI_NO_VLAN_PREV": "true",
+ "BFD_IBGP_ENABLE": "false",
+ "SGT_PREPROVISION": "",
+ "DCI_MACSEC_FALLBACK_KEY_STRING": "",
+ "AUTO_UNIQUE_VRF_LITE_IP_PREFIX_PREV": "false",
+ "IPv6_ANYCAST_RP_IP_RANGE_INTERNAL": "",
+ "DCI_MACSEC_FALLBACK_ALGORITHM": "",
+ "VPC_AUTO_RECOVERY_TIME": "360",
+ "DNS_SERVER_VRF": "",
+ "preInterfaceConfigLeaf": "",
+ "UPGRADE_FROM_VERSION": "",
+ "ISIS_AREA_NUM": "0001",
+ "BANNER": "",
+ "NXC_SRC_INTF": "",
+ "SGT_ID_RANGE": "",
+ "ENABLE_QKD": "",
+ "PER_VRF_LOOPBACK_IP_RANGE": "",
+ "SGT_PREPROVISION_PREV": "",
+ "SYSLOG_SEV": "",
+ "abstract_loopback_interface": "int_fabric_loopback_11_1",
+ "SYSLOG_SERVER_VRF": "",
+ "EXTRA_CONF_INTRA_LINKS": "",
+ "SNMP_SERVER_HOST_TRAP": "true",
+ "PIM_HELLO_AUTH_KEY": "",
+ "KME_SERVER_IP": "",
+ "abstract_extra_config_spine": "extra_config_spine",
+ "temp_vpc_domain_mgmt": "vpc_domain_mgmt",
+ "V6_SUBNET_RANGE": "",
+ "SUBINTERFACE_RANGE": "2-511",
+ "BGP_AUTH_KEY": "",
+ "abstract_routed_host": "int_routed_host",
+ "ENABLE_PVLAN": "false",
+ "INBAND_DHCP_SERVERS": "",
+ "MPLS_ISIS_AREA_NUM_PREV": "",
+ "default_network": "Default_Network_Universal",
+ "PFC_WATCH_INT": "",
+ "ISIS_AUTH_KEYCHAIN_KEY_ID": "",
+ "MGMT_V6PREFIX": "",
+ "abstract_feature_spine": "base_feature_spine_upg",
+ "ENABLE_DEFAULT_QUEUING_POLICY": "false",
+ "allowVlanOnLeafTorPairing": "none",
+ "PNP_ENABLE_INTERNAL": "",
+ "ANYCAST_BGW_ADVERTISE_PIP": "false",
+ "NETFLOW_EXPORTER_LIST": "",
+ "RP_COUNT": "2",
+ "abstract_vlan_interface": "int_fabric_vlan_11_1",
+ "FABRIC_NAME": "fabric-stage",
+ "abstract_pim_interface": "pim_interface",
+ "PM_ENABLE": "false",
+ "LOOPBACK0_IPV6_RANGE": "",
+ "IGNORE_CERT": "",
+ "dcnmUser": "admin",
+ "DEFAULT_VRF_REDIS_BGP_RMAP": "",
+ "NVE_LB_ID": "1",
+ "OVERLAY_MODE_PREV": "cli",
+ "VPC_DELAY_RESTORE": "150",
+ "IPv6_ANYCAST_RP_IP_RANGE": "",
+ "UNDERLAY_IS_V6_PREV": "false",
+ "SGT_OPER_STATUS": "off",
+ "NXAPI_HTTPS_PORT": "443",
+ "ENABLE_SGT_PREV": "false",
+ "ENABLE_VPC_PEER_LINK_NATIVE_VLAN": "false",
+ "L2_HOST_INTF_MTU": "9216",
+ "abstract_route_map": "route_map",
+ "TRUSTPOINT_LABEL": "",
+ "INBAND_MGMT_PREV": "false",
+ "EXT_FABRIC_TYPE": "",
+ "abstract_vpc_domain": "base_vpc_domain_11_1",
+ "ACTIVE_MIGRATION": "false",
+ "ISIS_AREA_NUM_PREV": "",
+ "COPP_POLICY": "strict",
+ "DHCP_END_INTERNAL": "",
+ "DCI_MACSEC_CIPHER_SUITE": "",
+ "BOOTSTRAP_ENABLE": "false",
+ "ADVERTISE_PIP_ON_BORDER": "true",
+ "default_vrf": "Default_VRF_Universal",
+ "NXC_PROXY_SERVER": "",
+ "OSPF_AREA_ID": "0.0.0.0",
+ "abstract_extra_config_tor": "extra_config_tor",
+ "SYSLOG_SERVER_IP_LIST": "",
+ "ENABLE_TENANT_DHCP": "true",
+ "BOOTSTRAP_ENABLE_PREV": "false",
+ "ANYCAST_RP_IP_RANGE_INTERNAL": "10.254.254.0/24",
+ "RR_COUNT": "2",
+ "BOOTSTRAP_MULTISUBNET_INTERNAL": "",
+ "MGMT_GW": "",
+ "UNNUM_DHCP_START": "",
+ "MGMT_PREFIX": "",
+ "BFD_ENABLE_PREV": "false",
+ "abstract_bgp_rr": "evpn_bgp_rr",
+ "INBAND_MGMT": "false",
+ "abstract_bgp": "base_bgp",
+ "SLA_ID_RANGE": "10000-19999",
+ "ENABLE_NETFLOW_PREV": "false",
+ "SUBNET_RANGE": "10.4.0.0/16",
+ "DEAFULT_QUEUING_POLICY_CLOUDSCALE": "queuing_policy_default_8q_cloudscale",
+ "MULTICAST_GROUP_SUBNET": "239.1.1.0/25",
+ "FABRIC_INTERFACE_TYPE": "p2p",
+ "ALLOW_NXC": "true",
+ "FABRIC_VPC_QOS": "false",
+ "OVERWRITE_GLOBAL_NXC": "false",
+ "AAA_REMOTE_IP_ENABLED": "false",
+ "L2_SEGMENT_ID_RANGE": "30000-49000"
+ },
+ "vrfTemplate": "Default_VRF_Universal",
+ "networkTemplate": "Default_Network_Universal",
+ "vrfExtensionTemplate": "Default_VRF_Extension_Universal",
+ "networkExtensionTemplate": "Default_Network_Extension_Universal",
+ "createdOn": 1749530399770,
+ "modifiedOn": 1749531013275
+ },
"fabric_details": {
"createdOn": 1613750822779,
"deviceType": "n9k",
diff --git a/tests/unit/modules/dcnm/test_dcnm_intf.py b/tests/unit/modules/dcnm/test_dcnm_intf.py
index 1c52a9013..9e182472d 100644
--- a/tests/unit/modules/dcnm/test_dcnm_intf.py
+++ b/tests/unit/modules/dcnm/test_dcnm_intf.py
@@ -3073,6 +3073,9 @@ def test_dcnm_intf_pc_overridden_existing(self):
def test_dcnm_intf_eth_merged_existing(self):
+ # Use Version 12 For This Test Case
+ self.run_dcnm_version_supported.side_effect = [12]
+
# load the json from playbooks
self.config_data = loadPlaybookData("dcnm_intf_eth_configs")
self.payloads_data = loadPlaybookData("dcnm_intf_eth_payloads")
@@ -3110,6 +3113,9 @@ def test_dcnm_intf_eth_merged_existing(self):
def test_dcnm_intf_eth_merged_new(self):
+ # Use Version 12 For This Test Case
+ self.run_dcnm_version_supported.side_effect = [12]
+
# load the json from playbooks
self.config_data = loadPlaybookData("dcnm_intf_eth_configs")
self.payloads_data = loadPlaybookData("dcnm_intf_eth_payloads")
@@ -3653,6 +3659,9 @@ def test_dcnm_intf_subint_overridden_existing(self):
def test_dcnm_intf_lo_merged_new(self):
+ # Use Version 12 For This Test Case
+ self.run_dcnm_version_supported.side_effect = [12]
+
# load the json from playbooks
self.config_data = loadPlaybookData("dcnm_intf_lo_configs")
self.payloads_data = loadPlaybookData("dcnm_intf_lo_payloads")
diff --git a/tests/unit/modules/dcnm/test_dcnm_network.py b/tests/unit/modules/dcnm/test_dcnm_network.py
index 62d33f44f..8e592c73b 100644
--- a/tests/unit/modules/dcnm/test_dcnm_network.py
+++ b/tests/unit/modules/dcnm/test_dcnm_network.py
@@ -40,6 +40,7 @@ class TestDcnmNetworkModule(TestDcnmModule):
mock_ip_sn = test_data.get("mock_ip_sn")
net_inv_data = test_data.get("net_inv_data")
fabric_details = test_data.get("fabric_details")
+ fabric_details_vxlan_fabric = test_data.get("fabric_details_vxlan_fabric")
playbook_config = test_data.get("playbook_config")
playbook_config_incorrect_netid = test_data.get("playbook_config_incorrect_netid")
@@ -214,6 +215,7 @@ def load_fixtures(self, response=None, device=""):
elif "_merged_duplicate" in self._testMethodName:
self.init_data()
self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object]
+ self.run_dcnm_fabric_details.side_effect = [self.fabric_details_vxlan_fabric]
self.run_dcnm_send.side_effect = [
self.mock_vrf_object,
self.mock_net_object,