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) {
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment