Skip to content

Commit

Permalink
Lab includes vMX and vEOS and supports segment routing
Browse files Browse the repository at this point in the history
  • Loading branch information
knewell committed Aug 15, 2018
1 parent 048dbfc commit c3075dd
Show file tree
Hide file tree
Showing 27 changed files with 946 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ pip-selfcheck.json
.ropeproject
*.retry
*.swp

.retry
29 changes: 29 additions & 0 deletions backup/ansible-veos5_config.2018-08-14@17:27:35
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
! Command: show running-config
! device: ansible-veos5 (vEOS, EOS-4.20.1F)
!
! boot system flash:/vEOS-lab.swi
!
transceiver qsfp default-mode 4x10G
!
hostname ansible-veos5
!
spanning-tree mode mstp
!
no aaa root
!
username admin privilege 15 role network-admin secret sha512 $6$QooVHYszFBY655A/$WnVBzmLe2LsWQ2kF01jtWff4L9xlxIfCpB0/rS7nWB70dFEoIbIYPRf1LHGg/jSGcR6VdecKvweJxry2vttCR1
username salt privilege 15 role network-admin secret sha512 $6$gNfDGxuNqAufb7SS$XuBAZwDyHEX6Bt6zgDBA0zkJLhOm.5aJ8cwy2wd21DVr9yWr.gqwYBx7NUntbvSjTlKDQBg.XsMIIYRwqU10u1
username salt sshkey ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxY2hLZ+ju5wdK4GYNhKGgnS8EWLBoEVpo+xQkhDzkTiBx3HGAnmARcVV0B9MqrHZl1omdnirJeygWzVbVY4yPUqGgEcUsTTq9fvK4AjTwtaoB5txAosaOnZq0zewmuZ6EMi6E3RND6A3FGXkf1Il2jg3I8k/dGqdyFI80B7sWy90fk+EqsGMPxVc+l5vAtY2jm84ellxxzBsulxfCSKPH86hZ1GqZ8A1ZBWITu15NjQw0aGssSYGMMTa1T8eFyY4hHWqqdwgOlODg9mZwwP1JdJH79SRoTOjqGGixuAFDGAgH3fNX6u8wTmYya/z7WXH6B2XwiiaZYdcyEbMLPZt knewell@ubuntu
!
interface Ethernet1
!
interface Ethernet2
!
interface Management1
ip address 10.39.0.55/20
!
ip route 0.0.0.0/0 10.39.0.1
!
ip routing
!
end
29 changes: 29 additions & 0 deletions backup/ansible-veos6_config.2018-08-14@17:27:35
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
! Command: show running-config
! device: ansible-veos6 (vEOS, EOS-4.20.1F)
!
! boot system flash:/vEOS-lab.swi
!
transceiver qsfp default-mode 4x10G
!
hostname ansible-veos6
!
spanning-tree mode mstp
!
no aaa root
!
username admin privilege 15 role network-admin secret sha512 $6$/7bApigLDgtwdZn4$8zr7AxxO2Lj2CXoV.fFWzmjrsusPfN453qwG/y76NCT7TNokv7XAZhJtgH6m82hwO14Y3W/zqyN4pHKitK1kO1
username salt privilege 15 role network-admin secret sha512 $6$dUVSZEiQz8f5/ZTP$SMN1MWMaOLpyyUuBNjex/rVJL5WLw0SHi1MfOpdDAgPz1Fu7MMrHmJZ8.jU4kUjqC8xY.9VSp47m9MdqZl2Ck/
username salt sshkey ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxY2hLZ+ju5wdK4GYNhKGgnS8EWLBoEVpo+xQkhDzkTiBx3HGAnmARcVV0B9MqrHZl1omdnirJeygWzVbVY4yPUqGgEcUsTTq9fvK4AjTwtaoB5txAosaOnZq0zewmuZ6EMi6E3RND6A3FGXkf1Il2jg3I8k/dGqdyFI80B7sWy90fk+EqsGMPxVc+l5vAtY2jm84ellxxzBsulxfCSKPH86hZ1GqZ8A1ZBWITu15NjQw0aGssSYGMMTa1T8eFyY4hHWqqdwgOlODg9mZwwP1JdJH79SRoTOjqGGixuAFDGAgH3fNX6u8wTmYya/z7WXH6B2XwiiaZYdcyEbMLPZt knewell@ubuntu
!
interface Ethernet1
!
interface Ethernet2
!
interface Management1
ip address 10.39.0.56/20
!
ip route 0.0.0.0/0 10.39.0.1
!
ip routing
!
end
50 changes: 31 additions & 19 deletions core-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
tags: [ template ]
tasks:
- include_vars: "./nodes.yml"
- name: Get facts for napalm_os_version
napalm_get_facts:
hostname: "{{ ansible_host }}"
username: "{{ ansible_user }}"
dev_os: "{{ ansible_network_os }}"
optional_args:
key_file: "{{ ansible_ssh_private_key_file }}"
- name: Gather facts (eos)
eos_facts:
when: ansible_network_os == 'eos'
- name: Gather facts (junos)
junos_facts:
when: ansible_network_os == 'junos'
- name: create the directory for the configuration
file: path=core_config state=directory
run_once: true
Expand All @@ -44,15 +43,28 @@
- include_vars: "./nodes.yml"
- file: path=diff state=directory
run_once: true
- name: load the configuration to the devices
napalm_install_config:
hostname: "{{ ansible_host }}"
username: "{{ ansible_user }}"
dev_os: "{{ ansible_network_os }}"
optional_args:
key_file: "{{ ansible_ssh_private_key_file }}"
config_file: core_config/{{inventory_hostname}}-config.txt
commit_changes: "{{commit}}"
replace_config: "{{replace_config|default('0')}}"
diff_file: diff/{{inventory_hostname}}-diff.txt
when: "inventory_hostname in nodes.keys()"

- name: Load config (junos)
junos_config:
src: core_config/{{inventory_hostname}}-config.txt
update: replace
comment: Ansible config update
when: ansible_network_os == 'junos'

- name: Load config (eos)
eos_config:
src: core_config/{{inventory_hostname}}-config.txt
when: ansible_network_os == 'eos'

# - name: load the configuration to the devices
# napalm_install_config:
# hostname: "{{ ansible_host }}"
# username: "{{ ansible_user }}"
# dev_os: "{{ ansible_network_os }}"
# optional_args:
# key_file: "{{ ansible_ssh_private_key_file }}"
# config_file: core_config/{{inventory_hostname}}-config.txt
# commit_changes: "{{commit}}"
# replace_config: "{{replace_config|default('0')}}"
# diff_file: diff/{{inventory_hostname}}-diff.txt
# when: "inventory_hostname in nodes.keys()"
71 changes: 62 additions & 9 deletions core/core-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,93 @@ nodes:
- name: ansible-vmx1
mgmt: 10.39.0.41
rid: 10.39.8.41
sid: 10
iso: 49.0001.0010.0100.1001.00

- name: ansible-vmx2
mgmt: 10.39.0.42
rid: 10.39.8.42

sid: 20
iso: 49.0001.0010.0100.1002.00

- name: ansible-vmx3
mgmt: 10.39.0.43
rid: 10.39.8.43
sid: 30
iso: 49.0001.0010.0100.1003.00

- name: ansible-vmx4
mgmt: 10.39.0.44
rid: 10.39.8.44
sid: 40
iso: 49.0001.0010.0100.1004.00

- name: ansible-veos5
mgmt: 10.39.0.55
rid: 10.39.8.55
sid: 50
iso: 49.0001.0010.0100.1005.00
lu: 163.253.39.165

- name: ansible-veos6
mgmt: 10.39.0.56
rid: 10.39.8.56
sid: 60
iso: 49.0001.0010.0100.1006.00
lu: 163.253.39.165

