[VOL-4589] Make NNI ports speed configurable and report it to the OpenOLT Adapter

Change-Id: Iea4fc1c9ced0975ebbefffd4b13ef1e6e5fa00a1
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index ef95ad6..3410e60 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -77,6 +77,7 @@
 	ID                   int
 	SerialNumber         string
 	NumNni               int
+	NniSpeed             uint32
 	NumPon               int
 	NumOnuPerPon         int
 	NumUni               int
@@ -123,6 +124,7 @@
 	oltLogger.WithFields(log.Fields{
 		"ID":           options.Olt.ID,
 		"NumNni":       options.Olt.NniPorts,
+		"NniSpeed":     options.Olt.NniSpeed,
 		"NumPon":       options.Olt.PonPorts,
 		"NumOnuPerPon": options.Olt.OnusPonPort,
 		"NumUni":       options.Olt.UniPorts,
@@ -136,6 +138,7 @@
 			oltLogger.Debugf("Changing OLT OperState from %s to %s", e.Src, e.Dst)
 		}),
 		NumNni:              int(options.Olt.NniPorts),
+		NniSpeed:            options.Olt.NniSpeed,
 		NumPon:              int(options.Olt.PonPorts),
 		NumOnuPerPon:        int(options.Olt.OnusPonPort),
 		NumUni:              int(options.Olt.UniPorts),
@@ -634,6 +637,7 @@
 		Type:      nni.Type,
 		IntfId:    nni.ID,
 		OperState: nni.OperState.Current(),
+		Speed:     o.NniSpeed,
 	}}
 
 	if err := stream.Send(&openolt.Indication{Data: operData}); err != nil {
@@ -645,6 +649,7 @@
 		"Type":      nni.Type,
 		"IntfId":    nni.ID,
 		"OperState": nni.OperState.Current(),
+		"Speed":     o.NniSpeed,
 	}).Debug("Sent Indication_IntfOperInd for NNI")
 }
 
diff --git a/internal/common/options.go b/internal/common/options.go
index c0798ae..0919de8 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -86,6 +86,7 @@
 	DeviceSerialNumber string `yaml:"device_serial_number"`
 	PonPorts           uint32 `yaml:"pon_ports"`
 	NniPorts           uint32 `yaml:"nni_ports"`
+	NniSpeed           uint32 `yaml:"nni_speed"`
 	OnusPonPort        uint32 `yaml:"onus_per_port"`
 	Technology         string `yaml:"technology"`
 	ID                 int    `yaml:"id"`
@@ -230,6 +231,7 @@
 
 	olt_id := flag.Int("olt_id", conf.Olt.ID, "OLT device ID")
 	nni := flag.Int("nni", int(conf.Olt.NniPorts), "Number of NNI ports per OLT device to be emulated")
+	nni_speed := flag.Uint("nni_speed", uint(conf.Olt.NniSpeed), "Reported speed of the NNI ports in Mbps")
 	pon := flag.Int("pon", int(conf.Olt.PonPorts), "Number of PON ports per OLT device to be emulated")
 	onu := flag.Int("onu", int(conf.Olt.OnusPonPort), "Number of ONU devices per PON port to be emulated")
 	uni := flag.Int("uni", int(conf.Olt.UniPorts), "Number of Ethernet UNI Ports per ONU device to be emulated")
@@ -262,6 +264,7 @@
 
 	conf.Olt.ID = int(*olt_id)
 	conf.Olt.NniPorts = uint32(*nni)
+	conf.Olt.NniSpeed = uint32(*nni_speed)
 	conf.Olt.PonPorts = uint32(*pon)
 	conf.Olt.UniPorts = uint32(*uni)
 	conf.Olt.PotsPorts = uint32(*pots)
@@ -334,6 +337,7 @@
 			DeviceSerialNumber: "BBSM00000001",
 			PonPorts:           1,
 			NniPorts:           1,
+			NniSpeed:           10000, //Mbps
 			OnusPonPort:        1,
 			Technology:         "XGS-PON",
 			ID:                 0,