Update config-generator to account for ONOS API changes in 1.12.
Change-Id: I6a07e4bfe2bd69a1a63a628539d7d39899436854
diff --git a/config-generator/handlers.go b/config-generator/handlers.go
index 3363c6c..e880c86 100644
--- a/config-generator/handlers.go
+++ b/config-generator/handlers.go
@@ -148,7 +148,8 @@
// Walk the list of know compute nodes (hosts) and if the compute node
// is connected to a switch, then that switch is an edge router
for _, host := range hosts.Hosts {
- if device, ok := dm[host.Location.ElementID]; ok {
+ // Assume that each host has only one location for now
+ if device, ok := dm[host.Locations[0].ElementID]; ok {
(*device).IsEdgeRouter = true
}
}
diff --git a/config-generator/netconfig.tpl b/config-generator/netconfig.tpl
index 3c3cc31..4e75e10 100644
--- a/config-generator/netconfig.tpl
+++ b/config-generator/netconfig.tpl
@@ -14,7 +14,7 @@
},
"ports": {
{{ range $index, $element := .Hosts }}{{ if $index }},
- {{ end }}"{{ .Location.ElementID }}/{{ .Location.Port }}": {
+ {{ end }}"{{ (index .Locations 0).ElementID }}/{{ (index .Locations 0).Port }}": {
"interfaces": [
{
"ips": [ "{{ gateway .IpAddresses }}" ],
diff --git a/config-generator/onos_types.go b/config-generator/onos_types.go
index be3de81..a28e5c7 100644
--- a/config-generator/onos_types.go
+++ b/config-generator/onos_types.go
@@ -17,10 +17,10 @@
Id string `json:"id"`
Mac string `json:"mac"`
IpAddresses []string `json:"ipAddresses"`
- Location struct {
+ Locations []struct {
ElementID string `json:"elementId`
Port string `json:"port"`
- } `json:"location"`
+ } `json:"locations"`
}
type onosHosts struct {