VOL-1924: Observed the panic error while Object conversion in statsmanager.go
1.interface conversion: interface {} is *adaptercore.NniPort, not adaptercore.NniPort
2.interface conversion: interface {} is *adaptercore.PonPort, not adaptercore.PonPort
Change-Id: Iff0f02df53eeed5d4d63f3ea0ad00171232da753
(cherry picked from commit 768708d53855ea5b14b0944f82122df5e5695beb)
diff --git a/adaptercore/statsmanager.go b/adaptercore/statsmanager.go
index 6b2dfdc..0e207fb 100755
--- a/adaptercore/statsmanager.go
+++ b/adaptercore/statsmanager.go
@@ -206,15 +206,15 @@
if Intftype == "nni" {
NniPorts := make(map[uint32]NniPort)
for i = 0; i <= 1; i++ {
- Port := BuildPortObject(i, "nni", DeviceID).(NniPort)
- NniPorts[Port.IntfID] = Port
+ Port := BuildPortObject(i, "nni", DeviceID).(*NniPort)
+ NniPorts[Port.IntfID] = *Port
}
return NniPorts, nil
} else if Intftype == "pon" {
PONPorts := make(map[uint32]PonPort)
for i = 0; i <= 16; i++ {
- PONPort := BuildPortObject(i, "pon", DeviceID).(PonPort)
- PONPorts[PONPort.IntfID] = PONPort
+ PONPort := BuildPortObject(i, "pon", DeviceID).(*PonPort)
+ PONPorts[PONPort.IntfID] = *PONPort
}
return PONPorts, nil
} else {