Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2017 the original author or authors. |
| 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 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 16 | from __future__ import absolute_import, division |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 17 | import inspect |
| 18 | |
| 19 | import sys |
| 20 | from binascii import hexlify |
| 21 | from bitstring import BitArray |
| 22 | import json |
| 23 | from scapy.fields import ByteField, ShortField, MACField, BitField, IPField |
| 24 | from scapy.fields import IntField, StrFixedLenField, LongField, FieldListField, PacketLenField |
| 25 | from scapy.packet import Packet |
| 26 | |
| 27 | from pyvoltha.adapters.extensions.omci.omci_defs import OmciUninitializedFieldError, \ |
| 28 | AttributeAccess, OmciNullPointer, EntityOperations, OmciInvalidTypeError |
| 29 | from pyvoltha.adapters.extensions.omci.omci_fields import OmciSerialNumberField, OmciTableField |
| 30 | from pyvoltha.adapters.extensions.omci.omci_defs import bitpos_from_mask |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 31 | import six |
| 32 | from six.moves import range |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 33 | |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 34 | RECONCILE_LOW_PRIORITY=1000 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 35 | |
| 36 | class EntityClassAttribute(object): |
| 37 | |
| 38 | def __init__(self, fld, access=set(), optional=False, range_check=None, |
| 39 | avc=False, tca=False, counter=False, deprecated=False): |
| 40 | """ |
| 41 | Initialize an Attribute for a Managed Entity Class |
| 42 | |
| 43 | :param fld: (Field) Scapy field type |
| 44 | :param access: (AttributeAccess) Allowed access |
| 45 | :param optional: (boolean) If true, attribute is option, else mandatory |
| 46 | :param range_check: (callable) None, Lambda, or Function to validate value |
| 47 | :param avc: (boolean) If true, an AVC notification can occur for the attribute |
| 48 | :param tca: (boolean) If true, a threshold crossing alert alarm notification can occur |
| 49 | for the attribute |
| 50 | :param counter: (boolean) If true, this attribute is a PM counter |
| 51 | :param deprecated: (boolean) If true, this attribute is deprecated and |
| 52 | only 'read' operations (if-any) performed. |
| 53 | """ |
| 54 | self._fld = fld |
| 55 | self._access = access |
| 56 | self._optional = optional |
| 57 | self._range_check = range_check |
| 58 | self._avc = avc |
| 59 | self._tca = tca |
| 60 | self._counter = counter |
| 61 | self._deprecated = deprecated |
| 62 | |
| 63 | @property |
| 64 | def field(self): |
| 65 | return self._fld |
| 66 | |
| 67 | @property |
| 68 | def access(self): |
| 69 | return self._access |
| 70 | |
| 71 | @property |
| 72 | def optional(self): |
| 73 | return self._optional |
| 74 | |
| 75 | @property |
| 76 | def is_counter(self): |
| 77 | return self._counter |
| 78 | |
| 79 | @property |
| 80 | def range_check(self): |
| 81 | return self._range_check |
| 82 | |
| 83 | @property |
| 84 | def avc_allowed(self): |
| 85 | return self._avc |
| 86 | |
| 87 | @property |
| 88 | def deprecated(self): |
| 89 | return self._deprecated |
| 90 | |
| 91 | _type_checker_map = { |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 92 | 'ByteField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFF, |
| 93 | 'ShortField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFF, |
| 94 | 'IntField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFFFFFF, |
| 95 | 'LongField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFFFFFFFFFFFFFF, |
| 96 | 'StrFixedLenField': lambda val: isinstance(val, six.string_types), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 97 | 'MACField': lambda val: True, # TODO: Add a constraint for this field type |
| 98 | 'BitField': lambda val: True, # TODO: Add a constraint for this field type |
| 99 | 'IPField': lambda val: True, # TODO: Add a constraint for this field type |
| 100 | 'OmciTableField': lambda val: True, |
| 101 | |
| 102 | # TODO: As additional Scapy field types are used, add constraints |
| 103 | } |
| 104 | |
| 105 | def valid(self, value): |
| 106 | def _isa_lambda_function(v): |
| 107 | import inspect |
| 108 | return callable(v) and len(inspect.getargspec(v).args) == 1 |
| 109 | |
| 110 | field_type = self.field.__class__.__name__ |
| 111 | type_check = EntityClassAttribute._type_checker_map.get(field_type, |
| 112 | lambda val: True) |
| 113 | |
| 114 | # TODO: Currently StrFixedLenField is used heavily for both bit fields as |
| 115 | # and other 'byte/octet' related strings that are NOT textual. Until |
| 116 | # all of these are corrected, 'StrFixedLenField' cannot test the type |
| 117 | # of the value provided |
| 118 | |
| 119 | if field_type != 'StrFixedLenField' and not type_check(value): |
| 120 | return False |
| 121 | |
| 122 | if _isa_lambda_function(self.range_check): |
| 123 | return self.range_check(value) |
| 124 | return True |
| 125 | |
| 126 | |
| 127 | class EntityClassMeta(type): |
| 128 | """ |
| 129 | Metaclass for EntityClass to generate secondary class attributes |
| 130 | for class attributes of the derived classes. |
| 131 | """ |
| 132 | def __init__(cls, name, bases, dct): |
| 133 | super(EntityClassMeta, cls).__init__(name, bases, dct) |
| 134 | |
| 135 | # initialize attribute_name_to_index_map |
| 136 | cls.attribute_name_to_index_map = dict( |
| 137 | (a._fld.name, idx) for idx, a in enumerate(cls.attributes)) |
| 138 | |
| 139 | |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 140 | class EntityClass(six.with_metaclass(EntityClassMeta, object)): |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 141 | |
| 142 | class_id = 'to be filled by subclass' |
| 143 | attributes = [] |
| 144 | mandatory_operations = set() |
| 145 | optional_operations = set() |
| 146 | notifications = set() |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 147 | reconcile_sort_order = RECONCILE_LOW_PRIORITY |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 148 | alarms = dict() # Alarm Number -> Alarm Name |
| 149 | hidden = False # If true, this attribute is not reported by a MIB upload. |
| 150 | # This attribute is needed to be able to properly perform |
| 151 | # MIB Audits. |
| 152 | |
| 153 | # will be map of attr_name -> index in attributes, initialized by metaclass |
| 154 | attribute_name_to_index_map = None |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 155 | |
| 156 | def __init__(self, **kw): |
| 157 | assert(isinstance(kw, dict)) |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 158 | for k, v in six.iteritems(kw): |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 159 | assert(k in self.attribute_name_to_index_map) |
| 160 | self._data = kw |
| 161 | |
| 162 | def serialize(self, mask=None, operation=None): |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 163 | octets = b'' |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 164 | |
| 165 | # generate ordered list of attribute indices needed to be processed |
| 166 | # if mask is provided, we use that explicitly |
| 167 | # if mask is not provided, we determine attributes from the self._data |
| 168 | # content also taking into account the type of operation in hand |
| 169 | if mask is not None: |
| 170 | attribute_indices = EntityClass.attribute_indices_from_mask(mask) |
| 171 | else: |
| 172 | attribute_indices = self.attribute_indices_from_data() |
| 173 | |
| 174 | # Serialize each indexed field (ignoring entity id) |
| 175 | for index in attribute_indices: |
| 176 | eca = self.attributes[index] |
| 177 | field = eca.field |
| 178 | try: |
| 179 | value = self._data[field.name] |
| 180 | |
| 181 | if not eca.valid(value): |
| 182 | raise OmciInvalidTypeError( |
| 183 | 'Value "{}" for Entity field "{}" is not valid'.format(value, |
| 184 | field.name)) |
| 185 | except KeyError: |
| 186 | raise OmciUninitializedFieldError( |
| 187 | 'Entity field "{}" not set'.format(field.name)) |
| 188 | |
| 189 | octets = field.addfield(None, octets, value) |
| 190 | |
| 191 | return octets |
| 192 | |
| 193 | def attribute_indices_from_data(self): |
| 194 | return sorted( |
| 195 | self.attribute_name_to_index_map[attr_name] |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 196 | for attr_name in six.iterkeys(self._data)) |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 197 | |
| 198 | byte1_mask_to_attr_indices = dict( |
| 199 | (m, bitpos_from_mask(m, 8, -1)) for m in range(256)) |
| 200 | byte2_mask_to_attr_indices = dict( |
| 201 | (m, bitpos_from_mask(m, 16, -1)) for m in range(256)) |
| 202 | |
| 203 | @classmethod |
| 204 | def attribute_indices_from_mask(cls, mask): |
| 205 | # each bit in the 2-byte field denote an attribute index; we use a |
| 206 | # lookup table to make lookup a bit faster |
| 207 | return \ |
| 208 | cls.byte1_mask_to_attr_indices[(mask >> 8) & 0xff] + \ |
| 209 | cls.byte2_mask_to_attr_indices[(mask & 0xff)] |
| 210 | |
| 211 | @classmethod |
| 212 | def mask_for(cls, *attr_names): |
| 213 | """ |
| 214 | Return mask value corresponding to given attributes names |
| 215 | :param attr_names: Attribute names |
| 216 | :return: integer mask value |
| 217 | """ |
| 218 | mask = 0 |
| 219 | for attr_name in attr_names: |
| 220 | index = cls.attribute_name_to_index_map[attr_name] |
| 221 | mask |= (1 << (16 - index)) |
| 222 | return mask |
| 223 | |
| 224 | |
| 225 | # abbreviations |
| 226 | ECA = EntityClassAttribute |
| 227 | AA = AttributeAccess |
| 228 | OP = EntityOperations |
| 229 | |
| 230 | |
| 231 | class OntData(EntityClass): |
| 232 | class_id = 2 |
| 233 | hidden = True |
| 234 | attributes = [ |
| 235 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 236 | range_check=lambda x: x == 0), |
| 237 | # Only 1 octet used if GET/SET operation |
| 238 | ECA(ShortField("mib_data_sync", 0), {AA.R, AA.W}) |
| 239 | ] |
| 240 | mandatory_operations = {OP.Get, OP.Set, |
| 241 | OP.GetAllAlarms, OP.GetAllAlarmsNext, |
| 242 | OP.MibReset, OP.MibUpload, OP.MibUploadNext} |
| 243 | |
| 244 | |
| 245 | class Cardholder(EntityClass): |
| 246 | class_id = 5 |
| 247 | attributes = [ |
| 248 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 249 | range_check=lambda x: 0 <= x < 255 or 256 <= x < 511, |
| 250 | avc=True), |
| 251 | ECA(ByteField("actual_plugin_unit_type", None), {AA.R}), |
| 252 | ECA(ByteField("expected_plugin_unit_type", None), {AA.R, AA.W}), |
| 253 | ECA(ByteField("expected_port_count", None), {AA.R, AA.W}, |
| 254 | optional=True), |
| 255 | ECA(StrFixedLenField("expected_equipment_id", None, 20), {AA.R, AA.W}, |
| 256 | optional=True, avc=True), |
| 257 | ECA(StrFixedLenField("actual_equipment_id", None, 20), {AA.R}, |
| 258 | optional=True), |
| 259 | ECA(ByteField("protection_profile_pointer", None), {AA.R}, |
| 260 | optional=True), |
| 261 | ECA(ByteField("invoke_protection_switch", None), {AA.R, AA.W}, |
| 262 | optional=True, range_check=lambda x: 0 <= x <= 3), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 263 | ECA(ByteField("arc", 0), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 264 | range_check=lambda x: 0 <= x <= 1, optional=True, avc=True), |
| 265 | ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True), |
| 266 | ] |
| 267 | mandatory_operations = {OP.Get, OP.Set} |
| 268 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 269 | alarms = { |
| 270 | 0: 'Plug-in circuit pack missing', |
| 271 | 1: 'Plug-in type mismatch alarm', |
| 272 | 2: 'Improper card removal', |
| 273 | 3: 'Plug-in equipment ID mismatch alarm', |
| 274 | 4: 'Protection switch', |
| 275 | } |
| 276 | |
| 277 | |
| 278 | class CircuitPack(EntityClass): |
| 279 | class_id = 6 |
| 280 | attributes = [ |
| 281 | ECA(StrFixedLenField("managed_entity_id", None, 22), {AA.R, AA.SBC}, |
| 282 | range_check=lambda x: 0 <= x < 255 or 256 <= x < 511), |
| 283 | ECA(ByteField("type", None), {AA.R, AA.SBC}), |
| 284 | ECA(ByteField("number_of_ports", None), {AA.R}, optional=True), |
| 285 | ECA(OmciSerialNumberField("serial_number"), {AA.R}), |
| 286 | ECA(StrFixedLenField("version", None, 14), {AA.R}), |
| 287 | ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}), |
| 288 | ECA(ByteField("administrative_state", None), {AA.R, AA.W}), |
| 289 | ECA(ByteField("operational_state", None), {AA.R}, optional=True, avc=True), |
| 290 | ECA(ByteField("bridged_or_ip_ind", None), {AA.R, AA.W}, optional=True, |
| 291 | range_check=lambda x: 0 <= x <= 2), |
| 292 | ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}, optional=True), |
| 293 | ECA(ByteField("card_configuration", None), {AA.R, AA.W, AA.SBC}, |
| 294 | optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6 |
| 295 | ECA(ByteField("total_tcont_buffer_number", None), {AA.R}, |
| 296 | optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6 |
| 297 | ECA(ByteField("total_priority_queue_number", None), {AA.R}, |
| 298 | optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6 |
| 299 | ECA(ByteField("total_traffic_scheduler_number", None), {AA.R}, |
| 300 | optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6 |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 301 | ECA(IntField("power_sched_override", None), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 302 | optional=True) |
| 303 | ] |
| 304 | mandatory_operations = {OP.Get, OP.Set, OP.Reboot} |
| 305 | optional_operations = {OP.Create, OP.Delete, OP.Test} |
| 306 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 307 | alarms = { |
| 308 | 0: 'Equipment alarm', |
| 309 | 1: 'Powering alarm', |
| 310 | 2: 'Self-test failure', |
| 311 | 3: 'Laser end of life', |
| 312 | 4: 'Temperature yellow', |
| 313 | 5: 'Temperature red', |
| 314 | } |
| 315 | |
| 316 | class SoftwareImage(EntityClass): |
| 317 | class_id = 7 |
| 318 | attributes = [ |
| 319 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 320 | range_check=lambda x: 0 <= x/256 <= 254 or 0 <= x % 256 <= 1), |
| 321 | ECA(StrFixedLenField("version", None, 14), {AA.R}, avc=True), |
| 322 | ECA(ByteField("is_committed", None), {AA.R}, avc=True, |
| 323 | range_check=lambda x: 0 <= x <= 1), |
| 324 | ECA(ByteField("is_active", None), {AA.R}, avc=True, |
| 325 | range_check=lambda x: 0 <= x <= 1), |
| 326 | ECA(ByteField("is_valid", None), {AA.R}, avc=True, |
| 327 | range_check=lambda x: 0 <= x <= 1), |
| 328 | ECA(StrFixedLenField("product_code", None, 25), {AA.R}, optional=True, avc=True), |
| 329 | ECA(StrFixedLenField("image_hash", None, 16), {AA.R}, optional=True, avc=True), |
| 330 | ] |
| 331 | mandatory_operations = {OP.Get, OP.StartSoftwareDownload, OP.DownloadSection, |
| 332 | OP.EndSoftwareDownload, OP.ActivateSoftware, |
| 333 | OP.CommitSoftware} |
| 334 | notifications = {OP.AttributeValueChange} |
| 335 | |
| 336 | |
| 337 | class PptpEthernetUni(EntityClass): |
| 338 | class_id = 11 |
| 339 | attributes = [ |
| 340 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 341 | ECA(ByteField("expected_type", 0), {AA.R, AA.W}, |
| 342 | range_check=lambda x: 0 <= x <= 254), |
| 343 | ECA(ByteField("sensed_type", 0), {AA.R}, optional=True, avc=True), |
| 344 | # TODO: For sensed_type AVC, see note in AT&T OMCI Specification, V3.0, page 123 |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 345 | ECA(ByteField("autodetection_config", 0), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 346 | range_check=lambda x: x in [0, 1, 2, 3, 4, 5, |
| 347 | 0x10, 0x11, 0x12, 0x13, 0x14, |
| 348 | 0x20, 0x30], optional=True), # See ITU-T G.988 |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 349 | ECA(ByteField("ethernet_loopback_config", 0), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 350 | range_check=lambda x: x in [0, 3]), |
| 351 | ECA(ByteField("administrative_state", 1), {AA.R, AA.W}, |
| 352 | range_check=lambda x: 0 <= x <= 1), |
Matt Jeanneret | 994b0f0 | 2019-10-08 13:59:23 -0400 | [diff] [blame] | 353 | ECA(ByteField("operational_state", 1), {AA.R}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 354 | range_check=lambda x: 0 <= x <= 1, optional=True, avc=True), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 355 | ECA(ByteField("config_ind", 0), {AA.R}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 356 | range_check=lambda x: x in [0, 1, 2, 3, 4, 0x11, 0x12, 0x13]), |
| 357 | ECA(ShortField("max_frame_size", 1518), {AA.R, AA.W}, optional=True), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 358 | ECA(ByteField("dte_dce_ind", 0), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 359 | range_check=lambda x: 0 <= x <= 2), |
| 360 | ECA(ShortField("pause_time", 0), {AA.R, AA.W}, optional=True), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 361 | ECA(ByteField("bridged_ip_ind", 2), {AA.R, AA.W}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 362 | optional=True, range_check=lambda x: 0 <= x <= 2), |
| 363 | ECA(ByteField("arc", 0), {AA.R, AA.W}, optional=True, |
| 364 | range_check=lambda x: 0 <= x <= 1, avc=True), |
| 365 | ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True), |
| 366 | ECA(ByteField("pppoe_filter", 0), {AA.R, AA.W}, optional=True), |
| 367 | ECA(ByteField("power_control", 0), {AA.R, AA.W}, optional=True), |
| 368 | ] |
| 369 | mandatory_operations = {OP.Get, OP.Set} |
| 370 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 371 | alarms = { |
| 372 | 0: 'LAN Loss Of Signal', |
| 373 | } |
| 374 | |
| 375 | |
| 376 | class MacBridgeServiceProfile(EntityClass): |
| 377 | class_id = 45 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 378 | reconcile_sort_order = 2 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 379 | attributes = [ |
| 380 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 381 | ECA(ByteField("spanning_tree_ind", None), {AA.R, AA.W, AA.SBC}, |
| 382 | range_check=lambda x: 0 <= x <= 1), |
| 383 | ECA(ByteField("learning_ind", None), {AA.R, AA.W, AA.SBC}, |
| 384 | range_check=lambda x: 0 <= x <= 1), |
| 385 | ECA(ByteField("port_bridging_ind", None), {AA.R, AA.W, AA.SBC}, |
| 386 | range_check=lambda x: 0 <= x <= 1), |
| 387 | ECA(ShortField("priority", None), {AA.R, AA.W, AA.SBC}), |
| 388 | ECA(ShortField("max_age", None), {AA.R, AA.W, AA.SBC}, |
| 389 | range_check=lambda x: 0x0600 <= x <= 0x2800), |
| 390 | ECA(ShortField("hello_time", None), {AA.R, AA.W, AA.SBC}, |
| 391 | range_check=lambda x: 0x0100 <= x <= 0x0A00), |
| 392 | ECA(ShortField("forward_delay", None), {AA.R, AA.W, AA.SBC}, |
| 393 | range_check=lambda x: 0x0400 <= x <= 0x1E00), |
| 394 | ECA(ByteField("unknown_mac_address_discard", None), |
| 395 | {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1), |
| 396 | ECA(ByteField("mac_learning_depth", None), |
| 397 | {AA.R, AA.W, AA.SBC}, optional=True), |
| 398 | ECA(ByteField("dynamic_filtering_ageing_time", None), |
| 399 | {AA.R, AA.W, AA.SBC}, optional=True), |
| 400 | ] |
| 401 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 402 | |
| 403 | |
| 404 | class MacBridgePortConfigurationData(EntityClass): |
| 405 | class_id = 47 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 406 | reconcile_sort_order = 4 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 407 | attributes = [ |
| 408 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 409 | ECA(ShortField("bridge_id_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 410 | ECA(ByteField("port_num", None), {AA.R, AA.W, AA.SBC}), |
| 411 | ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC}, |
| 412 | range_check=lambda x: 1 <= x <= 12), |
| 413 | ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 414 | ECA(ShortField("port_priority", None), {AA.R, AA.W, AA.SBC}), |
| 415 | ECA(ShortField("port_path_cost", None), {AA.R, AA.W, AA.SBC}), |
| 416 | ECA(ByteField("port_spanning_tree_in", None), {AA.R, AA.W, AA.SBC}), |
| 417 | ECA(ByteField("encapsulation_methods", None), {AA.R, AA.W, AA.SBC}, |
| 418 | optional=True, deprecated=True), |
| 419 | ECA(ByteField("lan_fcs_ind", None), {AA.R, AA.W, AA.SBC}, |
| 420 | optional=True, deprecated=True), |
| 421 | ECA(MACField("port_mac_address", None), {AA.R}, optional=True), |
| 422 | ECA(ShortField("outbound_td_pointer", None), {AA.R, AA.W}, |
| 423 | optional=True), |
| 424 | ECA(ShortField("inbound_td_pointer", None), {AA.R, AA.W}, |
| 425 | optional=True), |
| 426 | # TODO: |
| 427 | ECA(ByteField("mac_learning_depth", 0), {AA.R, AA.W, AA.SBC}, |
| 428 | optional=True), |
| 429 | ] |
| 430 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 431 | notifications = {OP.AlarmNotification} |
| 432 | alarms = { |
| 433 | 0: 'Port blocking', |
| 434 | } |
| 435 | |
| 436 | |
| 437 | class MacBridgePortFilterPreAssignTable(EntityClass): |
| 438 | class_id = 79 |
| 439 | attributes = [ |
| 440 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 441 | ECA(ShortField("ipv4_multicast", 0), {AA.R, AA.W}, |
| 442 | range_check=lambda x: 0 <= x <= 1), |
| 443 | ECA(ShortField("ipv6_multicast", 0), {AA.R, AA.W}, |
| 444 | range_check=lambda x: 0 <= x <= 1), |
| 445 | ECA(ShortField("ipv4_broadcast", 0), {AA.R, AA.W}, |
| 446 | range_check=lambda x: 0 <= x <= 1), |
| 447 | ECA(ShortField("rarp", 0), {AA.R, AA.W}, |
| 448 | range_check=lambda x: 0 <= x <= 1), |
| 449 | ECA(ShortField("ipx", 0), {AA.R, AA.W}, |
| 450 | range_check=lambda x: 0 <= x <= 1), |
| 451 | ECA(ShortField("netbeui", 0), {AA.R, AA.W}, |
| 452 | range_check=lambda x: 0 <= x <= 1), |
| 453 | ECA(ShortField("appletalk", 0), {AA.R, AA.W}, |
| 454 | range_check=lambda x: 0 <= x <= 1), |
| 455 | ECA(ShortField("bridge_management_information", 0), {AA.R, AA.W}, |
| 456 | range_check=lambda x: 0 <= x <= 1), |
| 457 | ECA(ShortField("arp", 0), {AA.R, AA.W}, |
| 458 | range_check=lambda x: 0 <= x <= 1), |
| 459 | ECA(ShortField("pppoe_broadcast", 0), {AA.R, AA.W}, |
| 460 | range_check=lambda x: 0 <= x <= 1) |
| 461 | ] |
| 462 | mandatory_operations = {OP.Get, OP.Set} |
| 463 | |
| 464 | |
| 465 | class VlanTaggingFilterData(EntityClass): |
| 466 | class_id = 84 |
| 467 | attributes = [ |
| 468 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 469 | ECA(FieldListField("vlan_filter_list", None, |
| 470 | ShortField('', 0), count_from=lambda _: 12), |
| 471 | {AA.R, AA.W, AA.SBC}), |
| 472 | ECA(ByteField("forward_operation", None), {AA.R, AA.W, AA.SBC}, |
| 473 | range_check=lambda x: 0x00 <= x <= 0x21), |
| 474 | ECA(ByteField("number_of_entries", None), {AA.R, AA.W, AA.SBC}) |
| 475 | ] |
| 476 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 477 | |
| 478 | |
| 479 | class Ieee8021pMapperServiceProfile(EntityClass): |
| 480 | class_id = 130 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 481 | reconcile_sort_order = 3 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 482 | attributes = [ |
| 483 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 484 | ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 485 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_0", |
| 486 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 487 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_1", |
| 488 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 489 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_2", |
| 490 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 491 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_3", |
| 492 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 493 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_4", |
| 494 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 495 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_5", |
| 496 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 497 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_6", |
| 498 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 499 | ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_7", |
| 500 | OmciNullPointer), {AA.R, AA.W, AA.SBC}), |
| 501 | ECA(ByteField("unmarked_frame_option", None), |
| 502 | {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1), |
| 503 | ECA(StrFixedLenField("dscp_to_p_bit_mapping", None, length=24), |
| 504 | {AA.R, AA.W}), # TODO: Would a custom 3-bit group bitfield work better? |
| 505 | ECA(ByteField("default_p_bit_marking", None), |
| 506 | {AA.R, AA.W, AA.SBC}), |
| 507 | ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC}, |
| 508 | optional=True, range_check=lambda x: 0 <= x <= 8) |
| 509 | ] |
| 510 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 511 | |
| 512 | |
| 513 | class OltG(EntityClass): |
| 514 | class_id = 131 |
| 515 | attributes = [ |
| 516 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 517 | range_check=lambda x: x == 0), |
| 518 | ECA(StrFixedLenField("olt_vendor_id", None, 4), {AA.R, AA.W}), |
| 519 | ECA(StrFixedLenField("equipment_id", None, 20), {AA.R, AA.W}), |
| 520 | ECA(StrFixedLenField("version", None, 14), {AA.R, AA.W}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 521 | ECA(StrFixedLenField("time_of_day", None, 14), {AA.R, AA.W}) |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 522 | ] |
| 523 | mandatory_operations = {OP.Get, OP.Set} |
| 524 | |
| 525 | |
| 526 | class OntPowerShedding(EntityClass): |
| 527 | class_id = 133 |
| 528 | attributes = [ |
| 529 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 530 | range_check=lambda x: x == 0), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 531 | ECA(ShortField("restore_power_time_reset_interval", 0), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 532 | {AA.R, AA.W}), |
| 533 | ECA(ShortField("data_class_shedding_interval", 0), {AA.R, AA.W}), |
| 534 | ECA(ShortField("voice_class_shedding_interval", 0), {AA.R, AA.W}), |
| 535 | ECA(ShortField("video_overlay_class_shedding_interval", 0), {AA.R, AA.W}), |
| 536 | ECA(ShortField("video_return_class_shedding_interval", 0), {AA.R, AA.W}), |
| 537 | ECA(ShortField("dsl_class_shedding_interval", 0), {AA.R, AA.W}), |
| 538 | ECA(ShortField("atm_class_shedding_interval", 0), {AA.R, AA.W}), |
| 539 | ECA(ShortField("ces_class_shedding_interval", 0), {AA.R, AA.W}), |
| 540 | ECA(ShortField("frame_class_shedding_interval", 0), {AA.R, AA.W}), |
| 541 | ECA(ShortField("sonet_class_shedding_interval", 0), {AA.R, AA.W}), |
| 542 | ECA(ShortField("shedding_status", None), {AA.R, AA.W}, optional=True, |
| 543 | avc=True), |
| 544 | ] |
| 545 | mandatory_operations = {OP.Get, OP.Set} |
| 546 | notifications = {OP.AttributeValueChange} |
| 547 | |
| 548 | |
| 549 | class IpHostConfigData(EntityClass): |
| 550 | class_id = 134 |
| 551 | attributes = [ |
| 552 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 553 | ECA(BitField("ip_options", 0, size=8), {AA.R, AA.W}), |
| 554 | ECA(MACField("mac_address", None), {AA.R}), |
| 555 | ECA(StrFixedLenField("onu_identifier", None, 25), {AA.R, AA.W}), |
| 556 | ECA(IPField("ip_address", None), {AA.R, AA.W}), |
| 557 | ECA(IPField("mask", None), {AA.R, AA.W}), |
| 558 | ECA(IPField("gateway", None), {AA.R, AA.W}), |
| 559 | ECA(IPField("primary_dns", None), {AA.R, AA.W}), |
| 560 | ECA(IPField("secondary_dns", None), {AA.R, AA.W}), |
| 561 | ECA(IPField("current_address", None), {AA.R}, avc=True), |
| 562 | ECA(IPField("current_mask", None), {AA.R}, avc=True), |
| 563 | ECA(IPField("current_gateway", None), {AA.R}, avc=True), |
| 564 | ECA(IPField("current_primary_dns", None), {AA.R}, avc=True), |
| 565 | ECA(IPField("current_secondary_dns", None), {AA.R}, avc=True), |
| 566 | ECA(StrFixedLenField("domain_name", None, 25), {AA.R}, avc=True), |
| 567 | ECA(StrFixedLenField("host_name", None, 25), {AA.R}, avc=True), |
| 568 | ECA(ShortField("relay_agent_options", None), {AA.R, AA.W}, |
| 569 | optional=True), |
| 570 | ] |
| 571 | mandatory_operations = {OP.Get, OP.Set, OP.Test} |
| 572 | notifications = {OP.AttributeValueChange} |
| 573 | |
| 574 | |
| 575 | class VlanTaggingOperation(Packet): |
| 576 | name = "VlanTaggingOperation" |
| 577 | fields_desc = [ |
| 578 | BitField("filter_outer_priority", 0, 4), |
| 579 | BitField("filter_outer_vid", 0, 13), |
| 580 | BitField("filter_outer_tpid_de", 0, 3), |
| 581 | BitField("pad1", 0, 12), |
| 582 | |
| 583 | BitField("filter_inner_priority", 0, 4), |
| 584 | BitField("filter_inner_vid", 0, 13), |
| 585 | BitField("filter_inner_tpid_de", 0, 3), |
| 586 | BitField("pad2", 0, 8), |
| 587 | BitField("filter_ether_type", 0, 4), |
| 588 | |
| 589 | BitField("treatment_tags_to_remove", 0, 2), |
| 590 | BitField("pad3", 0, 10), |
| 591 | BitField("treatment_outer_priority", 0, 4), |
| 592 | BitField("treatment_outer_vid", 0, 13), |
| 593 | BitField("treatment_outer_tpid_de", 0, 3), |
| 594 | |
| 595 | BitField("pad4", 0, 12), |
| 596 | BitField("treatment_inner_priority", 0, 4), |
| 597 | BitField("treatment_inner_vid", 0, 13), |
| 598 | BitField("treatment_inner_tpid_de", 0, 3), |
| 599 | ] |
| 600 | |
| 601 | def to_json(self): |
| 602 | return json.dumps(self.fields, separators=(',', ':')) |
| 603 | |
| 604 | @staticmethod |
| 605 | def json_from_value(value): |
| 606 | bits = BitArray(hex=hexlify(value)) |
| 607 | temp = VlanTaggingOperation( |
| 608 | filter_outer_priority=bits[0:4].uint, # 4 <-size |
| 609 | filter_outer_vid=bits[4:17].uint, # 13 |
| 610 | filter_outer_tpid_de=bits[17:20].uint, # 3 |
| 611 | # pad 12 |
| 612 | filter_inner_priority=bits[32:36].uint, # 4 |
| 613 | filter_inner_vid=bits[36:49].uint, # 13 |
| 614 | filter_inner_tpid_de=bits[49:52].uint, # 3 |
| 615 | # pad 8 |
| 616 | filter_ether_type=bits[60:64].uint, # 4 |
| 617 | treatment_tags_to_remove=bits[64:66].uint, # 2 |
| 618 | # pad 10 |
| 619 | treatment_outer_priority=bits[76:80].uint, # 4 |
| 620 | treatment_outer_vid=bits[80:93].uint, # 13 |
| 621 | treatment_outer_tpid_de=bits[93:96].uint, # 3 |
| 622 | # pad 12 |
| 623 | treatment_inner_priority=bits[108:112].uint, # 4 |
| 624 | treatment_inner_vid=bits[112:125].uint, # 13 |
| 625 | treatment_inner_tpid_de=bits[125:128].uint, # 3 |
| 626 | ) |
| 627 | return json.dumps(temp.fields, separators=(',', ':')) |
| 628 | |
| 629 | def index(self): |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 630 | return b'%02d' % (self.fields.get('filter_outer_priority',0)) + \ |
| 631 | b'%03d' % (self.fields.get('filter_outer_vid',0)) + \ |
| 632 | b'%01d' % (self.fields.get('filter_outer_tpid_de',0)) + \ |
| 633 | b'%03d' % (self.fields.get('filter_inner_priority',0)) + \ |
| 634 | b'%04d' % (self.fields.get('filter_inner_vid',0)) + \ |
| 635 | b'%01d' % (self.fields.get('filter_inner_tpid_de',0)) + \ |
| 636 | b'%02d' % (self.fields.get('filter_ether_type',0)) |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 637 | |
| 638 | def is_delete(self): |
| 639 | return self.fields.get('treatment_tags_to_remove',0) == 0x3 and \ |
| 640 | self.fields.get('pad3',0) == 0x3ff and \ |
| 641 | self.fields.get('treatment_outer_priority',0) == 0xf and \ |
| 642 | self.fields.get('treatment_outer_vid',0) == 0x1fff and \ |
| 643 | self.fields.get('treatment_outer_tpid_de',0) == 0x7 and \ |
| 644 | self.fields.get('pad4',0) == 0xfff and \ |
| 645 | self.fields.get('treatment_inner_priority',0) == 0xf and \ |
| 646 | self.fields.get('treatment_inner_vid',0) == 0x1fff and \ |
| 647 | self.fields.get('treatment_inner_tpid_de',0) == 0x7 |
| 648 | |
| 649 | def delete(self): |
| 650 | self.fields['treatment_tags_to_remove'] = 0x3 |
| 651 | self.fields['pad3'] = 0x3ff |
| 652 | self.fields['treatment_outer_priority'] = 0xf |
| 653 | self.fields['treatment_outer_vid'] = 0x1fff |
| 654 | self.fields['treatment_outer_tpid_de'] = 0x7 |
| 655 | self.fields['pad4'] = 0xfff |
| 656 | self.fields['treatment_inner_priority'] = 0xf |
| 657 | self.fields['treatment_inner_vid'] = 0x1fff |
| 658 | self.fields['treatment_inner_tpid_de'] = 0x7 |
| 659 | return self |
| 660 | |
| 661 | |
| 662 | class ExtendedVlanTaggingOperationConfigurationData(EntityClass): |
| 663 | class_id = 171 |
| 664 | attributes = [ |
| 665 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 666 | ECA(ByteField("association_type", None), {AA.R, AA.W, AA.SBC}, |
| 667 | range_check=lambda x: 0 <= x <= 11), |
| 668 | ECA(ShortField("received_vlan_tagging_operation_table_max_size", None), |
| 669 | {AA.R}), |
| 670 | ECA(ShortField("input_tpid", None), {AA.R, AA.W}), |
| 671 | ECA(ShortField("output_tpid", None), {AA.R, AA.W}), |
| 672 | ECA(ByteField("downstream_mode", None), {AA.R, AA.W}, |
| 673 | range_check=lambda x: 0 <= x <= 8), |
| 674 | ECA(OmciTableField( |
| 675 | PacketLenField("received_frame_vlan_tagging_operation_table", None, |
| 676 | VlanTaggingOperation, length_from=lambda pkt: 16)), {AA.R, AA.W}), |
| 677 | ECA(ShortField("associated_me_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 678 | ECA(FieldListField("dscp_to_p_bit_mapping", None, |
| 679 | BitField('', 0, size=3), count_from=lambda _: 64), |
| 680 | {AA.R, AA.W}), |
| 681 | ] |
| 682 | mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext} |
| 683 | optional_operations = {OP.SetTable} |
| 684 | |
| 685 | |
| 686 | class OntG(EntityClass): |
| 687 | class_id = 256 |
| 688 | attributes = [ |
| 689 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 690 | range_check=lambda x: x == 0), |
| 691 | ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}), |
| 692 | ECA(StrFixedLenField("version", None, 14), {AA.R}), |
| 693 | ECA(OmciSerialNumberField("serial_number"), {AA.R}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 694 | ECA(ByteField("traffic_management_options", None), {AA.R}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 695 | range_check=lambda x: 0 <= x <= 2), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 696 | ECA(ByteField("vp_vc_cross_connection_option", 0), {AA.R}, |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 697 | optional=True, deprecated=True), |
| 698 | ECA(ByteField("battery_backup", None), {AA.R, AA.W}, |
| 699 | range_check=lambda x: 0 <= x <= 1), |
| 700 | ECA(ByteField("administrative_state", None), {AA.R, AA.W}, |
| 701 | range_check=lambda x: 0 <= x <= 1), |
| 702 | ECA(ByteField("operational_state", None), {AA.R}, optional=True, |
| 703 | range_check=lambda x: 0 <= x <= 1, avc=True), |
| 704 | ECA(ByteField("ont_survival_time", None), {AA.R}, optional=True), |
| 705 | ECA(StrFixedLenField("logical_onu_id", None, 24), {AA.R}, |
| 706 | optional=True, avc=True), |
| 707 | ECA(StrFixedLenField("logical_password", None, 12), {AA.R}, |
| 708 | optional=True, avc=True), |
| 709 | ECA(ByteField("credentials_status", None), {AA.R, AA.W}, |
| 710 | optional=True, range_check=lambda x: 0 <= x <= 4), |
| 711 | ECA(BitField("extended_tc_layer_options", None, size=16), {AA.R}, |
| 712 | optional=True), |
| 713 | ] |
| 714 | mandatory_operations = { |
| 715 | OP.Get, OP.Set, OP.Reboot, OP.Test, OP.SynchronizeTime} |
| 716 | notifications = {OP.TestResult, OP.AttributeValueChange, |
| 717 | OP.AlarmNotification} |
| 718 | alarms = { |
| 719 | 0: 'Equipment alarm', |
| 720 | 1: 'Powering alarm', |
| 721 | 2: 'Battery missing', |
| 722 | 3: 'Battery failure', |
| 723 | 4: 'Battery low', |
| 724 | 5: 'Physical intrusion', |
| 725 | 6: 'Self-test failure', |
| 726 | 7: 'Dying gasp', |
| 727 | 8: 'Temperature yellow', |
| 728 | 9: 'Temperature red', |
| 729 | 10: 'Voltage yellow', |
| 730 | 11: 'Voltage red', |
| 731 | 12: 'ONU manual power off', |
| 732 | 13: 'Invalid image', |
| 733 | 14: 'PSE overload yellow', |
| 734 | 15: 'PSE overload red', |
| 735 | } |
| 736 | |
| 737 | |
| 738 | class Ont2G(EntityClass): |
| 739 | class_id = 257 |
| 740 | attributes = [ |
| 741 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 742 | range_check=lambda x: x == 0), |
| 743 | ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}), |
| 744 | ECA(ByteField("omcc_version", None), {AA.R}, avc=True), |
| 745 | ECA(ShortField("vendor_product_code", None), {AA.R}), |
| 746 | ECA(ByteField("security_capability", None), {AA.R}, |
| 747 | range_check=lambda x: 0 <= x <= 1), |
| 748 | ECA(ByteField("security_mode", None), {AA.R, AA.W}, |
| 749 | range_check=lambda x: 0 <= x <= 1), |
| 750 | ECA(ShortField("total_priority_queue_number", None), {AA.R}), |
| 751 | ECA(ByteField("total_traffic_scheduler_number", None), {AA.R}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 752 | ECA(ByteField("mode", None), {AA.R}, deprecated=True), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 753 | ECA(ShortField("total_gem_port_id_number", None), {AA.R}), |
| 754 | ECA(IntField("sys_uptime", None), {AA.R}), |
| 755 | ECA(BitField("connectivity_capability", None, size=16), {AA.R}), |
| 756 | ECA(ByteField("current_connectivity_mode", None), {AA.R, AA.W}, |
| 757 | range_check=lambda x: 0 <= x <= 7), |
| 758 | ECA(BitField("qos_configuration_flexibility", None, size=16), |
| 759 | {AA.R}, optional=True), |
| 760 | ECA(ShortField("priority_queue_scale_factor", None), {AA.R, AA.W}, |
| 761 | optional=True), |
| 762 | ] |
| 763 | mandatory_operations = {OP.Get, OP.Set} |
| 764 | notifications = {OP.AttributeValueChange} |
| 765 | |
| 766 | |
| 767 | class Tcont(EntityClass): |
| 768 | class_id = 262 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 769 | reconcile_sort_order = 5 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 770 | attributes = [ |
| 771 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 772 | ECA(ShortField("alloc_id", None), {AA.R, AA.W}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 773 | ECA(ByteField("mode_indicator", 1), {AA.R}, deprecated=True), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 774 | ECA(ByteField("policy", None), {AA.R, AA.W}, |
| 775 | range_check=lambda x: 0 <= x <= 2), |
| 776 | ] |
| 777 | mandatory_operations = {OP.Get, OP.Set} |
| 778 | |
| 779 | |
| 780 | class AniG(EntityClass): |
| 781 | class_id = 263 |
| 782 | attributes = [ |
| 783 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 784 | ECA(ByteField("sr_indication", None), {AA.R}), |
| 785 | ECA(ShortField("total_tcont_number", None), {AA.R}), |
| 786 | ECA(ShortField("gem_block_length", None), {AA.R, AA.W}), |
| 787 | ECA(ByteField("piggyback_dba_reporting", None), {AA.R}, |
| 788 | range_check=lambda x: 0 <= x <= 4), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 789 | ECA(ByteField("whole_ont_dba_reporting", None), {AA.R}, |
| 790 | deprecated=True), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 791 | ECA(ByteField("sf_threshold", 5), {AA.R, AA.W}), |
| 792 | ECA(ByteField("sd_threshold", 9), {AA.R, AA.W}), |
| 793 | ECA(ByteField("arc", 0), {AA.R, AA.W}, |
| 794 | range_check=lambda x: 0 <= x <= 1, avc=True), |
| 795 | ECA(ByteField("arc_interval", 0), {AA.R, AA.W}), |
| 796 | ECA(ShortField("optical_signal_level", None), {AA.R}), |
| 797 | ECA(ByteField("lower_optical_threshold", 0xFF), {AA.R, AA.W}), |
| 798 | ECA(ByteField("upper_optical_threshold", 0xFF), {AA.R, AA.W}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 799 | ECA(ShortField("ont_response_time", None), {AA.R}), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 800 | ECA(ShortField("transmit_optical_level", None), {AA.R}), |
| 801 | ECA(ByteField("lower_transmit_power_threshold", 0x81), {AA.R, AA.W}), |
| 802 | ECA(ByteField("upper_transmit_power_threshold", 0x81), {AA.R, AA.W}), |
| 803 | ] |
| 804 | mandatory_operations = {OP.Get, OP.Set, OP.Test} |
| 805 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 806 | alarms = { |
| 807 | 0: 'Low received optical power', |
| 808 | 1: 'High received optical power', |
| 809 | 2: 'Signal fail', |
| 810 | 3: 'Signal degrade', |
| 811 | 4: 'Low transmit optical power', |
| 812 | 5: 'High transmit optical power', |
| 813 | 6: 'Laser bias current', |
| 814 | } |
| 815 | |
| 816 | |
| 817 | class UniG(EntityClass): |
| 818 | class_id = 264 |
| 819 | attributes = [ |
| 820 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 821 | ECA(ShortField("configuration_option_status", None), {AA.R, AA.W}, |
| 822 | deprecated=True), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 823 | ECA(ByteField("administrative_state", None), {AA.R, AA.W}), |
| 824 | ECA(ByteField("management_capability", None), {AA.R}, |
| 825 | range_check=lambda x: 0 <= x <= 2), |
| 826 | ECA(ShortField("non_omci_management_identifier", None), {AA.R, AA.W}), |
| 827 | ECA(ShortField("relay_agent_options", None), {AA.R, AA.W}, |
| 828 | optional=True), |
| 829 | ] |
| 830 | mandatory_operations = {OP.Get, OP.Set} |
| 831 | |
| 832 | |
| 833 | class GemInterworkingTp(EntityClass): |
| 834 | class_id = 266 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 835 | reconcile_sort_order = 7 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 836 | attributes = [ |
| 837 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 838 | ECA(ShortField("gem_port_network_ctp_pointer", None), |
| 839 | {AA.R, AA.W, AA.SBC}), |
| 840 | ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC}, |
| 841 | range_check=lambda x: 0 <= x <= 7), |
| 842 | ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 843 | ECA(ShortField("interworking_tp_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 844 | ECA(ByteField("pptp_counter", None), {AA.R}, optional=True), |
| 845 | ECA(ByteField("operational_state", None), {AA.R}, optional=True, |
| 846 | range_check=lambda x: 0 <= x <= 1, avc=True), |
| 847 | ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 848 | ECA(ByteField("gal_loopback_configuration", 0), |
| 849 | {AA.R, AA.W}, range_check=lambda x: 0 <= x <= 1), |
| 850 | ] |
| 851 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 852 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 853 | alarms = { |
| 854 | 6: 'Operational state change', |
| 855 | } |
| 856 | |
| 857 | |
| 858 | class GemPortNetworkCtp(EntityClass): |
| 859 | class_id = 268 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 860 | reconcile_sort_order = 6 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 861 | attributes = [ |
| 862 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 863 | ECA(ShortField("port_id", None), {AA.R, AA.W, AA.SBC}), |
| 864 | ECA(ShortField("tcont_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 865 | ECA(ByteField("direction", None), {AA.R, AA.W, AA.SBC}, |
| 866 | range_check=lambda x: 1 <= x <= 3), |
| 867 | ECA(ShortField("traffic_management_pointer_upstream", None), |
| 868 | {AA.R, AA.W, AA.SBC}), |
| 869 | ECA(ShortField("traffic_descriptor_profile_pointer", None), |
| 870 | {AA.R, AA.W, AA.SBC}, optional=True), |
| 871 | ECA(ByteField("uni_counter", None), {AA.R}, optional=True), |
| 872 | ECA(ShortField("priority_queue_pointer_downstream", None), |
| 873 | {AA.R, AA.W, AA.SBC}), |
| 874 | ECA(ByteField("encryption_state", None), {AA.R}, optional=True), |
| 875 | ECA(ShortField("traffic_desc_profile_pointer_downstream", None), |
| 876 | {AA.R, AA.W, AA.SBC}, optional=True), |
| 877 | ECA(ShortField("encryption_key_ring", None), {AA.R, AA.W, AA.SBC}, |
| 878 | range_check=lambda x: 0 <= x <= 3) |
| 879 | ] |
| 880 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 881 | notifications = {OP.AlarmNotification} |
| 882 | alarms = { |
| 883 | 5: 'End-to-end loss of continuity', |
| 884 | } |
| 885 | |
| 886 | |
| 887 | class GalEthernetProfile(EntityClass): |
| 888 | class_id = 272 |
Matt Jeanneret | b3287df | 2019-10-11 19:00:20 -0400 | [diff] [blame] | 889 | reconcile_sort_order = 1 |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 890 | attributes = [ |
| 891 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 892 | ECA(ShortField("max_gem_payload_size", None), {AA.R, AA.W, AA.SBC}), |
| 893 | ] |
| 894 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 895 | |
| 896 | |
| 897 | class PriorityQueueG(EntityClass): |
| 898 | class_id = 277 |
| 899 | attributes = [ |
| 900 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 901 | ECA(ByteField("queue_configuration_option", None), {AA.R}, |
| 902 | range_check=lambda x: 0 <= x <= 1), |
| 903 | ECA(ShortField("maximum_queue_size", None), {AA.R}), |
| 904 | ECA(ShortField("allocated_queue_size", None), {AA.R, AA.W}), |
| 905 | ECA(ShortField("discard_block_counter_reset_interval", None), {AA.R, AA.W}), |
| 906 | ECA(ShortField("threshold_value_for_discarded_blocks", None), {AA.R, AA.W}), |
aishwaryarana01 | e7eb1c7 | 2019-07-24 09:52:21 -0500 | [diff] [blame] | 907 | ECA(IntField("related_port", None), {AA.R, AA.W}), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 908 | ECA(ShortField("traffic_scheduler_pointer", 0), {AA.R, AA.W}), |
| 909 | ECA(ByteField("weight", 1), {AA.R, AA.W}), |
| 910 | ECA(ShortField("back_pressure_operation", 0), {AA.R, AA.W}, |
| 911 | range_check=lambda x: 0 <= x <= 1), |
| 912 | ECA(IntField("back_pressure_time", 0), {AA.R, AA.W}), |
| 913 | ECA(ShortField("back_pressure_occur_queue_threshold", None), {AA.R, AA.W}), |
| 914 | ECA(ShortField("back_pressure_clear_queue_threshold", None), {AA.R, AA.W}), |
| 915 | # TODO: Custom field of 4 2-byte values would help below |
| 916 | ECA(LongField("packet_drop_queue_thresholds", None), {AA.R, AA.W}, |
| 917 | optional=True), |
| 918 | ECA(ShortField("packet_drop_max_p", 0xFFFF), {AA.R, AA.W}, optional=True), |
| 919 | ECA(ByteField("queue_drop_w_q", 9), {AA.R, AA.W}, optional=True), |
| 920 | ECA(ByteField("drop_precedence_colour_marking", 0), {AA.R, AA.W}, |
| 921 | optional=True, range_check=lambda x: 0 <= x <= 7), |
| 922 | ] |
| 923 | mandatory_operations = {OP.Get, OP.Set} |
| 924 | notifications = {OP.AlarmNotification} |
| 925 | alarms = { |
| 926 | 0: 'Block loss', |
| 927 | } |
| 928 | |
| 929 | |
| 930 | class TrafficSchedulerG(EntityClass): |
| 931 | class_id = 278 |
| 932 | attributes = [ |
| 933 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 934 | ECA(ShortField("tcont_pointer", None), {AA.R}), |
| 935 | ECA(ShortField("traffic_scheduler_pointer", None), {AA.R}), |
| 936 | ECA(ByteField("policy", None), {AA.R, AA.W}, |
| 937 | range_check=lambda x: 0 <= x <= 2), |
| 938 | ECA(ByteField("priority_weight", 0), {AA.R, AA.W}), |
| 939 | ] |
| 940 | mandatory_operations = {OP.Get, OP.Set} |
| 941 | |
| 942 | |
| 943 | class MulticastGemInterworkingTp(EntityClass): |
| 944 | class_id = 281 |
| 945 | attributes = [ |
| 946 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}, |
| 947 | range_check=lambda x: x != OmciNullPointer), |
| 948 | ECA(ShortField("gem_port_network_ctp_pointer", None), {AA.R, AA.SBC}), |
| 949 | ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC}, |
| 950 | range_check=lambda x: x in [0, 1, 3, 5]), |
| 951 | ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 952 | ECA(ShortField("interworking_tp_pointer", 0), {AA.R, AA.W, AA.SBC}, |
| 953 | deprecated=True), |
| 954 | ECA(ByteField("pptp_counter", None), {AA.R}), |
| 955 | ECA(ByteField("operational_state", None), {AA.R}, avc=True, |
| 956 | range_check=lambda x: 0 <= x <= 1), |
| 957 | ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}), |
| 958 | ECA(ByteField("gal_loopback_configuration", None), {AA.R, AA.W, AA.SBC}, |
| 959 | deprecated=True), |
| 960 | # TODO add multicast_address_table here (page 85 of spec.) |
| 961 | # ECA(...("multicast_address_table", None), {AA.R, AA.W}) |
| 962 | ] |
| 963 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.GetNext, OP.Set} |
| 964 | optional_operations = {OP.SetTable} |
| 965 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 966 | alarms = { |
| 967 | 0: 'Deprecated', |
| 968 | } |
| 969 | |
| 970 | |
| 971 | class AccessControlRow0(Packet): |
| 972 | name = "AccessControlRow0" |
| 973 | fields_desc = [ |
| 974 | BitField("set_ctrl", 0, 2), |
| 975 | BitField("row_part_id", 0, 3), |
| 976 | BitField("test", 0, 1), |
| 977 | BitField("row_key", 0, 10), |
| 978 | |
| 979 | ShortField("gem_port_id", None), |
| 980 | ShortField("vlan_id", None), |
| 981 | IPField("src_ip", None), |
| 982 | IPField("dst_ip_start", None), |
| 983 | IPField("dst_ip_end", None), |
| 984 | IntField("ipm_group_bw", None), |
| 985 | ShortField("reserved0", 0) |
| 986 | ] |
| 987 | |
| 988 | def to_json(self): |
| 989 | return json.dumps(self.fields, separators=(',', ':')) |
| 990 | |
| 991 | |
| 992 | class AccessControlRow1(Packet): |
| 993 | name = "AccessControlRow1" |
| 994 | fields_desc = [ |
| 995 | BitField("set_ctrl", 0, 2), |
| 996 | BitField("row_part_id", 0, 3), |
| 997 | BitField("test", 0, 1), |
| 998 | BitField("row_key", 0, 10), |
| 999 | |
| 1000 | StrFixedLenField("ipv6_src_addr_start_bytes", None, 12), |
| 1001 | ShortField("preview_length", None), |
| 1002 | ShortField("preview_repeat_time", None), |
| 1003 | ShortField("preview_repeat_count", None), |
| 1004 | ShortField("preview_reset_time", None), |
| 1005 | ShortField("reserved1", 0) |
| 1006 | ] |
| 1007 | |
| 1008 | def to_json(self): |
| 1009 | return json.dumps(self.fields, separators=(',', ':')) |
| 1010 | |
| 1011 | |
| 1012 | class AccessControlRow2(Packet): |
| 1013 | name = "AccessControlRow2" |
| 1014 | fields_desc = [ |
| 1015 | BitField("set_ctrl", 0, 2), |
| 1016 | BitField("row_part_id", 0, 3), |
| 1017 | BitField("test", 0, 1), |
| 1018 | BitField("row_key", 0, 10), |
| 1019 | |
| 1020 | StrFixedLenField("ipv6_dst_addr_start_bytes", None, 12), |
| 1021 | StrFixedLenField("reserved2", None, 10) |
| 1022 | ] |
| 1023 | |
| 1024 | def to_json(self): |
| 1025 | return json.dumps(self.fields, separators=(',', ':')) |
| 1026 | |
| 1027 | |
| 1028 | class DownstreamIgmpMulticastTci(Packet): |
| 1029 | name = "DownstreamIgmpMulticastTci" |
| 1030 | fields_desc = [ |
| 1031 | ByteField("ctrl_type", None), |
| 1032 | ShortField("tci", None) |
| 1033 | ] |
| 1034 | |
| 1035 | def to_json(self): |
| 1036 | return json.dumps(self.fields, separators=(',', ':')) |
| 1037 | |
| 1038 | |
| 1039 | class MulticastOperationsProfile(EntityClass): |
| 1040 | class_id = 309 |
| 1041 | attributes = [ |
| 1042 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}, |
| 1043 | range_check=lambda x: x != 0 and x != OmciNullPointer), |
| 1044 | ECA(ByteField("igmp_version", None), {AA.R, AA.W, AA.SBC}, |
| 1045 | range_check=lambda x: x in [1, 2, 3, 16, 17]), |
| 1046 | ECA(ByteField("igmp_function", None), {AA.R, AA.W, AA.SBC}, |
| 1047 | range_check=lambda x: 0 <= x <= 2), |
| 1048 | ECA(ByteField("immediate_leave", None), {AA.R, AA.W, AA.SBC}, |
| 1049 | range_check=lambda x: 0 <= x <= 1), |
| 1050 | ECA(ShortField("us_igmp_tci", None), {AA.R, AA.W, AA.SBC}, optional=True), |
| 1051 | ECA(ByteField("us_igmp_tag_ctrl", None), {AA.R, AA.W, AA.SBC}, |
| 1052 | range_check=lambda x: 0 <= x <= 3, optional=True), |
| 1053 | ECA(IntField("us_igmp_rate", None), {AA.R, AA.W, AA.SBC}, optional=True), |
| 1054 | # TODO: need to make table and add column data |
| 1055 | ECA(StrFixedLenField( |
| 1056 | "dynamic_access_control_list_table", None, 24), {AA.R, AA.W}), |
| 1057 | # TODO: need to make table and add column data |
| 1058 | ECA(StrFixedLenField( |
| 1059 | "static_access_control_list_table", None, 24), {AA.R, AA.W}), |
| 1060 | # TODO: need to make table and add column data |
| 1061 | ECA(StrFixedLenField("lost_groups_list_table", None, 10), {AA.R}), |
| 1062 | ECA(ByteField("robustness", None), {AA.R, AA.W, AA.SBC}), |
| 1063 | ECA(IntField("querier_ip", None), {AA.R, AA.W, AA.SBC}), |
| 1064 | ECA(IntField("query_interval", None), {AA.R, AA.W, AA.SBC}), |
| 1065 | ECA(IntField("querier_max_response_time", None), {AA.R, AA.W, AA.SBC}), |
| 1066 | ECA(IntField("last_member_response_time", 10), {AA.R, AA.W}), |
| 1067 | ECA(ByteField("unauthorized_join_behaviour", None), {AA.R, AA.W}), |
| 1068 | ECA(StrFixedLenField("ds_igmp_mcast_tci", None, 3), {AA.R, AA.W, AA.SBC}, optional=True) |
| 1069 | ] |
| 1070 | mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext} |
| 1071 | optional_operations = {OP.SetTable} |
| 1072 | notifications = {OP.AlarmNotification} |
| 1073 | alarms = { |
| 1074 | 0: 'Lost multicast group', |
| 1075 | } |
| 1076 | |
| 1077 | |
| 1078 | class MulticastServicePackage(Packet): |
| 1079 | name = "MulticastServicePackage" |
| 1080 | fields_desc = [ |
| 1081 | BitField("set_ctrl", 0, 2), |
| 1082 | BitField("reserved0", 0, 4), |
| 1083 | BitField("row_key", 0, 10), |
| 1084 | |
| 1085 | ShortField("vid_uni", None), |
| 1086 | ShortField("max_simultaneous_groups", None), |
| 1087 | IntField("max_multicast_bw", None), |
| 1088 | ShortField("mcast_operations_profile_pointer", None), |
| 1089 | StrFixedLenField("reserved1", None, 8) |
| 1090 | ] |
| 1091 | |
| 1092 | def to_json(self): |
| 1093 | return json.dumps(self.fields, separators=(',', ':')) |
| 1094 | |
| 1095 | |
| 1096 | class AllowedPreviewGroupsRow0(Packet): |
| 1097 | name = "AllowedPreviewGroupsRow0" |
| 1098 | fields_desc = [ |
| 1099 | BitField("set_ctrl", 0, 2), |
| 1100 | BitField("row_part_id", 0, 3), |
| 1101 | BitField("reserved0", 0, 1), |
| 1102 | BitField("row_key", 0, 10), |
| 1103 | |
| 1104 | StrFixedLenField("ipv6_pad", 0, 12), |
| 1105 | IPField("src_ip", None), |
| 1106 | ShortField("vlan_id_ani", None), |
| 1107 | ShortField("vlan_id_uni", None) |
| 1108 | ] |
| 1109 | |
| 1110 | def to_json(self): |
| 1111 | return json.dumps(self.fields, separators=(',', ':')) |
| 1112 | |
| 1113 | |
| 1114 | class AllowedPreviewGroupsRow1(Packet): |
| 1115 | name = "AllowedPreviewGroupsRow1" |
| 1116 | fields_desc = [ |
| 1117 | BitField("set_ctrl", 0, 2), |
| 1118 | BitField("row_part_id", 0, 3), |
| 1119 | BitField("reserved0", 0, 1), |
| 1120 | BitField("row_key", 0, 10), |
| 1121 | |
| 1122 | StrFixedLenField("ipv6_pad", 0, 12), |
| 1123 | IPField("dst_ip", None), |
| 1124 | ShortField("duration", None), |
| 1125 | ShortField("time_left", None) |
| 1126 | ] |
| 1127 | |
| 1128 | def to_json(self): |
| 1129 | return json.dumps(self.fields, separators=(',', ':')) |
| 1130 | |
| 1131 | |
| 1132 | class MulticastSubscriberConfigInfo(EntityClass): |
| 1133 | class_id = 310 |
| 1134 | attributes = [ |
| 1135 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1136 | ECA(ByteField("me_type", None), {AA.R, AA.W, AA.SBC}, |
| 1137 | range_check=lambda x: 0 <= x <= 1), |
| 1138 | ECA(ShortField("mcast_operations_profile_pointer", None), |
| 1139 | {AA.R, AA.W, AA.SBC}), |
| 1140 | ECA(ShortField("max_simultaneous_groups", None), {AA.R, AA.W, AA.SBC}), |
| 1141 | ECA(IntField("max_multicast_bandwidth", None), {AA.R, AA.W, AA.SBC}), |
| 1142 | ECA(ByteField("bandwidth_enforcement", None), {AA.R, AA.W, AA.SBC}, |
| 1143 | range_check=lambda x: 0 <= x <= 1), |
| 1144 | # TODO: need to make table and add column data |
| 1145 | ECA(StrFixedLenField( |
| 1146 | "multicast_service_package_table", None, 20), {AA.R, AA.W}), |
| 1147 | # TODO: need to make table and add column data |
| 1148 | ECA(StrFixedLenField( |
| 1149 | "allowed_preview_groups_table", None, 22), {AA.R, AA.W}), |
| 1150 | ] |
| 1151 | mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext, |
| 1152 | OP.SetTable} |
| 1153 | |
| 1154 | |
| 1155 | class VirtualEthernetInterfacePt(EntityClass): |
| 1156 | class_id = 329 |
| 1157 | attributes = [ |
| 1158 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 1159 | range_check=lambda x: x != 0 and x != OmciNullPointer), |
| 1160 | ECA(ByteField("administrative_state", None), {AA.R, AA.W}, |
| 1161 | range_check=lambda x: 0 <= x <= 1), |
| 1162 | ECA(ByteField("operational_state", None), {AA.R}, avc=True, |
| 1163 | range_check=lambda x: 0 <= x <= 1), |
| 1164 | ECA(StrFixedLenField( |
| 1165 | "interdomain_name", None, 25), {AA.R, AA.W}, optional=True), |
| 1166 | ECA(ShortField("tcp_udp_pointer", None), {AA.R, AA.W}, optional=True), |
| 1167 | ECA(ShortField("iana_assigned_port", None), {AA.R}), |
| 1168 | ] |
| 1169 | mandatory_operations = {OP.Get, OP.Set} |
| 1170 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 1171 | alarms = { |
| 1172 | 0: 'Connecting function fail', |
| 1173 | } |
| 1174 | |
| 1175 | |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 1176 | class OmciMeTypeTable(Packet): |
| 1177 | """ |
| 1178 | OMCI ME Supported Types Table |
| 1179 | """ |
| 1180 | name = "OmciMeTypeTable" |
| 1181 | fields_desc = [ |
| 1182 | ShortField("me_type", None) |
| 1183 | ] |
| 1184 | |
| 1185 | def to_json(self): |
| 1186 | return json.dumps(self.fields, separators=(',', ':')) |
| 1187 | |
| 1188 | @staticmethod |
| 1189 | def json_from_value(value): |
| 1190 | data = int(value) |
| 1191 | temp = OmciMeTypeTable(me_type=data) |
| 1192 | return json.dumps(temp.fields, separators=(',', ':')) |
| 1193 | |
| 1194 | def index(self): |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 1195 | return b'%04d' % (self.fields.get('me_type', 0)) |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 1196 | |
| 1197 | def is_delete(self): |
| 1198 | return self.fields.get('me_type', 0) == 0 |
| 1199 | |
| 1200 | def delete(self): |
| 1201 | self.fields['me_type'] = 0 |
| 1202 | return self |
| 1203 | |
| 1204 | |
| 1205 | class OmciMsgTypeTable(Packet): |
| 1206 | """ |
| 1207 | OMCI Supported Message Types Table |
| 1208 | """ |
| 1209 | name = "OmciMsgTypeTable" |
| 1210 | fields_desc = [ |
| 1211 | ByteField("msg_type", None) |
| 1212 | ] |
| 1213 | |
| 1214 | def to_json(self): |
| 1215 | return json.dumps(self.fields, separators=(',', ':')) |
| 1216 | |
| 1217 | @staticmethod |
| 1218 | def json_from_value(value): |
| 1219 | data = int(value) |
| 1220 | temp = OmciMeTypeTable(me_type=data) |
| 1221 | return json.dumps(temp.fields, separators=(',', ':')) |
| 1222 | |
| 1223 | def index(self): |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 1224 | return b'%02d' % (self.fields.get('msg_type', 0)) |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 1225 | |
| 1226 | def is_delete(self): |
| 1227 | return self.fields.get('me_type', 0) == 0 |
| 1228 | |
| 1229 | def delete(self): |
| 1230 | self.fields['me_type'] = 0 |
| 1231 | return self |
| 1232 | |
| 1233 | |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1234 | class Omci(EntityClass): |
| 1235 | class_id = 287 |
| 1236 | hidden = True |
| 1237 | attributes = [ |
| 1238 | ECA(ShortField("managed_entity_id", None), {AA.R}, |
| 1239 | range_check=lambda x: x == 0), |
| 1240 | |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 1241 | ECA(OmciTableField( |
| 1242 | PacketLenField("me_type_table", None, |
| 1243 | OmciMeTypeTable, length_from=lambda pkt: 2)), |
| 1244 | {AA.R}), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1245 | |
Matt Jeanneret | 72fe6ae | 2019-04-13 20:58:47 -0400 | [diff] [blame] | 1246 | ECA(OmciTableField( |
| 1247 | PacketLenField("message_type_table", None, |
| 1248 | OmciMsgTypeTable, length_from=lambda pkt: 1)), |
| 1249 | {AA.R}), |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1250 | ] |
| 1251 | mandatory_operations = {OP.Get, OP.GetNext} |
| 1252 | |
| 1253 | |
| 1254 | class EnhSecurityControl(EntityClass): |
| 1255 | class_id = 332 |
| 1256 | attributes = [ |
| 1257 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 1258 | ECA(BitField("olt_crypto_capabilities", None, 16*8), {AA.W}), |
| 1259 | # TODO: need to make table and add column data |
| 1260 | ECA(StrFixedLenField( |
| 1261 | "olt_random_challenge_table", None, 17), {AA.R, AA.W}), |
| 1262 | ECA(ByteField("olt_challenge_status", 0), {AA.R, AA.W}, |
| 1263 | range_check=lambda x: 0 <= x <= 1), |
| 1264 | ECA(ByteField("onu_selected_crypto_capabilities", None), {AA.R}), |
| 1265 | # TODO: need to make table and add column data |
| 1266 | ECA(StrFixedLenField( |
| 1267 | "onu_random_challenge_table", None, 16), {AA.R}, avc=True), |
| 1268 | # TODO: need to make table and add column data |
| 1269 | ECA(StrFixedLenField( |
| 1270 | "onu_authentication_result_table", None, 16), {AA.R}, avc=True), |
| 1271 | # TODO: need to make table and add column data |
| 1272 | ECA(StrFixedLenField( |
| 1273 | "olt_authentication_result_table", None, 17), {AA.W}), |
| 1274 | ECA(ByteField("olt_result_status", None), {AA.R, AA.W}, |
| 1275 | range_check=lambda x: 0 <= x <= 1), |
| 1276 | ECA(ByteField("onu_authentication_status", None), {AA.R}, avc=True, |
| 1277 | range_check=lambda x: 0 <= x <= 5), |
| 1278 | ECA(StrFixedLenField( |
| 1279 | "master_session_key_name", None, 16), {AA.R}), |
| 1280 | ECA(StrFixedLenField( |
| 1281 | "broadcast_key_table", None, 18), {AA.R, AA.W}), |
| 1282 | ECA(ShortField("effective_key_length", None), {AA.R}), |
| 1283 | |
| 1284 | ] |
| 1285 | mandatory_operations = {OP.Set, OP.Get, OP.GetNext} |
| 1286 | notifications = {OP.AttributeValueChange} |
| 1287 | |
| 1288 | |
| 1289 | class EthernetPMMonitoringHistoryData(EntityClass): |
| 1290 | class_id = 24 |
| 1291 | hidden = True |
| 1292 | attributes = [ |
| 1293 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1294 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1295 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1296 | ECA(IntField("fcs_errors", None), {AA.R}, tca=True, counter=True), |
| 1297 | ECA(IntField("excessive_collision_counter", None), {AA.R}, tca=True, counter=True), |
| 1298 | ECA(IntField("late_collision_counter", None), {AA.R}, tca=True, counter=True), |
| 1299 | ECA(IntField("frames_too_long", None), {AA.R}, tca=True, counter=True), |
| 1300 | ECA(IntField("buffer_overflows_on_rx", None), {AA.R}, tca=True, counter=True), |
| 1301 | ECA(IntField("buffer_overflows_on_tx", None), {AA.R}, tca=True, counter=True), |
| 1302 | ECA(IntField("single_collision_frame_counter", None), {AA.R}, tca=True, counter=True), |
| 1303 | ECA(IntField("multiple_collisions_frame_counter", None), {AA.R}, tca=True, counter=True), |
| 1304 | ECA(IntField("sqe_counter", None), {AA.R}, tca=True, counter=True), |
| 1305 | ECA(IntField("deferred_tx_counter", None), {AA.R}, tca=True, counter=True), |
| 1306 | ECA(IntField("internal_mac_tx_error_counter", None), {AA.R}, tca=True, counter=True), |
| 1307 | ECA(IntField("carrier_sense_error_counter", None), {AA.R}, tca=True, counter=True), |
| 1308 | ECA(IntField("alignment_error_counter", None), {AA.R}, tca=True, counter=True), |
| 1309 | ECA(IntField("internal_mac_rx_error_counter", None), {AA.R}, tca=True, counter=True) |
| 1310 | ] |
| 1311 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData} |
| 1312 | notifications = {OP.AlarmNotification} |
| 1313 | alarms = { |
| 1314 | 0: 'FCS errors', |
| 1315 | 1: 'Excessive collision counter', |
| 1316 | 2: 'Late collision counter', |
| 1317 | 3: 'Frames too long', |
| 1318 | 4: 'Buffer overflows on receive', |
| 1319 | 5: 'Buffer overflows on transmit', |
| 1320 | 6: 'Single collision frame counter', |
| 1321 | 7: 'Multiple collision frame counter', |
| 1322 | 8: 'SQE counter', |
| 1323 | 9: 'Deferred transmission counter', |
| 1324 | 10: 'Internal MAC transmit error counter', |
| 1325 | 11: 'Carrier sense error counter', |
| 1326 | 12: 'Alignment error counter', |
| 1327 | 13: 'Internal MAC receive error counter', |
| 1328 | } |
| 1329 | |
| 1330 | |
| 1331 | class FecPerformanceMonitoringHistoryData(EntityClass): |
| 1332 | class_id = 312 |
| 1333 | hidden = True |
| 1334 | attributes = [ |
| 1335 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1336 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1337 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1338 | ECA(IntField("corrected_bytes", None), {AA.R}, tca=True, counter=True), |
| 1339 | ECA(IntField("corrected_code_words", None), {AA.R}, tca=True, counter=True), |
| 1340 | ECA(IntField("uncorrectable_code_words", None), {AA.R}, tca=True, counter=True), |
| 1341 | ECA(IntField("total_code_words", None), {AA.R}, counter=True), |
| 1342 | ECA(ShortField("fec_seconds", None), {AA.R}, tca=True, counter=True) |
| 1343 | ] |
| 1344 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData} |
| 1345 | notifications = {OP.AlarmNotification} |
| 1346 | alarms = { |
| 1347 | 0: 'Corrected bytes', |
| 1348 | 1: 'Corrected code words', |
| 1349 | 2: 'Uncorrectable code words', |
| 1350 | 4: 'FEC seconds', |
| 1351 | } |
| 1352 | |
| 1353 | |
| 1354 | class EthernetFrameDownstreamPerformanceMonitoringHistoryData(EntityClass): |
| 1355 | class_id = 321 |
| 1356 | hidden = True |
| 1357 | attributes = [ |
| 1358 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1359 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1360 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1361 | ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True), |
| 1362 | ECA(IntField("octets", None), {AA.R}, counter=True), |
| 1363 | ECA(IntField("packets", None), {AA.R}, counter=True), |
| 1364 | ECA(IntField("broadcast_packets", None), {AA.R}, counter=True), |
| 1365 | ECA(IntField("multicast_packets", None), {AA.R}, counter=True), |
| 1366 | ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True), |
| 1367 | ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True), |
| 1368 | ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True), |
| 1369 | ECA(IntField("64_octets", None), {AA.R}, counter=True), |
| 1370 | ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True), |
| 1371 | ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True), |
| 1372 | ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True), |
| 1373 | ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True), |
| 1374 | ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True) |
| 1375 | ] |
| 1376 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData} |
| 1377 | notifications = {OP.AlarmNotification} |
| 1378 | alarms = { |
| 1379 | 0: 'Drop events', |
| 1380 | 1: 'CRC errored packets', |
| 1381 | 2: 'Undersize packets', |
| 1382 | 3: 'Oversize packets', |
| 1383 | } |
| 1384 | |
| 1385 | |
| 1386 | class EthernetFrameUpstreamPerformanceMonitoringHistoryData(EntityClass): |
| 1387 | class_id = 322 |
| 1388 | hidden = True |
| 1389 | attributes = [ |
| 1390 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1391 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1392 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1393 | ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True), |
| 1394 | ECA(IntField("octets", None), {AA.R}, counter=True), |
| 1395 | ECA(IntField("packets", None), {AA.R}, counter=True), |
| 1396 | ECA(IntField("broadcast_packets", None), {AA.R}, counter=True), |
| 1397 | ECA(IntField("multicast_packets", None), {AA.R}, counter=True), |
| 1398 | ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True), |
| 1399 | ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True), |
| 1400 | ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True), |
| 1401 | ECA(IntField("64_octets", None), {AA.R}, counter=True), |
| 1402 | ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True), |
| 1403 | ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True), |
| 1404 | ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True), |
| 1405 | ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True), |
| 1406 | ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True) |
| 1407 | ] |
| 1408 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData} |
| 1409 | notifications = {OP.AlarmNotification} |
| 1410 | alarms = { |
| 1411 | 0: 'Drop events', |
| 1412 | 1: 'CRC errored packets', |
| 1413 | 2: 'Undersize packets', |
| 1414 | 3: 'Oversize packets', |
| 1415 | } |
| 1416 | |
| 1417 | |
| 1418 | class VeipUni(EntityClass): |
| 1419 | class_id = 329 |
| 1420 | attributes = [ |
| 1421 | ECA(ShortField("managed_entity_id", None), {AA.R}), |
| 1422 | ECA(ByteField("administrative_state", 1), {AA.R, AA.W}, |
| 1423 | range_check=lambda x: 0 <= x <= 1), |
| 1424 | ECA(ByteField("operational_state", 1), {AA.R, AA.W}, |
| 1425 | range_check=lambda x: 0 <= x <= 1, optional=True, avc=True), |
| 1426 | ECA(StrFixedLenField("interdomain_name", None, 25), {AA.R, AA.W}, |
| 1427 | optional=True), |
| 1428 | ECA(ShortField("tcp_udp_pointer", None), {AA.R, AA.W}, optional=True), |
| 1429 | ECA(ShortField("iana_assigned_port", 0xFFFF), {AA.R}) |
| 1430 | ] |
| 1431 | mandatory_operations = {OP.Get, OP.Set} |
| 1432 | notifications = {OP.AttributeValueChange, OP.AlarmNotification} |
| 1433 | alarms = { |
| 1434 | 0: 'Connecting function fail' |
| 1435 | } |
| 1436 | |
| 1437 | |
| 1438 | class EthernetFrameExtendedPerformanceMonitoring(EntityClass): |
| 1439 | class_id = 334 |
| 1440 | hidden = True |
| 1441 | attributes = [ |
| 1442 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1443 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1444 | # 2-octet field -> Threshold data 1/2 ID |
| 1445 | # 2-octet field -> Parent ME Class |
| 1446 | # 2-octet field -> Parent ME Instance |
| 1447 | # 2-octet field -> Accumulation disable |
| 1448 | # 2-octet field -> TCA Disable |
| 1449 | # 2-octet field -> Control fields bitmap |
| 1450 | # 2-octet field -> TCI |
| 1451 | # 2-octet field -> Reserved |
| 1452 | ECA(FieldListField("control_block", None, ShortField('', 0), |
| 1453 | count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}), |
| 1454 | ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True), |
| 1455 | ECA(IntField("octets", None), {AA.R}, counter=True), |
| 1456 | ECA(IntField("packets", None), {AA.R}, counter=True), |
| 1457 | ECA(IntField("broadcast_packets", None), {AA.R}, counter=True), |
| 1458 | ECA(IntField("multicast_packets", None), {AA.R}, counter=True), |
| 1459 | ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True), |
| 1460 | ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True), |
| 1461 | ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True), |
| 1462 | ECA(IntField("64_octets", None), {AA.R}, counter=True), |
| 1463 | ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True), |
| 1464 | ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True), |
| 1465 | ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True), |
| 1466 | ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True), |
| 1467 | ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True) |
| 1468 | ] |
| 1469 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 1470 | optional_operations = {OP.GetCurrentData} |
| 1471 | notifications = {OP.AlarmNotification} |
| 1472 | alarms = { |
| 1473 | 0: 'Drop events', |
| 1474 | 1: 'CRC errored packets', |
| 1475 | 2: 'Undersize packets', |
| 1476 | 3: 'Oversize packets', |
| 1477 | } |
| 1478 | |
| 1479 | |
| 1480 | class EthernetFrameExtendedPerformanceMonitoring64Bit(EntityClass): |
| 1481 | class_id = 426 |
| 1482 | hidden = True |
| 1483 | attributes = [ |
| 1484 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1485 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1486 | # 2-octet field -> Threshold data 1/2 ID |
| 1487 | # 2-octet field -> Parent ME Class |
| 1488 | # 2-octet field -> Parent ME Instance |
| 1489 | # 2-octet field -> Accumulation disable |
| 1490 | # 2-octet field -> TCA Disable |
| 1491 | # 2-octet field -> Control fields bitmap |
| 1492 | # 2-octet field -> TCI |
| 1493 | # 2-octet field -> Reserved |
| 1494 | ECA(FieldListField("control_block", None, ShortField('', 0), |
| 1495 | count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}), |
| 1496 | ECA(LongField("drop_events", None), {AA.R}, tca=True, counter=True), |
| 1497 | ECA(LongField("octets", None), {AA.R}, counter=True), |
| 1498 | ECA(LongField("packets", None), {AA.R}, counter=True), |
| 1499 | ECA(LongField("broadcast_packets", None), {AA.R}, counter=True), |
| 1500 | ECA(LongField("multicast_packets", None), {AA.R}, counter=True), |
| 1501 | ECA(LongField("crc_errored_packets", None), {AA.R}, tca=True, counter=True), |
| 1502 | ECA(LongField("undersize_packets", None), {AA.R}, tca=True, counter=True), |
| 1503 | ECA(LongField("oversize_packets", None), {AA.R}, tca=True, counter=True), |
| 1504 | ECA(LongField("64_octets", None), {AA.R}, counter=True), |
| 1505 | ECA(LongField("65_to_127_octets", None), {AA.R}, counter=True), |
| 1506 | ECA(LongField("128_to_255_octets", None), {AA.R}, counter=True), |
| 1507 | ECA(LongField("256_to_511_octets", None), {AA.R}, counter=True), |
| 1508 | ECA(LongField("512_to_1023_octets", None), {AA.R}, counter=True), |
| 1509 | ECA(LongField("1024_to_1518_octets", None), {AA.R}, counter=True) |
| 1510 | ] |
| 1511 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 1512 | optional_operations = {OP.GetCurrentData} |
| 1513 | notifications = {OP.AlarmNotification} |
| 1514 | alarms = { |
| 1515 | 0: 'Drop events', |
| 1516 | 1: 'CRC errored packets', |
| 1517 | 2: 'Undersize packets', |
| 1518 | 3: 'Oversize packets', |
| 1519 | } |
| 1520 | |
| 1521 | |
| 1522 | class GemPortNetworkCtpMonitoringHistoryData(EntityClass): |
| 1523 | class_id = 341 |
| 1524 | hidden = True |
| 1525 | attributes = [ |
| 1526 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1527 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1528 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1529 | ECA(IntField("transmitted_gem_frames", None), {AA.R}, counter=True), |
| 1530 | ECA(IntField("received_gem_frames", None), {AA.R}, counter=True), |
| 1531 | ECA(LongField("received_payload_bytes", None), {AA.R}, counter=True), |
| 1532 | ECA(LongField("transmitted_payload_bytes", None), {AA.R}, counter=True), |
| 1533 | ECA(IntField("encryption_key_errors", None), {AA.R}, tca=True, counter=True) |
| 1534 | ] |
| 1535 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData} |
| 1536 | notifications = {OP.AlarmNotification} |
| 1537 | alarms = { |
| 1538 | 1: 'Encryption key errors', |
| 1539 | } |
| 1540 | |
| 1541 | |
| 1542 | class XgPonTcPerformanceMonitoringHistoryData(EntityClass): |
| 1543 | class_id = 344 |
| 1544 | hidden = True |
| 1545 | attributes = [ |
| 1546 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1547 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1548 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1549 | ECA(IntField("psbd_hec_error_count", None), {AA.R}, tca=True, counter=True), |
| 1550 | ECA(IntField("xgtc_hec_error_count", None), {AA.R}, tca=True, counter=True), |
| 1551 | ECA(IntField("unknown_profile_count", None), {AA.R}, tca=True, counter=True), |
| 1552 | ECA(IntField("transmitted_xgem_frames", None), {AA.R}, counter=True), |
| 1553 | ECA(IntField("fragment_xgem_frames", None), {AA.R}, counter=True), |
| 1554 | ECA(IntField("xgem_hec_lost_words_count", None), {AA.R}, tca=True, counter=True), |
| 1555 | ECA(IntField("xgem_key_errors", None), {AA.R}, tca=True, counter=True), |
| 1556 | ECA(IntField("xgem_hec_error_count", None), {AA.R}, tca=True, counter=True) |
| 1557 | ] |
| 1558 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 1559 | optional_operations = {OP.GetCurrentData} |
| 1560 | notifications = {OP.AlarmNotification} |
| 1561 | alarms = { |
| 1562 | 1: 'PSBd HEC error count', |
| 1563 | 2: 'XGTC HEC error count', |
| 1564 | 3: 'Unknown profile count', |
| 1565 | 4: 'XGEM HEC loss count', |
| 1566 | 5: 'XGEM key errors', |
| 1567 | 6: 'XGEM HEC error count', |
| 1568 | } |
| 1569 | |
| 1570 | |
| 1571 | class XgPonDownstreamPerformanceMonitoringHistoryData(EntityClass): |
| 1572 | class_id = 345 |
| 1573 | hidden = True |
| 1574 | attributes = [ |
| 1575 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1576 | ECA(ByteField("interval_end_time", None), {AA.R},), |
| 1577 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1578 | ECA(IntField("ploam_mic_error_count", None), {AA.R}, tca=True, counter=True), |
| 1579 | ECA(IntField("downstream_ploam_messages_count", None), {AA.R}, counter=True), |
| 1580 | ECA(IntField("profile_messages_received", None), {AA.R}, counter=True), |
| 1581 | ECA(IntField("ranging_time_messages_received", None), {AA.R}, counter=True), |
| 1582 | ECA(IntField("deactivate_onu_id_messages_received", None), {AA.R}, counter=True), |
| 1583 | ECA(IntField("disable_serial_number_messages_received", None), {AA.R}, counter=True), |
| 1584 | ECA(IntField("request_registration_messages_received", None), {AA.R}, counter=True), |
| 1585 | ECA(IntField("assign_alloc_id_messages_received", None), {AA.R}, counter=True), |
| 1586 | ECA(IntField("key_control_messages_received", None), {AA.R}, counter=True), |
| 1587 | ECA(IntField("sleep_allow_messages_received", None), {AA.R}, counter=True), |
| 1588 | ECA(IntField("baseline_omci_messages_received_count", None), {AA.R}, counter=True), |
| 1589 | ECA(IntField("extended_omci_messages_received_count", None), {AA.R}, counter=True), |
| 1590 | ECA(IntField("assign_onu_id_messages_received", None), {AA.R}, counter=True), |
| 1591 | ECA(IntField("omci_mic_error_count", None), {AA.R}, tca=True, counter=True), |
| 1592 | ] |
| 1593 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 1594 | optional_operations = {OP.GetCurrentData} |
| 1595 | notifications = {OP.AlarmNotification} |
| 1596 | alarms = { |
| 1597 | 1: 'PLOAM MIC error count', |
| 1598 | 2: 'OMCI MIC error count', |
| 1599 | } |
| 1600 | |
| 1601 | |
| 1602 | class XgPonUpstreamPerformanceMonitoringHistoryData(EntityClass): |
| 1603 | class_id = 346 |
| 1604 | hidden = True |
| 1605 | attributes = [ |
| 1606 | ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}), |
| 1607 | ECA(ByteField("interval_end_time", None), {AA.R}), |
| 1608 | ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}), |
| 1609 | ECA(IntField("upstream_ploam_message_count", None), {AA.R}, counter=True), |
| 1610 | ECA(IntField("serial_number_onu_message_count", None), {AA.R}, counter=True), |
| 1611 | ECA(IntField("registration_message_count", None), {AA.R}, counter=True), |
| 1612 | ECA(IntField("key_report_message_count", None), {AA.R}, counter=True), |
| 1613 | ECA(IntField("acknowledge_message_count", None), {AA.R}, counter=True), |
| 1614 | ECA(IntField("sleep_request_message_count", None), {AA.R}, counter=True), |
| 1615 | ] |
| 1616 | mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set} |
| 1617 | optional_operations = {OP.GetCurrentData} |
| 1618 | |
| 1619 | |
| 1620 | # entity class lookup table from entity_class values |
| 1621 | entity_classes_name_map = dict( |
| 1622 | inspect.getmembers(sys.modules[__name__], |
| 1623 | lambda o: inspect.isclass(o) and \ |
| 1624 | issubclass(o, EntityClass) and \ |
| 1625 | o is not EntityClass) |
| 1626 | ) |
| 1627 | |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 1628 | entity_classes = [c for c in six.itervalues(entity_classes_name_map)] |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1629 | entity_id_to_class_map = dict((c.class_id, c) for c in entity_classes) |