[VOL-4111] Moving Services under the UNI struct
Controlling the UNI state via OMCI Set Messages
Upgraded APIs to reflect the new format

Change-Id: I3a6c166205fad4a381e562ab3b873d03b633303e
diff --git a/internal/bbr/devices/olt.go b/internal/bbr/devices/olt.go
index b40bf58..39ce70b 100644
--- a/internal/bbr/devices/olt.go
+++ b/internal/bbr/devices/olt.go
@@ -42,7 +42,8 @@
 	BBSimPort     string
 	BBSimApiPort  string
 
-	conn *grpc.ClientConn
+	conn   *grpc.ClientConn
+	Client *openolt.OpenoltClient
 
 	TargetOnus    int
 	CompletedOnus int // Number of ONUs that have received a DHCPAck
@@ -76,6 +77,7 @@
 
 	client, conn := Connect(o.BBSimIp, o.BBSimPort)
 	o.conn = conn
+	o.Client = &client
 	defer conn.Close()
 
 	deviceInfo, err := o.getDeviceInfo(client)
@@ -301,6 +303,7 @@
 	onu.Channel <- msg
 }
 
+// packets arriving from the ONU and received in VOLTHA
 func (o *OltMock) handlePktIndication(client openolt.OpenoltClient, pktIndication *openolt.PacketIndication) {
 
 	pkt := gopacket.NewPacket(pktIndication.Pkt, layers.LayerTypeEthernet, gopacket.Default)
@@ -344,7 +347,7 @@
 		}
 
 		service := s.(*devices.Service)
-		onu := service.Onu
+		onu := service.UniPort.Onu
 
 		msg := types.Message{
 			Type: types.OnuPacketIn,
diff --git a/internal/bbr/devices/validate.go b/internal/bbr/devices/validate.go
index 29fcba4..a5f1d85 100644
--- a/internal/bbr/devices/validate.go
+++ b/internal/bbr/devices/validate.go
@@ -48,11 +48,17 @@
 
 	res := true
 	for _, service := range services.Items {
+		if service.UniId != 0 {
+			// BBR only interacts with the first UNI, rightfully so services for different UNIs
+			// won't reach the desired state
+			continue
+		}
 		if service.DhcpState != expectedDhcpState || service.EapolState != expectedEapolState {
 			res = false
 			log.WithFields(log.Fields{
 				"OnuSN":              service.OnuSn,
 				"ServiceName":        service.Name,
+				"UniId":              service.UniId,
 				"DhcpState":          service.DhcpState,
 				"EapolState":         service.EapolState,
 				"ExpectedDhcpState":  expectedDhcpState,
@@ -65,7 +71,7 @@
 		// NOTE that in BBR we expect to have a single service but this is not always the case
 		log.WithFields(log.Fields{
 			"ExpectedState": expectedDhcpState,
-		}).Infof("%d ONUs matching expected state", len(services.Items))
+		}).Infof("%d ONUs matching expected state", len(services.Items)/4) // for now BBSim has 4 UNIs per ONU (each UNI has a single service in BBR)
 	}
 
 	olt.conn.Close()