From 6106301587e555b5cff96f4d9b4ce79cd41100aa Mon Sep 17 00:00:00 2001 From: "Johann Kellerman kellerza@gmail.com" Date: Mon, 26 Apr 2021 15:24:35 +0200 Subject: [PATCH] multiinstance --- templates/config/base-vr-sros.tmpl | 149 +++++++++++++++++++++++++++++ templates/vr-sros/base-link.tmpl | 8 +- templates/vr-sros/base-node.tmpl | 19 +++- 3 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 templates/config/base-vr-sros.tmpl diff --git a/templates/config/base-vr-sros.tmpl b/templates/config/base-vr-sros.tmpl new file mode 100644 index 000000000..0e536801b --- /dev/null +++ b/templates/config/base-vr-sros.tmpl @@ -0,0 +1,149 @@ +{{ expect .systemip "ip" }} +{{ optional .isis_iid "0-31" }} +{{ optional .sid_idx "0-999" }} +{{ optional .sid_start "19000-30000" }} +{{ optional .sid_end "19000-30000" }} +{{ range .links }} + {{ expect .port "^\\d+/\\d/" }} + {{ expect .name "string" }} + {{ expect .ip "ip" }} + {{ optional .vlan "0-4096" }} + {{ optional .isis_iid "0-31" }} + {{ optional .sid_idx "0-999" }} + {{ optional .metric "1-10000" }} +{{ end }} + +/configure system login-control idle-timeout 1440 + +/configure router interface "system" + ipv4 primary address {{ ip .systemip }} + ipv4 primary prefix-length {{ ipmask .systemip }} + admin-state enable + +/configure router + autonomous-system {{ default 64500 .as_number }} + mpls-labels sr-labels start {{ default 19000 .sid_start }} end {{ default 30000 .sid_end }} + +{{ if .isis_iid }} +/configure router isis {{ .isis_iid }} + area-address 49.0000.0000.0000.{{ .isis_iid | printf "%02s" }} + level-capability 2 + level 2 wide-metrics-only + #database-export igp-identifier {{ .isis_iid }} bgp-ls-identifier value {{ default 0 .isis_iid }} + traffic-engineering + advertise-router-capability area + admin-state enable + interface "system" admin-state enable + {{- if .sid_idx }} + interface "system" ipv4-node-sid index {{ .sid_idx }}{{ .isis_iid | printf "%02s" }} + segment-routing prefix-sid-range global + segment-routing admin-state enable + {{- end }} +{{ end }} + +/configure router rsvp + admin-state enable + interface system admin-state enable + +/configure router mpls + cspf-on-loose-hop + interface system admin-state enable + admin-state enable + pce-report rsvp-te true + pce-report sr-te true + +{{ range .links }} + +{{- if contains "/c" .port }} +/configure port {{ slice 0 -2 .port }} admin-state enable +/configure port {{ .port | slice 0 -2 }} connector breakout c1-10g +{{- end }} + +/configure port {{ .port }} admin-state enable + +/configure router interface {{ .name }} + ipv4 primary address {{ ip .ip }} + ipv4 primary prefix-length {{ ipmask .ip }} + port {{ .port }}:{{ default 10 .vlan }} + +{{- if .isis_iid }} +/configure router isis {{ default 0 .isis_iid }} + area-address 49.0000.0000.0000.{{ .isis_iid | printf "%02s" }} + level-capability 2 + level 2 wide-metrics-only + traffic-engineering + advertise-router-capability area + admin-state enable + interface "system" admin-state enable + {{- if .sid_idx }} + interface "system" ipv4-node-sid index {{ .sid_idx }}{{ default 0 .isis_iid | printf "%02s" }} + segment-routing prefix-sid-range global + segment-routing admin-state enable + {{- end }} + interface {{ .name }} admin-state enable + interface {{ .name }} interface-type point-to-point + interface {{ .name }} level 2 metric {{ default 10 .metric }} +{{- end }} + +/configure router rsvp + interface {{ .name }} admin-state enable + +/configure router mpls + interface {{ .name }} admin-state enable + +{{ end }} + + + +/configure apply-groups ["baseport"] +/configure router bgp apply-groups ["basebgp"] + +/configure groups { + group "baseport" { + port "<.*\/[0-9]+>" { + # wanted to add this, but you really need the /1 context to exist + # admin-state enable + ethernet { + mode hybrid + encap-type dot1q + lldp { + dest-mac nearest-bridge { + notification true + receive true + transmit true + tx-tlvs { + #port-desc true + sys-name true + #sys-desc true + sys-cap true + } + tx-mgmt-address system { + admin-state enable + } + } + } + } + } +# port "<.*c[0-9]+>" { +# connector { +# breakout c1-10g +# } +# } + } +} +/configure groups { + group "basebgp" { + router "Base" { + bgp { + group "<.*>" { + admin-state enable + min-route-advertisement 5 + type internal + } + neighbor "<.*>" { + admin-state enable + } + } + } + } +} diff --git a/templates/vr-sros/base-link.tmpl b/templates/vr-sros/base-link.tmpl index 4ab5d7d74..60a702db8 100644 --- a/templates/vr-sros/base-link.tmpl +++ b/templates/vr-sros/base-link.tmpl @@ -3,6 +3,7 @@ {{ expect .ip "ip" }} {{ optional .vlan "0-4096" }} {{ optional .isis_iid "0-32" }} +{{ optional .sid_idx "0-999" }} {{ optional .metric "1-10000" }} {{- if contains "/c" .port }} @@ -22,22 +23,19 @@ area-address 49.0000.0000.0000.0{{ default 0 .isis_iid }} level-capability 2 level 2 wide-metrics-only - #database-export igp-identifier {{ default 0 .isis_iid }} bgp-ls-identifier value {{ default 0 .isis_iid }} traffic-engineering advertise-router-capability area admin-state enable interface "system" admin-state enable {{- if .sid_idx }} - interface "system" ipv4-node-sid index {{ .sid_idx }} + interface "system" ipv4-node-sid index {{ default 0 .isis_iid }}0{{ .sid_idx }} segment-routing prefix-sid-range global segment-routing admin-state enable {{- end }} interface {{ .name }} admin-state enable interface {{ .name }} interface-type point-to-point - {{- if .metric }} - interface {{ .name }} level 2 metric {{ .metric }} - {{- end }} + interface {{ .name }} level 2 metric {{ default 10 .metric }} /configure router isis {{ default 0 .isis_iid }} diff --git a/templates/vr-sros/base-node.tmpl b/templates/vr-sros/base-node.tmpl index feb75118b..fc0698cdf 100644 --- a/templates/vr-sros/base-node.tmpl +++ b/templates/vr-sros/base-node.tmpl @@ -1,6 +1,6 @@ {{ expect .systemip "ip" }} {{ optional .isis_iid "0-31" }} -{{ optional .sid_idx "1-10000" }} +{{ optional .sid_idx "0-999" }} {{ optional .sid_start "19000-30000" }} {{ optional .sid_end "19000-30000" }} @@ -17,6 +17,23 @@ mpls-labels sr-labels start {{ default 19000 .sid_start }} end {{ default 30000 .sid_end }} {{- end }} +{{ if .isis_iid }} +/configure router isis {{ .isis_iid }} + area-address 49.0000.0000.0000.0{{ .isis_iid }} + level-capability 2 + level 2 wide-metrics-only + #database-export igp-identifier {{ .isis_iid }} bgp-ls-identifier value {{ default 0 .isis_iid }} + traffic-engineering + advertise-router-capability area + admin-state enable + interface "system" admin-state enable + {{- if .sid_idx }} + interface "system" ipv4-node-sid index {{ .isis_iid }}0{{ .sid_idx }} + segment-routing prefix-sid-range global + segment-routing admin-state enable + {{- end }} +{{ end }} + /configure router rsvp admin-state enable interface system admin-state enable