Starting 1.6.1 VERSION, also fixing issues with master image

Change-Id: Id8f094f3f616630dd0e5191d21eefe27b6274978
diff --git a/VERSION b/VERSION
index dc1e644..06bb452 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.6.0
+1.6.1-dev
diff --git a/internal/bbsim/devices/olt_test.go b/internal/bbsim/devices/olt_test.go
index 4544539..c8f920f 100644
--- a/internal/bbsim/devices/olt_test.go
+++ b/internal/bbsim/devices/olt_test.go
@@ -32,9 +32,10 @@
 
 func createMockOlt(numPon int, numOnu int, services []ServiceIf) *OltDevice {
 	olt := &OltDevice{
-		ID:         0,
-		AllocIDs:   make(map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool),
-		GemPortIDs: make(map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool),
+		ID:               0,
+		AllocIDs:         make(map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool),
+		GemPortIDs:       make(map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool),
+		OmciResponseRate: 10,
 	}
 
 	for i := 0; i < numPon; i++ {
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 982e9ef..0f04039 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -383,7 +383,7 @@
 			case bbsim.OMCI:
 				// these are OMCI messages received by the ONU
 				msg, _ := message.Data.(bbsim.OmciMessage)
-				o.handleOmciRequest(msg, stream)
+				_ = o.handleOmciRequest(msg, stream)
 			case bbsim.UniStatusAlarm:
 				msg, _ := message.Data.(bbsim.UniStatusAlarmMessage)
 				onuAlarmMapKey := omcilib.OnuAlarmInfoMapKey{
@@ -732,7 +732,7 @@
 
 // handleOmciRequest is responsible to parse the OMCI packets received from the openolt adapter
 // and generate the appropriate response to it
-func (o *Onu) handleOmciRequest(msg bbsim.OmciMessage, stream openolt.Openolt_EnableIndicationServer) {
+func (o *Onu) handleOmciRequest(msg bbsim.OmciMessage, stream openolt.Openolt_EnableIndicationServer) error {
 
 	onuLogger.WithFields(log.Fields{
 		"omciMsgType":  msg.OmciMsg.MessageType,
@@ -752,8 +752,8 @@
 			"OmciMsgCounter":   o.OmciMsgCounter,
 			"OmciResponseRate": o.OmciResponseRate,
 			"omciMsgType":      msg.OmciMsg.MessageType,
-		}).Debug("skip-omci-msg-response")
-		return
+		}).Debug("skipping-omci-msg-response")
+		return fmt.Errorf("skipping-omci-msg-response-because-of-response-rate-%d", o.OmciResponseRate)
 	}
 	var responsePkt []byte
 	var errResp error
@@ -1023,7 +1023,7 @@
 				"IntfId":       o.PonPortID,
 				"SerialNumber": o.Sn(),
 			}).Error("error-while-processing-create-download-section-response")
-			return
+			return fmt.Errorf("error-while-processing-create-download-section-response: %s", errResp.Error())
 		}
 		o.ImageSoftwareReceivedSections++
 
@@ -1181,6 +1181,7 @@
 	}
 
 	o.publishOmciEvent(msg)
+	return nil
 }
 
 // sendOmciIndication takes an OMCI packet and sends it up to VOLTHA
