[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/common/omci/set.go b/internal/common/omci/set.go
index 73e17df..e584b52 100644
--- a/internal/common/omci/set.go
+++ b/internal/common/omci/set.go
@@ -73,3 +73,30 @@
return pkt, nil
}
+
+func CreateSetRequest(managedEntity *me.ManagedEntity, tid uint16) ([]byte, error) {
+
+ // TODO
+ // why can't we create the SetRequest as we do for all other omci Requests (eg: MibResetRequest)?
+ // if we do the Attributes are not sent
+
+ request := &omci.SetRequest{
+ MeBasePacket: omci.MeBasePacket{
+ EntityClass: managedEntity.GetClassID(),
+ EntityInstance: managedEntity.GetEntityID(),
+ },
+ Attributes: managedEntity.GetAttributeValueMap(),
+ AttributeMask: 0x800, // FIXME how can we generate this based on managedEntity.AttributeValueMap?
+ }
+ omciLogger.Info(request)
+
+ pkt, err := Serialize(omci.SetRequestType, request, tid)
+
+ if err != nil {
+ omciLogger.WithFields(log.Fields{
+ "Err": err,
+ }).Fatalf("Cannot Serialize SetRequest")
+ return nil, err
+ }
+ return HexEncode(pkt)
+}