Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -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 | |
| 17 | package omci |
| 18 | |
| 19 | // CreateUniStatusAlarm will generate an Alarm packet to report that the Link is UP or DOWN |
| 20 | // as a consequence of a SetRequest on PhysicalPathTerminationPointEthernetUniClassID |
| 21 | func CreateUniStatusAlarm(adminState uint8, entityId uint16) []byte { |
| 22 | |
| 23 | // TODO generate using omci-lib-go |
| 24 | linkMsgDown := []byte{ |
| 25 | 0x00, 0x00, 0x10, 0x0a, 0x00, 0x0b, 0x01, 0x01, |
| 26 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} |
| 31 | |
| 32 | linkMsgUp := []byte{ |
| 33 | 0x00, 0x00, 0x10, 0x0a, 0x00, 0x0b, 0x01, 0x01, |
| 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} |
| 39 | |
| 40 | if adminState == 0 { |
| 41 | return linkMsgUp |
| 42 | } else if adminState == 1 { |
| 43 | return linkMsgDown |
| 44 | } |
| 45 | |
| 46 | return nil |
| 47 | } |