blob: 3a4335d9494b2b412e0c3fb997e51ff70c507bc5 [file] [log] [blame]
Shad Ansari2eac6a42018-11-14 22:35:39 -08001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package core
18
Shad Ansari45806172018-11-19 17:13:08 -080019import (
Shad Ansaria5c79892018-11-29 16:32:59 -080020 "bytes"
21 "encoding/binary"
22
Shad Ansari45806172018-11-19 17:13:08 -080023 "gerrit.opencord.org/voltha-bbsim/common/logger"
Shad Ansaria5c79892018-11-29 16:32:59 -080024 "gerrit.opencord.org/voltha-bbsim/protos"
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +090025 "gerrit.opencord.org/voltha-bbsim/device"
26 "time"
Keita NISHIMOTO2b694202018-12-18 07:30:55 +090027 "context"
28 "errors"
Shad Ansari45806172018-11-19 17:13:08 -080029)
30
Shad Ansaria5c79892018-11-29 16:32:59 -080031//
32// OMCI definitions
33//
34
35// OmciMsgType represents a OMCI message-type
36type OmciMsgType byte
37
38const (
39 // Message Types
40 _ = iota
41 Create OmciMsgType = 4
42 Delete OmciMsgType = 6
43 Set OmciMsgType = 8
44 Get OmciMsgType = 9
45 GetAllAlarms OmciMsgType = 11
46 GetAllAlarmsNext OmciMsgType = 12
47 MibUpload OmciMsgType = 13
48 MibUploadNext OmciMsgType = 14
49 MibReset OmciMsgType = 15
50 AlarmNotification OmciMsgType = 16
51 AttributeValueChange OmciMsgType = 17
52 Test OmciMsgType = 18
53 StartSoftwareDownload OmciMsgType = 19
54 DownloadSection OmciMsgType = 20
55 EndSoftwareDownload OmciMsgType = 21
56 ActivateSoftware OmciMsgType = 22
57 CommitSoftware OmciMsgType = 23
58 SynchronizeTime OmciMsgType = 24
59 Reboot OmciMsgType = 25
60 GetNext OmciMsgType = 26
61 TestResult OmciMsgType = 27
62 GetCurrentData OmciMsgType = 28
63 SetTable OmciMsgType = 29 // Defined in Extended Message Set Only
64)
65
66const (
67 // Managed Entity Class values
68 GEMPortNetworkCTP OmciClass = 268
69)
70
71// OMCI Managed Entity Class
72type OmciClass uint16
73
74// OMCI Message Identifier
75type OmciMessageIdentifier struct {
76 Class OmciClass
77 Instance uint16
78}
79
80type OmciContent [32]byte
81
82type OmciMessage struct {
83 TransactionId uint16
84 MessageType OmciMsgType
85 DeviceId uint8
86 MessageId OmciMessageIdentifier
87 Content OmciContent
Shad Ansari2eac6a42018-11-14 22:35:39 -080088}
89
Shad Ansari45806172018-11-19 17:13:08 -080090const NumMibUploads byte = 9
91
92type OnuKey struct {
93 IntfId, OnuId uint32
94}
95
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +090096type OnuOmciState struct {
Shad Ansaria5c79892018-11-29 16:32:59 -080097 gemPortId uint16
Shad Ansari45806172018-11-19 17:13:08 -080098 mibUploadCtr uint16
99 uniGInstance uint8
100 pptpInstance uint8
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900101 init istate
Shad Ansari45806172018-11-19 17:13:08 -0800102}
103
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900104type istate int
105
106const (
107 INCOMPLETE istate = iota
108 DONE
109)
110
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900111type OmciMsgHandler func(class OmciClass, content OmciContent, key OnuKey) ([]byte, error)
Shad Ansari8213c532018-12-11 13:53:34 -0800112
113var Handlers = map[OmciMsgType]OmciMsgHandler{
114 MibReset: mibReset,
115 MibUpload: mibUpload,
116 MibUploadNext: mibUploadNext,
117 Set: set,
118 Create: create,
119 Get: get,
120 GetAllAlarms: getAllAlarms,
121}
122
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900123var OnuOmciStateMap = map[OnuKey]*OnuOmciState{}
Shad Ansari45806172018-11-19 17:13:08 -0800124
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900125func OmciRun(ctx context.Context, omciOut chan openolt.OmciMsg, omciIn chan openolt.OmciIndication, onumap map[uint32][] *device.Onu, errch chan error) {
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900126 go func() { //For monitoring the OMCI states
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900127 t := time.NewTicker(1 * time.Second)
128 defer t.Stop()
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900129 for {
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900130 select{
131 case <- t.C:
132 logger.Debug("Monitor omci init state")
133 if isAllOmciInitDone(onumap) {
134 logger.Info("OmciRun - All the omci initialization wes done")
135 close(errch)
136 return
137 }
138 case <- ctx.Done():
139 logger.Debug("Omci Monitoring process was done")
140 return
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900141 }
Shad Ansari45806172018-11-19 17:13:08 -0800142 }
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900143 }()
Shad Ansari8213c532018-12-11 13:53:34 -0800144
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900145 go func(){
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900146 defer logger.Debug("Omci response process was done")
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900147 for {
148 var resp openolt.OmciIndication
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900149 select{
150 case m := <-omciOut:
151 transactionId, deviceId, msgType, class, instance, content, err := ParsePkt(m.Pkt)
152 if err != nil {
153 errch <- err
154 return
155 }
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900156
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900157 logger.Debug("OmciRun - transactionId: %d msgType: %d, ME Class: %d, ME Instance: %d",
158 transactionId, msgType, class, instance)
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900159
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900160 key := OnuKey{m.IntfId, m.OnuId}
161 if _, ok := OnuOmciStateMap[key]; !ok {
162 OnuOmciStateMap[key] = NewOnuOmciState()
163 }
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900164
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900165 if _, ok := Handlers[msgType]; !ok {
166 logger.Warn("Ignore omci msg (msgType %d not handled)", msgType)
167 continue
168 }
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900169
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900170 resp.Pkt, err = Handlers[msgType](class, content, key)
171 if err != nil {
172 errch <- err
173 return
174 }
175 resp.Pkt[0] = byte(transactionId >> 8)
176 resp.Pkt[1] = byte(transactionId & 0xFF)
177 resp.Pkt[2] = 0x2<<4 | byte(msgType)
178 resp.Pkt[3] = deviceId
179 resp.IntfId = m.IntfId
180 resp.OnuId = m.OnuId
181 omciIn <- resp
182 case <-ctx.Done():
183 return
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900184 }
Shad Ansari45806172018-11-19 17:13:08 -0800185 }
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900186 }()
Shad Ansari2eac6a42018-11-14 22:35:39 -0800187}
Shad Ansari45806172018-11-19 17:13:08 -0800188
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900189func ParsePkt(pkt []byte) (uint16, uint8, OmciMsgType, OmciClass, uint16, OmciContent, error) {
Shad Ansaria5c79892018-11-29 16:32:59 -0800190 var m OmciMessage
191
192 r := bytes.NewReader(HexDecode(pkt))
193
194 if err := binary.Read(r, binary.BigEndian, &m); err != nil {
195 logger.Error("binary.Read failed: %s", err)
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900196 return 0, 0, 0, 0, 0, OmciContent{}, errors.New("binary.Read failed")
Shad Ansaria5c79892018-11-29 16:32:59 -0800197 }
198 logger.Debug("OmciRun - TransactionId: %d MessageType: %d, ME Class: %d, ME Instance: %d, Content: %x",
199 m.TransactionId, m.MessageType&0x0F, m.MessageId.Class, m.MessageId.Instance, m.Content)
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900200 return m.TransactionId, m.DeviceId, m.MessageType & 0x0F, m.MessageId.Class, m.MessageId.Instance, m.Content, nil
Shad Ansaria5c79892018-11-29 16:32:59 -0800201}
202
203func HexDecode(pkt []byte) []byte {
204 // Convert the hex encoding to binary
205 // TODO - Change openolt adapter to send raw binary instead of hex encoded
Shad Ansari45806172018-11-19 17:13:08 -0800206 p := make([]byte, len(pkt)/2)
207 for i, j := 0, 0; i < len(pkt); i, j = i+2, j+1 {
Shad Ansaria5c79892018-11-29 16:32:59 -0800208 // Go figure this ;)
Shad Ansari45806172018-11-19 17:13:08 -0800209 u := (pkt[i] & 15) + (pkt[i]>>6)*9
210 l := (pkt[i+1] & 15) + (pkt[i+1]>>6)*9
211 p[j] = u<<4 + l
212 }
213 logger.Debug("Omci decoded: %x.", p)
Shad Ansaria5c79892018-11-29 16:32:59 -0800214 return p
Shad Ansari45806172018-11-19 17:13:08 -0800215}
216
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900217func NewOnuOmciState() *OnuOmciState {
218 return &OnuOmciState{gemPortId: 0, mibUploadCtr: 0, uniGInstance: 1, pptpInstance: 1}
Shad Ansari45806172018-11-19 17:13:08 -0800219}
220
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900221func mibReset(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800222 var pkt []byte
223
224 logger.Debug("Omci MibReset")
225
226 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800227 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900233 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800234}
235
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900236func mibUpload(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800237 var pkt []byte
238
239 logger.Debug("Omci MibUpload")
240
241 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800242 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800248
249 pkt[9] = NumMibUploads // Number of subsequent MibUploadNext cmds
250
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900251 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800252}
253
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900254func mibUploadNext(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800255 var pkt []byte
256
257 logger.Debug("Omci MibUploadNext")
258
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900259 state := OnuOmciStateMap[key]
Shad Ansari8213c532018-12-11 13:53:34 -0800260
Shad Ansari45806172018-11-19 17:13:08 -0800261 switch state.mibUploadCtr {
262 case 0:
263 // ANI-G
264 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800265 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800266 0x01, 0x07, 0x80, 0x01, 0xff, 0xff, 0x01, 0x00,
267 0x08, 0x00, 0x30, 0x00, 0x00, 0x05, 0x09, 0x00,
268 0x00, 0xe0, 0x54, 0xff, 0xff, 0x00, 0x00, 0x0c,
269 0x63, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800271 case 1, 2, 3, 4:
272 // UNI-G
273 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800274 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800275 0x01, 0x08, 0x01, 0x01, 0xf8, 0x00, 0x00, 0x00,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800280 pkt[11] = state.uniGInstance // ME Instance
281 state.uniGInstance++
282 case 5, 6, 7, 8:
283 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800284 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800285 0x00, 0x0b, 0x01, 0x01, 0xff, 0xfe, 0x00, 0x2f,
286 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0xee, 0x00,
287 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800290 pkt[11] = state.pptpInstance // ME Instance
291 state.pptpInstance++
292 default:
293 logger.Error("Invalid MibUpload request %d", state.mibUploadCtr)
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900294 return nil, errors.New("Invalid MibUpload request")
Shad Ansari45806172018-11-19 17:13:08 -0800295 }
296
297 state.mibUploadCtr++
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900298 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800299}
300
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900301func set(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800302 var pkt []byte
303
304 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800305 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
Shad Ansari45806172018-11-19 17:13:08 -0800306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
309 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800311
312 logger.Debug("Omci Set")
313
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900314 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800315}
316
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900317func create(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800318 var pkt []byte
319
Shad Ansaria5c79892018-11-29 16:32:59 -0800320 if class == GEMPortNetworkCTP {
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900321 if onuOmciState, ok := OnuOmciStateMap[key]; !ok {
Shad Ansaria5c79892018-11-29 16:32:59 -0800322 logger.Error("ONU Key Error - IntfId: %d, OnuId:", key.IntfId, key.OnuId)
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900323 return nil, errors.New("ONU Key Error")
Shad Ansaria5c79892018-11-29 16:32:59 -0800324 } else {
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900325 onuOmciState.gemPortId = binary.BigEndian.Uint16(content[:2])
326 logger.Debug("Gem Port Id %d", onuOmciState.gemPortId)
327 OnuOmciStateMap[key].init = DONE
Shad Ansaria5c79892018-11-29 16:32:59 -0800328 }
329 }
330
Shad Ansari45806172018-11-19 17:13:08 -0800331 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800332 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x01,
Shad Ansari45806172018-11-19 17:13:08 -0800333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800338
339 logger.Debug("Omci Create")
340
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900341 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800342}
343
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900344func get(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansari45806172018-11-19 17:13:08 -0800345 var pkt []byte
346
347 pkt = []byte{
Shad Ansaria5c79892018-11-29 16:32:59 -0800348 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x02, 0x01,
Shad Ansari45806172018-11-19 17:13:08 -0800349 0x00, 0x20, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Shad Ansaria5c79892018-11-29 16:32:59 -0800353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Shad Ansari45806172018-11-19 17:13:08 -0800354
355 logger.Debug("Omci Get")
356
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900357 return pkt, nil
Shad Ansari45806172018-11-19 17:13:08 -0800358}
Shad Ansaria5c79892018-11-29 16:32:59 -0800359
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900360func getAllAlarms(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
Shad Ansaria5c79892018-11-29 16:32:59 -0800361 var pkt []byte
362
363 pkt = []byte{
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
365 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
370
371 logger.Debug("Omci GetAllAlarms")
372
Keita NISHIMOTO2b694202018-12-18 07:30:55 +0900373 return pkt, nil
Shad Ansaria5c79892018-11-29 16:32:59 -0800374}
Keita NISHIMOTO3af86da2018-12-12 10:34:43 +0900375
376func isAllOmciInitDone(onumap map[uint32][] *device.Onu) bool {
377 for _, onus := range onumap {
378 for _, onu := range onus{
379 key := OnuKey{onu.IntfID, onu.OnuID}
380 state := OnuOmciStateMap[key]
381 if state.init == INCOMPLETE{
382 return false
383 }
384 }
385 }
386 return true
387}
388