blob: c3b73ca22056c0f00a60b8812b3efc4b9ad9bd17 [file] [log] [blame]
Chip Boling6e27b352020-02-14 09:10:01 -06001/*
2 * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14/*
15 * NOTE: This file was generated, manual edits will be overwritten!
16 *
17 * Generated by 'goCodeGenerator.py':
18 * https://github.com/cboling/OMCI-parser/README.md
19 */
20
21package generated
22
23import "github.com/deckarep/golang-set"
24
25// SoftwareImageClassID is the 16-bit ID for the OMCI
26// Managed entity Software image
27const SoftwareImageClassID ClassID = ClassID(7)
28
29var softwareimageBME *ManagedEntityDefinition
30
31// SoftwareImage (class ID #7)
32// This ME models an executable software image stored in the ONU (documented here as its
33// fundamental usage). It may also be used to represent an opaque vendor-specific file
34// (vendorspecific usage).
35//
36// Fundamental usage
37//
38// The ONU automatically creates two instances of this ME upon the creation of each ME that
39// contains independently manageable software, either the ONU itself or an individual circuit pack.
40// It populates ME attributes according to data within the ONU or the circuit pack.
41//
42// Some pluggable equipment may not contain software. Others may contain software that is
43// intrinsically bound to the ONU's own software image. No software image ME need exist for such
44// equipment, though it may be convenient for the ONU to create them to support software version
45// audit from the OLT. In this case, the dependent MEs would support only the get action.
46//
47// A slot may contain various equipment over its lifetime, and if software image MEs exist, the ONU
48// must automatically create and delete them as the equipped configuration changes. The identity of
49// the software image is tied to the cardholder.
50//
51// When an ONU controller packs are duplicated, each can be expected to contain two software image
52// MEs, managed through reference to the individual controller packs themselves. When this occurs,
53// the ONU should not have a global pair of software images MEs (instance 0), since an action
54// (download, activate, commit) directed to instance 0 would be ambiguous.
55//
56// Relationships
57// Two instances of the software image ME are associated with each instance of the ONU or
58// cardholder whose software is independently managed.
59//
60// Attributes
61// Managed Entity Id
62// Managed entity ID: This attribute uniquely identifies each instance of this ME. The first byte
63// indicates the physical location of the equipment hosting the software image, either the ONU (0)
64// or a cardholder (1..254). The second byte distinguishes between the two software image ME
65// instances (0..1). (R) (mandatory) (2-bytes)
66//
67// Version
68// Version: This string attribute identifies the version of the software. (R) (mandatory)
69// (14-bytes)
70//
71// Is Committed
72// Is committed: This attribute indicates whether the associated software image is committed (1) or
73// uncommitted (0). By definition, the committed software image is loaded and executed upon reboot
74// of the ONU or circuit pack. During normal operation, one software image is always committed,
75// while the other is uncommitted. Under no circumstances are both software images allowed to be
76// committed at the same time. On the other hand, both software images could be uncommitted at the
77// same time if both were invalid. Upon ME instantiation, instance 0 is initialized to committed,
78// while instance 1 is initialized to uncommitted (i.e., the ONU ships from the factory with image
79// 0 committed). (R) (mandatory) (1-byte)
80//
81// Is Active
82// Is active: This attribute indicates whether the associated software image is active (1) or
83// inactive (0). By definition, the active software image is one that is currently loaded and
84// executing in the ONU or circuit pack. Under normal operation, one software image is always
85// active while the other is inactive. Under no circumstances are both software images allowed to
86// be active at the same time. On the other hand, both software images could be inactive at the
87// same time if both were invalid. (R) (mandatory) (1-byte)
88//
89// Is Valid
90// Is valid: This attribute indicates whether the associated software image is valid (1) or invalid
91// (0). By definition, a software image is valid if it has been verified to be an executable code
92// image. The verification mechanism is not subject to standardization; however, it should include
93// at least a data integrity check [e.g., a cyclic redundancy check (CRC)] of the entire code
94// image. Upon ME instantiation or software download completion, the ONU validates the associated
95// code image and sets this attribute according to the result. (R) (mandatory) (1-byte)
96//
97// Product Code
98// Product code: This attribute provides a way for a vendor to indicate product code information on
99// a file. It is a character string, padded with trailing nulls if it is shorter than 25 bytes. (R)
100// (optional) (25 bytes)
101//
102// Image Hash
103// Image hash: This attribute is an MD5 hash of the software image. It is computed at completion of
104// the end download action. (R) (optional) (16-bytes)
105//
106type SoftwareImage struct {
107 ManagedEntityDefinition
108 Attributes AttributeValueMap
109}
110
111func init() {
112 softwareimageBME = &ManagedEntityDefinition{
113 Name: "SoftwareImage",
114 ClassID: 7,
115 MessageTypes: mapset.NewSetWith(
116 ActivateSoftware,
117 CommitSoftware,
118 DownloadSection,
119 EndSoftwareDownload,
120 Get,
121 StartSoftwareDownload,
122 ),
123 AllowedAttributeMask: 0xfc00,
124 AttributeDefinitions: AttributeDefinitionMap{
125 0: Uint16Field("ManagedEntityId", PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read), false, false, false, 0),
126 1: MultiByteField("Version", StringAttributeType, 0x8000, 14, toOctets("ICAgICAgICAgICAgICA="), mapset.NewSetWith(Read), true, false, false, 1),
127 2: ByteField("IsCommitted", EnumerationAttributeType, 0x4000, 0, mapset.NewSetWith(Read), true, false, false, 2),
128 3: ByteField("IsActive", EnumerationAttributeType, 0x2000, 0, mapset.NewSetWith(Read), true, false, false, 3),
129 4: ByteField("IsValid", EnumerationAttributeType, 0x1000, 0, mapset.NewSetWith(Read), true, false, false, 4),
130 5: MultiByteField("ProductCode", OctetsAttributeType, 0x0800, 25, toOctets("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="), mapset.NewSetWith(Read), true, true, false, 5),
131 6: MultiByteField("ImageHash", StringAttributeType, 0x0400, 16, toOctets("AAAAAAAAAAAAAAAAAAAAAA=="), mapset.NewSetWith(Read), true, true, false, 6),
132 },
133 Access: CreatedByOnu,
134 Support: UnknownSupport,
135 }
136}
137
138// NewSoftwareImage (class ID 7) creates the basic
139// Managed Entity definition that is used to validate an ME of this type that
140// is received from or transmitted to the OMCC.
141func NewSoftwareImage(params ...ParamData) (*ManagedEntity, OmciErrors) {
142 return NewManagedEntity(*softwareimageBME, params...)
143}