[VOL-3548] BBSim support for reboot vs disconnect

Change-Id: I6ea2a8a510a6ed17d040d3572a04fc988866116f
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 6540a56..b2c82d9 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -66,6 +66,7 @@
 	EventChannel         chan common.Event
 	PublishEvents        bool
 	PortStatsInterval    int
+	PreviouslyConnected  bool
 
 	Pons []*PonPort
 	Nnis []*NniPort
@@ -100,16 +101,17 @@
 		OperState: getOperStateFSM(func(e *fsm.Event) {
 			oltLogger.Debugf("Changing OLT OperState from %s to %s", e.Src, e.Dst)
 		}),
-		NumNni:            int(options.Olt.NniPorts),
-		NumPon:            int(options.Olt.PonPorts),
-		NumOnuPerPon:      int(options.Olt.OnusPonPort),
-		Pons:              []*PonPort{},
-		Nnis:              []*NniPort{},
-		Delay:             options.BBSim.Delay,
-		enablePerf:        options.BBSim.EnablePerf,
-		PublishEvents:     options.BBSim.Events,
-		PortStatsInterval: options.Olt.PortStatsInterval,
-		dhcpServer:        dhcp.NewDHCPServer(),
+		NumNni:              int(options.Olt.NniPorts),
+		NumPon:              int(options.Olt.PonPorts),
+		NumOnuPerPon:        int(options.Olt.OnusPonPort),
+		Pons:                []*PonPort{},
+		Nnis:                []*NniPort{},
+		Delay:               options.BBSim.Delay,
+		enablePerf:          options.BBSim.EnablePerf,
+		PublishEvents:       options.BBSim.Events,
+		PortStatsInterval:   options.Olt.PortStatsInterval,
+		dhcpServer:          dhcp.NewDHCPServer(),
+		PreviouslyConnected: false,
 	}
 
 	if val, ok := ControlledActivationModes[options.BBSim.ControlledActivation]; ok {
@@ -244,6 +246,8 @@
 
 func (o *OltDevice) RestartOLT() error {
 
+	o.PreviouslyConnected = false
+
 	softReboot := false
 	rebootDelay := common.Config.Olt.OltRebootDelay
 
@@ -1153,10 +1157,6 @@
 
 func (o *OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error) {
 
-	oltLogger.WithFields(log.Fields{
-		"oltId":    o.ID,
-		"PonPorts": o.NumPon,
-	}).Info("OLT receives GetDeviceInfo call from VOLTHA")
 	devinfo := new(openolt.DeviceInfo)
 	devinfo.Vendor = common.Config.Olt.Vendor
 	devinfo.Model = common.Config.Olt.Model
@@ -1174,6 +1174,30 @@
 	devinfo.FlowIdEnd = 16383
 	devinfo.DeviceSerialNumber = o.SerialNumber
 	devinfo.DeviceId = common.Config.Olt.DeviceId
+	devinfo.PreviouslyConnected = o.PreviouslyConnected
+
+	oltLogger.WithFields(log.Fields{
+		"Vendor":              devinfo.Vendor,
+		"Model":               devinfo.Model,
+		"HardwareVersion":     devinfo.HardwareVersion,
+		"FirmwareVersion":     devinfo.FirmwareVersion,
+		"Technology":          devinfo.Technology,
+		"PonPorts":            devinfo.PonPorts,
+		"OnuIdStart":          devinfo.OnuIdStart,
+		"OnuIdEnd":            devinfo.OnuIdEnd,
+		"AllocIdStart":        devinfo.AllocIdStart,
+		"AllocIdEnd":          devinfo.AllocIdEnd,
+		"GemportIdStart":      devinfo.GemportIdStart,
+		"GemportIdEnd":        devinfo.GemportIdEnd,
+		"FlowIdStart":         devinfo.FlowIdStart,
+		"FlowIdEnd":           devinfo.FlowIdEnd,
+		"DeviceSerialNumber":  devinfo.DeviceSerialNumber,
+		"DeviceId":            devinfo.DeviceId,
+		"PreviouslyConnected": devinfo.PreviouslyConnected,
+	}).Info("OLT receives GetDeviceInfo call from VOLTHA")
+
+	// once we connect, set the flag
+	o.PreviouslyConnected = true
 
 	return devinfo, nil
 }
@@ -1443,3 +1467,11 @@
 func (o *OltDevice) GetLogicalOnuDistance(ctx context.Context, in *openolt.Onu) (*openolt.OnuLogicalDistance, error) {
 	return &openolt.OnuLogicalDistance{}, nil
 }
+
+func (o *OltDevice) GetGemPortStatistics(ctx context.Context, in *openolt.OnuPacket) (*openolt.GemPortStatistics, error) {
+	return &openolt.GemPortStatistics{}, nil
+}
+
+func (o *OltDevice) GetOnuStatistics(ctx context.Context, in *openolt.Onu) (*openolt.OnuStatistics, error) {
+	return &openolt.OnuStatistics{}, nil
+}