Adding channgel for OMCI State feedback
Change-Id: I35728846ab86ca7f6686782e00df7f291a4376e6
diff --git a/omci_common.go b/omci_common.go
index 55c3b02..c878780 100644
--- a/omci_common.go
+++ b/omci_common.go
@@ -60,7 +60,7 @@
"IntfId": key.IntfId,
"OnuId": key.OnuId,
"class": class,
- }).Warnf("Unimplemeted GetAttributes for ME Class: %v " +
+ }).Tracef("Unimplemeted GetAttributes for ME Class: %v " +
"Filling with zero value for the requested attributes", class)
AttributesMask := getAttributeMask(content)
pkt[8] = 0x00 // Command Processed Successfully
diff --git a/omci_defs.go b/omci_defs.go
index dfa0f52..44347ef 100644
--- a/omci_defs.go
+++ b/omci_defs.go
@@ -23,6 +23,31 @@
log "github.com/sirupsen/logrus"
)
+// OMCI Sim definitions
+
+type ChMessageType int
+
+const (
+ GemPortAdded ChMessageType = iota
+)
+
+func (m ChMessageType) String() string {
+ names := [...]string{
+ "GemPortAdded",
+ }
+ return names[m]
+}
+
+type OmciChMessageData struct {
+ IntfId uint32
+ OnuId uint32
+}
+
+type OmciChMessage struct {
+ Type ChMessageType
+ Data OmciChMessageData
+}
+
//
// OMCI definitions
//
@@ -79,7 +104,18 @@
case SetTable:
return "SetTable"
default:
- log.Warnf("Cant't convert state %v to string", t)
+ // FIXME
+ // msg="Cant't convert state 68 to string"
+ // msg="Cant't convert state 72 to string"
+ // msg="Cant't convert state 73 to string"
+ // msg="Cant't convert state 75 to string"
+ // msg="Cant't convert state 76 to string"
+ // msg="Cant't convert state 77 to string"
+ // msg="Cant't convert state 78 to string"
+ // msg="Cant't convert state 79 to string"
+ // msg="Cant't convert state 88 to string"
+
+ log.Tracef("Cant't convert OmciMsgType %v to string", t)
return string(t)
}
}
@@ -112,6 +148,26 @@
SetTable OmciMsgType = 29 // Defined in Extended Message Set Only
)
+
+// OMCI Managed Entity Class
+type OmciClass uint16
+
+func (c OmciClass) PrettyPrint() string {
+ switch c {
+ case EthernetPMHistoryData:
+ return "EthernetPMHistoryData"
+ case ONUG:
+ return "ONUG"
+ case ANIG:
+ return "ANIG"
+ case GEMPortNetworkCTP:
+ return "GEMPortNetworkCTP"
+ default:
+ log.Tracef("Cant't convert OmciClass %v to string", c)
+ return string(c)
+ }
+}
+
const (
// Managed Entity Class values
EthernetPMHistoryData OmciClass = 24
@@ -120,9 +176,6 @@
GEMPortNetworkCTP OmciClass = 268
)
-// OMCI Managed Entity Class
-type OmciClass uint16
-
// OMCI Message Identifier
type OmciMessageIdentifier struct {
Class OmciClass
diff --git a/omci_handlers.go b/omci_handlers.go
index ec7f712..c766c1a 100644
--- a/omci_handlers.go
+++ b/omci_handlers.go
@@ -421,6 +421,13 @@
}).Tracef("Gem Port Id %d", key, onuOmciState)
// FIXME
OnuOmciStateMap[key].state = DONE
+ omciCh <- OmciChMessage{
+ Type: GemPortAdded,
+ Data: OmciChMessageData{
+ OnuId: key.OnuId,
+ IntfId: key.IntfId,
+ },
+ }
}
}
diff --git a/omci_sim.go b/omci_sim.go
index 5980db1..6cc0708 100644
--- a/omci_sim.go
+++ b/omci_sim.go
@@ -21,6 +21,12 @@
log "github.com/sirupsen/logrus"
)
+var omciCh = make(chan OmciChMessage)
+
+func GetChannel() chan OmciChMessage {
+ return omciCh
+}
+
func OmciSim(intfId uint32, onuId uint32, request []byte) ([]byte, error) {
var resp []byte
@@ -42,7 +48,7 @@
"MeInstance": instance,
//"Conent": content,
"omciMsg": fmt.Sprintf("%x", content),
- }).Debugf("Processing OMCI pakcet")
+ }).Tracef("Processing OMCI pakcet")
key := OnuKey{intfId, onuId}
if _, ok := OnuOmciStateMap[key]; !ok {
@@ -102,7 +108,7 @@
"OnuId": onuId,
"msgType": msgType.PrettyPrint(),
"omciMsg": fmt.Sprintf("%x", resp),
- }).Debugf("OMCI-SIM Response")
+ }).Tracef("OMCI-SIM Response")
return resp, nil
}
\ No newline at end of file