Shad Ansari | 1106b02 | 2019-01-16 22:22:35 -0800 | [diff] [blame^] | 1 | /* |
| 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 | package core |
| 17 | |
| 18 | type OnuOmciState struct { |
| 19 | gemPortId uint16 |
| 20 | mibUploadCtr uint16 |
| 21 | uniGInstance uint8 |
| 22 | tcontInstance uint8 |
| 23 | pptpInstance uint8 |
| 24 | state istate |
| 25 | } |
| 26 | |
| 27 | type istate int |
| 28 | |
| 29 | // TODO - Needs to reflect real ONU/OMCI state |
| 30 | const ( |
| 31 | INCOMPLETE istate = iota |
| 32 | DONE |
| 33 | ) |
| 34 | |
| 35 | var OnuOmciStateMap = map[OnuKey]*OnuOmciState{} |
| 36 | |
| 37 | func NewOnuOmciState() *OnuOmciState { |
| 38 | return &OnuOmciState{gemPortId: 0, mibUploadCtr: 0, uniGInstance: 1, tcontInstance: 0, pptpInstance: 1} |
| 39 | } |
| 40 | |
| 41 | func GetOnuOmciState(onuId uint32, intfId uint32) istate { |
| 42 | key := OnuKey{intfId, onuId} |
| 43 | return (OnuOmciStateMap[key].state) |
| 44 | } |
| 45 | |
| 46 | func GetGemPortId(onuId uint32, intfId uint32) uint16 { |
| 47 | key := OnuKey{intfId, onuId} |
| 48 | return (OnuOmciStateMap[key].gemPortId) |
| 49 | } |