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