VOL-1282 BBSim - Add reboot-related features
Change-Id: I9a1ce85eae18e42361956942aaf8d8fae0cc0802
diff --git a/core/grpc_service.go b/core/grpc_service.go
index a5bc3e5..e647c9d 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -45,13 +45,17 @@
func (s *Server) GetDeviceInfo(c context.Context, empty *openolt.Empty) (*openolt.DeviceInfo, error) {
log.Printf("OLT receives GetDeviceInfo()\n")
- return new(openolt.DeviceInfo), nil
+ devinfo := new(openolt.DeviceInfo)
+ devinfo.Vendor = "CORD"
+ devinfo.OnuIdStart = 0
+ devinfo.OnuIdEnd = 3
+ devinfo.PonPorts = 4
+ return devinfo, nil
}
func (s *Server) ActivateOnu(c context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
log.Printf("OLT receives ActivateONU()\n")
result := device.ValidateONU(*onu, s.Onumap)
-
if result == true {
matched, error := s.getOnuBySN(onu.SerialNumber)
if error != nil {
@@ -59,7 +63,7 @@
}
onuid := onu.OnuId
matched.OnuID = onuid
- matched.InternalState = device.ONU_ACTIVATED
+ *matched.InternalState = device.ONU_ACTIVATED
log.Printf("ONU IntfID: %d OnuID: %d activated succesufully.\n", onu.IntfId, onu.OnuId)
}
return new(openolt.Empty), nil
@@ -130,6 +134,24 @@
func (s *Server) Reboot(c context.Context, empty *openolt.Empty) (*openolt.Empty, error) {
log.Printf("OLT %d receives Reboot ().\n", s.Olt.ID)
+ log.Printf("pointer@Reboot %p", s)
+ // Initialize OLT & Env
+ if s.TestFlag == true{
+ log.Println("Initialize by Reboot")
+ cleanUpVeths(s.VethEnv)
+ close(s.Endchan)
+ processes := s.Processes
+ log.Println("processes:", processes)
+ killProcesses(processes)
+ s.Initialize()
+ }
+ olt := s.Olt
+ olt.InitializeStatus()
+ for intfid, _ := range s.Onumap{
+ for _, onu := range s.Onumap[intfid] {
+ onu.InitializeStatus()
+ }
+ }
return new(openolt.Empty), nil
}