Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 3 | * Copyright 2020-present Open Networking Foundation |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 4 | * |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [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 |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 8 | * |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 10 | * |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [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 | */ |
Girish Gowdra | 161d27a | 2021-05-05 12:01:44 -0700 | [diff] [blame] | 17 | /* |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [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 | */ |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 23 | |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 24 | package generated |
| 25 | |
| 26 | import "github.com/deckarep/golang-set" |
| 27 | |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 28 | // TrafficSchedulerClassID is the 16-bit ID for the OMCI |
| 29 | // Managed entity Traffic scheduler |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 30 | const TrafficSchedulerClassID = ClassID(278) // 0x0116 |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 31 | |
| 32 | var trafficschedulerBME *ManagedEntityDefinition |
| 33 | |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 34 | // TrafficScheduler (Class ID: #278 / 0x0116) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 35 | // NOTE 1 - In [ITU-T G.984.4], this ME is called a traffic scheduler-G. |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 36 | // |
| 37 | // An instance of this ME represents a logical object that can control upstream GEM packets. A |
| 38 | // traffic scheduler can accommodate GEM packets after a priority queue or other traffic scheduler |
| 39 | // and transfer them towards the next traffic scheduler or T-CONT. Because T-CONTs and traffic |
| 40 | // schedulers are created autonomously by the ONU, the ONU vendor predetermines the most complex |
| 41 | // traffic handling model it is prepared to support; the OLT may use less than the ONU's full |
| 42 | // capabilities, but cannot ask for more. See Appendix II for more details. |
| 43 | // |
| 44 | // After the ONU creates instances of the T-CONT ME, it then autonomously creates instances of the |
| 45 | // traffic scheduler ME. |
| 46 | // |
| 47 | // Relationships |
| 48 | // The traffic scheduler ME may be related to a T-CONT or other traffic schedulers through pointer |
| 49 | // attributes. |
| 50 | // |
| 51 | // Attributes |
| 52 | // Managed Entity Id |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 53 | // This attribute uniquely identifies each instance of this ME. This 2-byte number indicates the |
| 54 | // physical capability that realizes the traffic scheduler. The first byte is the slot ID of the |
| 55 | // circuit pack with which this traffic scheduler is associated. For a traffic scheduler that is |
| 56 | // not associated with a circuit pack, the first byte is 0xFF. The second byte is the traffic |
| 57 | // scheduler id, assigned by the ONU itself. Traffic schedulers are numbered in ascending order |
| 58 | // with the range 0..0xFF in each circuit pack or in the ONU core. (R) (mandatory) (2-bytes) |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 59 | // |
| 60 | // T_Cont Pointer |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 61 | // T-CONT pointer: This attribute points to the T-CONT ME instance associated with this traffic |
| 62 | // scheduler. This pointer is used when this traffic scheduler is connected to the T-CONT directly; |
| 63 | // It is null (0) otherwise. (R, W) (mandatory) (2 bytes) |
| 64 | // |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 65 | // NOTE 2 - This attribute is read-only unless otherwise specified by the QoS configuration |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 66 | // flexibility attribute of the ONU2-G ME. If flexible configuration is not supported, the ONU |
| 67 | // should reject an attempt to set the TCONT pointer attribute with a parameter error result-reason |
| 68 | // code. |
| 69 | // |
| 70 | // Traffic Scheduler Pointer |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 71 | // This attribute points to another traffic scheduler ME instance that may serve this traffic |
| 72 | // scheduler. This pointer is used when this traffic scheduler is connected to another traffic |
| 73 | // scheduler; it is null (0) otherwise. (R) (mandatory) (2-bytes) |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 74 | // |
| 75 | // Policy |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 76 | // This attribute represents scheduling policy. Valid values include: |
| 77 | // |
| 78 | // 0 Null |
| 79 | // |
| 80 | // 1 Strict priority |
| 81 | // |
| 82 | // 2 WRR (weighted round robin) |
| 83 | // |
| 84 | // The traffic scheduler derives priority or weight values for its tributary traffic schedulers or |
| 85 | // priority queues from the tributary MEs themselves. |
| 86 | // |
| 87 | // (R, W) (mandatory) (1 byte) |
| 88 | // |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 89 | // NOTE 3 - This attribute is read-only unless otherwise specified by the QoS configuration |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 90 | // flexibility attribute of the ONU2-G ME. If flexible configuration is not supported, the ONU |
| 91 | // should reject an attempt to set the policy attribute with a parameter error result-reason code. |
| 92 | // |
| 93 | // Priority_Weight |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 94 | // Priority/weight: This attribute represents the priority for strict priority scheduling or the |
| 95 | // weight for WRR scheduling. This value is used by the next upstream ME, as indicated by the |
| 96 | // T-CONT pointer attribute or traffic scheduler pointer attribute. |
| 97 | // |
| 98 | // If the indicated pointer has policy-=-strict priority, this value is interpreted as a priority |
| 99 | // (0 is the highest priority, 255 the lowest). |
| 100 | // |
| 101 | // If the indicated pointer has policy-=-WRR, this value is interpreted as a weight. Higher values |
| 102 | // receive more bandwidth. |
| 103 | // |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 104 | // Upon ME instantiation, the ONU sets this attribute to 0. (R,-W) (mandatory) (1-byte) |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 105 | // |
| 106 | type TrafficScheduler struct { |
| 107 | ManagedEntityDefinition |
| 108 | Attributes AttributeValueMap |
| 109 | } |
| 110 | |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 111 | // Attribute name constants |
| 112 | |
| 113 | const TrafficScheduler_TContPointer = "TContPointer" |
| 114 | const TrafficScheduler_TrafficSchedulerPointer = "TrafficSchedulerPointer" |
| 115 | const TrafficScheduler_Policy = "Policy" |
| 116 | const TrafficScheduler_PriorityWeight = "PriorityWeight" |
| 117 | |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 118 | func init() { |
| 119 | trafficschedulerBME = &ManagedEntityDefinition{ |
| 120 | Name: "TrafficScheduler", |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 121 | ClassID: TrafficSchedulerClassID, |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 122 | MessageTypes: mapset.NewSetWith( |
| 123 | Get, |
| 124 | Set, |
| 125 | ), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 126 | AllowedAttributeMask: 0xf000, |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 127 | AttributeDefinitions: AttributeDefinitionMap{ |
Elia Battiston | 9bfe110 | 2022-02-03 10:38:03 +0100 | [diff] [blame] | 128 | 0: Uint16Field(ManagedEntityID, PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read), false, false, false, 0), |
| 129 | 1: Uint16Field(TrafficScheduler_TContPointer, PointerAttributeType, 0x8000, 0, mapset.NewSetWith(Read, Write), false, false, false, 1), |
| 130 | 2: Uint16Field(TrafficScheduler_TrafficSchedulerPointer, PointerAttributeType, 0x4000, 0, mapset.NewSetWith(Read), false, false, false, 2), |
| 131 | 3: ByteField(TrafficScheduler_Policy, EnumerationAttributeType, 0x2000, 0, mapset.NewSetWith(Read, Write), false, false, false, 3), |
| 132 | 4: ByteField(TrafficScheduler_PriorityWeight, UnsignedIntegerAttributeType, 0x1000, 0, mapset.NewSetWith(Read, Write), false, false, false, 4), |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 133 | }, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 134 | Access: CreatedByOnu, |
| 135 | Support: UnknownSupport, |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 136 | } |
| 137 | } |
| 138 | |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 139 | // NewTrafficScheduler (class ID 278) creates the basic |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 140 | // Managed Entity definition that is used to validate an ME of this type that |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 141 | // is received from or transmitted to the OMCC. |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 142 | func NewTrafficScheduler(params ...ParamData) (*ManagedEntity, OmciErrors) { |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 143 | return NewManagedEntity(*trafficschedulerBME, params...) |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 144 | } |