Skip to content

Commit 516f4cf

Browse files
contivcontiv
contiv
authored and
contiv
committed
Merge branch 'master' of https://github.com/hefayed/vxlan-evpn
2 parents 402558c + bbbfb37 commit 516f4cf

File tree

101 files changed

+2538
-510
lines changed

Some content is hidden

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

101 files changed

+2538
-510
lines changed

.remote-sync.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"logger": {
3+
"title": "Remote Sync"
4+
},
5+
"uploadOnSave": true,
6+
"useAtomicWrites": false,
7+
"deleteLocal": true,
8+
"port": "22",
9+
"target": "vxlan-evpn",
10+
"ignore": [
11+
".remote-sync.json",
12+
".git/**"
13+
],
14+
"username": "contiv",
15+
"password": "C1sc0123!",
16+
"watch": [],
17+
"transport": "scp",
18+
"hostname": "10.2.6.149"
19+
}

BGW.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
#Task 1: Build the Underlay for all Leafs
3+
- hosts: BGW
4+
connection: local
5+
roles:
6+
- BGW

ISN.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
#Task 1: Build the Underlay for all Leafs
3+
- hosts: ISN
4+
connection: local
5+
roles:
6+
- ISN

access_ports.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
#Task 1: Build the Underlay for all spines
3+
- hosts: leafs
4+
connection: network_cli
5+
vars:
6+
nxos_provider:
7+
username: "{{ user }}"
8+
password: "{{ pwd }}"
9+
transport: cli
10+
host: "{{ hostvars[inventory_hostname].ansible_host }}"
11+
12+
tasks:
13+
14+
- name: ENSURE port is configured as access port
15+
nxos_l2_interface:
16+
provider: "{{ nxos_provider}}"
17+
name: "{{ item.name }}"
18+
mode: access
19+
access_vlan: "{{ item.access_vlan }}"
20+
with_items:
21+
- { name: "Ethernet1/3", access_vlan: 103 }

csv_to_yml.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
import sys
3+
import csv
4+
import yaml
5+
import yamlloader
6+
7+
l2vni_data = []
8+
my_csv_file = '/home/contiv/vxlan-evpn/l2vni_vars.csv'
9+
my_vars_file = '/home/contiv/vxlan-evpn/roles/l2vni_overlay/vars/main.yml'
10+
11+
with open(my_csv_file, mode='r') as csvfile:
12+
reader = csv.DictReader(csvfile)
13+
for row in reader:
14+
l2vni_data.append(row)
15+
16+
with open(my_vars_file) as data:
17+
data_loaded = yaml.load(data, Loader=yamlloader.ordereddict.CLoader)
18+
yaml.dump(data_loaded, sys.stdout)
19+
20+
with open(my_vars_file, "w") as file:
21+
file.write('---\n')
22+
yaml.dump({'nxos_provider': data_loaded['nxos_provider']}, file, Dumper=yamlloader.ordereddict.CDumper)
23+
file.write('\n')
24+
file.write('# vars for creation of l2vni and vlan interface configuration\n')
25+
26+
27+
with open(my_vars_file, "a") as file:
28+
file.write('\n')
29+
yaml.dump({'l2vni': l2vni_data}, file, Dumper=yamlloader.ordereddict.CDumper)

facts_module.retry

-1
This file was deleted.

facts_module.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020

2121
- name: switch ports qty
2222
set_fact:
23-
ports: "{{ module[0].ports }}"
24-
- debug: var=ports
23+
ports: "{{ vlan_list }}"
24+
- debug: var=vlan_list

hosts

+20-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,25 @@ pwd=C1sc0123!
1515
gather_fact=no
1616

1717
[leafs]
18-
leaf103 ansible_host=10.2.6.147 lo0_ipaddr=100.64.0.103 lo1_ipaddr=100.64.1.103 hostname=leaf103
19-
leaf101 ansible_host=10.2.6.146 lo0_ipaddr=100.64.0.101 lo1_ipaddr=100.64.1.101 hostname=leaf101
20-
leaf102 ansible_host=10.2.6.145 lo0_ipaddr=100.64.0.102 lo1_ipaddr=100.64.1.102 hostname=leaf102
18+
Leaf101 ansible_host=10.2.28.101 lo0_ipaddr=100.64.0.101 lo1_ipaddr=100.64.1.101 hostname=Leaf101
19+
Leaf102 ansible_host=10.2.28.102 lo0_ipaddr=100.64.0.102 lo1_ipaddr=100.64.1.102 hostname=Leaf102
20+
Leaf105 ansible_host=10.2.28.105 lo0_ipaddr=100.64.0.105 lo1_ipaddr=100.64.1.105 hostname=Leaf105
21+
Leaf106 ansible_host=10.2.28.106 lo0_ipaddr=100.64.0.106 lo1_ipaddr=100.64.1.106 hostname=Leaf106
22+
2123

2224
[spines]
23-
spine201 ansible_host=10.2.6.144 lo0_ipaddr=100.64.0.201 lo1_ipaddr=100.64.1.201 hostname=spine201
24-
spine202 ansible_host=10.2.6.143 lo0_ipaddr=100.64.0.202 lo1_ipaddr=100.64.1.202 hostname=spine202
25+
Spine201 ansible_host=10.2.28.201 lo0_ipaddr=100.64.0.201 lo1_ipaddr=100.64.1.201 hostname=Spine201
26+
Spine202 ansible_host=10.2.28.202 lo0_ipaddr=100.64.0.202 lo1_ipaddr=100.64.1.202 hostname=Spine202
27+
Spine203 ansible_host=10.2.28.203 lo0_ipaddr=100.64.0.203 lo1_ipaddr=100.64.1.203 hostname=Spine203
28+
Spine204 ansible_host=10.2.28.204 lo0_ipaddr=100.64.0.204 lo1_ipaddr=100.64.1.204 hostname=Spine204
29+
30+
31+
[ISN]
32+
ISN-1 ansible_host=10.2.28.111 lo0_ipaddr=100.64.0.111 lo1_ipaddr=100.64.1.111 ISN1_To_ISN2=100.64.254.101 hostname=ISN-1
33+
ISN-2 ansible_host=10.2.28.122 lo0_ipaddr=100.64.0.122 lo1_ipaddr=100.64.1.122 ISN2_To_ISN1=100.64.254.102 hostname=ISN-2
34+
35+
[BGW]
36+
BGW-1 ansible_host=10.2.28.103 lo0_ipaddr=100.64.0.103 lo1_ipaddr=100.64.1.103 lo2_ipaddr=100.64.2.103 lo100_ipaddr=100.64.100.103 site_id=1 BGW_To_ISN=100.64.254.13 ISN_To_BGW=100.64.254.14 hostname=BGW-1
37+
BGW-2 ansible_host=10.2.28.104 lo0_ipaddr=100.64.0.104 lo1_ipaddr=100.64.1.104 lo2_ipaddr=100.64.2.104 lo100_ipaddr=100.64.100.104 site_id=1 BGW_To_ISN=100.64.254.21 ISN_To_BGW=100.64.254.22 h2stname=BGW-2
38+
BGW-3 ansible_host=10.2.28.107 lo0_ipaddr=100.64.0.107 lo1_ipaddr=100.64.1.107 lo2_ipaddr=100.64.2.107 lo100_ipaddr=100.64.100.107 site_id=2 BGW_To_ISN=100.64.254.33 ISN_To_BGW=100.64.254.34 hostname=BGW-3
39+
BGW-4 ansible_host=10.2.28.108 lo0_ipaddr=100.64.0.108 lo1_ipaddr=100.64.1.108 lo2_ipaddr=100.64.2.108 lo100_ipaddr=100.64.100.104 site_id=2 BGW_To_ISN=100.64.254.41 ISN_To_BGW=100.64.254.42 hostname=BGW-4

interface_description.retry

-1
This file was deleted.

interface_description.yml

+31-58
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,31 @@
1-
---
2-
#Task 1: Configure uplinks to spines
3-
- hosts: leafs
4-
any_errors_fatal: yes
5-
vars_prompt:
6-
name: "confirmation"
7-
prompt: "Did you execute the leaf_underlay playbook? Answer 'Yes' or 'No' "
8-
default: "No"
9-
private: no
10-
11-
vars:
12-
nxos_provider:
13-
username: "{{ user }}"
14-
password: "{{ pwd }}"
15-
transport: cli
16-
host: "{{ hostvars[inventory_hostname].ansible_host }}"
17-
18-
tasks:
19-
20-
- name: Check Confirmation
21-
fail: msg="Playbook run confirmation failed"
22-
when: confirmation != "Yes"
23-
24-
- name: GATHER FACTS FOR Leaf "{{ inventory_hostname }}"
25-
nxos_facts:
26-
provider: "{{ nxos_provider }}"
27-
28-
- debug: var=ansible_net_neighbors
29-
30-
- name: create interface keys
31-
set_fact:
32-
interfaces: "{{ ansible_net_neighbors.keys() }}"
33-
- debug: var=interfaces
34-
35-
36-
- name: Configure uplink interfaces to spines
37-
nxos_config:
38-
provider: "{{ nxos_provider }}"
39-
lines:
40-
- no switchport
41-
- mtu 9216
42-
- medium p2p
43-
- ip unnumbered loopback0
44-
- ip ospf network point-to-point
45-
- ip router ospf UNDERLAY area 0.0.0.0
46-
- no shutdown
47-
parents: interface {{ item }}
48-
match: none
49-
with_items: "{{ interfaces }}"
50-
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine")
51-
52-
- name: Ensure an interface has the proper description
53-
nxos_interface:
54-
provider: "{{ nxos_provider }}"
55-
name: "{{ item }}"
56-
description: 'Connected-to-{{ ansible_net_neighbors[item][0]["port"] }}-{{ ansible_net_neighbors[item][0]["sysname"] }} '
57-
with_items: "{{ interfaces}}"
58-
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine")
1+
---
2+
#Task 1: Configure uplinks to spines
3+
- hosts: all
4+
vars:
5+
nxos_provider:
6+
username: "{{ user }}"
7+
password: "{{ pwd }}"
8+
transport: cli
9+
host: "{{ hostvars[inventory_hostname].ansible_host }}"
10+
11+
tasks:
12+
13+
- name: GATHER FACTS FOR Leaf "{{ inventory_hostname }}"
14+
nxos_facts:
15+
provider: "{{ nxos_provider }}"
16+
17+
- debug: var=ansible_net_neighbors
18+
19+
- name: create interface keys
20+
set_fact:
21+
interfaces: "{{ ansible_net_neighbors.keys() }}"
22+
- debug: var=interfaces
23+
24+
25+
- name: Ensure an interface has the proper description
26+
nxos_interface:
27+
provider: "{{ nxos_provider }}"
28+
name: "{{ item }}"
29+
description: 'Connected-to-{{ ansible_net_neighbors[item][0]["port"] }}-{{ ansible_net_neighbors[item][0]["sysname"] }} '
30+
with_items: "{{ interfaces}}"
31+
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine") or ansible_net_neighbors[item][0]["sysname"] is search("Leaf")

l2vni_overlay.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
#Task Creation of L2VNI on leafs
3+
- hosts: leafs
4+
connection: local
5+
roles:
6+
- l2vni_overlay

l2vni_vars.csv

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vlan_id,name,ip_address,l2vni,vrf
2+
103,L2BD-103,192.168.103.254/24,44103, EVPN-L3-VNI-VLAN-1000

l3vni_overlay.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
#Task Creation of L2VNI on leafs
3+
- hosts: leafs
4+
connection: local
5+
roles:
6+
- l3vni_overlay

leaf_underlay.retry

-1
This file was deleted.

leaf_underlay.yml

+1-46
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,4 @@
33
- hosts: leafs
44
connection: local
55
roles:
6-
- leaf_underlay
7-
8-
vars:
9-
nxos_provider:
10-
username: "{{ user }}"
11-
password: "{{ pwd }}"
12-
transport: cli
13-
host: "{{ hostvars[inventory_hostname].ansible_host }}"
14-
15-
tasks:
16-
17-
- name: GATHER FACTS FOR Leaf "{{ inventory_hostname }}"
18-
nxos_facts:
19-
provider: "{{ nxos_provider }}"
20-
21-
- debug: var=ansible_net_neighbors
22-
23-
- name: CREATE INTERFACE KEYS BASED ON CDP INFORMATION
24-
set_fact:
25-
interfaces: "{{ ansible_net_neighbors.keys() }}"
26-
- debug: var=interfaces
27-
28-
29-
- name: CONFIGURE UPLINK INTERFACES TO SPINES
30-
nxos_config:
31-
provider: "{{ nxos_provider }}"
32-
lines:
33-
- no switchport
34-
- mtu 9216
35-
- medium p2p
36-
- ip unnumbered loopback0
37-
- ip ospf network point-to-point
38-
- ip router ospf UNDERLAY area 0.0.0.0
39-
- no shutdown
40-
parents: interface {{ item }}
41-
match: none
42-
with_items: "{{ interfaces }}"
43-
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine")
44-
45-
- name: CONFIGURE PROPER DISCRIPTION FOR UPLINKS TO LEAFS BASED ON CDP INFORMATION
46-
nxos_interface:
47-
provider: "{{ nxos_provider }}"
48-
name: "{{ item }}"
49-
description: 'Connected-to-{{ ansible_net_neighbors[item][0]["port"] }}-{{ ansible_net_neighbors[item][0]["sysname"] }} '
50-
with_items: "{{ interfaces}}"
51-
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine")
6+
- leaf_underlay

leaf_uplink_config.yml

-58
This file was deleted.

0 commit comments

Comments
 (0)