[VOL-2452] Using the latest omci-sim to enable MIB templating and
correctly report port status
Change-Id: I291c0fe01416c1541ef0f55779a77412a2271ea9
diff --git a/VERSION b/VERSION
index c983ac1..9789c4c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.0.14-dev
+0.0.14
diff --git a/go.mod b/go.mod
index 085c3e5..410d698 100644
--- a/go.mod
+++ b/go.mod
@@ -14,7 +14,7 @@
github.com/jhump/protoreflect v1.5.0
github.com/looplab/fsm v0.1.0
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4
- github.com/opencord/omci-sim v0.0.2
+ github.com/opencord/omci-sim v0.0.4
github.com/opencord/voltha-protos/v2 v2.1.2
github.com/pkg/errors v0.8.1 // indirect
github.com/sirupsen/logrus v1.4.2
diff --git a/go.sum b/go.sum
index 7ba09a0..65cb433 100644
--- a/go.sum
+++ b/go.sum
@@ -43,12 +43,10 @@
github.com/looplab/fsm v0.1.0/go.mod h1:m2VaOfDHxqXBBMgc26m6yUOwkFn8H2AlJDE+jd/uafI=
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4 h1:Odib2px8tyALzdbyztAAqdxmpmQ/pJahJ7uz8kN/rvk=
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4/go.mod h1:/+3S0pwQUy7HeKnH0KfKp5W6hmh/LdZzuZTNT/m7vA4=
-github.com/opencord/omci-sim v0.0.2 h1:ojEWzeiAgD8Yg7EISYTUD/6vaFk0wzQ6QMtMBYFbIh0=
-github.com/opencord/omci-sim v0.0.2/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
+github.com/opencord/omci-sim v0.0.4 h1:kN8zi/8gkcHOkXPk27Wp6Wwp8ggUylXcD/egW7PUXmc=
+github.com/opencord/omci-sim v0.0.4/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
github.com/opencord/voltha-protos/v2 v2.1.2 h1:/eX+kXhANbzxTpBHgC6vjwBUGRKKvGUOQRDdDgROp9E=
github.com/opencord/voltha-protos/v2 v2.1.2/go.mod h1:6kOcfYi1CadWowFxI2SH5wLfHrsRECZLZlD2MFK6WDI=
-github.com/opencord/voltha-protos/v3 v3.1.0 h1:jPBizpoIRlVIy8ZzTpC+cyQQL2esjJgIPvNcilWMDLA=
-github.com/opencord/voltha-protos/v3 v3.1.0/go.mod h1:n60tmoNSjgDGxEH7YGqDhIeiCpQETpnF5wOcNepHvWU=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
diff --git a/vendor/github.com/opencord/omci-sim/.gitignore b/vendor/github.com/opencord/omci-sim/.gitignore
new file mode 100644
index 0000000..a9f04a3
--- /dev/null
+++ b/vendor/github.com/opencord/omci-sim/.gitignore
@@ -0,0 +1,2 @@
+# GoLand
+.idea
diff --git a/vendor/github.com/opencord/omci-sim/VERSION b/vendor/github.com/opencord/omci-sim/VERSION
index 4e379d2..81340c7 100644
--- a/vendor/github.com/opencord/omci-sim/VERSION
+++ b/vendor/github.com/opencord/omci-sim/VERSION
@@ -1 +1 @@
-0.0.2
+0.0.4
diff --git a/vendor/github.com/opencord/omci-sim/omci_common.go b/vendor/github.com/opencord/omci-sim/omci_common.go
index c878780..a140141 100644
--- a/vendor/github.com/opencord/omci-sim/omci_common.go
+++ b/vendor/github.com/opencord/omci-sim/omci_common.go
@@ -49,10 +49,26 @@
pkt, _ = GetANIGAttributes(&pos, pkt, content)
return pkt
+ case SoftwareImage:
+ pos := uint(11)
+ pkt, _ = GetSoftwareImageAttributes(&pos, pkt, content)
+ return pkt
+
+ case ONUG:
+ pos := uint(11)
+ pkt, _ = GetOnuGAttributes(&pos, pkt, content)
+ return pkt
+
+ case ONU2G:
+ pos := uint(11)
+ pkt, _ = GetOnu2GAttributes(&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
diff --git a/vendor/github.com/opencord/omci-sim/omci_defs.go b/vendor/github.com/opencord/omci-sim/omci_defs.go
index d84e878..90ea0af 100644
--- a/vendor/github.com/opencord/omci-sim/omci_defs.go
+++ b/vendor/github.com/opencord/omci-sim/omci_defs.go
@@ -159,10 +159,14 @@
func (c OmciClass) PrettyPrint() string {
switch c {
+ case SoftwareImage:
+ return "SoftwareImage"
case EthernetPMHistoryData:
return "EthernetPMHistoryData"
case ONUG:
return "ONUG"
+ case ONU2G:
+ return "ONU2G"
case ANIG:
return "ANIG"
case GEMPortNetworkCTP:
@@ -175,8 +179,10 @@
const (
// Managed Entity Class values
+ SoftwareImage OmciClass = 7
EthernetPMHistoryData OmciClass = 24
ONUG OmciClass = 256
+ ONU2G OmciClass = 257
ANIG OmciClass = 263
GEMPortNetworkCTP OmciClass = 268
)
diff --git a/vendor/github.com/opencord/omci-sim/omci_handlers.go b/vendor/github.com/opencord/omci-sim/omci_handlers.go
index de62498..5ba28f9 100644
--- a/vendor/github.com/opencord/omci-sim/omci_handlers.go
+++ b/vendor/github.com/opencord/omci-sim/omci_handlers.go
@@ -475,9 +475,10 @@
func getAllAlarms(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
+ // Report number of commands as 1, basically there is always one alarm to get, the ONU/PPTP locked, link down or up
pkt = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 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,
@@ -513,13 +514,31 @@
func getAllAlarmsNext(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
- pkt = []byte{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 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}
+ OnuOmciStateMapLock.Lock()
+ if OnuOmciState, ok := OnuOmciStateMap[key]; ok {
+ // if we are locked then admin down was sent and PPTP 257 is in alarm/locked state, this ensures get alarm
+ // shows that
+ if OnuOmciState.state == LOCKED {
+ // alarm set, alarm spot 0, LAN LOS
+ pkt = []byte{
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x0b, 0x01, 0x01, 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}
+ } else {
+ // alarm clear
+ pkt = []byte{
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x0b, 0x01, 0x01, 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, 0x00}
+ }
+ }
+ OnuOmciStateMapLock.Unlock()
log.WithFields(log.Fields{
"IntfId": key.IntfId,
diff --git a/vendor/github.com/opencord/omci-sim/omci_onu2g.go b/vendor/github.com/opencord/omci-sim/omci_onu2g.go
new file mode 100644
index 0000000..0c2329d
--- /dev/null
+++ b/vendor/github.com/opencord/omci-sim/omci_onu2g.go
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package core
+
+import (
+ "encoding/binary"
+)
+
+type Onu2GAttributes int
+
+const (
+ _ = iota
+ EquipmentID Onu2GAttributes = 0x8000
+ OmccVersion Onu2GAttributes = 0x4000
+ VendorProductCode Onu2GAttributes = 0x2000
+ SecurityCapability Onu2GAttributes = 0x1000
+ SecurityMode Onu2GAttributes = 0x0800
+ TotalPriorityQueueNumber Onu2GAttributes = 0x0400
+ TotalTrafficSchedulerNumber Onu2GAttributes = 0x0200
+ Mode Onu2GAttributes = 0x0100
+ TotalGemPortIDNumber Onu2GAttributes = 0x0080
+ SysUptime Onu2GAttributes = 0x0040
+ ConnectivityCapability Onu2GAttributes = 0x0020
+ CurrentConnectivityMode Onu2GAttributes = 0x0010
+ QosConfigurationFlexibility Onu2GAttributes = 0x0008
+ PriorityQueueScaleFactor Onu2GAttributes = 0x0004
+)
+
+type Onu2GAttributeHandler func(*uint, []byte) ([]byte, error)
+
+var Onu2GAttributeHandlers = map[Onu2GAttributes]Onu2GAttributeHandler{
+ EquipmentID: GetEquipmentID,
+ OmccVersion: GetOmccVersion,
+ VendorProductCode: GetVendorProductCode,
+ SecurityCapability: GetSecurityCapability,
+ SecurityMode: GetSecurityMode,
+ TotalPriorityQueueNumber: GetTotalPriorityQueueNumber,
+ TotalTrafficSchedulerNumber: GetTotalTrafficSchedulerNumber,
+ Mode: GetMode,
+ TotalGemPortIDNumber: GetTotalGemPortIDNumber,
+ SysUptime: GetSysUptime,
+ ConnectivityCapability: GetConnectivityCapability,
+ CurrentConnectivityMode: GetCurrentConnectivityMode,
+ QosConfigurationFlexibility: GetQosConfigurationFlexibility,
+ PriorityQueueScaleFactor: GetPriorityQueueScaleFactor,
+}
+
+func GetOnu2GAttributes(pos *uint, pkt []byte, content OmciContent) ([]byte, error) {
+ AttributesMask := getAttributeMask(content)
+
+ for index := uint(16); index >= 1; index-- {
+ Attribute := 1 << (index - 1)
+ reqAttribute := Attribute & AttributesMask
+
+ if reqAttribute != 0 {
+ pkt, _ = Onu2GAttributeHandlers[Onu2GAttributes(reqAttribute)](pos, pkt)
+ }
+ }
+
+ pkt[8] = 0x00 // Command Processed Successfully
+ pkt[9] = uint8(AttributesMask >> 8)
+ pkt[10] = uint8(AttributesMask & 0x00FF)
+
+ return pkt, nil
+
+}
+
+func GetEquipmentID(pos *uint, pkt []byte) ([]byte, error) {
+ // 20 bytes
+ equipid := []byte("12345123451234512345")
+ for _, ch := range equipid {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetOmccVersion(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 bytes
+ pkt[*pos] = 0xB4
+ *pos++
+ return pkt, nil
+}
+
+func GetVendorProductCode(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ prodcode := []byte{0x00, 0x00}
+ for _, ch := range prodcode {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetSecurityCapability(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetSecurityMode(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetTotalPriorityQueueNumber(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ // report 0 queues because thats what BRCM does...
+ numqueues := 0
+ bs := make([]byte, 2)
+ binary.BigEndian.PutUint16(bs, uint16(numqueues))
+ for _, ch := range bs {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetTotalTrafficSchedulerNumber(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetMode(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetTotalGemPortIDNumber(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ gemports := 32
+ bs := make([]byte, 2)
+ binary.BigEndian.PutUint16(bs, uint16(gemports))
+ for _, ch := range bs {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetSysUptime(pos *uint, pkt []byte) ([]byte, error) {
+ // 4 byte int
+ uptime := 0
+ bs := make([]byte, 4)
+ binary.BigEndian.PutUint32(bs, uint32(uptime))
+ for _, ch := range bs {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetConnectivityCapability(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ caps := []byte{0x00, 0x7F}
+ for _, ch := range caps {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetCurrentConnectivityMode(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetQosConfigurationFlexibility(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ qosconf := []byte{0x00, 0x30}
+ for _, ch := range qosconf {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetPriorityQueueScaleFactor(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 bytes
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
diff --git a/vendor/github.com/opencord/omci-sim/omci_onug.go b/vendor/github.com/opencord/omci-sim/omci_onug.go
new file mode 100644
index 0000000..1cf6b0d
--- /dev/null
+++ b/vendor/github.com/opencord/omci-sim/omci_onug.go
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package core
+
+type OnuGAttributes int
+
+const (
+ _ = iota
+ VendorID OnuGAttributes = 0x8000
+ Version OnuGAttributes = 0x4000
+ SerialNumber OnuGAttributes = 0x2000
+ TrafficManagementOptions OnuGAttributes = 0x1000
+ VpVcCrossConnectOptions OnuGAttributes = 0x0800
+ BatteryBackup OnuGAttributes = 0x0400
+ AdministrativeState OnuGAttributes = 0x0200
+ OperationalState OnuGAttributes = 0x0100
+ OntSurvivalTime OnuGAttributes = 0x0080
+ LogicalOnuID OnuGAttributes = 0x0040
+ LogicalPassword OnuGAttributes = 0x0020
+ CredentialsStatus OnuGAttributes = 0x0010
+ ExtendedTcLayerOptions OnuGAttributes = 0x0008
+)
+
+type OnuGAttributeHandler func(*uint, []byte) ([]byte, error)
+
+var OnuGAttributeHandlers = map[OnuGAttributes]OnuGAttributeHandler{
+ VendorID: GetVendorID,
+ Version: GetVersion,
+ SerialNumber: GetSerialNumber,
+ TrafficManagementOptions: GetTrafficManagementOptions,
+ VpVcCrossConnectOptions: GetVpVcCrossConnectOptions,
+ BatteryBackup: GetBatteryBackup,
+ AdministrativeState: GetAdministrativeState,
+ OperationalState: GetOperationalState,
+ OntSurvivalTime: GetOntSurvivalTime,
+ LogicalOnuID: GetLogicalOnuID,
+ LogicalPassword: GetLogicalPassword,
+ CredentialsStatus: GetCredentialsStatus,
+ ExtendedTcLayerOptions: GetExtendedTcLayerOptions,
+}
+
+func GetOnuGAttributes(pos *uint, pkt []byte, content OmciContent) ([]byte, error) {
+ AttributesMask := getAttributeMask(content)
+
+ for index := uint(16); index >= 1; index-- {
+ Attribute := 1 << (index - 1)
+ reqAttribute := Attribute & AttributesMask
+
+ if reqAttribute != 0 {
+ pkt, _ = OnuGAttributeHandlers[OnuGAttributes(reqAttribute)](pos, pkt)
+ }
+ }
+
+ pkt[8] = 0x00 // Command Processed Successfully
+ pkt[9] = uint8(AttributesMask >> 8)
+ pkt[10] = uint8(AttributesMask & 0x00FF)
+
+ return pkt, nil
+
+}
+
+func GetVendorID(pos *uint, pkt []byte) ([]byte, error) {
+ // 4 bytes
+ vendorid := []byte("BBSM")
+ for _, ch := range vendorid {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetVersion(pos *uint, pkt []byte) ([]byte, error) {
+ // 14 bytes
+ for i := 1; i <= 14; i++ {
+ b := byte(' ')
+ pkt[*pos] = b
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetSerialNumber(pos *uint, pkt []byte) ([]byte, error) {
+ // 8 bytes
+ vendorid := []byte("BBSM")
+ serialhex := []byte{0x00, 0x00, 0x00, 0x01}
+ serialnumber := append(vendorid, serialhex...)
+ for _, ch := range serialnumber {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetTrafficManagementOptions(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetVpVcCrossConnectOptions(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetBatteryBackup(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetAdministrativeState(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetOperationalState(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetOntSurvivalTime(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetLogicalOnuID(pos *uint, pkt []byte) ([]byte, error) {
+ // 24 bytes
+ for i := 1; i <= 24; i++ {
+ b := byte(' ')
+ pkt[*pos] = b
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetLogicalPassword(pos *uint, pkt []byte) ([]byte, error) {
+ // 24 bytes
+ for i := 1; i <= 24; i++ {
+ b := byte(' ')
+ pkt[*pos] = b
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetCredentialsStatus(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x00
+ *pos++
+ return pkt, nil
+}
+
+func GetExtendedTcLayerOptions(pos *uint, pkt []byte) ([]byte, error) {
+ // 2 bytes
+ tcbits := []byte{0x00, 0x00}
+ for _, ch := range tcbits {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
diff --git a/vendor/github.com/opencord/omci-sim/omci_sim.go b/vendor/github.com/opencord/omci-sim/omci_sim.go
index c971d54..6195168 100644
--- a/vendor/github.com/opencord/omci-sim/omci_sim.go
+++ b/vendor/github.com/opencord/omci-sim/omci_sim.go
@@ -135,6 +135,12 @@
Packet: linkMsgDown,
}
omciCh <- msg
+
+ OnuOmciStateMapLock.Lock()
+ if OnuOmciState, ok := OnuOmciStateMap[key]; ok {
+ OnuOmciState.state = LOCKED
+ }
+ OnuOmciStateMapLock.Unlock()
}
// attribute bit 5 (admin state) in the PPTP is being set, its value is 0, unlock
@@ -158,6 +164,12 @@
Packet: linkMsgUp,
}
omciCh <- msg
+
+ OnuOmciStateMapLock.Lock()
+ if OnuOmciState, ok := OnuOmciStateMap[key]; ok {
+ OnuOmciState.state = DONE
+ }
+ OnuOmciStateMapLock.Unlock()
}
}
diff --git a/vendor/github.com/opencord/omci-sim/omci_softwareimage.go b/vendor/github.com/opencord/omci-sim/omci_softwareimage.go
new file mode 100644
index 0000000..f0d2f9e
--- /dev/null
+++ b/vendor/github.com/opencord/omci-sim/omci_softwareimage.go
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package core
+
+type SoftwareImageAttributes int
+
+const (
+ _ = iota
+ SoftwareVersion SoftwareImageAttributes = 0x8000
+ IsCommited SoftwareImageAttributes = 0x4000
+ IsActive SoftwareImageAttributes = 0x2000
+ IsValid SoftwareImageAttributes = 0x1000
+ ProductCode SoftwareImageAttributes = 0x0800
+ ImageHash SoftwareImageAttributes = 0x0400
+)
+
+type SoftwareImageAttributeHandler func(*uint, []byte) ([]byte, error)
+
+var SoftwareImageAttributeHandlers = map[SoftwareImageAttributes]SoftwareImageAttributeHandler{
+ SoftwareVersion: GetSoftwareVersion,
+ IsCommited: GetIsCommited,
+ IsActive: GetIsActive,
+ IsValid: GetIsValid,
+ ProductCode: GetProductCode,
+ ImageHash: GetImageHash,
+}
+
+func GetSoftwareImageAttributes(pos *uint, pkt []byte, content OmciContent) ([]byte, error) {
+ AttributesMask := getAttributeMask(content)
+
+ for index := uint(16); index >= 1; index-- {
+ Attribute := 1 << (index - 1)
+ reqAttribute := Attribute & AttributesMask
+
+ if reqAttribute != 0 {
+ pkt, _ = SoftwareImageAttributeHandlers[SoftwareImageAttributes(reqAttribute)](pos, pkt)
+ }
+ }
+
+ pkt[8] = 0x00 // Command Processed Successfully
+ pkt[9] = uint8(AttributesMask >> 8)
+ pkt[10] = uint8(AttributesMask & 0x00FF)
+
+ return pkt, nil
+
+}
+
+func GetSoftwareVersion(pos *uint, pkt []byte) ([]byte, error) {
+ // 14 bytes
+ version := []byte("00000000000001")
+ for _, ch := range version {
+ pkt[*pos] = ch
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetIsCommited(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 bytes
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetIsActive(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 bytes
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetIsValid(pos *uint, pkt []byte) ([]byte, error) {
+ // 1 byte
+ pkt[*pos] = 0x01
+ *pos++
+ return pkt, nil
+}
+
+func GetProductCode(pos *uint, pkt []byte) ([]byte, error) {
+ // 25 bytes
+ // BRCM has 25 nulls
+ for i := 1; i <= 25; i++ {
+ pkt[*pos] = 0x00
+ *pos++
+ }
+ return pkt, nil
+}
+
+func GetImageHash(pos *uint, pkt []byte) ([]byte, error) {
+ // 16 bytes
+ // BRCM has 16 nulls
+ for i := 1; i <= 16; i++ {
+ pkt[*pos] = 0x00
+ *pos++
+ }
+ return pkt, nil
+}
diff --git a/vendor/github.com/opencord/omci-sim/omci_state.go b/vendor/github.com/opencord/omci-sim/omci_state.go
index eb923ba..ddb9921 100644
--- a/vendor/github.com/opencord/omci-sim/omci_state.go
+++ b/vendor/github.com/opencord/omci-sim/omci_state.go
@@ -41,6 +41,7 @@
const (
INCOMPLETE istate = iota
DONE
+ LOCKED
)
var OnuOmciStateMap = map[OnuKey]*OnuOmciState{}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 5d59038..44e2f86 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,6 @@
# github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1
-github.com/aead/cmac/aes
github.com/aead/cmac
+github.com/aead/cmac/aes
# github.com/cboling/omci v0.1.0
github.com/cboling/omci
github.com/cboling/omci/generated
@@ -12,21 +12,21 @@
github.com/golang/glog
# github.com/golang/protobuf v1.3.2
github.com/golang/protobuf/descriptor
+github.com/golang/protobuf/jsonpb
github.com/golang/protobuf/proto
github.com/golang/protobuf/protoc-gen-go
github.com/golang/protobuf/protoc-gen-go/descriptor
-github.com/golang/protobuf/jsonpb
-github.com/golang/protobuf/ptypes/any
-github.com/golang/protobuf/ptypes/duration
-github.com/golang/protobuf/ptypes/timestamp
-github.com/golang/protobuf/ptypes/wrappers
-github.com/golang/protobuf/ptypes
-github.com/golang/protobuf/ptypes/struct
-github.com/golang/protobuf/ptypes/empty
github.com/golang/protobuf/protoc-gen-go/generator
+github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
github.com/golang/protobuf/protoc-gen-go/grpc
github.com/golang/protobuf/protoc-gen-go/plugin
-github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
+github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/ptypes/any
+github.com/golang/protobuf/ptypes/duration
+github.com/golang/protobuf/ptypes/empty
+github.com/golang/protobuf/ptypes/struct
+github.com/golang/protobuf/ptypes/timestamp
+github.com/golang/protobuf/ptypes/wrappers
# github.com/google/go-cmp v0.2.0
github.com/google/go-cmp/cmp
github.com/google/go-cmp/cmp/internal/diff
@@ -39,77 +39,74 @@
# github.com/gorilla/mux v1.7.3
github.com/gorilla/mux
# github.com/grpc-ecosystem/grpc-gateway v1.11.3
+github.com/grpc-ecosystem/grpc-gateway/codegenerator
+github.com/grpc-ecosystem/grpc-gateway/internal
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
github.com/grpc-ecosystem/grpc-gateway/runtime
github.com/grpc-ecosystem/grpc-gateway/utilities
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
-github.com/grpc-ecosystem/grpc-gateway/internal
-github.com/grpc-ecosystem/grpc-gateway/codegenerator
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
# github.com/jessevdk/go-flags v1.4.0
github.com/jessevdk/go-flags
# github.com/jhump/protoreflect v1.5.0
-github.com/jhump/protoreflect/desc
-github.com/jhump/protoreflect/dynamic
-github.com/jhump/protoreflect/desc/internal
-github.com/jhump/protoreflect/internal
github.com/jhump/protoreflect/codec
+github.com/jhump/protoreflect/desc
+github.com/jhump/protoreflect/desc/internal
+github.com/jhump/protoreflect/dynamic
+github.com/jhump/protoreflect/internal
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/konsorten/go-windows-terminal-sequences
# github.com/looplab/fsm v0.1.0
github.com/looplab/fsm
# github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4
github.com/opencord/cordctl/pkg/format
-# github.com/opencord/omci-sim v0.0.2
+# github.com/opencord/omci-sim v0.0.4
github.com/opencord/omci-sim
# github.com/opencord/voltha-protos/v2 v2.1.2
github.com/opencord/voltha-protos/v2/go/openolt
github.com/opencord/voltha-protos/v2/go/tech_profile
-# github.com/opencord/voltha-protos/v3 v3.1.0
-github.com/opencord/voltha-protos/v3/go/openolt
-github.com/opencord/voltha-protos/v3/go/tech_profile
# github.com/pkg/errors v0.8.1
github.com/pkg/errors
# github.com/sirupsen/logrus v1.4.2
github.com/sirupsen/logrus
# golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
-golang.org/x/net/trace
-golang.org/x/net/internal/timeseries
-golang.org/x/net/http2
-golang.org/x/net/http2/hpack
golang.org/x/net/context
golang.org/x/net/http/httpguts
+golang.org/x/net/http2
+golang.org/x/net/http2/hpack
golang.org/x/net/idna
+golang.org/x/net/internal/timeseries
+golang.org/x/net/trace
# golang.org/x/sys v0.0.0-20190422165155-953cdadca894
golang.org/x/sys/unix
# golang.org/x/text v0.3.0
golang.org/x/text/secure/bidirule
+golang.org/x/text/transform
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
-golang.org/x/text/transform
# google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610
google.golang.org/genproto/googleapis/api/annotations
google.golang.org/genproto/googleapis/api/httpbody
-google.golang.org/genproto/protobuf/field_mask
google.golang.org/genproto/googleapis/rpc/status
+google.golang.org/genproto/protobuf/field_mask
# google.golang.org/grpc v1.22.1
google.golang.org/grpc
-google.golang.org/grpc/codes
-google.golang.org/grpc/grpclog
-google.golang.org/grpc/status
-google.golang.org/grpc/reflection
-google.golang.org/grpc/metadata
google.golang.org/grpc/balancer
+google.golang.org/grpc/balancer/base
google.golang.org/grpc/balancer/roundrobin
+google.golang.org/grpc/binarylog/grpc_binarylog_v1
+google.golang.org/grpc/codes
google.golang.org/grpc/connectivity
google.golang.org/grpc/credentials
+google.golang.org/grpc/credentials/internal
google.golang.org/grpc/encoding
google.golang.org/grpc/encoding/proto
+google.golang.org/grpc/grpclog
google.golang.org/grpc/internal
google.golang.org/grpc/internal/backoff
google.golang.org/grpc/internal/balancerload
@@ -118,26 +115,26 @@
google.golang.org/grpc/internal/envconfig
google.golang.org/grpc/internal/grpcrand
google.golang.org/grpc/internal/grpcsync
+google.golang.org/grpc/internal/syscall
google.golang.org/grpc/internal/transport
google.golang.org/grpc/keepalive
+google.golang.org/grpc/metadata
google.golang.org/grpc/naming
google.golang.org/grpc/peer
+google.golang.org/grpc/reflection
+google.golang.org/grpc/reflection/grpc_reflection_v1alpha
google.golang.org/grpc/resolver
google.golang.org/grpc/resolver/dns
google.golang.org/grpc/resolver/passthrough
google.golang.org/grpc/serviceconfig
google.golang.org/grpc/stats
+google.golang.org/grpc/status
google.golang.org/grpc/tap
-google.golang.org/grpc/reflection/grpc_reflection_v1alpha
-google.golang.org/grpc/balancer/base
-google.golang.org/grpc/credentials/internal
-google.golang.org/grpc/binarylog/grpc_binarylog_v1
-google.golang.org/grpc/internal/syscall
# gopkg.in/yaml.v2 v2.2.2
gopkg.in/yaml.v2
# gotest.tools v2.2.0+incompatible
gotest.tools/assert
gotest.tools/assert/cmp
+gotest.tools/internal/difflib
gotest.tools/internal/format
gotest.tools/internal/source
-gotest.tools/internal/difflib