blob: 0434f5e189c76dd186efd5d334991e3dae64ccf4 [file] [log] [blame]
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -07001/*
2 * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
Matteo Scandolof9d43412021-01-12 11:11:34 -08003 * Copyright 2020-present Open Networking Foundation
Elia Battiston9bfe1102022-02-03 10:38:03 +01004 *
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -07005 * 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
Elia Battiston9bfe1102022-02-03 10:38:03 +01008 *
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -07009 * http://www.apache.org/licenses/LICENSE-2.0
Elia Battiston9bfe1102022-02-03 10:38:03 +010010 *
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070011 * 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 */
17/*
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 */
Matteo Scandolof9d43412021-01-12 11:11:34 -080023
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070024package generated
25
26import "github.com/deckarep/golang-set"
27
Matteo Scandolof9d43412021-01-12 11:11:34 -080028// CardholderClassID is the 16-bit ID for the OMCI
29// Managed entity Cardholder
Andrea Campanella10426e22021-10-15 17:58:04 +020030const CardholderClassID = ClassID(5) // 0x0005
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070031
32var cardholderBME *ManagedEntityDefinition
33
Andrea Campanella10426e22021-10-15 17:58:04 +020034// Cardholder (Class ID: #5 / 0x0005)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070035// 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
Matteo Scandolof9d43412021-01-12 11:11:34 -080075// NOTE 1 - Some xDSL MEs use the two MSBs of the slot number for other purposes. An ONU that
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070076// supports these services may have slot limitations or restrictions.
77//
Andrea Campanella10426e22021-10-15 17:58:04 +020078// 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//
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070093// 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
Matteo Scandolof9d43412021-01-12 11:11:34 -080097// defined in Table 9.1.5-1. (R) (mandatory) (1-byte)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070098//
Andrea Campanella10426e22021-10-15 17:58:04 +020099// 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//
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700104// 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
Matteo Scandolof9d43412021-01-12 11:11:34 -0800109// attribute may be used to represent the type of interface. (R,-W) (mandatory) (1-byte)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700110//
111// Expected Port Count
Andrea Campanella10426e22021-10-15 17:58:04 +0200112// 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)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700115//
116// Expected Equipment Id
Andrea Campanella10426e22021-10-15 17:58:04 +0200117// 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)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700121//
122// Actual Equipment Id
Andrea Campanella10426e22021-10-15 17:58:04 +0200123// 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)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700127//
128// Protection Profile Pointer
Andrea Campanella10426e22021-10-15 17:58:04 +0200129// 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)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700133//
134// Invoke Protection Switch
Andrea Campanella10426e22021-10-15 17:58:04 +0200135// 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//
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700152// 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
Matteo Scandolof9d43412021-01-12 11:11:34 -0800154// to accept a response on the redundant PON. (R,-W) (optional) (1-byte)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700155//
156// Alarm _ Reporting Control
Matteo Scandolof9d43412021-01-12 11:11:34 -0800157// Alarm-reporting control (ARC): See clause A.1.4.3. (R,-W) (optional) (1-byte)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700158//
159// Arc Interval
Andrea Campanella10426e22021-10-15 17:58:04 +0200160// See clause A.1.4.3. (R,-W) (optional) (1-byte)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700161//
162type Cardholder struct {
163 ManagedEntityDefinition
164 Attributes AttributeValueMap
165}
166
Elia Battiston9bfe1102022-02-03 10:38:03 +0100167// Attribute name constants
168
169const Cardholder_ActualPlugInUnitType = "ActualPlugInUnitType"
170const Cardholder_ExpectedPlugInUnitType = "ExpectedPlugInUnitType"
171const Cardholder_ExpectedPortCount = "ExpectedPortCount"
172const Cardholder_ExpectedEquipmentId = "ExpectedEquipmentId"
173const Cardholder_ActualEquipmentId = "ActualEquipmentId"
174const Cardholder_ProtectionProfilePointer = "ProtectionProfilePointer"
175const Cardholder_InvokeProtectionSwitch = "InvokeProtectionSwitch"
176const Cardholder_AlarmReportingControl = "AlarmReportingControl"
177const Cardholder_ArcInterval = "ArcInterval"
178
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700179func init() {
180 cardholderBME = &ManagedEntityDefinition{
181 Name: "Cardholder",
Elia Battiston9bfe1102022-02-03 10:38:03 +0100182 ClassID: CardholderClassID,
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700183 MessageTypes: mapset.NewSetWith(
184 Get,
185 Set,
186 ),
Matteo Scandolof9d43412021-01-12 11:11:34 -0800187 AllowedAttributeMask: 0xff80,
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700188 AttributeDefinitions: AttributeDefinitionMap{
Elia Battiston9bfe1102022-02-03 10:38:03 +0100189 0: Uint16Field(ManagedEntityID, PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read), false, false, false, 0),
190 1: ByteField(Cardholder_ActualPlugInUnitType, EnumerationAttributeType, 0x8000, 0, mapset.NewSetWith(Read), true, false, false, 1),
191 2: ByteField(Cardholder_ExpectedPlugInUnitType, EnumerationAttributeType, 0x4000, 0, mapset.NewSetWith(Read, Write), false, false, false, 2),
192 3: ByteField(Cardholder_ExpectedPortCount, UnsignedIntegerAttributeType, 0x2000, 0, mapset.NewSetWith(Read, Write), false, true, false, 3),
193 4: MultiByteField(Cardholder_ExpectedEquipmentId, StringAttributeType, 0x1000, 20, toOctets("ICAgICAgICAgICAgICAgICAgICA="), mapset.NewSetWith(Read, Write), false, true, false, 4),
194 5: MultiByteField(Cardholder_ActualEquipmentId, StringAttributeType, 0x0800, 20, toOctets("ICAgICAgICAgICAgICAgICAgICA="), mapset.NewSetWith(Read), true, true, false, 5),
195 6: ByteField(Cardholder_ProtectionProfilePointer, UnsignedIntegerAttributeType, 0x0400, 0, mapset.NewSetWith(Read), false, true, false, 6),
196 7: ByteField(Cardholder_InvokeProtectionSwitch, EnumerationAttributeType, 0x0200, 0, mapset.NewSetWith(Read, Write), false, true, false, 7),
197 8: ByteField(Cardholder_AlarmReportingControl, EnumerationAttributeType, 0x0100, 0, mapset.NewSetWith(Read, Write), true, true, false, 8),
198 9: ByteField(Cardholder_ArcInterval, UnsignedIntegerAttributeType, 0x0080, 0, mapset.NewSetWith(Read, Write), false, true, false, 9),
Matteo Scandolof9d43412021-01-12 11:11:34 -0800199 },
200 Access: CreatedByOnu,
201 Support: UnknownSupport,
202 Alarms: AlarmMap{
203 0: "Plug-in circuit pack missing",
204 1: "Plug-in type mismatch alarm",
205 2: "Improper card removal",
206 3: "Plug-in equipment ID mismatch alarm",
207 4: "Protection switch",
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700208 },
209 }
210}
211
Matteo Scandolof9d43412021-01-12 11:11:34 -0800212// NewCardholder (class ID 5) creates the basic
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700213// Managed Entity definition that is used to validate an ME of this type that
Matteo Scandolof9d43412021-01-12 11:11:34 -0800214// is received from or transmitted to the OMCC.
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700215func NewCardholder(params ...ParamData) (*ManagedEntity, OmciErrors) {
Matteo Scandolof9d43412021-01-12 11:11:34 -0800216 return NewManagedEntity(*cardholderBME, params...)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -0700217}