blob: fe6abef3fe89e90f0ecc4aea105254ac8609024a [file] [log] [blame]
Matteo Scandolo86e8ce62019-10-11 12:03:10 -07001/*
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 devices
18
19import (
20 "github.com/google/gopacket"
21 "github.com/opencord/voltha-protos/go/openolt"
22)
23
24type MessageType int
25
26const (
27 OltIndication MessageType = 0
28 NniIndication MessageType = 1
29 PonIndication MessageType = 2
30 OnuDiscIndication MessageType = 3
31 OnuIndication MessageType = 4
32 OMCI MessageType = 5
33 FlowUpdate MessageType = 6
34 StartEAPOL MessageType = 7
35 StartDHCP MessageType = 8
36 OnuPacketOut MessageType = 9
37 DyingGaspIndication MessageType = 10
38)
39
40func (m MessageType) String() string {
41 names := [...]string{
42 "OltIndication",
43 "NniIndication",
44 "PonIndication",
45 "OnuDiscIndication",
46 "OnuIndication",
47 "OMCI",
48 "FlowUpdate",
49 "StartEAPOL",
50 "StartDHCP",
51 "OnuPacketOut",
52 "DyingGaspIndication",
53 }
54 return names[m]
55}
56
57type Message struct {
58 Type MessageType
59 Data interface{}
60}
61
62type OltIndicationMessage struct {
63 OperState OperState
64}
65
66type NniIndicationMessage struct {
67 OperState OperState
68 NniPortID uint32
69}
70
71type PonIndicationMessage struct {
72 OperState OperState
73 PonPortID uint32
74}
75
76type OnuDiscIndicationMessage struct {
77 OperState OperState
Matteo Scandolo27428702019-10-11 16:21:16 -070078 Onu *Onu
Matteo Scandolo86e8ce62019-10-11 12:03:10 -070079}
80
81type OnuIndicationMessage struct {
82 OperState OperState
83 PonPortID uint32
84 OnuID uint32
85 OnuSN *openolt.SerialNumber
86}
87
88type OmciMessage struct {
89 OnuSN *openolt.SerialNumber
90 OnuID uint32
91 omciMsg *openolt.OmciMsg
92}
93
94type OnuFlowUpdateMessage struct {
95 PonPortID uint32
96 OnuID uint32
97 Flow *openolt.Flow
98}
99
100type PacketMessage struct {
101 PonPortID uint32
102 OnuID uint32
103}
104
105type OnuPacketOutMessage struct {
106 IntfId uint32
107 OnuId uint32
108 Packet gopacket.Packet
109}
110
111type DyingGaspIndicationMessage struct {
112 PonPortID uint32
113 OnuID uint32
114 Status string
115}
116
117type OperState int
118
119const (
120 UP OperState = iota
121 DOWN // The device has been discovered, but not yet activated
122)
123
124func (m OperState) String() string {
125 names := [...]string{
126 "up",
127 "down",
128 }
129 return names[m]
130}