blob: aaa2fdd29ba8aad6d96af08a0057ee5c6f59a6ad [file] [log] [blame]
Matteo Scandolof9d43412021-01-12 11:11:34 -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 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
21func 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}