blob: be5c37b37e21bf5873cd7c76759bc27844dc193d [file] [log] [blame]
Chip Boling6e27b352020-02-14 09:10:01 -06001/*
2 * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
Andrea Campanella7167ebb2020-02-24 09:56:38 +01003 * Copyright 2020-present Open Networking Foundation
4
Chip Boling6e27b352020-02-14 09:10:01 -06005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Andrea Campanella7167ebb2020-02-24 09:56:38 +01008
Chip Boling6e27b352020-02-14 09:10:01 -06009 * http://www.apache.org/licenses/LICENSE-2.0
Andrea Campanella7167ebb2020-02-24 09:56:38 +010010
Chip Boling6e27b352020-02-14 09:10:01 -060011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Chip Boling6e27b352020-02-14 09:10:01 -060016 */
17
18package omci
19
20import (
Chip Boling34ebcb62021-02-02 12:13:58 -060021 me "github.com/opencord/omci-lib-go/generated"
Chip Boling6e27b352020-02-14 09:10:01 -060022)
23
Chip Boling610117d2021-09-09 11:24:34 -050024// MessageType is the OMCI Message Type combined with the AR/AK flags as appropriate.
Chip Boling6e27b352020-02-14 09:10:01 -060025type MessageType byte
26
27const (
Chip Boling8c8018e2021-02-22 15:56:00 -060028 CreateRequestType = MessageType(byte(me.Create) | me.AR)
29 CreateResponseType = MessageType(byte(me.Create) | me.AK)
30 DeleteRequestType = MessageType(byte(me.Delete) | me.AR)
31 DeleteResponseType = MessageType(byte(me.Delete) | me.AK)
32 SetRequestType = MessageType(byte(me.Set) | me.AR)
33 SetResponseType = MessageType(byte(me.Set) | me.AK)
34 GetRequestType = MessageType(byte(me.Get) | me.AR)
35 GetResponseType = MessageType(byte(me.Get) | me.AK)
36 GetAllAlarmsRequestType = MessageType(byte(me.GetAllAlarms) | me.AR)
37 GetAllAlarmsResponseType = MessageType(byte(me.GetAllAlarms) | me.AK)
38 GetAllAlarmsNextRequestType = MessageType(byte(me.GetAllAlarmsNext) | me.AR)
39 GetAllAlarmsNextResponseType = MessageType(byte(me.GetAllAlarmsNext) | me.AK)
40 MibUploadRequestType = MessageType(byte(me.MibUpload) | me.AR)
41 MibUploadResponseType = MessageType(byte(me.MibUpload) | me.AK)
42 MibUploadNextRequestType = MessageType(byte(me.MibUploadNext) | me.AR)
43 MibUploadNextResponseType = MessageType(byte(me.MibUploadNext) | me.AK)
44 MibResetRequestType = MessageType(byte(me.MibReset) | me.AR)
45 MibResetResponseType = MessageType(byte(me.MibReset) | me.AK)
46 TestRequestType = MessageType(byte(me.Test) | me.AR)
47 TestResponseType = MessageType(byte(me.Test) | me.AK)
48 StartSoftwareDownloadRequestType = MessageType(byte(me.StartSoftwareDownload) | me.AR)
49 StartSoftwareDownloadResponseType = MessageType(byte(me.StartSoftwareDownload) | me.AK)
50 DownloadSectionRequestType = MessageType(me.DownloadSection) // me.AR is optional
51 DownloadSectionRequestWithResponseType = MessageType(byte(me.DownloadSection) | me.AR)
52 DownloadSectionResponseType = MessageType(byte(me.DownloadSection) | me.AK)
53 EndSoftwareDownloadRequestType = MessageType(byte(me.EndSoftwareDownload) | me.AR)
54 EndSoftwareDownloadResponseType = MessageType(byte(me.EndSoftwareDownload) | me.AK)
55 ActivateSoftwareRequestType = MessageType(byte(me.ActivateSoftware) | me.AR)
56 ActivateSoftwareResponseType = MessageType(byte(me.ActivateSoftware) | me.AK)
57 CommitSoftwareRequestType = MessageType(byte(me.CommitSoftware) | me.AR)
58 CommitSoftwareResponseType = MessageType(byte(me.CommitSoftware) | me.AK)
59 SynchronizeTimeRequestType = MessageType(byte(me.SynchronizeTime) | me.AR)
60 SynchronizeTimeResponseType = MessageType(byte(me.SynchronizeTime) | me.AK)
61 RebootRequestType = MessageType(byte(me.Reboot) | me.AR)
62 RebootResponseType = MessageType(byte(me.Reboot) | me.AK)
63 GetNextRequestType = MessageType(byte(me.GetNext) | me.AR)
64 GetNextResponseType = MessageType(byte(me.GetNext) | me.AK)
65 GetCurrentDataRequestType = MessageType(byte(me.GetCurrentData) | me.AR)
66 GetCurrentDataResponseType = MessageType(byte(me.GetCurrentData) | me.AK)
67 SetTableRequestType = MessageType(byte(me.SetTable) | me.AR)
68 SetTableResponseType = MessageType(byte(me.SetTable) | me.AK)
Chip Bolingd8637b02021-04-29 08:36:38 -050069
Chip Boling6e27b352020-02-14 09:10:01 -060070 // Autonomous ONU messages
Chip Boling610117d2021-09-09 11:24:34 -050071
72 AlarmNotificationType = MessageType(me.AlarmNotification)
73 AttributeValueChangeType = MessageType(me.AttributeValueChange)
74 TestResultType = MessageType(me.TestResult)
Chip Boling157c9b92021-04-21 09:58:36 -050075
76 // Support mapping of extended format types (use MSB reserved bit)
Chip Boling610117d2021-09-09 11:24:34 -050077
Chip Boling157c9b92021-04-21 09:58:36 -050078 ExtendedTypeDecodeOffset = MessageType(byte(0x80))
Chip Boling6e27b352020-02-14 09:10:01 -060079)
80
81func (mt MessageType) String() string {
82 switch mt {
83 default:
84 return "Unknown"
85
86 case CreateRequestType:
87 return "Create Request"
88 case CreateResponseType:
89 return "Create Response"
90 case DeleteRequestType:
91 return "Delete Request"
92 case DeleteResponseType:
93 return "Delete Response"
94 case SetRequestType:
95 return "Set Request"
96 case SetResponseType:
97 return "Set Response"
98 case GetRequestType:
99 return "Get Request"
100 case GetResponseType:
101 return "Get Response"
102 case GetAllAlarmsRequestType:
103 return "Get All Alarms Request"
104 case GetAllAlarmsResponseType:
105 return "Get All Alarms Response"
106 case GetAllAlarmsNextRequestType:
107 return "Get All Alarms Next Request"
108 case GetAllAlarmsNextResponseType:
109 return "Get All Alarms Next Response"
110 case MibUploadRequestType:
111 return "MIB Upload Request"
112 case MibUploadResponseType:
113 return "MIB Upload Response"
114 case MibUploadNextRequestType:
115 return "MIB Upload Next Request"
116 case MibUploadNextResponseType:
117 return "MIB Upload Next Response"
118 case MibResetRequestType:
119 return "MIB Reset Request"
120 case MibResetResponseType:
121 return "MIB Reset Response"
122 case TestRequestType:
123 return "Test Request"
124 case TestResponseType:
125 return "Test Response"
126 case StartSoftwareDownloadRequestType:
127 return "Start Software Download Request"
128 case StartSoftwareDownloadResponseType:
129 return "Start Software Download Response"
Chip Boling157c9b92021-04-21 09:58:36 -0500130 case DownloadSectionRequestType, DownloadSectionRequestWithResponseType:
Chip Boling6e27b352020-02-14 09:10:01 -0600131 return "Download Section Request"
132 case DownloadSectionResponseType:
133 return "Download Section Response"
134 case EndSoftwareDownloadRequestType:
135 return "End Software Download Request"
136 case EndSoftwareDownloadResponseType:
137 return "End Software Download Response"
138 case ActivateSoftwareRequestType:
139 return "Activate Software Request"
140 case ActivateSoftwareResponseType:
141 return "Activate Software Response"
142 case CommitSoftwareRequestType:
143 return "Commit Software Request"
144 case CommitSoftwareResponseType:
145 return "Commit Software Response"
146 case SynchronizeTimeRequestType:
147 return "Synchronize Time Request"
148 case SynchronizeTimeResponseType:
149 return "Synchronize Time Response"
150 case RebootRequestType:
151 return "Reboot Request"
152 case RebootResponseType:
153 return "Reboot Response"
154 case GetNextRequestType:
155 return "Get Next Request"
156 case GetNextResponseType:
157 return "Get Next Response"
158 case GetCurrentDataRequestType:
159 return "Get Current Data Request"
160 case GetCurrentDataResponseType:
161 return "Get Current Data Response"
162 case SetTableRequestType:
163 return "Set Table Request"
164 case SetTableResponseType:
165 return "Set Table Response"
166 case AlarmNotificationType:
167 return "Alarm Notification"
168 case AttributeValueChangeType:
169 return "Attribute Value Change"
170 case TestResultType:
171 return "Test Result"
172 }
173}