diff --git a/internal/bbsim/devices/onu_omci_test.go b/internal/bbsim/devices/onu_omci_test.go
index 846b61c..50a3fa5 100644
--- a/internal/bbsim/devices/onu_omci_test.go
+++ b/internal/bbsim/devices/onu_omci_test.go
@@ -17,8 +17,6 @@
 package devices
 
 import (
-	"testing"
-
 	"github.com/google/gopacket"
 	bbsim "github.com/opencord/bbsim/internal/bbsim/types"
 	omcilib "github.com/opencord/bbsim/internal/common/omci"
@@ -26,6 +24,7 @@
 	me "github.com/opencord/omci-lib-go/generated"
 	"github.com/opencord/voltha-protos/v4/go/openolt"
 	"gotest.tools/assert"
+	"testing"
 )
 
 var mockAttr = me.AttributeValueMap{
@@ -230,34 +229,41 @@
 	}
 
 	// send a Create and check that MDS has been increased
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	err := onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(1))
 
 	// send a Set and check that MDS has been increased
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciSetRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciSetRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(2))
 
 	// send a Delete and check that MDS has been increased
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciDeleteRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciDeleteRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(3))
 
 	// Start software download
 	onu.InternalState.SetState(OnuStateEnabled)
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciStartSoftwareDownloadRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciStartSoftwareDownloadRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(4))
 
 	// End software download
 	onu.ImageSoftwareReceivedSections = 1 // we fake that we have received the one download section we expect
 	onu.InternalState.SetState(OnuStateImageDownloadInProgress)
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciEndSoftwareDownloadRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciEndSoftwareDownloadRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(5))
 
 	// Activate software
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciActivateSoftwareRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciActivateSoftwareRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(6))
 
 	// Commit software
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCommitSoftwareRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCommitSoftwareRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(7))
 }
 
@@ -275,7 +281,8 @@
 	onu.PonPort.storeAllocId(1024, onu.SerialNumber)
 
 	// send a MibReset
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciMibResetRequest(t)), stream)
+	err := onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciMibResetRequest(t)), stream)
+	assert.NilError(t, err)
 
 	// check that MDS has reset to 0
 	assert.Equal(t, onu.MibDataSync, uint8(0))
@@ -295,7 +302,8 @@
 	}
 
 	// send a request that increases the MDS, but once we're at 255 we should go back to 0 (8bit)
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciDeleteRequest(t)), stream)
+	err := onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciDeleteRequest(t)), stream)
+	assert.NilError(t, err)
 	assert.Equal(t, onu.MibDataSync, uint8(0))
 }
 
@@ -309,7 +317,8 @@
 	}
 
 	// create a gem port via OMCI (gemPortId 12)
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	err := onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	assert.NilError(t, err)
 
 	// the first time we created the gemPort
 	// the MDS should be incremented
@@ -323,7 +332,8 @@
 	assert.Equal(t, responseLayer.Result, me.Success)
 
 	// send a request to create the same gem port via OMCI (gemPortId 12)
-	onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	err = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciCreateRequest(t)), stream)
+	assert.NilError(t, err)
 
 	// this time the MDS should not be incremented
 	assert.Equal(t, stream.CallCount, 2)
@@ -340,14 +350,13 @@
 	onu := createMockOnu(1, 1)
 
 	for onu.OmciResponseRate = 0; onu.OmciResponseRate <= maxOmciMsgCounter; onu.OmciResponseRate++ {
-		//t.Logf("onu.OmciResponseRate: %d", onu.OmciResponseRate)
 		stream := &mockStream{
 			Calls: make(map[int]*openolt.Indication),
 		}
 		//send ten OMCI requests and check if number of responses is only equal to onu.OmciResponseRate
 		for i := 0; i < 10; i++ {
-			onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciSetRequest(t)), stream)
-			//t.Logf("stream.CallCount: %d", stream.CallCount)
+			// we are not checking the error as we're expecting them (some messages should be skipped)
+			_ = onu.handleOmciRequest(makeOmciMessage(t, onu, makeOmciSetRequest(t)), stream)
 		}
 		assert.Equal(t, stream.CallCount, int(onu.OmciResponseRate))
 	}
diff --git a/internal/bbsim/devices/onu_test_helpers.go b/internal/bbsim/devices/onu_test_helpers.go
index e441e73..017cc9c 100644
--- a/internal/bbsim/devices/onu_test_helpers.go
+++ b/internal/bbsim/devices/onu_test_helpers.go
@@ -157,7 +157,8 @@
 // this method creates a real ONU to be used in the tests
 func createTestOnu() *Onu {
 	olt := OltDevice{
-		ID: 0,
+		ID:               0,
+		OmciResponseRate: 10,
 	}
 
 	pon := CreatePonPort(&olt, 1)