Skip to content
Snippets Groups Projects
Commit c6d34a90 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

fixed get-ids bug

parent 9ed2e793
No related branches found
No related tags found
1 merge request!133Rewrite readme
Pipeline #67941 passed
...@@ -61,8 +61,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) { ...@@ -61,8 +61,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
return return
} }
var hasPnd bool
var hasSbi bool
id, err := uuid.Parse(query.Get("uuid")) id, err := uuid.Parse(query.Get("uuid"))
if err != nil { if err != nil {
...@@ -76,8 +74,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) { ...@@ -76,8 +74,6 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
if err.Error() != "invalid UUID length: 0" { if err.Error() != "invalid UUID length: 0" {
log.Error(err) log.Error(err)
} }
} else {
hasPnd = true
} }
sid, err := uuid.Parse(query.Get("sbi")) sid, err := uuid.Parse(query.Get("sbi"))
...@@ -85,13 +81,11 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) { ...@@ -85,13 +81,11 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
if err.Error() != "invalid UUID length: 0" { if err.Error() != "invalid UUID length: 0" {
log.Error(err) log.Error(err)
} }
} else {
hasSbi = true
} }
var pnd PrincipalNetworkDomain var pnd PrincipalNetworkDomain
var sbi SouthboundInterface var sbi SouthboundInterface
if hasSbi && hasPnd { if query.Get("q") != "init" && query.Get("q") != "getIDs" {
pnd, err = c.pndc.get(pid) pnd, err = c.pndc.get(pid)
if err != nil { if err != nil {
log.Error(err) log.Error(err)
...@@ -179,10 +173,17 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) { ...@@ -179,10 +173,17 @@ func httpHandler(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, "%v: %v\n", i+1, id) 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()) writeIDs("SBIs", c.sbic.UUIDs())
if pnd != nil { for _,id := range pnds{
writeIDs("Devices", pnd.(*pndImplementation).devices.UUIDs()) 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": case "init":
writeIDs := func(typ string, ids []uuid.UUID) { writeIDs := func(typ string, ids []uuid.UUID) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment