Skip to content

Commit 5f954aa

Browse files
authored
Merge pull request #144 from netascode/release_0.2.0
Release 0.2.0
2 parents 8460c73 + 04ba471 commit 5f954aa

File tree

95 files changed

+2436
-944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2436
-944
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,5 @@ roles/validate/files/schema.yaml
142142
!roles/validate/files/rules/enhanced_rules/.gitkeep
143143
!roles/validate/files/rules/required_rules/*
144144
roles/validate/defaults/*
145+
*service_model_extended*.json
146+
*service_model_golden*.json

CHANGELOG.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,34 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
88

99
.. contents:: ``Release Versions``
1010

11+
`0.2.0`_
12+
=====================
13+
14+
**Release Date:** ``2024-06-28``
15+
16+
Added
17+
-----
18+
19+
* Support for the following device inventory roles. Only applies to adding devices to a fabric with these role types.
20+
- border_spine
21+
- border_gateway
22+
- border_gateway_spine
23+
- super_spine
24+
- border_super_spine
25+
- border_gateway_super_spine
26+
* Added SysLog Server Support - Fabric Creation Stage
27+
* Added DHCP Support and Secondary IP Address Support - Network Creation Stage
28+
* Support for Ansible Tags
29+
- Tags to limit execution and target specific roles in the collection
30+
- Tags to limit execution and target specific stages inside a role
31+
32+
Fixed
33+
-----
34+
- https://github.com/netascode/ansible-dc-vxlan/issues/111
35+
- https://github.com/netascode/ansible-dc-vxlan/issues/112
36+
- https://github.com/netascode/ansible-dc-vxlan/issues/127
37+
- https://github.com/netascode/ansible-dc-vxlan/issues/135
38+
1139
`0.1.0`_
1240
=====================
1341

@@ -28,4 +56,5 @@ The following roles have been added to the collection:
2856

2957
This version of the collection includes support for an IPv4 Underlay only. Support for IPv6 Underlay will be available in the next release.
3058

59+
.. _0.2.0: https://github.com/netascode/ansible-dc-vxlan/compare/0.1.0...0.2.0
3160
.. _0.1.0: https://github.com/netascode/ansible-dc-vxlan/compare/0.1.0...0.1.0

README.md

Lines changed: 88 additions & 65 deletions
Large diffs are not rendered by default.

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
namespace: cisco
33
name: nac_dc_vxlan
4-
version: 0.1.0
4+
version: 0.2.0
55
readme: README.md
66
authors:
77
- Devendra Gupta <devegupt>

plugins/action/common/get_credentials.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,23 @@
3434
class ActionModule(ActionBase):
3535

3636
def run(self, tmp=None, task_vars=None):
37-
# self._supports_async = True
3837
results = super(ActionModule, self).run(tmp, task_vars)
39-
results['failed'] = False
38+
results['retrieve_failed'] = False
4039

41-
inv_list = self._task.args['inv_list']
42-
username = task_vars.get('ndfc_device_username')
43-
password = task_vars.get('ndfc_device_password')
40+
key_username = 'ndfc_switch_username'
41+
key_password = 'ndfc_switch_password'
42+
43+
ndfc_host_name = task_vars['inventory_hostname']
44+
username = task_vars['hostvars'][ndfc_host_name].get(key_username, '')
45+
password = task_vars['hostvars'][ndfc_host_name].get(key_password, '')
4446

4547
# Fail if username and password are not set
46-
if username is None or password is None:
47-
results['failed'] = True
48-
results['msg'] = "ndfc_device_username and ndfc_device_username must be set in group_vars or as environment variables!"
49-
# TODO: Add support for environemnt variables
48+
if username == '' or password == '':
49+
results['retrieve_failed'] = True
50+
results['msg'] = "{0} and {1} must be set in group_vars or as environment variables!".format(key_username, key_password)
5051
return results
5152

53+
inv_list = self._task.args['inv_list']
5254
# Create a new list and deep copy each dict item to avoid modifying the original and dict items
5355
updated_inv_list = []
5456
for device in inv_list:

plugins/action/common/nac_dc_validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def run(self, tmp=None, task_vars=None):
4747
mdata = self._task.args.get('mdata')
4848

4949
# Generate a warning if the Schema and Rules are not provided
50-
if schema and not os.path.exists(schema):
50+
if 'schema' in locals() and (schema == "" or not os.path.exists(schema)):
5151
display.warning("The schema ({0}) does not appear to exist! ".format(schema))
52-
if not os.path.exists(rules):
52+
if 'rules' in locals() and (rules == "" or not os.path.exists(rules)):
5353
display.warning("The rules directory ({0}) does not appear to exist! ".format(rules))
5454
# The rules directory is considered empty if it is an empty dir or only contains the .gitkeep file
5555
if os.path.exists(rules) and (not os.listdir(rules) or (len(os.listdir(rules)) == 1 and '.gitkeep' in os.listdir(rules))):

plugins/action/common/prepare_plugins/prep_103_topology_switches.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ def __init__(self, **kwargs):
2727

2828
def prepare(self):
2929
model_data = self.kwargs['results']['model_extended']
30-
30+
# Loop over all the roles in vxlan.topology.switches.role
3131
model_data['vxlan']['topology']['spine'] = {}
3232
model_data['vxlan']['topology']['leaf'] = {}
3333
model_data['vxlan']['topology']['border'] = {}
34+
model_data['vxlan']['topology']['border_spine'] = {}
35+
model_data['vxlan']['topology']['border_gateway'] = {}
36+
model_data['vxlan']['topology']['border_gateway_spine'] = {}
37+
model_data['vxlan']['topology']['super_spine'] = {}
38+
model_data['vxlan']['topology']['border_super_spine'] = {}
39+
model_data['vxlan']['topology']['border_gateway_super_spine'] = {}
40+
model_data['vxlan']['topology']['tor'] = {}
3441
sm_switches = model_data['vxlan']['topology']['switches']
3542
for switch in sm_switches:
3643
# Build list of switch IP's based on role keyed by switch name

plugins/action/dtc/verify_tags.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
# this software and associated documentation files (the "Software"), to deal in
5+
# the Software without restriction, including without limitation the rights to
6+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
# the Software, and to permit persons to whom the Software is furnished to do so,
8+
# subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
#
20+
# SPDX-License-Identifier: MIT
21+
22+
from __future__ import absolute_import, division, print_function
23+
24+
25+
__metaclass__ = type
26+
27+
from ansible.utils.display import Display
28+
from ansible.plugins.action import ActionBase
29+
30+
display = Display()
31+
32+
33+
class ActionModule(ActionBase):
34+
35+
def run(self, tmp=None, task_vars=None):
36+
# self._supports_async = True
37+
results = super(ActionModule, self).run(tmp, task_vars)
38+
results['failed'] = False
39+
40+
all_tags = self._task.args['all_tags']
41+
play_tags = self._task.args['play_tags']
42+
43+
if 'all' in play_tags:
44+
return results
45+
46+
for tag in play_tags:
47+
if tag not in all_tags:
48+
results['failed'] = True
49+
results['msg'] = "Tag '{0}' not found in list of supported tags".format(tag)
50+
results['supported_tags'] = all_tags
51+
52+
return results

roles/common_global/tasks/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
# this software and associated documentation files (the "Software"), to deal in
5+
# the Software without restriction, including without limitation the rights to
6+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
# the Software, and to permit persons to whom the Software is furnished to do so,
8+
# subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
#
20+
# SPDX-License-Identifier: MIT
21+
---
22+
23+
- name: Verify User Tags
24+
cisco.nac_dc_vxlan.dtc.verify_tags:
25+
all_tags: "{{ nac_tags.all }}"
26+
play_tags: "{{ ansible_run_tags }}"
27+
tags: "{{ ansible_run_tags }}"

roles/common_global/vars/main.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
# this software and associated documentation files (the "Software"), to deal in
5+
# the Software without restriction, including without limitation the rights to
6+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
# the Software, and to permit persons to whom the Software is furnished to do so,
8+
# subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
#
20+
# SPDX-License-Identifier: MIT
21+
22+
---
23+
24+
nac_tags:
25+
# All Create and Remove Tags
26+
all:
27+
- cr_manage_fabric
28+
- cr_manage_switches
29+
- cr_manage_vpc_peers
30+
- cr_manage_interfaces
31+
- cr_manage_vrfs_networks
32+
# -------------------------
33+
- rr_manage_interfaces
34+
- rr_manage_networks
35+
- rr_manage_vrfs
36+
- rr_manage_vpc_peers
37+
- rr_manage_links
38+
- rr_manage_switches
39+
# -------------------------
40+
- role_validate
41+
- role_create
42+
- role_deploy
43+
- role_remove
44+
# All Create Tags
45+
create:
46+
- cr_manage_fabric
47+
- cr_manage_switches
48+
- cr_manage_vpc_peers
49+
- cr_manage_interfaces
50+
- cr_manage_vrfs_networks
51+
create_fabric:
52+
- cr_manage_fabric
53+
create_switches:
54+
- cr_manage_switches
55+
create_vpc_peers:
56+
- cr_manage_vpc_peers
57+
create_interfaces:
58+
- cr_manage_interfaces
59+
create_vrfs_networks:
60+
- cr_manage_vrfs_networks
61+
# All Remove Tags
62+
remove:
63+
- rr_manage_interfaces
64+
- rr_manage_networks
65+
- rr_manage_vrfs
66+
- rr_manage_vpc_peers
67+
- rr_manage_links
68+
- rr_manage_switches
69+
remove_interfaces:
70+
- rr_manage_interfaces
71+
remove_networks:
72+
- rr_manage_networks
73+
remove_vrfs:
74+
- rr_manage_vrfs
75+
remove_vpc_peers:
76+
- rr_manage_vpc_peers
77+
remove_links:
78+
- rr_manage_links
79+
remove_switches:
80+
- rr_manage_switches
81+
82+

0 commit comments

Comments
 (0)