Skip to content

Commit

Permalink
multiinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerza committed Jun 8, 2021
1 parent 0a9fd67 commit 6106301
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 6 deletions.
149 changes: 149 additions & 0 deletions templates/config/base-vr-sros.tmpl
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
8 changes: 3 additions & 5 deletions templates/vr-sros/base-link.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
19 changes: 18 additions & 1 deletion templates/vr-sros/base-node.tmpl
Original file line number Diff line number Diff line change
@@ -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" }}

Expand All @@ -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
Expand Down

0 comments on commit 6106301

Please sign in to comment.