VOL-1123 Specify serial number for Ponsim v2 ONU on command line
Change-Id: I85a15c0e710f22d2869fbe47976036cfa1ee610d
diff --git a/ponsim/v2/grpc/nbi/ponsim_handler.go b/ponsim/v2/grpc/nbi/ponsim_handler.go
index 8205386..49fd71a 100644
--- a/ponsim/v2/grpc/nbi/ponsim_handler.go
+++ b/ponsim/v2/grpc/nbi/ponsim_handler.go
@@ -128,25 +128,28 @@
"handler": handler,
}).Info("Getting device information")
- var out *voltha.PonSimDeviceInfo
+ out := &voltha.PonSimDeviceInfo{}
// Check which device type we're currently handling
if _, ok := (handler.device).(*core.PonSimOltDevice); ok {
common.Logger().WithFields(logrus.Fields{
"handler": handler,
}).Debug("Handling OLT device")
- keys := make([]int32, 0, len((handler.device).(*core.PonSimOltDevice).GetOnus()))
- for k := range (handler.device).(*core.PonSimOltDevice).GetOnus() {
- keys = append(keys, k)
+ onus := (handler.device).(*core.PonSimOltDevice).GetOnus()
+ for k := range onus {
+ out.Onus = append(
+ out.Onus,
+ &voltha.PonSimOnuDeviceInfo {
+ UniPort: k,
+ SerialNumber: onus[k].Device.SerialNumber,
+ },
+ )
}
- out = &voltha.PonSimDeviceInfo{NniPort: 0, UniPorts: []int32(keys)}
-
+ out.NniPort = 0
} else {
common.Logger().WithFields(logrus.Fields{
"handler": handler,
}).Debug("Handling ONU/OTHER device")
-
- out = &voltha.PonSimDeviceInfo{}
}
common.Logger().WithFields(logrus.Fields{