Skip to content

Commit

Permalink
Merge pull request #143 from kpbush30/main
Browse files Browse the repository at this point in the history
Feat: New ANTA and AVD Network Testing Labs
  • Loading branch information
mthiel117 authored Sep 26, 2024
2 parents 3f1a46b + 3494213 commit 89a4cb7
Show file tree
Hide file tree
Showing 36 changed files with 1,084 additions and 0 deletions.
73 changes: 73 additions & 0 deletions labs/NET_TESTING/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.PHONY: help
help: ## Display help message
@grep -E '^[0-9a-zA-Z_-]+\.*[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

########################################################
# Site 1
########################################################

.PHONY: ping-site-1
ping-site-1: ## Ping Nodes
ansible-playbook playbooks/ping.yml -i sites/site_1/inventory.yml -e "target_hosts=SITE1_FABRIC"

.PHONY: build-site-1
build-site-1: ## Build Configs
ansible-playbook playbooks/build.yml -i sites/site_1/inventory.yml -e "target_hosts=SITE1_FABRIC"

.PHONY: deploy-site-1
deploy-site-1: ## Deploy Configs via eAPI
ansible-playbook playbooks/deploy.yml -i sites/site_1/inventory.yml -e "target_hosts=SITE1_FABRIC"

.PHONY: validate-site-1
validate-site-1: ## Validate network state
ansible-playbook playbooks/validate.yml -i sites/site_1/inventory.yml -e "target_hosts=SITE1_FABRIC"

.PHONY: cvp-site-1
cvp-site-1: ## Deploy Configs via eAPI
ansible-playbook playbooks/cvp1.yml -i sites/site_1/inventory.yml

########################################################
# Site 2
########################################################

.PHONY: ping-site-2
ping-site-2: ## Ping Nodes
ansible-playbook playbooks/ping.yml -i sites/site_2/inventory.yml -e "target_hosts=SITE2_FABRIC"

.PHONY: build-site-2
build-site-2: ## Build Configs
ansible-playbook playbooks/build.yml -i sites/site_2/inventory.yml -e "target_hosts=SITE2_FABRIC"

.PHONY: deploy-site-2
deploy-site-2: ## Deploy Configs via eAPI
ansible-playbook playbooks/deploy.yml -i sites/site_2/inventory.yml -e "target_hosts=SITE2_FABRIC"

.PHONY: validate-site-2
validate-site-2: ## Validate network state
ansible-playbook playbooks/validate.yml -i sites/site_2/inventory.yml -e "target_hosts=SITE2_FABRIC"

.PHONY: cvp-site-2
cvp-site-2: ## Deploy Configs via eAPI
ansible-playbook playbooks/cvp2.yml -i sites/site_2/inventory.yml

########################################################
# WAN & Hosts - Lab Prep
########################################################

.PHONY: preplab
preplab: ## Deploy Configs via eAPI
ansible-playbook playbooks/preplab.yml -i extra_configs/inventory.yml -e "target_hosts=LAB"

########################################################
# ANTA COMMANDS
########################################################


.PHONY: anta-inv-site-1
anta-inv-site-1: ## Generate ANTA Inventory
anta get from-ansible --ansible-inventory sites/site_1/inventory.yml -g SITE1_FABRIC -o sites/site_1/anta_inventory.yml

.PHONY: anta-inv-site-2
anta-inv-site-2: ## Generate ANTA Inventory
anta get from-ansible --ansible-inventory sites/site_2/inventory.yml -g SITE2_FABRIC -o sites/site_2/anta_inventory.yml

55 changes: 55 additions & 0 deletions labs/NET_TESTING/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[defaults]

# Disable host key checking by the underlying tools Ansible uses to connect to target hosts
host_key_checking = False

# Location of inventory file containing target hosts
# inventory = ./inventory/inventory.yml

# Only gather Ansible facts if explicity directed to in a given play
gathering = explicit

# Disable the creation of .retry files if a playbook fails
retry_files_enabled = False

# Path(s) to search for installed Ansible Galaxy Collections
collections_paths = ~/.ansible/collections

# Enable additional Jinja2 Extensions (https://jinja.palletsprojects.com/en/3.1.x/extensions/)
jinja2_extensions = jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n

# Enable the YAML callback plugin, providing much easier to read terminal output. (https://docs.ansible.com/ansible/latest/plugins/callback.html#callback-plugins)
stdout_callback = yaml

# Permit the use of callback plugins when running ad-hoc commands
bin_ansible_callbacks = True

# List of enabled callbacks. Many callbacks shipped with Ansible are not enabled by default
callbacks_enabled = profile_roles, profile_tasks, timer

# Maximum number of forks that Ansible will use to execute tasks on target hosts
forks = 15

