SEBA-594: added missing OMCI message handling for Tech Profiles in BBSim
Change-Id: I330f547580901a3ead3f59badb6a44535ab9bf93
diff --git a/omci_handlers.go b/omci_handlers.go
index e8c8890..d5ce6d7 100644
--- a/omci_handlers.go
+++ b/omci_handlers.go
@@ -19,30 +19,31 @@
import (
"encoding/binary"
"errors"
- "log"
"fmt"
+ "log"
)
type OmciMsgHandler func(class OmciClass, content OmciContent, key OnuKey) ([]byte, error)
var Handlers = map[OmciMsgType]OmciMsgHandler{
- MibReset: mibReset,
- MibUpload: mibUpload,
- MibUploadNext: mibUploadNext,
- Set: set,
- Create: create,
- Get: get,
- GetAllAlarms: getAllAlarms,
- GetAllAlarmsNext: getAllAlarmsNext,
- SynchronizeTime: syncTime,
+ MibReset: mibReset,
+ MibUpload: mibUpload,
+ MibUploadNext: mibUploadNext,
+ Set: set,
+ Create: create,
+ Get: get,
+ GetAllAlarms: getAllAlarms,
+ GetAllAlarmsNext: getAllAlarmsNext,
+ SynchronizeTime: syncTime,
+ Delete: delete,
}
func mibReset(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
- log.Printf("%v - Omci MibReset",key)
- if state, ok := OnuOmciStateMap[key]; ok{
- log.Printf("%v - Reseting OnuOmciState",key)
+ log.Printf("%v - Omci MibReset", key)
+ if state, ok := OnuOmciStateMap[key]; ok {
+ log.Printf("%v - Reseting OnuOmciState", key)
state.ResetOnuOmciState()
}
@@ -59,7 +60,7 @@
func mibUpload(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
- log.Printf("%v - Omci MibUpload",key)
+ log.Printf("%v - Omci MibUpload", key)
pkt = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
@@ -205,6 +206,98 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
pkt[11] = state.uniGInstance // UNI-G ME Instance
state.uniGInstance++
+
+ case 26, 30, 34, 38, 42, 46, 50, 54:
+ // Prior-Q with mask downstream
+ log.Println("Mib-upload for prior-q with mask")
+ // For downstream PQ, pkt[10] is 0x00
+ // So the instanceId will be like 0x0001, 0x0002,... etc
+ pkt = []byte{
+ 0x00, 0x42, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x15, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+ state.priorQInstance++
+ pkt[11] = state.priorQInstance
+
+ case 27, 31, 35, 39, 43, 47, 51, 55:
+ // Prior-Q with attribute list downstream
+ log.Println("Mib-upload for prior-q with attribute list")
+ pkt = []byte{
+ 0x00, 0x43, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x15, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x20, 0x00, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+
+ pkt[11] = state.priorQInstance
+ state.tcontInstance--
+ pkt[24] = state.tcontInstance // related port points to tcont
+ pkt[28] = state.tcontInstance
+
+ case 28, 32, 36, 40, 44, 48, 52, 56:
+ // Prior-Q with mask upstream
+ log.Println("Mib-upload for prior-q with mask")
+ pkt = []byte{
+ 0x00, 0x42, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x15, 0x80, 0x00, 0x00, 0x0f, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+ pkt[11] = state.priorQInstance
+
+ case 29, 33, 37, 41, 45, 49, 53, 57:
+ // Prior-Q with attribute list upstream
+ log.Println("Mib-upload for prior-q with attribute list")
+ // For upstream pkt[10] is fixed as 80
+ // So for upstream PQ, instanceId will be like 0x8001, 0x8002 ... etc
+ pkt = []byte{
+ 0x00, 0x43, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x15, 0x80, 0x00, 0xff, 0xf0, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x20, 0x00, 0x00, 0x80, 0x20, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+
+ pkt[11] = state.priorQInstance
+ pkt[24] = state.tcontInstance // related port points to tcont
+ pkt[28] = state.tcontInstance
+
+ case 58, 59, 60, 61, 62, 63, 64, 65:
+ // Traffic Scheduler
+ log.Println("Traffic Scheduler")
+ pkt = []byte{
+ 0x02, 0xa4, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x16, 0x80, 0x00, 0xf0, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+
+ pkt[15] = state.tcontInstance
+ state.tcontInstance++
+
+ case 66:
+ // ONT-2G
+ log.Println("ONT-2G")
+ pkt = []byte{
+ 0x00, 0x16, 0x2e, 0x0a, 0x00, 0x02, 0x00, 0x00,
+ 0x01, 0x01, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x40,
+ 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x7f, 0x00, 0x00, 0x3f, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }
+
default:
state.extraMibUploadCtr++
errstr := fmt.Sprintf("%v - Invalid MibUpload request: %d, extras: %d", key, state.mibUploadCtr, state.extraMibUploadCtr)
@@ -226,7 +319,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci Set",key)
+ log.Printf("%v - Omci Set", key)
return pkt, nil
}
@@ -236,7 +329,7 @@
if class == GEMPortNetworkCTP {
if onuOmciState, ok := OnuOmciStateMap[key]; !ok {
- log.Printf("%v - ONU Key Error",key)
+ log.Printf("%v - ONU Key Error", key)
return nil, errors.New("ONU Key Error")
} else {
onuOmciState.gemPortId = binary.BigEndian.Uint16(content[:2])
@@ -254,7 +347,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci Create",key)
+ log.Printf("%v - Omci Create", key)
return pkt, nil
}
@@ -270,7 +363,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci Get",key)
+ log.Printf("%v - Omci Get", key)
return pkt, nil
}
@@ -286,12 +379,11 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci GetAllAlarms",key)
+ log.Printf("%v - Omci GetAllAlarms", key)
return pkt, nil
}
-
func syncTime(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
@@ -303,7 +395,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci syncTime",key)
+ log.Printf("%v - Omci syncTime", key)
return pkt, nil
}
@@ -319,7 +411,23 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- log.Printf("%v - Omci GetAllAlarmsNext",key)
+ log.Printf("%v - Omci GetAllAlarmsNext", key)
+
+ return pkt, nil
+}
+
+func delete(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
+ var pkt []byte
+
+ pkt = []byte{
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x0b, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+ log.Printf("%v - Omci Delete", key)
return pkt, nil
}