Skip to content

Commit

Permalink
Update SR model and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
knewell committed Jan 10, 2019
1 parent e9b9679 commit 39f4ec5
Show file tree
Hide file tree
Showing 17 changed files with 1,793 additions and 71 deletions.
16 changes: 10 additions & 6 deletions core-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
tags: [ template ]
tasks:
- include_vars: "./nodes.yml"
- name: Gather facts (eos)
eos_facts:
when: ansible_network_os == 'eos'
- name: Gather facts (junos)
junos_facts:
when: ansible_network_os == 'junos'
# - name: Gather facts (eos)
# eos_facts:
# when:
# - ansible_network_os == 'eos'
# - dryrun is not defined
# - name: Gather facts (junos)
# junos_facts:
# when:
# - ansible_network_os == 'junos'
# - dryrun is not defined
- name: create the directory for the configuration
file: path=core_config state=directory
run_once: true
Expand Down
123 changes: 123 additions & 0 deletions core/core-model-sr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---

common:
bgp_asn: 65000

nodes:
- name: sr-vmx1
mgmt: 10.39.0.57
rid: 192.168.0.1
sid: 10
iso: 49.0001.0010.0100.1001.00

- name: sr-vmx2
mgmt: 10.39.0.58
rid: 192.168.0.2
sid: 20
iso: 49.0001.0010.0100.1002.00

- name: sr-vmx3
mgmt: 10.39.0.59
rid: 192.168.0.3
sid: 30
iso: 49.0001.0010.0100.1003.00

- name: sr-vmx4
mgmt: 10.39.0.60
rid: 192.168.0.4
sid: 40
iso: 49.0001.0010.0100.1004.00

- name: sr-vmx5
mgmt: 10.39.0.55
rid: 192.168.0.5
sid: 50
iso: 49.0001.0010.0100.1005.00

- name: sr-vmx6
mgmt: 10.39.0.56
rid: 192.168.0.6
sid: 60
iso: 49.0001.0010.0100.1006.00

- name: sr-vmx7
mgmt: 10.39.0.57
rid: 192.168.0.7
sid: 70
iso: 49.0001.0010.0100.1007.00

- name: sr-vmx8
mgmt: 10.39.0.58
rid: 192.168.0.8
sid: 80
iso: 49.0001.0010.0100.1008.00

- name: sr-vmx9
mgmt: 10.39.0.59
rid: 192.168.0.9
sid: 90
iso: 49.0001.0010.0100.1009.00

links:
- {left: sr-vmx1, left_port: ge-0/0/0, left_ip: 10.0.0.0.0,
right: sr-vmx2, right_port: ge-0/0/0, right_ip: 10.0.0.0.1,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx1, left_port: ge-0/0/1, left_ip: 10.0.0.2,
right: sr-vmx4, right_port: ge-0/0/1, right_ip: 10.0.0.3,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx1, left_port: ge-0/0/2, left_ip: 10.0.0.22,
right: sr-vmx3, right_port: ge-0/0/2, right_ip: 10.0.0.23,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx2, left_port: ge-0/0/1, left_ip: 10.0.0.4,
right: sr-vmx5, right_port: ge-0/0/1, right_ip: 10.0.0.5,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx3, left_port: ge-0/0/4, left_ip: 10.0.0.24,
right: sr-vmx6, right_port: ge-0/0/4, right_ip: 10.0.0.25,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx4, left_port: ge-0/0/0, left_ip: 10.0.0.6,
right: sr-vmx5, right_port: ge-0/0/0, right_ip: 10.0.0.7,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx4, left_port: ge-0/0/2, left_ip: 10.0.0.8,
right: sr-vmx6, right_port: ge-0/0/2, right_ip: 10.0.0.9,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx4, left_port: ge-0/0/3, left_ip: 10.0.0.10,
right: sr-vmx6, right_port: ge-0/0/3, right_ip: 10.0.0.11,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx5, left_port: ge-0/0/2, left_ip: 10.0.0.12,
right: sr-vmx7, right_port: ge-0/0/2, right_ip: 10.0.0.13,
mask: 31, cost: 500, mpls: True, iso: True }

- {left: sr-vmx6, left_port: ge-0/0/0, left_ip: 10.0.0.14,
right: sr-vmx7, right_port: ge-0/0/0, right_ip: 10.0.0.15,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx6, left_port: ge-0/0/1, left_ip: 10.0.0.16,
right: sr-vmx8, right_port: ge-0/0/1, right_ip: 10.0.0.17,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx7, left_port: ge-0/0/1, left_ip: 10.0.0.18,
right: sr-vmx9, right_port: ge-0/0/1, right_ip: 10.0.0.19,
mask: 31, cost: 1000, mpls: True, iso: True }

- {left: sr-vmx8, left_port: ge-0/0/0, left_ip: 10.0.0.20,
right: sr-vmx9, right_port: ge-0/0/0, right_ip: 10.0.0.21,
mask: 31, cost: 1000, mpls: True, iso: True }


