Merge "[VOL-4552] Test FTTB support in BBSIM"
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index f7d2171..e460956 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -185,6 +185,7 @@
}).Debugf("Changing ONU OperState from %s to %s", e.Src, e.Dst)
})
o.onuAlarmsInfo = make(map[omcilib.OnuAlarmInfoMapKey]omcilib.OnuAlarmInfo)
+
// NOTE this state machine is used to activate the OMCI, EAPOL and DHCP clients
o.InternalState = fsm.NewFSM(
OnuStateCreated,
@@ -817,6 +818,7 @@
onuDown := o.AdminLockState == 1
responsePkt, _ = omcilib.CreateGetResponse(msg.OmciPkt, msg.OmciMsg, o.SerialNumber, o.MibDataSync, o.ActiveImageEntityId,
o.CommittedImageEntityId, o.StandbyImageVersion, o.ActiveImageVersion, o.CommittedImageVersion, onuDown)
+
case omci.SetRequestType:
success := true
msgObj, _ := omcilib.ParseSetRequest(msg.OmciPkt)
@@ -917,7 +919,15 @@
o.PonPort.storeAllocId(allocId, o.SerialNumber)
}
}
-
+ case me.EthernetFrameExtendedPmClassID,
+ me.EthernetFrameExtendedPm64BitClassID:
+ onuLogger.WithFields(log.Fields{
+ "me-instance": msgObj.EntityInstance,
+ }).Debug("set-request-received")
+ // No need to reset counters as onu adapter will simply send the set control block request to actually reset
+ // the counters, and respond with 0's without sending the get request to device.
+ // Also, if we even reset the counters here in cache, then on get we need to restore the counters back which
+ // would be of no use as ultimately the counters need to be restored.
}
if success {
diff --git a/internal/common/omci/get.go b/internal/common/omci/get.go
index 1f76a0d..f8680a8 100644
--- a/internal/common/omci/get.go
+++ b/internal/common/omci/get.go
@@ -49,13 +49,10 @@
func CreateGetResponse(omciPkt gopacket.Packet, omciMsg *omci.OMCI, onuSn *openolt.SerialNumber, mds uint8,
activeImageEntityId uint16, committedImageEntityId uint16, standbyImageVersion string, activeImageVersion string,
committedImageVersion string, onuDown bool) ([]byte, error) {
-
msgObj, err := ParseGetRequest(omciPkt)
-
if err != nil {
return nil, err
}
-
omciLogger.WithFields(log.Fields{
"EntityClass": msgObj.EntityClass,
"EntityInstance": msgObj.EntityInstance,
@@ -688,25 +685,26 @@
if meClass != me.EthernetFrameExtendedPmClassID {
callback = me.NewEthernetFrameExtendedPm64Bit
}
+ attr := me.AttributeValueMap{
+ "ManagedEntityId": entityID,
+ "DropEvents": 100,
+ "Octets": 101,
+ "Frames": 102,
+ "BroadcastFrames": 103,
+ "MulticastFrames": 104,
+ "CrcErroredFrames": 105,
+ "UndersizeFrames": 106,
+ "OversizeFrames": 107,
+ "Frames64Octets": 108,
+ "Frames65To127Octets": 109,
+ "Frames128To255Octets": 110,
+ "Frames256To511Octets": 111,
+ "Frames512To1023Octets": 112,
+ "Frames1024To1518Octets": 113,
+ }
managedEntity, meErr := callback(me.ParamData{
- EntityID: entityID,
- Attributes: me.AttributeValueMap{
- "ManagedEntityId": entityID,
- "DropEvents": rand.Intn(100),
- "Octets": rand.Intn(100),
- "Frames": rand.Intn(100),
- "BroadcastFrames": rand.Intn(100),
- "MulticastFrames": rand.Intn(100),
- "CrcErroredFrames": rand.Intn(100),
- "UndersizeFrames": rand.Intn(100),
- "OversizeFrames": rand.Intn(100),
- "Frames64Octets": rand.Intn(100),
- "Frames65To127Octets": rand.Intn(100),
- "Frames128To255Octets": rand.Intn(100),
- "Frames256To511Octets": rand.Intn(100),
- "Frames512To1023Octets": rand.Intn(100),
- "Frames1024To1518Octets": rand.Intn(100),
- },
+ EntityID: entityID,
+ Attributes: attr,
})
if meErr.GetError() != nil {
diff --git a/internal/common/omci/get_test.go b/internal/common/omci/get_test.go
index 7a9c21f..6fde0dc 100644
--- a/internal/common/omci/get_test.go
+++ b/internal/common/omci/get_test.go
@@ -75,7 +75,6 @@
VendorId: []byte("BBSM"),
VendorSpecific: []byte{0, byte(1 % 256), byte(1), byte(1)},
}
-
tests := []struct {
name string
args getArgs
@@ -129,6 +128,22 @@
getArgs{createSoftwareImageResponse(1024, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
getWant{2, map[string]interface{}{"ImageHash": ToOctets("BBSM_IMG_00001", 25)}},
},
+ {"getEthernetFrameExtendedPMDataResponse",
+ getArgs{createEthernetFrameExtendedPmGetResponse(me.EthernetFrameExtendedPmClassID, 16128, 10), 2},
+ getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10),
+ "DropEvents": uint32(100),
+ "Octets": uint32(101),
+ "Frames": uint32(102),
+ "BroadcastFrames": uint32(103),
+ "MulticastFrames": uint32(104),
+ "CrcErroredFrames": uint32(105)}},
+ },
+ {"getEthernetFrameExtendedPM64BitDataResponse",
+ getArgs{createEthernetFrameExtendedPmGetResponse(me.EthernetFrameExtendedPm64BitClassID, 3, 10), 2},
+ getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10),
+ "Frames512To1023Octets": uint64(112),
+ "Frames1024To1518Octets": uint64(113)}},
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -151,7 +166,6 @@
// the myb_sync.handleOmciMessage is called and then
// myb_sync.handleOmciGetResponseMessage where we extract the GetResponse layer
getResponseLayer := omciToGetResponse(t, omciPkt)
-
assert.Equal(t, getResponseLayer.Result, me.Success)
for k, v := range tt.want.attributes {