Commit c6d34a90 authored by Manuel Kieweg's avatar Manuel Kieweg 🤷
Browse files

fixed get-ids bug

parent 9ed2e793
......@@ -61,8 +61,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
return
}
var hasPnd bool
var hasSbi bool
id, err := uuid.Parse(query.Get("uuid"))
if err != nil {
......@@ -76,8 +74,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
if err.Error() != "invalid UUID length: 0" {
log.Error(err)
}
} else {
hasPnd = true
}
sid, err := uuid.Parse(query.Get("sbi"))
......@@ -85,13 +81,11 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
if err.Error() != "invalid UUID length: 0" {
log.Error(err)
}
} else {
hasSbi = true
}
var pnd PrincipalNetworkDomain
var sbi SouthboundInterface
if hasSbi && hasPnd {
if query.Get("q") != "init" && query.Get("q") != "getIDs" {
pnd, err = c.pndc.get(pid)
if err != nil {
log.Error(err)
......@@ -179,10 +173,17 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, "%v: %v\n", i+1, id)
}
}
writeIDs("PNDs", c.pndc.UUIDs())
pnds := c.pndc.UUIDs()
writeIDs("PNDs", pnds)
writeIDs("SBIs", c.sbic.UUIDs())
if pnd != nil {
writeIDs("Devices", pnd.(*pndImplementation).devices.UUIDs())
for _,id := range pnds{
p, err := c.pndc.get(id)
if err != nil {
writer.WriteHeader(http.StatusInternalServerError)
log.Error(err)
return
}
writeIDs("Devices", p.(*pndImplementation).devices.UUIDs())
}
case "init":
writeIDs := func(typ string, ids []uuid.UUID) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment