| /* |
| * Copyright 2018-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 omci |
| |
| // CreateUniStatusAlarm will generate an Alarm packet to report that the Link is UP or DOWN |
| // as a consequence of a SetRequest on PhysicalPathTerminationPointEthernetUniClassID |
| func CreateUniStatusAlarm(adminState uint8, entityId uint16) []byte { |
| |
| // TODO generate using omci-lib-go |
| linkMsgDown := []byte{ |
| 0x00, 0x00, 0x10, 0x0a, 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, 0x00, 0x00, 0x00, 0x00} |
| |
| linkMsgUp := []byte{ |
| 0x00, 0x00, 0x10, 0x0a, 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, 0x00, 0x00, 0x00, 0x00} |
| |
| if adminState == 0 { |
| return linkMsgUp |
| } else if adminState == 1 { |
| return linkMsgDown |
| } |
| |
| return nil |
| } |