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. |
| 16 | */ |
Chip Boling | 2c046fa | 2021-02-23 11:30:29 -0600 | [diff] [blame] | 17 | /* |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 18 | * NOTE: This file was generated, manual edits will be overwritten! |
| 19 | * |
| 20 | * Generated by 'goCodeGenerator.py': |
| 21 | * https://github.com/cboling/OMCI-parser/README.md |
| 22 | */ |
| 23 | |
| 24 | package generated |
| 25 | |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 26 | // ManagedEntityInfo provides ManagedEntity information |
| 27 | type ManagedEntityInfo struct { |
| 28 | New func(params ...ParamData) (*ManagedEntity, error) |
| 29 | } |
| 30 | |
| 31 | // ParamData can be passed to the 'New' function to dictate how the returned |
| 32 | // Managed Entity is created. You should supply either zero or one ParamData |
| 33 | // structure to 'New'. |
| 34 | // |
| 35 | // If No ParamData is passed, the returned Managed Entity can only be used for |
| 36 | // providing validation of other structures. This is commonly done in a packet |
| 37 | // encoder/decoder to assist in that process. |
| 38 | // |
| 39 | // If One ParamData is passed, the returned Managed Entity will be initialized |
| 40 | // with the given values/attributes and then validated. This is commonly done |
| 41 | // when you wish to create an ME for transmission, storage or removal from a |
| 42 | // persistent database, or some other similar purpose. |
| 43 | // |
| 44 | type ParamData struct { |
| 45 | EntityID uint16 |
| 46 | Attributes AttributeValueMap |
| 47 | } |
| 48 | |
| 49 | // CreateME wraps a function that makes it a creator of a Managed Entity |
| 50 | type CreateME func(params ...ParamData) (*ManagedEntity, OmciErrors) |
| 51 | |
| 52 | var classToManagedEntityMap map[ClassID]CreateME |
| 53 | |
| 54 | func init() { |
| 55 | // Create mapping of 16-bit managed entity class IDs to ME-type |
Chip Boling | 2c046fa | 2021-02-23 11:30:29 -0600 | [diff] [blame] | 56 | classToManagedEntityMap = make(map[ClassID]CreateME, 179) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 57 | |
| 58 | classToManagedEntityMap[2] = NewOnuData |
| 59 | classToManagedEntityMap[5] = NewCardholder |
| 60 | classToManagedEntityMap[6] = NewCircuitPack |
| 61 | classToManagedEntityMap[7] = NewSoftwareImage |
| 62 | classToManagedEntityMap[11] = NewPhysicalPathTerminationPointEthernetUni |
| 63 | classToManagedEntityMap[12] = NewPhysicalPathTerminationPointCesUni |
| 64 | classToManagedEntityMap[14] = NewInterworkingVccTerminationPoint |
| 65 | classToManagedEntityMap[16] = NewAal5Profile |
| 66 | classToManagedEntityMap[18] = NewAal5PerformanceMonitoringHistoryData |
| 67 | classToManagedEntityMap[21] = NewCesServiceProfile |
| 68 | classToManagedEntityMap[24] = NewEthernetPerformanceMonitoringHistoryData |
| 69 | classToManagedEntityMap[45] = NewMacBridgeServiceProfile |
| 70 | classToManagedEntityMap[46] = NewMacBridgeConfigurationData |
| 71 | classToManagedEntityMap[47] = NewMacBridgePortConfigurationData |
| 72 | classToManagedEntityMap[48] = NewMacBridgePortDesignationData |
| 73 | classToManagedEntityMap[49] = NewMacBridgePortFilterTableData |
| 74 | classToManagedEntityMap[50] = NewMacBridgePortBridgeTableData |
| 75 | classToManagedEntityMap[51] = NewMacBridgePerformanceMonitoringHistoryData |
| 76 | classToManagedEntityMap[52] = NewMacBridgePortPerformanceMonitoringHistoryData |
| 77 | classToManagedEntityMap[53] = NewPhysicalPathTerminationPointPotsUni |
| 78 | classToManagedEntityMap[58] = NewVoiceServiceProfile |
| 79 | classToManagedEntityMap[62] = NewVpPerformanceMonitoringHistoryData |
| 80 | classToManagedEntityMap[78] = NewVlanTaggingOperationConfigurationData |
| 81 | classToManagedEntityMap[79] = NewMacBridgePortFilterPreAssignTable |
| 82 | classToManagedEntityMap[82] = NewPhysicalPathTerminationPointVideoUni |
| 83 | classToManagedEntityMap[83] = NewPhysicalPathTerminationPointLctUni |
| 84 | classToManagedEntityMap[84] = NewVlanTaggingFilterData |
| 85 | classToManagedEntityMap[89] = NewEthernetPerformanceMonitoringHistoryData2 |
| 86 | classToManagedEntityMap[90] = NewPhysicalPathTerminationPointVideoAni |
| 87 | classToManagedEntityMap[98] = NewPhysicalPathTerminationPointXdslUniPart1 |
| 88 | classToManagedEntityMap[99] = NewPhysicalPathTerminationPointXdslUniPart2 |
| 89 | classToManagedEntityMap[100] = NewXdslLineInventoryAndStatusDataPart1 |
| 90 | classToManagedEntityMap[101] = NewXdslLineInventoryAndStatusDataPart2 |
| 91 | classToManagedEntityMap[102] = NewXdslChannelDownstreamStatusData |
| 92 | classToManagedEntityMap[103] = NewXdslChannelUpstreamStatusData |
| 93 | classToManagedEntityMap[105] = NewXdslLineConfigurationProfilePart2 |
| 94 | classToManagedEntityMap[106] = NewXdslLineConfigurationProfilePart3 |
| 95 | classToManagedEntityMap[107] = NewXdslChannelConfigurationProfile |
| 96 | classToManagedEntityMap[108] = NewXdslSubcarrierMaskingDownstreamProfile |
| 97 | classToManagedEntityMap[109] = NewXdslSubcarrierMaskingUpstreamProfile |
| 98 | classToManagedEntityMap[110] = NewXdslPsdMaskProfile |
| 99 | classToManagedEntityMap[111] = NewXdslDownstreamRfiBandsProfile |
| 100 | classToManagedEntityMap[112] = NewXdslXtuCPerformanceMonitoringHistoryData |
| 101 | classToManagedEntityMap[113] = NewXdslXtuRPerformanceMonitoringHistoryData |
| 102 | classToManagedEntityMap[114] = NewXdslXtuCChannelPerformanceMonitoringHistoryData |
| 103 | classToManagedEntityMap[115] = NewXdslXtuRChannelPerformanceMonitoringHistoryData |
| 104 | classToManagedEntityMap[116] = NewTcAdaptorPerformanceMonitoringHistoryDataXdsl |
| 105 | classToManagedEntityMap[130] = NewIeee8021PMapperServiceProfile |
| 106 | classToManagedEntityMap[131] = NewOltG |
| 107 | classToManagedEntityMap[133] = NewOnuPowerShedding |
| 108 | classToManagedEntityMap[134] = NewIpHostConfigData |
| 109 | classToManagedEntityMap[135] = NewIpHostPerformanceMonitoringHistoryData |
| 110 | classToManagedEntityMap[136] = NewTcpUdpConfigData |
| 111 | classToManagedEntityMap[137] = NewNetworkAddress |
| 112 | classToManagedEntityMap[138] = NewVoipConfigData |
| 113 | classToManagedEntityMap[139] = NewVoipVoiceCtp |
| 114 | classToManagedEntityMap[140] = NewCallControlPerformanceMonitoringHistoryData |
| 115 | classToManagedEntityMap[141] = NewVoipLineStatus |
| 116 | classToManagedEntityMap[142] = NewVoipMediaProfile |
| 117 | classToManagedEntityMap[143] = NewRtpProfileData |
| 118 | classToManagedEntityMap[144] = NewRtpPerformanceMonitoringHistoryData |
| 119 | classToManagedEntityMap[145] = NewNetworkDialPlanTable |
| 120 | classToManagedEntityMap[146] = NewVoipApplicationServiceProfile |
| 121 | classToManagedEntityMap[147] = NewVoipFeatureAccessCodes |
| 122 | classToManagedEntityMap[148] = NewAuthenticationSecurityMethod |
| 123 | classToManagedEntityMap[150] = NewSipAgentConfigData |
| 124 | classToManagedEntityMap[151] = NewSipAgentPerformanceMonitoringHistoryData |
| 125 | classToManagedEntityMap[152] = NewSipCallInitiationPerformanceMonitoringHistoryData |
| 126 | classToManagedEntityMap[153] = NewSipUserData |
| 127 | classToManagedEntityMap[155] = NewMgcConfigData |
| 128 | classToManagedEntityMap[156] = NewMgcPerformanceMonitoringHistoryData |
| 129 | classToManagedEntityMap[160] = NewEquipmentExtensionPackage |
| 130 | classToManagedEntityMap[162] = NewPhysicalPathTerminationPointMocaUni |
| 131 | classToManagedEntityMap[163] = NewMocaEthernetPerformanceMonitoringHistoryData |
| 132 | classToManagedEntityMap[168] = NewVdsl2LineInventoryAndStatusDataPart1 |
| 133 | classToManagedEntityMap[169] = NewVdsl2LineInventoryAndStatusDataPart2 |
| 134 | classToManagedEntityMap[170] = NewVdsl2LineInventoryAndStatusDataPart3 |
| 135 | classToManagedEntityMap[171] = NewExtendedVlanTaggingOperationConfigurationData |
| 136 | classToManagedEntityMap[256] = NewOnuG |
| 137 | classToManagedEntityMap[257] = NewOnu2G |
| 138 | classToManagedEntityMap[262] = NewTCont |
| 139 | classToManagedEntityMap[263] = NewAniG |
| 140 | classToManagedEntityMap[264] = NewUniG |
| 141 | classToManagedEntityMap[266] = NewGemInterworkingTerminationPoint |
| 142 | classToManagedEntityMap[268] = NewGemPortNetworkCtp |
| 143 | classToManagedEntityMap[269] = NewVpNetworkCtp |
| 144 | classToManagedEntityMap[272] = NewGalEthernetProfile |
| 145 | classToManagedEntityMap[273] = NewThresholdData1 |
| 146 | classToManagedEntityMap[274] = NewThresholdData2 |
| 147 | classToManagedEntityMap[276] = NewGalEthernetPerformanceMonitoringHistoryData |
| 148 | classToManagedEntityMap[277] = NewPriorityQueue |
| 149 | classToManagedEntityMap[278] = NewTrafficScheduler |
| 150 | classToManagedEntityMap[280] = NewTrafficDescriptor |
| 151 | classToManagedEntityMap[281] = NewMulticastGemInterworkingTerminationPoint |
| 152 | classToManagedEntityMap[282] = NewPseudowireTerminationPoint |
| 153 | classToManagedEntityMap[283] = NewRtpPseudowireParameters |
| 154 | classToManagedEntityMap[284] = NewPseudowireMaintenanceProfile |
| 155 | classToManagedEntityMap[285] = NewPseudowirePerformanceMonitoringHistoryData |
| 156 | classToManagedEntityMap[286] = NewEthernetFlowTerminationPoint |
| 157 | classToManagedEntityMap[287] = NewOmci |
| 158 | classToManagedEntityMap[288] = NewManagedEntityMe |
| 159 | classToManagedEntityMap[289] = NewAttributeMe |
| 160 | classToManagedEntityMap[290] = NewDot1XPortExtensionPackage |
| 161 | classToManagedEntityMap[291] = NewDot1XConfigurationProfile |
| 162 | classToManagedEntityMap[292] = NewDot1XPerformanceMonitoringHistoryData |
| 163 | classToManagedEntityMap[293] = NewRadiusPerformanceMonitoringHistoryData |
| 164 | classToManagedEntityMap[296] = NewEthernetPerformanceMonitoringHistoryData3 |
| 165 | classToManagedEntityMap[298] = NewDot1RateLimiter |
| 166 | classToManagedEntityMap[299] = NewDot1AgMaintenanceDomain |
| 167 | classToManagedEntityMap[300] = NewDot1AgMaintenanceAssociation |
| 168 | classToManagedEntityMap[301] = NewDot1AgDefaultMdLevel |
| 169 | classToManagedEntityMap[302] = NewDot1AgMep |
| 170 | classToManagedEntityMap[305] = NewDot1AgCfmStack |
| 171 | classToManagedEntityMap[306] = NewDot1AgChassisManagementInfo |
| 172 | classToManagedEntityMap[307] = NewOctetString |
Chip Boling | 2c046fa | 2021-02-23 11:30:29 -0600 | [diff] [blame] | 173 | classToManagedEntityMap[308] = NewGeneralPurposeBuffer |
ozgecanetsia | 68a475b | 2020-05-21 17:03:12 +0300 | [diff] [blame] | 174 | classToManagedEntityMap[309] = NewMulticastOperationsProfile |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 175 | classToManagedEntityMap[310] = NewMulticastSubscriberConfigInfo |
| 176 | classToManagedEntityMap[311] = NewMulticastSubscriberMonitor |
Chip Boling | 2c046fa | 2021-02-23 11:30:29 -0600 | [diff] [blame] | 177 | classToManagedEntityMap[312] = NewFecPerformanceMonitoringHistoryData |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 178 | classToManagedEntityMap[313] = NewReAniG |
| 179 | classToManagedEntityMap[314] = NewPhysicalPathTerminationPointReUni |
| 180 | classToManagedEntityMap[315] = NewReUpstreamAmplifier |
| 181 | classToManagedEntityMap[316] = NewReDownstreamAmplifier |
| 182 | classToManagedEntityMap[321] = NewEthernetFramePerformanceMonitoringHistoryDataDownstream |
| 183 | classToManagedEntityMap[322] = NewEthernetFramePerformanceMonitoringHistoryDataUpstream |
| 184 | classToManagedEntityMap[323] = NewVdsl2LineConfigurationExtensions2 |
| 185 | classToManagedEntityMap[324] = NewXdslImpulseNoiseMonitorPerformanceMonitoringHistoryData |
| 186 | classToManagedEntityMap[325] = NewXdslLineInventoryAndStatusDataPart5 |
| 187 | classToManagedEntityMap[328] = NewReCommonAmplifierParameters |
| 188 | classToManagedEntityMap[329] = NewVirtualEthernetInterfacePoint |
| 189 | classToManagedEntityMap[332] = NewEnhancedSecurityControl |
| 190 | classToManagedEntityMap[333] = NewMplsPseudowireTerminationPoint |
| 191 | classToManagedEntityMap[334] = NewEthernetFrameExtendedPm |
| 192 | classToManagedEntityMap[335] = NewSnmpConfigurationData |
| 193 | classToManagedEntityMap[336] = NewOnuDynamicPowerManagementControl |
| 194 | classToManagedEntityMap[337] = NewPwAtmConfigurationData |
| 195 | classToManagedEntityMap[338] = NewPwAtmPerformanceMonitoringHistoryData |
| 196 | classToManagedEntityMap[339] = NewPwEthernetConfigurationData |
| 197 | classToManagedEntityMap[340] = NewBbfTr069ManagementServer |
| 198 | classToManagedEntityMap[341] = NewGemPortNetworkCtpPerformanceMonitoringHistoryData |
| 199 | classToManagedEntityMap[342] = NewTcpUdpPerformanceMonitoringHistoryData |
| 200 | classToManagedEntityMap[343] = NewEnergyConsumptionPerformanceMonitoringHistoryData |
| 201 | classToManagedEntityMap[344] = NewXgPonTcPerformanceMonitoringHistoryData |
| 202 | classToManagedEntityMap[345] = NewXgPonDownstreamManagementPerformanceMonitoringHistoryData |
| 203 | classToManagedEntityMap[346] = NewXgPonUpstreamManagementPerformanceMonitoringHistoryData |
| 204 | classToManagedEntityMap[348] = NewMacBridgePortIcmpv6ProcessPreAssignTable |
| 205 | classToManagedEntityMap[400] = NewEthernetPseudowireParameters |
| 206 | classToManagedEntityMap[408] = NewXdslXtuCPerformanceMonitoringHistoryDataPart2 |
| 207 | classToManagedEntityMap[410] = NewVdsl2LineConfigurationExtensions3 |
| 208 | classToManagedEntityMap[412] = NewXdslChannelConfigurationProfilePart2 |
| 209 | classToManagedEntityMap[413] = NewXtuDataGatheringConfiguration |
| 210 | classToManagedEntityMap[414] = NewXdslLineInventoryAndStatusDataPart8 |
| 211 | classToManagedEntityMap[419] = NewEfmBondingGroup |
| 212 | classToManagedEntityMap[420] = NewEfmBondingLink |
| 213 | classToManagedEntityMap[421] = NewEfmBondingGroupPerformanceMonitoringHistoryData |
| 214 | classToManagedEntityMap[422] = NewEfmBondingGroupPerformanceMonitoringHistoryDataPart2 |
| 215 | classToManagedEntityMap[423] = NewEfmBondingLinkPerformanceMonitoringHistoryData |
| 216 | classToManagedEntityMap[424] = NewEfmBondingPortPerformanceMonitoringHistoryData |
| 217 | classToManagedEntityMap[425] = NewEfmBondingPortPerformanceMonitoringHistoryDataPart2 |
| 218 | classToManagedEntityMap[426] = NewEthernetFrameExtendedPm64Bit |
| 219 | classToManagedEntityMap[432] = NewFastChannelConfigurationProfile |
| 220 | classToManagedEntityMap[433] = NewFastDataPathConfigurationProfile |
| 221 | classToManagedEntityMap[434] = NewFastVectoringLineConfigurationExtensions |
| 222 | classToManagedEntityMap[436] = NewFastLineInventoryAndStatusDataPart2 |
| 223 | classToManagedEntityMap[437] = NewFastXtuCPerformanceMonitoringHistoryData |
| 224 | classToManagedEntityMap[438] = NewFastXtuRPerformanceMonitoringHistoryData |
| 225 | classToManagedEntityMap[443] = NewTwdmChannelManagedEntity |
| 226 | classToManagedEntityMap[444] = NewTwdmChannelPhyLodsPerformanceMonitoringHistoryData |
| 227 | classToManagedEntityMap[445] = NewTwdmChannelXgemPerformanceMonitoringHistoryData |
| 228 | classToManagedEntityMap[446] = NewTwdmChannelPloamPerformanceMonitoringHistoryDataPart1 |
| 229 | classToManagedEntityMap[447] = NewTwdmChannelPloamPerformanceMonitoringHistoryDataPart2 |
| 230 | classToManagedEntityMap[448] = NewTwdmChannelPloamPerformanceMonitoringHistoryDataPart3 |
| 231 | classToManagedEntityMap[449] = NewTwdmChannelTuningPerformanceMonitoringHistoryDataPart1 |
| 232 | classToManagedEntityMap[450] = NewTwdmChannelTuningPerformanceMonitoringHistoryDataPart2 |
| 233 | classToManagedEntityMap[451] = NewTwdmChannelTuningPerformanceMonitoringHistoryDataPart3 |
| 234 | classToManagedEntityMap[452] = NewTwdmChannelOmciPerformanceMonitoringHistoryData |
| 235 | classToManagedEntityMap[453] = NewEnhancedFecPerformanceMonitoringHistoryData |
| 236 | classToManagedEntityMap[454] = NewEnhancedTcPerformanceMonitoringHistoryData |
| 237 | } |
| 238 | |
| 239 | // LoadManagedEntityDefinition returns a function to create a Managed Entity for a specific |
| 240 | // Managed Entity class ID |
| 241 | func LoadManagedEntityDefinition(classID ClassID, params ...ParamData) (*ManagedEntity, OmciErrors) { |
Chip Boling | 8a5379a | 2020-11-17 12:59:40 -0600 | [diff] [blame] | 242 | if newFunc, ok := classToManagedEntityMap[classID]; ok { |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 243 | return newFunc(params...) |
| 244 | } |
Chip Boling | 8a5379a | 2020-11-17 12:59:40 -0600 | [diff] [blame] | 245 | if IsVendorSpecificClassID(classID) { |
| 246 | return NewUnknownVendorSpecificME(classID, params...) |
| 247 | } |
| 248 | return NewUnknownG988ME(classID, params...) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | // GetSupportedClassIDs returns an array of Managed Entity Class IDs supported |
| 252 | func GetSupportedClassIDs() []ClassID { |
| 253 | supported := make([]ClassID, 0, len(classToManagedEntityMap)) |
| 254 | for k := range classToManagedEntityMap { |
| 255 | supported = append(supported, k) |
| 256 | } |
| 257 | return supported |
| 258 | } |
| 259 | |
| 260 | // GetAttributesDefinitions returns the attribute definition map for a specific class |
| 261 | func GetAttributesDefinitions(classID ClassID) (AttributeDefinitionMap, OmciErrors) { |
| 262 | medef, err := LoadManagedEntityDefinition(classID) |
| 263 | if err.StatusCode() != Success { |
| 264 | return nil, err |
| 265 | } |
| 266 | return medef.GetAttributeDefinitions(), err |
| 267 | } |
Chip Boling | 8a5379a | 2020-11-17 12:59:40 -0600 | [diff] [blame] | 268 | |
| 269 | // IsVendorSpecificClassID returns true if the provided class ID is reserved in ITU-T G.988 |
| 270 | // for vendor specific functionality |
| 271 | func IsVendorSpecificClassID(classID ClassID) bool { |
| 272 | // Values below are from Table 11.2.4-1 of ITU-T G.988 (11/2017) |
| 273 | return (ClassID(240) <= classID && classID <= ClassID(255)) || |
| 274 | (ClassID(350) <= classID && classID <= ClassID(399)) || |
| 275 | (ClassID(65280) <= classID && classID <= ClassID(65535)) |
David K. Bainbridge | adf422d | 2021-04-09 16:06:41 +0000 | [diff] [blame] | 276 | } |