Using real serial_number when looking up OLT
Change-Id: Ie51676c56df08e98a3cf338b9a57c061b36900ff
diff --git a/handlers.go b/handlers.go
index d030fa7..c85f239 100644
--- a/handlers.go
+++ b/handlers.go
@@ -15,7 +15,6 @@
import (
"encoding/json"
- "fmt"
"net"
"net/http"
"strconv"
@@ -78,10 +77,9 @@
}
- fmt.Println(devices)
-
for _, device := range devices.OltDevices {
- devID := device.Host + ":" + strconv.Itoa(device.Port)
+ // NOTE if it's an OLT then sadisRequestID is the device serial number
+ devID := device.SerialNumber
if devID == sadisRequestID {
log.Infof("Found OLT device with ID %s", devID)
diff --git a/sadisTypes.go b/sadisTypes.go
index 96ac92c..b28c1f7 100644
--- a/sadisTypes.go
+++ b/sadisTypes.go
@@ -73,10 +73,11 @@
XOS vOLT device format
*/
type oltDevice struct {
- Uplink string `json:"uplink"`
- Host string `json:"host"`
- Port int `json:"port"`
- NasID string `json:"nas_id"`
+ Uplink string `json:"uplink"`
+ Host string `json:"host"`
+ Port int `json:"port"`
+ NasID string `json:"nas_id"`
+ SerialNumber string `json:"serial_number"`
}
type oltDevices struct {