links:
- {left: ansible-vmx1, left_port: ge-0/0/0, left_ip: 172.10.12.1,
right: ansible-vmx2, right_port: ge-0/0/0, right_ip: 172.10.12.2, cost: 10 }
right: ansible-vmx2, right_port: ge-0/0/0, right_ip: 172.10.12.2,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx1, left_port: ge-0/0/1, left_ip: 172.10.13.1,
right: ansible-vmx3, right_port: ge-0/0/0, right_ip: 172.10.13.3, cost: 10 }
right: ansible-vmx3, right_port: ge-0/0/0, right_ip: 172.10.13.3,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx1, left_port: ge-0/0/2, left_ip: 172.10.14.1,
right: ansible-vmx4, right_port: ge-0/0/0, right_ip: 172.10.14.4,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx1, left_port: ge-0/0/3, left_ip: 172.10.15.1,
right: ansible-veos5, right_port: Ethernet1, right_ip: 172.10.15.5,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx2, left_port: ge-0/0/1, left_ip: 172.10.23.2,
right: ansible-vmx3, right_port: ge-0/0/1, right_ip: 172.10.23.3, cost: 10 }
right: ansible-vmx3, right_port: ge-0/0/1, right_ip: 172.10.23.3,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx1, left_port: ge-0/0/2, left_ip: 172.10.14.1,
right: ansible-vmx4, right_port: ge-0/0/0, right_ip: 172.10.14.4, cost: 10 }
- {left: ansible-vmx2, left_port: ge-0/0/2, left_ip: 172.10.24.2,
right: ansible-vmx4, right_port: ge-0/0/1, right_ip: 172.10.24.4,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx2, left_port: ge-0/0/3, left_ip: 172.10.25.2,
right: ansible-veos5, right_port: Ethernet2, right_ip: 172.10.25.5,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx3, left_port: ge-0/0/2, left_ip: 172.10.34.3,
right: ansible-vmx4, right_port: ge-0/0/2, right_ip: 172.10.34.4,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx3, left_port: ge-0/0/3, left_ip: 172.10.36.3,
right: ansible-veos6, right_port: Ethernet1, right_ip: 172.10.36.6,
cost: 10, mpls: True, iso: True }

- {left: ansible-vmx4, left_port: ge-0/0/3, left_ip: 172.10.46.4,
right: ansible-veos6, right_port: Ethernet2, right_ip: 172.10.46.6,
cost: 10, mpls: True, iso: True }

bgp:
rr: [10.39.8.41]
clients: [10.39.8.42, 10.39.8.43, 10.39.8.44]
af:
- inet
- inet-vpn
- inet-lu

ospf:
area: 0
network: p2p
#ospf:
# area: 0
# network: p2p

isis:
network: p2p
18 changes: 13 additions & 5 deletions core/core-to-nodes.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# Nodes in the network
#
{% macro core_link(name,ip,cost,vlan,remote) %}
{{name}}.{{vlan}}: { ip: {{ip}}, remote: {{remote}} {% if cost %}, cost: {{cost}}{% endif %} {% if vlan %}, vlan: {{vlan}}{% endif %}}{% endmacro %}
{% macro core_link(name,ip,cost,vlan,remote,mpls,iso) %}
{{name}}.{{vlan}}: { ip: {{ip}}, remote: {{remote}} {% if cost %}, cost: {{cost}}{% endif %} {% if vlan %}, vlan: {{vlan}}{% endif %} {% if mpls %}, mpls: {{mpls}}{% endif %} {% if iso %}, iso: {{iso}}{% endif %}}{% endmacro %}

---

Expand All @@ -15,12 +15,14 @@ nodes:
{{ node.name }}:
mgmt: {{ node.mgmt }}
rid: {{ node.rid }}
sid: {{ node.sid }}
iso: {{ node.iso }}
links:
{% for link in links %}
{% if link.left == node.name %}
{{ core_link(link.left_port,link.left_ip,link.cost|default(''),link.vlan|default('0'),link.right) }}
{{ core_link(link.left_port,link.left_ip,link.cost|default(''),link.vlan|default('0'),link.right,link.mpls|default(''),link.iso|default('')) }}
{% elif link.right == node.name %}
{{ core_link(link.right_port,link.right_ip, link.cost|default(''),link.vlan|default('0'),link.left) }}
{{ core_link(link.right_port,link.right_ip, link.cost|default(''),link.vlan|default('0'),link.left,link.mpls|default(''),link.iso|default('')) }}
{% endif %}
{% endfor %}
{% if bgp is defined %}
Expand All @@ -38,6 +40,9 @@ nodes:
- {{ peer }}
{% endfor %}
{% endif %}
{% if node.lu is defined %}
- {{ node.lu }}
{% endif %}
af:
{% for af in bgp.af %}
- {{ af }}
Expand All @@ -48,5 +53,8 @@ nodes:
area: {{ospf.area}}
network: {{ospf.network}}
{% endif %}
{% if isis is defined %}
isis:
network: {{isis.network}}
{% endif %}
{% endfor %}

84 changes: 84 additions & 0 deletions core_config/ansible-veos5-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
!
no schedule tech-support
!
transceiver qsfp default-mode 4x10G
!
hostname ansible-veos5
!
spanning-tree mode mstp
!
no aaa root
!
username admin privilege 15 role network-admin secret sha512 $6$QooVHYszFBY655A/$WnVBzmLe2LsWQ2kF01jtWff4L9xlxIfCpB0/rS7nWB70dFEoIbIYPRf1LHGg/jSGcR6VdecKvweJxry2vttCR1
username salt privilege 15 role network-admin secret sha512 $6$gNfDGxuNqAufb7SS$XuBAZwDyHEX6Bt6zgDBA0zkJLhOm.5aJ8cwy2wd21DVr9yWr.gqwYBx7NUntbvSjTlKDQBg.XsMIIYRwqU10u1
username salt sshkey ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxY2hLZ+ju5wdK4GYNhKGgnS8EWLBoEVpo+xQkhDzkTiBx3HGAnmARcVV0B9MqrHZl1omdnirJeygWzVbVY4yPUqGgEcUsTTq9fvK4AjTwtaoB5txAosaOnZq0zewmuZ6EMi6E3RND6A3FGXkf1Il2jg3I8k/dGqdyFI80B7sWy90fk+EqsGMPxVc+l5vAtY2jm84ellxxzBsulxfCSKPH86hZ1GqZ8A1ZBWITu15NjQw0aGssSYGMMTa1T8eFyY4hHWqqdwgOlODg9mZwwP1JdJH79SRoTOjqGGixuAFDGAgH3fNX6u8wTmYya/z7WXH6B2XwiiaZYdcyEbMLPZt knewell@ubuntu
!
interface Ethernet1
no switchport
ip address 172.10.15.5/24
isis enable sr_instance
isis network point-to-point
!
!
interface Ethernet2
no switchport
ip address 172.10.25.5/24
isis enable sr_instance
isis network point-to-point
!
!
!
interface Loopback0
ip address 10.39.8.55/32
isis enable sr_instance
node-segment ipv4 index 50
!
interface Management1
ip address 10.39.0.55/22
!
ip route 0.0.0.0/0 10.39.0.1
!
ip routing
!
ipv6 unicast-routing
!
!
mpls ip
!
mpls label range isis-sr 800000 4096
!
router bgp 65000
router-id 10.39.8.55
!
neighbor 10.39.8.41 remote-as 65000
neighbor 10.39.8.41 update-source Management1
!
address-family ipv4 labeled-unicast
neighbor 10.39.8.41 activate
!
neighbor 163.253.39.165 remote-as 65000
neighbor 163.253.39.165 update-source Management1
!
address-family ipv4 labeled-unicast
neighbor 163.253.39.165 activate
!
!
!
!
!
router isis sr_instance
net 49.0001.0010.0100.1005.00
is-type level-2
log-adjacency-changes
!
address-family ipv4 unicast
!
segment-routing mpls
router-id 10.39.8.55
no shutdown
!
!
management api http-commands
protocol http
no shutdown
!
Loading

0 comments on commit c3075dd

Please sign in to comment.