CORD-1506 Update fabric config generator to ONOS 1.10 format.
Change-Id: I7eaa620d4a651028e5fb1572bf91d314aed11112
diff --git a/config-generator/handlers.go b/config-generator/handlers.go
index dc5b34b..a12da98 100644
--- a/config-generator/handlers.go
+++ b/config-generator/handlers.go
@@ -74,7 +74,7 @@
// If the request specified the number of hosts, validate we have that
// exact number
if options.HostCount > 0 && len(hosts.Hosts) != options.HostCount {
- log.Errorf("Expecting %d host(s), found %d, no configuration generaged",
+ log.Errorf("Expecting %d host(s), found %d, no configuration generated",
options.HostCount, len(hosts.Hosts))
http.Error(w, "Expected host count mismatch",
http.StatusInternalServerError)
@@ -108,6 +108,13 @@
return "0.0.0.254/24"
}
},
+ "vlan": func(ips []string) string {
+ if (len(ips) > 0) {
+ return strings.Split(ips[0], ".")[2]
+ } else {
+ return "0"
+ }
+ },
}
tpl, err := template.New("netconfig.tpl").Funcs(funcMap).ParseFiles("netconfig.tpl")
diff --git a/config-generator/netconfig.tpl b/config-generator/netconfig.tpl
index f962a87..3c3cc31 100644
--- a/config-generator/netconfig.tpl
+++ b/config-generator/netconfig.tpl
@@ -4,33 +4,30 @@
{{ end }}"{{ .Id }}": {
"segmentrouting": {
"name": "device-{{ .ChassisId }}",
- "nodeSid": {{ add 100 $index }},
- "routerIp": "{{ .Annotations.ManagementAddress }}",
+ "ipv4NodeSid": {{ add 100 $index }},
+ "ipv4Loopback": "{{ .Annotations.ManagementAddress }}",
"routerMac": "{{ .Mac }}",
"isEdgeRouter": {{ .IsEdgeRouter }},
"adjacencySids": []
}
}{{ end }}
},
- "hosts": {
- {{ range $index, $element := .Hosts }}{{ if $index }},
- {{ end }}"{{ .Mac }}/-1": {
- "basic" : {
- "ips": ["{{ range $idx_ip, $ip := .IpAddresses }}{{if $idx_ip}},{{end}}{{ $ip }}{{ end }}"],
- "location": "{{ .Location.ElementID }}/{{ .Location.Port }}"
- }
- }{{ end }}
- },
"ports": {
{{ range $index, $element := .Hosts }}{{ if $index }},
{{ end }}"{{ .Location.ElementID }}/{{ .Location.Port }}": {
"interfaces": [
{
- "ips": [ "{{ gateway .IpAddresses }}" ]
+ "ips": [ "{{ gateway .IpAddresses }}" ],
+ "vlan-untagged" : {{ vlan .IpAddresses }}
}
]
}{{ end }}
},
- "links": {},
- "apps": {}
+ "apps" : {
+ "org.onosproject.segmentrouting" : {
+ "segmentrouting" : {
+ "vRouterMacs" : [ "a4:23:05:06:01:01" ]
+ }
+ }
+ }
}