SEBA-758 send periodic port stats to voltha
SEBA-790 get flow, gemport, and tcont information through API
fix lint errors
Change-Id: I10909e1992eba71d8e54c976ccbcea8778e35539
diff --git a/core/openolt_service.go b/core/openolt_service.go
index 7c7f498..cd96970 100644
--- a/core/openolt_service.go
+++ b/core/openolt_service.go
@@ -17,14 +17,14 @@
package core
import (
-
"github.com/opencord/voltha-bbsim/common/logger"
"github.com/opencord/voltha-bbsim/device"
+ "github.com/opencord/voltha-bbsim/flow"
openolt "github.com/opencord/voltha-protos/go/openolt"
)
func sendOltIndUp(stream openolt.Openolt_EnableIndicationServer, olt *device.Olt) error {
- data := &openolt.Indication_OltInd{OltInd: &openolt.OltIndication{OperState: "up"}}
+ data := &openolt.Indication_OltInd{OltInd: &openolt.OltIndication{OperState: olt.OperState}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
logger.Error("Failed to send OLT UP indication: %v", err)
return err
@@ -45,7 +45,7 @@
// There is no need to send IntfInd for NNI
for i := uint32(0); i < olt.NumPonIntf; i++ {
intf := olt.PonIntfs[i]
- data := &openolt.Indication_IntfInd{&openolt.IntfIndication{IntfId: intf.IntfID, OperState: intf.OperState}}
+ data := &openolt.Indication_IntfInd{IntfInd: &openolt.IntfIndication{IntfId: intf.IntfID, OperState: intf.OperState}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
logger.Error("Failed to send Intf [id: %d] indication : %v", i, err)
return err
@@ -59,7 +59,7 @@
// Send OperInd for Nni
for i := uint32(0); i < olt.NumNniIntf; i++ {
intf := olt.NniIntfs[i]
- data := &openolt.Indication_IntfOperInd{&openolt.IntfOperIndication{Type: intf.Type, IntfId: intf.IntfID, OperState: intf.OperState}}
+ data := &openolt.Indication_IntfOperInd{IntfOperInd: &openolt.IntfOperIndication{Type: intf.Type, IntfId: intf.IntfID, OperState: intf.OperState}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
logger.Error("Failed to send NNI IntfOper [id: %d] indication : %v", i, err)
return err
@@ -70,7 +70,7 @@
// Send OperInd for Pon
for i := uint32(0); i < olt.NumPonIntf; i++ {
intf := olt.PonIntfs[i]
- data := &openolt.Indication_IntfOperInd{&openolt.IntfOperIndication{Type: intf.Type, IntfId: intf.IntfID, OperState: intf.OperState}}
+ data := &openolt.Indication_IntfOperInd{IntfOperInd: &openolt.IntfOperIndication{Type: intf.Type, IntfId: intf.IntfID, OperState: intf.OperState}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
logger.Error("Failed to send PON IntfOper [id: %d] indication : %v", i, err)
return err
@@ -133,3 +133,12 @@
}
}
}
+
+func sendPortStats(stream openolt.Openolt_EnableIndicationServer, port *device.Port) error {
+ portStats := flow.GetPortStats(&port.PortStats)
+ portStats.IntfId = interfaceIDToPortNo(port.IntfID, port.Type)
+ data := &openolt.Indication_PortStats{
+ PortStats: portStats,
+ }
+ return stream.Send(&openolt.Indication{Data: data})
+}