bgp:
rr: [192.168.0.4, 192.168.0.7]
clients: [192.168.0.1, 192.168.0.2, 192.168.0.8, 192.168.0.9]
af:
- inet
- inet-vpn

#isis:
# network: p2p
8 changes: 4 additions & 4 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,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 %}
{% macro core_link(name,ip,mask,cost,vlan,remote,mpls,iso) %}
{{name}}.{{vlan}}: { ip: {{ip}}, remote: {{remote}}{% if mask %}, mask: {{mask}}{% endif %}{% if cost %}, cost: {{cost}}{% endif %}{% if vlan %}, vlan: {{vlan}}{% endif %}{% if mpls %}, mpls: {{mpls}}{% endif %}{% if iso %}, iso: {{iso}}{% endif %}}{% endmacro %}

---

Expand All @@ -24,9 +24,9 @@ nodes:
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,link.mpls|default(''),link.iso|default('')) }}
{{ core_link(link.left_port,link.left_ip,link.mask|default(''),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,link.mpls|default(''),link.iso|default('')) }}
{{ core_link(link.right_port,link.right_ip,link.mask|default(''),link.cost|default(''),link.vlan|default('0'),link.left,link.mpls|default(''),link.iso|default('')) }}
{% endif %}
{% endfor %}
{% if bgp is defined %}
Expand Down
172 changes: 172 additions & 0 deletions core_config/sr-vmx1-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@

version VERSION
system {
host-name sr-vmx1;
no-redirects;
root-authentication {
encrypted-password "$5$mcE0Hfiq$JfBeC3QSAvnd1tjqlOhlYXDgVrwvd6S4G3oVj5wiMO7"; ## SECRET-DATA
}
login {
user salt {
uid 2001;
class super-user;
authentication {
encrypted-password "$5$yp7ziGTI$F5F.6AUlR8hDK2JIsw5WRrTLex/yTCWH3iSR1Auk293"; ## SECRET-DATA
ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxY2hLZ+ju5wdK4GYNhKGgnS8EWLBoEVpo+xQkhDzkTiBx3HGAnmARcVV0B9MqrHZl1omdnirJeygWzVbVY4yPUqGgEcUsTTq9fvK4AjTwtaoB5txAosaOnZq0zewmuZ6EMi6E3RND6A3FGXkf1Il2jg3I8k/dGqdyFI80B7sWy90fk+EqsGMPxVc+l5vAtY2jm84ellxxzBsulxfCSKPH86hZ1GqZ8A1ZBWITu15NjQw0aGssSYGMMTa1T8eFyY4hHWqqdwgOlODg9mZwwP1JdJH79SRoTOjqGGixuAFDGAgH3fNX6u8wTmYya/z7WXH6B2XwiiaZYdcyEbMLPZt"; ## SECRET-DATA
}
}
}
services {
ssh;
netconf {
ssh;
traceoptions {
file nc.txt size 1m world-readable;
flag all;
}
}
}
syslog {
user * {
any emergency;
}
file messages {
any any;
authorization info;
}
file interactive-commands {
interactive-commands any;
}
}
}

interfaces {
ge-0/0/0 {
description "sr-vmx2"
unit 0 {
family inet {
address 10.0.0.0.0/31
}
family mpls;
family iso;
}
}

ge-0/0/1 {
description "sr-vmx4"
unit 0 {
family inet {
address 10.0.0.2/31
}
family mpls;
family iso;
}
}

ge-0/0/2 {
description "sr-vmx3"
unit 0 {
family inet {
address 10.0.0.22/31
}
family mpls;
family iso;
}
}

fxp0 {
description "OOB to MGMT Network";
unit 0 {
family inet {
address 10.39.0.57/20;
}
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.1/32;
}
family iso {
address 49.0001.0010.0100.1001.00;
}

}
}
}
routing-options {
router-id 192.168.0.1;
autonomous-system 65000;
static {
route 0.0.0.0/0 {
next-hop 10.39.0.1;
no-readvertise;
preference 255;
}
}
}
protocols {
bgp {
group Core {
type internal;
export __Ansible_Core_export;
local-address 192.168.0.1;
family inet {
unicast;
}
family inet-vpn {
unicast;
}
neighbor 192.168.0.4;
neighbor 192.168.0.7;
}
}
isis {
no-ipv6-routing;
source-packet-routing {
node-segment {
ipv4-index 10;
}
}
level 1 disable;
interface ge-0/0/0.0 {
point-to-point;
metric 1000;
}
interface ge-0/0/1.0 {
point-to-point;
metric 1000;
}
interface ge-0/0/2.0 {
point-to-point;
metric 1000;
}
interface lo0.0 {
passive;
}
}
mpls {
interface ge-0/0/0.0;
interface ge-0/0/1.0;
interface ge-0/0/2.0;
}
lldp {
interface ge-0/0/0;
interface ge-0/0/1;
interface ge-0/0/2;
}
}
policy-options {
policy-statement __Ansible_Core_export {
term ebgp {
from {
protocol bgp;
external;
}
then {
next-hop self;
accept;
}
}
}
}
Loading

0 comments on commit 39f4ec5

Please sign in to comment.