blob: 8e4af358963d06dfedbb6abe043d1c577fb4eb4d [file] [log] [blame]
Shad Ansari1106b022019-01-16 22:22:35 -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 */
16package core
17
18type OnuOmciState struct {
19 gemPortId uint16
20 mibUploadCtr uint16
21 uniGInstance uint8
22 tcontInstance uint8
23 pptpInstance uint8
24 state istate
25}
26
27type istate int
28
29// TODO - Needs to reflect real ONU/OMCI state
30const (
31 INCOMPLETE istate = iota
32 DONE
33)
34
35var OnuOmciStateMap = map[OnuKey]*OnuOmciState{}
36
37func NewOnuOmciState() *OnuOmciState {
38 return &OnuOmciState{gemPortId: 0, mibUploadCtr: 0, uniGInstance: 1, tcontInstance: 0, pptpInstance: 1}
39}
40
41func GetOnuOmciState(onuId uint32, intfId uint32) istate {
Shad Ansari3259e6d2019-01-17 15:51:19 -080042 key := OnuKey{intfId, onuId}
43 if onu, ok := OnuOmciStateMap[key]; ok {
44 return onu.state
45 } else {
46 return INCOMPLETE
47 }
Shad Ansari1106b022019-01-16 22:22:35 -080048}
49
50func GetGemPortId(onuId uint32, intfId uint32) uint16 {
51 key := OnuKey{intfId, onuId}
52 return (OnuOmciStateMap[key].gemPortId)
53}