# Disable cowsay (Why?)
nocows = True

# Disable deprecation warnings, more readable output
deprecation_warnings = False

#enable global vars
vars_plugins_enabled = arista.avd.global_vars, host_group_vars

#define global vars path
[vars_global_vars]
paths = ../../global_vars

[paramiko_connection]
# Automatically add the keys of target hosts to known hosts
host_key_auto_add = True

[persistent_connection]
# Set the amount of time, in seconds, to wait for response from remote device before timing out persistent connection.
command_timeout = 60

# Set the amount of time, in seconds, that a persistent connection will remain idle before it is destroyed.
connect_timeout = 60
11 changes: 11 additions & 0 deletions labs/NET_TESTING/extra_configs/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
LAB:
hosts:
s1-core1:
s1-core2:
s1-host1:
s1-host2:
s2-core1:
s2-core2:
s2-host1:
s2-host2:
57 changes: 57 additions & 0 deletions labs/NET_TESTING/extra_configs/s1-core1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
! Command: show running-config
! device: s1-core1 (cEOSLab, EOS-4.29.0.2F-29226602.42902F (engineering build))
!
no aaa root
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname s1-core1
dns domain atd.lab
!
spanning-tree mode mstp
!
management api http-commands
no shutdown
!
vlan 1000
name dci
!
radius-server host 192.168.0.1 key 7 0207165218120E
!
aaa group server radius atds
server 192.168.0.1
!
aaa authentication login default group atds local
aaa authorization exec default group atds local
aaa authorization commands all default local
!
interface Ethernet1
shutdown
!
interface Ethernet2
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet3
shutdown
!
interface Ethernet4
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet6
shutdown
!
interface Management0
ip address 192.168.0.102/24
!
ip routing
!
ntp server 192.168.0.1 iburst source Management0
!
ip radius source-interface Management0
!
57 changes: 57 additions & 0 deletions labs/NET_TESTING/extra_configs/s1-core2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
! Command: show running-config
! device: s1-core2 (cEOSLab, EOS-4.29.0.2F-29226602.42902F (engineering build))
!
no aaa root
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname s1-core2
dns domain atd.lab
!
spanning-tree mode mstp
!
management api http-commands
no shutdown
!
vlan 1000
name dci
!
radius-server host 192.168.0.1 key 7 0207165218120E
!
aaa group server radius atds
server 192.168.0.1
!
aaa authentication login default group atds local
aaa authorization exec default group atds local
aaa authorization commands all default local
!
interface Ethernet1
shutdown
!
interface Ethernet2
shutdown
!
interface Ethernet3
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet4
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet6
shutdown
!
interface Management0
ip address 192.168.0.103/24
!
ip routing
!
ntp server 192.168.0.1 iburst source Management0
!
ip radius source-interface Management0
!
16 changes: 16 additions & 0 deletions labs/NET_TESTING/extra_configs/s1-host1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!-----------------------------------------
! s1-host1 - Lab config
!-----------------------------------------
!
interface Port-Channel1
no switchport
ip address 10.10.10.100/24
!
interface Ethernet1
channel-group 1 mode active
!
interface Ethernet2
channel-group 1 mode active
!
ip route 10.0.0.0/8 10.10.10.1
!
16 changes: 16 additions & 0 deletions labs/NET_TESTING/extra_configs/s1-host2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!-----------------------------------------
! s1-host2 - Lab config
!-----------------------------------------
!
interface Port-Channel1
no switchport
ip address 10.20.20.100/24
!
interface Ethernet1
channel-group 1 mode active
!
interface Ethernet2
channel-group 1 mode active
!
ip route 10.0.0.0/8 10.20.20.1
!
57 changes: 57 additions & 0 deletions labs/NET_TESTING/extra_configs/s2-core1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
! Command: show running-config
! device: s2-core1 (cEOSLab, EOS-4.29.0.2F-29226602.42902F (engineering build))
!
no aaa root
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname s2-core1
dns domain atd.lab
!
spanning-tree mode mstp
!
management api http-commands
no shutdown
!
vlan 1000
name dci
!
radius-server host 192.168.0.1 key 7 0207165218120E
!
aaa group server radius atds
server 192.168.0.1
!
aaa authentication login default group atds local
aaa authorization exec default group atds local
aaa authorization commands all default local
!
interface Ethernet1
shutdown
!
interface Ethernet2
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet3
shutdown
!
interface Ethernet4
switchport
switchport mode access
switchport access vlan 1000
!
interface Ethernet6
shutdown
!
interface Management0
ip address 192.168.0.202/24
!
ip routing
!
ntp server 192.168.0.1 iburst source Management0
!
ip radius source-interface Management0
!
Loading

0 comments on commit 89a4cb7

Please sign in to comment.