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 | 34ebcb6 | 2021-02-02 12:13:58 -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 | |
| 26 | import "github.com/deckarep/golang-set" |
| 27 | |
| 28 | // CardholderClassID is the 16-bit ID for the OMCI |
| 29 | // Managed entity Cardholder |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 30 | const CardholderClassID = ClassID(5) // 0x0005 |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 31 | |
| 32 | var cardholderBME *ManagedEntityDefinition |
| 33 | |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 34 | // Cardholder (Class ID: #5 / 0x0005) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 35 | // The cardholder represents the fixed equipment slot configuration of the ONU. Each cardholder can |
| 36 | // contain 0 or 1 circuit packs; the circuit pack models equipment information that can change over |
| 37 | // the lifetime of the ONU, e.g., through replacement. |
| 38 | // |
| 39 | // One instance of this ME exists for each physical slot in an ONU that has pluggable circuit |
| 40 | // packs. One or more instances of this ME may also exist in an integrated ONU, to represent |
| 41 | // virtual slots. Instances of this ME are created automatically by the ONU, and the status |
| 42 | // attributes are populated according to data within the ONU itself. |
| 43 | // |
| 44 | // Slot 0 is intended to be used only in an integrated ONU. If an integrated ONU is modelled with a |
| 45 | // universal slot 0, it is recommended that it does not contain additional (non-zero) virtual |
| 46 | // slots. A cardholder for virtual slot 0 is recommended. |
| 47 | // |
| 48 | // There is potential for conflict in the semantics of the expected plug-in unit type, the expected |
| 49 | // port count and the expected equipment ID, both when the slot is not populated and when a new |
| 50 | // circuit pack is inserted. The expected plug-in unit type and the plug-in type mismatch alarm are |
| 51 | // mandatory, although plug-and-play/unknown (circuit pack type 255) may be used as a way to |
| 52 | // minimize their significance. It is recommended that an ONU deny the provisioning of inconsistent |
| 53 | // combinations of expected equipment attributes. |
| 54 | // |
| 55 | // When a circuit pack is plugged into a cardholder or when a cardholder is pre-provisioned to |
| 56 | // expect a circuit pack of a given type, it may trigger the ONU to instantiate a number of MEs and |
| 57 | // update the values of others, depending on the circuit pack type. The ONU may also delete a |
| 58 | // variety of other MEs when a circuit pack is reprovisioned to not expect a circuit pack or to |
| 59 | // expect a circuit pack of a different type. These actions are described in the definitions of the |
| 60 | // various MEs. |
| 61 | // |
| 62 | // Expected equipment ID and expected port count are alternate ways to trigger the same |
| 63 | // preprovisioning effects. These tools may be useful if an ONU is prepared to accept more than one |
| 64 | // circuit pack of a given type but with different port counts, or if a circuit pack is a hybrid |
| 65 | // that matches none of the types in Table 9.1.5-1, but whose identification (e.g., part number) is |
| 66 | // known. |
| 67 | // |
| 68 | // Relationships |
| 69 | // An ONU may contain zero or more instances of the cardholder, each of which may contain an |
| 70 | // instance of the circuit pack ME. The slot ID, real or virtual, is a fundamental identification |
| 71 | // mechanism for MEs that bear some relationship to a physical location. |
| 72 | // |
| 73 | // Attributes |
| 74 | // Managed Entity Id |
| 75 | // NOTE 1 - Some xDSL MEs use the two MSBs of the slot number for other purposes. An ONU that |
| 76 | // supports these services may have slot limitations or restrictions. |
| 77 | // |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 78 | // This attribute uniquely identifies each instance of this ME. The ONU sets the first byte of this |
| 79 | // 2-byte identifier to: |
| 80 | // |
| 81 | // 0 if the ONU contains pluggable equipment modules |
| 82 | // |
| 83 | // 1 if the ONU is a single piece of integrated equipment. |
| 84 | // |
| 85 | // The second byte of this identifier is the slot number. In integrated ONUs, this byte may be used |
| 86 | // as a virtual slot or set to 0 to indicate a universal pseudoslot. |
| 87 | // |
| 88 | // Slot numbering schemes differ among vendors. It is only required that slot numbers be unique |
| 89 | // across the ONU. Up to 254 equipment slots are supported in the range 1..254 (Note 1). The value |
| 90 | // 0 is reserved for possible use in an integrated ONU to indicate a universal pseudo-slot. The |
| 91 | // value 255 is also reserved. (R) (mandatory) (2-bytes) |
| 92 | // |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 93 | // Actual Plug In Unit Type |
| 94 | // Actual plugin unit type: This attribute is equal to the type of the circuit pack in the |
| 95 | // cardholder, or 0 if the cardholder is empty. When the cardholder is populated, this attribute is |
| 96 | // the same as the type attribute of the corresponding circuit pack ME. Circuit pack types are |
| 97 | // defined in Table 9.1.5-1. (R) (mandatory) (1-byte) |
| 98 | // |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 99 | // The three following attributes permit the OLT to specify its intentions for any future equipped |
| 100 | // configuration of a slot. Once some or all of these are set, the ONU can proceed to instantiate |
| 101 | // circuit pack and PPTP MEs, along with other predeterminable MEs, and allow the OLT to create |
| 102 | // related discretionary MEs, thereby supporting service pre-provisioning. |
| 103 | // |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 104 | // Expected Plug_In Unit Type |
| 105 | // Expected plug-in unit type: This attribute provisions the type of circuit pack for the slot. For |
| 106 | // type coding, see Table 9.1.5-1. The value 0 means that the cardholder is not provisioned to |
| 107 | // contain a circuit pack. The value 255 means that the cardholder is configured for plug-and-play. |
| 108 | // Upon ME instantiation, the ONU sets this attribute to 0. For integrated interfaces, this |
| 109 | // attribute may be used to represent the type of interface. (R,-W) (mandatory) (1-byte) |
| 110 | // |
| 111 | // Expected Port Count |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 112 | // This attribute permits the OLT to specify the number of ports it expects in a circuit pack. |
| 113 | // Prior to provisioning by the OLT, the ONU initializes this attribute to 0. (R,-W) (optional) |
| 114 | // (1-byte) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 115 | // |
| 116 | // Expected Equipment Id |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 117 | // This attribute provisions the specific type of expected circuit pack. This attribute applies |
| 118 | // only to ONUs that do not have integrated interfaces. In some environments, this may contain the |
| 119 | // expected CLEI code. Upon ME instantiation, the ONU sets this attribute to all spaces. (R,-W) |
| 120 | // (optional) (20-bytes) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 121 | // |
| 122 | // Actual Equipment Id |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 123 | // This attribute identifies the specific type of circuit pack, once it is installed. This |
| 124 | // attribute applies only to ONUs that do not have integrated interfaces. In some environments, |
| 125 | // this may include the CLEI code. When the slot is empty or the equipment ID is not known, this |
| 126 | // attribute should be set to all spaces. (R) (optional) (20-bytes) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 127 | // |
| 128 | // Protection Profile Pointer |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 129 | // This attribute specifies an equipment protection profile that may be associated with the |
| 130 | // cardholder. Its value is the least significant byte of the ME ID of the equipment protection |
| 131 | // profile with which it is associated, or 0 if equipment protection is not used. (R) (optional) |
| 132 | // (1-byte) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 133 | // |
| 134 | // Invoke Protection Switch |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 135 | // The OLT may use this attribute to control equipment protection switching. Code points have the |
| 136 | // following meaning when set by the OLT: |
| 137 | // |
| 138 | // 0 Release protection switch |
| 139 | // |
| 140 | // 1 Operate protection switch, protect cardholder unspecified |
| 141 | // |
| 142 | // 2 Operate protection switch, use first protect cardholder |
| 143 | // |
| 144 | // 3 Operate protection switch, use second protect cardholder |
| 145 | // |
| 146 | // The ONU should deny attempts to switch to an unequipped, defective or already active protection |
| 147 | // cardholder. |
| 148 | // |
| 149 | // Upon the get action from the OLT, this attribute should return the current value of the actual |
| 150 | // protection configuration. Code points are as defined above; the value 1 is never returned. |
| 151 | // |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 152 | // When circuit packs that support a PON interface (IF) function are switched, the response should |
| 153 | // be returned on the same PON that received the command. However, the OLT should also be prepared |
| 154 | // to accept a response on the redundant PON. (R,-W) (optional) (1-byte) |
| 155 | // |
| 156 | // Alarm _ Reporting Control |
| 157 | // Alarm-reporting control (ARC): See clause A.1.4.3. (R,-W) (optional) (1-byte) |
| 158 | // |
| 159 | // Arc Interval |
Chip Boling | 610117d | 2021-09-09 11:24:34 -0500 | [diff] [blame] | 160 | // See clause A.1.4.3. (R,-W) (optional) (1-byte) |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 161 | // |
| 162 | type Cardholder struct { |
| 163 | ManagedEntityDefinition |
| 164 | Attributes AttributeValueMap |
| 165 | } |
| 166 | |
| 167 | func init() { |
| 168 | cardholderBME = &ManagedEntityDefinition{ |
| 169 | Name: "Cardholder", |
| 170 | ClassID: 5, |
| 171 | MessageTypes: mapset.NewSetWith( |
| 172 | Get, |
| 173 | Set, |
| 174 | ), |
| 175 | AllowedAttributeMask: 0xff80, |
| 176 | AttributeDefinitions: AttributeDefinitionMap{ |
| 177 | 0: Uint16Field("ManagedEntityId", PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read), false, false, false, 0), |
| 178 | 1: ByteField("ActualPlugInUnitType", EnumerationAttributeType, 0x8000, 0, mapset.NewSetWith(Read), true, false, false, 1), |
| 179 | 2: ByteField("ExpectedPlugInUnitType", EnumerationAttributeType, 0x4000, 0, mapset.NewSetWith(Read, Write), false, false, false, 2), |
| 180 | 3: ByteField("ExpectedPortCount", UnsignedIntegerAttributeType, 0x2000, 0, mapset.NewSetWith(Read, Write), false, true, false, 3), |
| 181 | 4: MultiByteField("ExpectedEquipmentId", StringAttributeType, 0x1000, 20, toOctets("ICAgICAgICAgICAgICAgICAgICA="), mapset.NewSetWith(Read, Write), false, true, false, 4), |
| 182 | 5: MultiByteField("ActualEquipmentId", StringAttributeType, 0x0800, 20, toOctets("ICAgICAgICAgICAgICAgICAgICA="), mapset.NewSetWith(Read), true, true, false, 5), |
| 183 | 6: ByteField("ProtectionProfilePointer", UnsignedIntegerAttributeType, 0x0400, 0, mapset.NewSetWith(Read), false, true, false, 6), |
| 184 | 7: ByteField("InvokeProtectionSwitch", EnumerationAttributeType, 0x0200, 0, mapset.NewSetWith(Read, Write), false, true, false, 7), |
| 185 | 8: ByteField("AlarmReportingControl", EnumerationAttributeType, 0x0100, 0, mapset.NewSetWith(Read, Write), true, true, false, 8), |
| 186 | 9: ByteField("ArcInterval", UnsignedIntegerAttributeType, 0x0080, 0, mapset.NewSetWith(Read, Write), false, true, false, 9), |
| 187 | }, |
| 188 | Access: CreatedByOnu, |
| 189 | Support: UnknownSupport, |
Chip Boling | 34ebcb6 | 2021-02-02 12:13:58 -0600 | [diff] [blame] | 190 | Alarms: AlarmMap{ |
| 191 | 0: "Plug-in circuit pack missing", |
| 192 | 1: "Plug-in type mismatch alarm", |
| 193 | 2: "Improper card removal", |
| 194 | 3: "Plug-in equipment ID mismatch alarm", |
| 195 | 4: "Protection switch", |
| 196 | }, |
Chip Boling | 6e27b35 | 2020-02-14 09:10:01 -0600 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
| 200 | // NewCardholder (class ID 5) creates the basic |
| 201 | // Managed Entity definition that is used to validate an ME of this type that |
| 202 | // is received from or transmitted to the OMCC. |
| 203 | func NewCardholder(params ...ParamData) (*ManagedEntity, OmciErrors) { |
| 204 | return NewManagedEntity(*cardholderBME, params...) |
| 205 | } |