-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dcnm_vrf fix issues #351, #356, #357 #354
base: develop
Are you sure you want to change the base?
Changes from 41 commits
40d93d6
0b17715
6e32f42
244929b
5f67187
9508840
098d17f
be41882
13e076e
6a6de04
12f9e53
bbbf285
da54fa1
c8c578b
14da7d7
1e028a2
ee179b5
0c980b3
5b8c1c3
b401ab8
978b0d2
75a24d5
f747767
dbfe057
cc804e0
78f9e0d
e861626
3a1a514
fed3a70
930dbec
d83d4fc
832a3e8
cf27b33
72bfc10
5749eda
acb3890
0bc26be
b78e996
ca7bea8
8fb0907
509c335
b61fd0b
a565a46
001931e
ecd1849
a0f44c3
41a8fd7
c30cfd4
d754e3e
75334e0
e92c1e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright (c) 2024 Cisco and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
__copyright__ = "Copyright (c) 2024 Cisco and/or its affiliates." | ||
__author__ = "Allen Robel" | ||
|
||
import json | ||
from os import environ | ||
|
||
""" | ||
# Summary | ||
|
||
Dynamic inventory for DCNM Collection integration tests. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the idea to use this dynamic_inventory file (eventually) for all of the integration tests? I suspect we will need to use a common naming convention across all of our tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind the question about how to run it... I see the instructions in the diffs below. |
||
Inventory is built from environment variables. | ||
|
||
# Usage | ||
|
||
See README.md in the top-level of this repository and define the environment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you adding more information to our README.md? I don't see any updates to it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. This is a holdover from when this was a separate repository. I'll modify to remove this reference. EDIT: Added detailed usage to the Usage section of dynamic_inventory.py |
||
variables described there appropriately for your environment. | ||
""" | ||
nd_role = environ.get("ND_ROLE", "dcnm_vrf") | ||
nd_testcase = environ.get("ND_TESTCASE", "query") | ||
|
||
fabric_1 = environ.get("ND_FABRIC_1") | ||
nd_ip4 = environ.get("ND_IP4") | ||
nd_password = environ.get("ND_PASSWORD") | ||
nd_username = environ.get("ND_USERNAME", "admin") | ||
nxos_password = environ.get("NXOS_PASSWORD") | ||
nxos_username = environ.get("NXOS_USERNAME", "admin") | ||
|
||
# Base set of switches | ||
bgw_1 = environ.get("ND_BGW_1_IP4", "10.1.1.211") | ||
bgw_2 = environ.get("ND_BGW_2_IP4", "10.1.1.212") | ||
leaf_1 = environ.get("ND_LEAF_1_IP4", "10.1.1.106") | ||
leaf_2 = environ.get("ND_LEAF_2_IP4", "10.1.1.107") | ||
leaf_3 = environ.get("ND_LEAF_3_IP4", "10.1.1.108") | ||
leaf_4 = environ.get("ND_LEAF_4_IP4", "10.1.1.109") | ||
spine_1 = environ.get("ND_SPINE_1_IP4", "10.1.1.112") | ||
spine_2 = environ.get("ND_SPINE_2_IP4", "10.1.1.113") | ||
|
||
# Base set of interfaces | ||
interface_1 = environ.get("ND_INTERFACE_1", "Ethernet1/1") | ||
interface_2 = environ.get("ND_INTERFACE_2", "Ethernet1/2") | ||
interface_3 = environ.get("ND_INTERFACE_3", "Ethernet1/3") | ||
|
||
if nd_role == "dcnm_vrf": | ||
# VXLAN/EVPN Fabric Name | ||
# fabric_1 | ||
# - all tests | ||
# switch_1 | ||
# - all tests | ||
# - vrf capable | ||
switch_1 = spine_1 | ||
# switch_2 | ||
# - all tests | ||
# - vrf-lite capable | ||
switch_2 = spine_2 | ||
# switch_3 | ||
# - merged | ||
# - NOT vrf-lite capable | ||
switch_3 = leaf_3 | ||
# interface_1 | ||
# - no tests | ||
# interface_2 | ||
# - all tests | ||
# - switch_2 VRF LITE extensions | ||
# interface_3 | ||
# - merged | ||
# - switch_3 non-vrf-lite capable switch | ||
# - overridden | ||
# - Removed from test due to unrelated IP POOL errors. | ||
# - It appears that fabric would need to have SUBNET | ||
# resource added? | ||
# | ||
elif nd_role == "vrf_lite": | ||
# VXLAN/EVPN Fabric Name | ||
# Uses fabric_1 | ||
# switch_1: vrf-lite capable | ||
switch_1 = spine_1 | ||
# switch_2: vrf-lite capable | ||
switch_2 = spine_2 | ||
# switch_3: vrf-lite capable | ||
switch_3 = bgw_1 | ||
else: | ||
switch_1 = leaf_1 | ||
switch_2 = spine_1 | ||
switch_3 = bgw_1 | ||
|
||
# output is printed to STDOUT, where ansible-playbook -i reads it. | ||
# If you change any vars above, be sure to add them below. | ||
# We'll clean this up as the integration test vars are standardized. | ||
|
||
output = { | ||
"_meta": {"hostvars": {}}, | ||
"all": { | ||
"children": ["ungrouped", "dcnm", "ndfc", "nxos"], | ||
"vars": { | ||
"ansible_httpapi_use_ssl": "true", | ||
"ansible_httpapi_validate_certs": "false", | ||
"ansible_password": nd_password, | ||
"ansible_python_interpreter": "python", | ||
"ansible_user": nd_username, | ||
"fabric_1": fabric_1, | ||
"bgw1": bgw_1, | ||
"bgw2": bgw_2, | ||
"leaf1": leaf_1, | ||
"leaf2": leaf_2, | ||
"leaf_1": leaf_1, | ||
"leaf_2": leaf_2, | ||
"leaf3": leaf_3, | ||
"leaf4": leaf_4, | ||
"nxos_username": nxos_username, | ||
"nxos_password": nxos_password, | ||
"switch_password": nxos_password, | ||
"switch_username": nxos_username, | ||
"spine1": spine_1, | ||
"spine2": spine_2, | ||
"switch1": switch_1, | ||
"switch2": switch_2, | ||
"switch_1": switch_1, | ||
"switch_2": switch_2, | ||
"switch_3": switch_3, | ||
"interface_1": interface_1, | ||
"interface_2": interface_2, | ||
"interface_3": interface_3, | ||
"testcase": nd_testcase, | ||
}, | ||
}, | ||
"dcnm": { | ||
"hosts": [nd_ip4], | ||
"vars": { | ||
"ansible_connection": "ansible.netcommon.httpapi", | ||
"ansible_network_os": "cisco.dcnm.dcnm", | ||
}, | ||
}, | ||
"ndfc": { | ||
"hosts": [nd_ip4], | ||
"vars": { | ||
"ansible_connection": "ansible.netcommon.httpapi", | ||
"ansible_network_os": "cisco.dcnm.dcnm", | ||
}, | ||
}, | ||
"nxos": { | ||
"children": [ | ||
"bgw1", | ||
"bgw2", | ||
"leaf_1", | ||
"leaf_2", | ||
"leaf1", | ||
"leaf2", | ||
"leaf3", | ||
"leaf4", | ||
"spine1", | ||
"spine2", | ||
"switch1", | ||
"switch2", | ||
], | ||
"vars": { | ||
"ansible_become": "true", | ||
"ansible_become_method": "enable", | ||
"ansible_connection": "ansible.netcommon.httpapi", | ||
"ansible_network_os": "cisco.nxos.nxos", | ||
}, | ||
}, | ||
"bgw1": {"hosts": [bgw_1]}, | ||
"bgw2": {"hosts": [bgw_2]}, | ||
"leaf_1": {"hosts": [leaf_1]}, | ||
"leaf_2": {"hosts": [leaf_2]}, | ||
"leaf1": {"hosts": [leaf_1]}, | ||
"leaf2": {"hosts": [leaf_2]}, | ||
"leaf3": {"hosts": [leaf_3]}, | ||
"leaf4": {"hosts": [leaf_4]}, | ||
"spine1": {"hosts": [spine_1]}, | ||
"spine2": {"hosts": [spine_2]}, | ||
"switch1": {"hosts": [switch_1]}, | ||
"switch2": {"hosts": [switch_2]}, | ||
} | ||
|
||
print(json.dumps(output)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
all: | ||
vars: | ||
ansible_user: "admin" | ||
ansible_password: "password-ndfc" | ||
switch_password: "password-switch" | ||
ansible_python_interpreter: python | ||
ansible_httpapi_validate_certs: False | ||
ansible_httpapi_use_ssl: True | ||
children: | ||
ndfc: | ||
vars: | ||
ansible_connection: ansible.netcommon.httpapi | ||
ansible_network_os: cisco.dcnm.dcnm | ||
hosts: | ||
192.168.1.1: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
# This playbook can be used to execute integration tests for | ||
# the roles located in: | ||
# | ||
# REPO_ROOT/tests/integration/targets/dcnm_vrf/tests/dcnm/*.yaml | ||
# | ||
# Either: | ||
# 1. Modify the following: | ||
# - The vars section below with details for your testing setup. | ||
# - dcnm_hosts.yaml in this directory | ||
# | ||
# 2. Run the tests | ||
# ansible-playbook dcnm_tests.yaml -i dcnm_hosts.yaml | ||
# | ||
# OR: | ||
# 1. Modify ../dynamic_inventory.py to align with your setup | ||
# This must contain the vars mentioned below and controller | ||
# info from dcnm_hosts.yaml (modified for your setup) | ||
# 2. Run the tests | ||
# ansible-playbook dcnm_tests.yaml -i ../files/dynamic_inventory.py | ||
# | ||
# NOTES: | ||
- hosts: dcnm | ||
gather_facts: no | ||
connection: ansible.netcommon.httpapi | ||
# Uncomment and modify if not using dynamic_inventory.py | ||
# vars: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the full set of vars that are required by the vrf integration tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! I've updated it to include all the vars. |
||
# test_fabric: f1 | ||
# switch_1: 10.1.1.2 | ||
# switch_2: 10.1.1.3 | ||
# switch_3: 10.1.1.4 | ||
# interface_1: Ethernet1/2 | ||
## Uncomment ONE of the following testcases | ||
# testcase: deleted | ||
# testcase: merged | ||
# testcase: query | ||
|
||
roles: | ||
- dcnm_vrf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!