fix for profiles in voltha1.7
Change-Id: Id6d7c38ae38460e879d99f63f8db07321e07cf21
diff --git a/omci_common.go b/omci_common.go
index 2a478ce..223fe0e 100644
--- a/omci_common.go
+++ b/omci_common.go
@@ -16,7 +16,10 @@
package core
-import "fmt"
+import (
+ "fmt"
+ "log"
+)
type OmciError struct {
Msg string
@@ -33,3 +36,36 @@
func (k OnuKey) String() string {
return fmt.Sprintf("Onu {intfid:%d, onuid:%d}", k.IntfId, k.OnuId)
}
+
+func GetAttributes(class OmciClass, content OmciContent, key OnuKey, pkt []byte) []byte {
+ log.Printf("GetAttributes() invoked with onu key: %+v\n", key)
+
+ switch class {
+ case ANIG:
+ pos := uint(11)
+ pkt, _ = GetANIGAttributes(&pos, pkt, content)
+ return pkt
+
+ case EthernetPMHistoryData:
+ pos := uint(11)
+ pkt, _ = GetEthernetPMHistoryDataAttributes(&pos, pkt, content)
+ return pkt
+ default:
+ // For unimplemented MEs, just fill in the attribute mask and return 0 values for the requested attributes
+ // TODO implement Get for unimplemented MEs as well
+ log.Printf("Unimplemeted GetAttributes for ME Class: %v " +
+ "Filling with zero value for the requested attributes", class)
+ AttributesMask := getAttributeMask(content)
+ pkt[8] = 0x00 // Command Processed Successfully
+ pkt[9] = uint8(AttributesMask >> 8)
+ pkt[10] = uint8(AttributesMask & 0xFF)
+
+ return pkt
+ }
+}
+
+func getAttributeMask(content OmciContent) int {
+ // mask is present in pkt[8] and pkt[9]
+ log.Printf("GetAttributeMask() invoked\n content[0] , content[1]: %+v, %+v", content[0], content[1])
+ return (int(content[0]) << 8) | int(content[1])
+}