Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) |
Andrea Campanella | 7167ebb | 2020-02-24 09:56:38 +0100 | [diff] [blame] | 3 | * Copyright 2020-present Open Networking Foundation |
| 4 | |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 5 | * 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 Campanella | 7167ebb | 2020-02-24 09:56:38 +0100 | [diff] [blame] | 8 | |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Andrea Campanella | 7167ebb | 2020-02-24 09:56:38 +0100 | [diff] [blame] | 10 | |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 11 | * 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 Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | package omci |
| 19 | |
| 20 | import ( |
Chip Boling | 34ebcb6 | 2021-02-02 12:13:58 -0600 | [diff] [blame] | 21 | me "github.com/opencord/omci-lib-go/generated" |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 22 | ) |
| 23 | |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 24 | // MessageType is the OMCI Message Type combined with the AR/AK flags as appropriate. |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 25 | type MessageType byte |
| 26 | |
| 27 | const ( |
Chip Boling | 8c8018e | 2021-02-22 15:56:00 -0600 | [diff] [blame] | 28 | 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 Boling | d8637b0 | 2021-04-29 08:36:38 -0500 | [diff] [blame] | 69 | |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 70 | // Autonomous ONU messages |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 71 | |
| 72 | AlarmNotificationType = MessageType(me.AlarmNotification) |
| 73 | AttributeValueChangeType = MessageType(me.AttributeValueChange) |
| 74 | TestResultType = MessageType(me.TestResult) |
Chip Boling | 157c9b9 | 2021-04-21 09:58:36 -0500 | [diff] [blame] | 75 | |
| 76 | // Support mapping of extended format types (use MSB reserved bit) |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 77 | |
Chip Boling | 157c9b9 | 2021-04-21 09:58:36 -0500 | [diff] [blame] | 78 | ExtendedTypeDecodeOffset = MessageType(byte(0x80)) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 79 | ) |
| 80 | |
| 81 | func (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 Boling | 157c9b9 | 2021-04-21 09:58:36 -0500 | [diff] [blame] | 130 | case DownloadSectionRequestType, DownloadSectionRequestWithResponseType: |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 131 | 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 | } |