blob: b523ebf6981d38886f8a0dd614dea286c182223b [file] [log] [blame]
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -08001#
Zsolt Haraszti3eb27a52017-01-03 21:56:48 -08002# Copyright 2017 the original author or authors.
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -08003#
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#
16import inspect
17
18import sys
Nathan Knuthb396f472017-03-28 17:18:51 -070019from binascii import hexlify
Chip Boling77c01802018-06-22 09:49:20 -050020from bitstring import BitArray
Chip Bolingc7d3e2d2018-04-06 10:16:29 -050021import json
Zsolt Haraszti578a46c2016-12-20 16:38:43 -080022from scapy.fields import ByteField, ShortField, MACField, BitField, IPField
Chip Boling4c06db92018-05-24 15:02:26 -050023from scapy.fields import IntField, StrFixedLenField, LongField, FieldListField
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -080024from scapy.packet import Packet
25
26from voltha.extensions.omci.omci_defs import OmciUninitializedFieldError, \
Chip Bolinge2e64a02018-02-06 12:58:07 -060027 AttributeAccess, OmciNullPointer, EntityOperations, OmciInvalidTypeError
Craig Lutgenc37a0062018-11-09 17:26:16 +000028from voltha.extensions.omci.omci_fields import OmciSerialNumberField
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -080029from voltha.extensions.omci.omci_defs import bitpos_from_mask
30
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -080031class EntityClassAttribute(object):
32
Chip Bolinge2e64a02018-02-06 12:58:07 -060033 def __init__(self, fld, access=set(), optional=False, range_check=None,
Chip Bolingac7b5622018-07-12 18:53:55 -050034 avc=False, tca=False, counter=False, deprecated=False):
Chip Bolinge2e64a02018-02-06 12:58:07 -060035 """
36 Initialize an Attribute for a Managed Entity Class
37
38 :param fld: (Field) Scapy field type
39 :param access: (AttributeAccess) Allowed access
40 :param optional: (boolean) If true, attribute is option, else mandatory
41 :param range_check: (callable) None, Lambda, or Function to validate value
42 :param avc: (boolean) If true, an AVC notification can occur for the attribute
Chip Bolingac7b5622018-07-12 18:53:55 -050043 :param tca: (boolean) If true, a threshold crossing alert alarm notification can occur
44 for the attribute
45 :param counter: (boolean) If true, this attribute is a PM counter
Chip Bolinge2e64a02018-02-06 12:58:07 -060046 :param deprecated: (boolean) If true, this attribute is deprecated and
47 only 'read' operations (if-any) performed.
48 """
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -080049 self._fld = fld
50 self._access = access
51 self._optional = optional
Chip Bolinge2e64a02018-02-06 12:58:07 -060052 self._range_check = range_check
53 self._avc = avc
Chip Bolingac7b5622018-07-12 18:53:55 -050054 self._tca = tca
55 self._counter = counter
Chip Bolinge2e64a02018-02-06 12:58:07 -060056 self._deprecated = deprecated
57
58 @property
59 def field(self):
60 return self._fld
61
62 @property
63 def access(self):
64 return self._access
65
66 @property
67 def optional(self):
68 return self._optional
69
70 @property
Chip Bolingac7b5622018-07-12 18:53:55 -050071 def is_counter(self):
72 return self._counter
73
74 @property
Chip Bolinge2e64a02018-02-06 12:58:07 -060075 def range_check(self):
76 return self._range_check
77
78 @property
79 def avc_allowed(self):
80 return self._avc
81
82 @property
83 def deprecated(self):
84 return self._deprecated
85
86 _type_checker_map = {
87 'ByteField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFF,
88 'ShortField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFF,
89 'IntField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFFFFFF,
90 'LongField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFFFFFFFFFFFFFF,
91 'StrFixedLenField': lambda val: isinstance(val, basestring),
92 'MACField': lambda val: True, # TODO: Add a constraint for this field type
93 'BitField': lambda val: True, # TODO: Add a constraint for this field type
94 'IPField': lambda val: True, # TODO: Add a constraint for this field type
95
96 # TODO: As additional Scapy field types are used, add constraints
97 }
98
99 def valid(self, value):
100 def _isa_lambda_function(v):
101 import inspect
102 return callable(v) and len(inspect.getargspec(v).args) == 1
103
104 field_type = self.field.__class__.__name__
105 type_check = EntityClassAttribute._type_checker_map.get(field_type,
106 lambda val: True)
107
108 # TODO: Currently StrFixedLenField is used heavily for both bit fields as
109 # and other 'byte/octet' related strings that are NOT textual. Until
110 # all of these are corrected, 'StrFixedLenField' cannot test the type
111 # of the value provided
112
113 if field_type != 'StrFixedLenField' and not type_check(value):
114 return False
115
116 if _isa_lambda_function(self.range_check):
117 return self.range_check(value)
118 return True
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800119
120
121class EntityClassMeta(type):
122 """
123 Metaclass for EntityClass to generate secondary class attributes
124 for class attributes of the derived classes.
125 """
126 def __init__(cls, name, bases, dct):
127 super(EntityClassMeta, cls).__init__(name, bases, dct)
128
129 # initialize attribute_name_to_index_map
130 cls.attribute_name_to_index_map = dict(
131 (a._fld.name, idx) for idx, a in enumerate(cls.attributes))
132
133
134class EntityClass(object):
135
136 class_id = 'to be filled by subclass'
137 attributes = []
Chip Boling106b60a2018-01-21 06:55:40 -0600138 mandatory_operations = set()
139 optional_operations = set()
Chip Bolinge2e64a02018-02-06 12:58:07 -0600140 notifications = set()
Chip Boling3186eb52018-11-02 14:28:01 -0500141 alarms = dict() # Alarm Number -> Alarm Name
Chip Boling50432882018-09-28 14:14:35 -0500142 hidden = False # If true, this attribute is not reported by a MIB upload.
143 # This attribute is needed to be able to properly perform
144 # MIB Audits.
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800145
146 # will be map of attr_name -> index in attributes, initialized by metaclass
147 attribute_name_to_index_map = None
148 __metaclass__ = EntityClassMeta
149
150 def __init__(self, **kw):
151 assert(isinstance(kw, dict))
152 for k, v in kw.iteritems():
153 assert(k in self.attribute_name_to_index_map)
154 self._data = kw
155
156 def serialize(self, mask=None, operation=None):
Chip Bolinge2e64a02018-02-06 12:58:07 -0600157 octets = ''
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800158
159 # generate ordered list of attribute indices needed to be processed
160 # if mask is provided, we use that explicitly
161 # if mask is not provided, we determine attributes from the self._data
162 # content also taking into account the type of operation in hand
163 if mask is not None:
164 attribute_indices = EntityClass.attribute_indices_from_mask(mask)
165 else:
166 attribute_indices = self.attribute_indices_from_data()
167
168 # Serialize each indexed field (ignoring entity id)
169 for index in attribute_indices:
Chip Bolinge2e64a02018-02-06 12:58:07 -0600170 eca = self.attributes[index]
171 field = eca.field
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800172 try:
173 value = self._data[field.name]
Chip Bolinge2e64a02018-02-06 12:58:07 -0600174
175 if not eca.valid(value):
176 raise OmciInvalidTypeError(
177 'Value "{}" for Entity field "{}" is not valid'.format(value,
178 field.name))
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800179 except KeyError:
180 raise OmciUninitializedFieldError(
Chip Bolinge2e64a02018-02-06 12:58:07 -0600181 'Entity field "{}" not set'.format(field.name))
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800182
Chip Bolinge2e64a02018-02-06 12:58:07 -0600183 octets = field.addfield(None, octets, value)
184
185 return octets
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800186
187 def attribute_indices_from_data(self):
188 return sorted(
189 self.attribute_name_to_index_map[attr_name]
190 for attr_name in self._data.iterkeys())
191
192 byte1_mask_to_attr_indices = dict(
193 (m, bitpos_from_mask(m, 8, -1)) for m in range(256))
194 byte2_mask_to_attr_indices = dict(
195 (m, bitpos_from_mask(m, 16, -1)) for m in range(256))
Chip Bolinge2e64a02018-02-06 12:58:07 -0600196
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800197 @classmethod
198 def attribute_indices_from_mask(cls, mask):
199 # each bit in the 2-byte field denote an attribute index; we use a
200 # lookup table to make lookup a bit faster
201 return \
202 cls.byte1_mask_to_attr_indices[(mask >> 8) & 0xff] + \
203 cls.byte2_mask_to_attr_indices[(mask & 0xff)]
204
205 @classmethod
206 def mask_for(cls, *attr_names):
207 """
208 Return mask value corresponding to given attributes names
209 :param attr_names: Attribute names
210 :return: integer mask value
211 """
212 mask = 0
213 for attr_name in attr_names:
214 index = cls.attribute_name_to_index_map[attr_name]
215 mask |= (1 << (16 - index))
216 return mask
217
218
219# abbreviations
220ECA = EntityClassAttribute
221AA = AttributeAccess
222OP = EntityOperations
223
224
225class OntData(EntityClass):
226 class_id = 2
Chip Boling50432882018-09-28 14:14:35 -0500227 hidden = True
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800228 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600229 ECA(ShortField("managed_entity_id", None), {AA.R},
230 range_check=lambda x: x == 0),
Chip Boling9b7a11a2018-04-15 13:33:21 -0500231 # Only 1 octet used if GET/SET operation
232 ECA(ShortField("mib_data_sync", 0), {AA.R, AA.W})
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800233 ]
234 mandatory_operations = {OP.Get, OP.Set,
235 OP.GetAllAlarms, OP.GetAllAlarmsNext,
236 OP.MibReset, OP.MibUpload, OP.MibUploadNext}
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800237
238
239class Cardholder(EntityClass):
240 class_id = 5
241 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600242 ECA(ShortField("managed_entity_id", None), {AA.R},
243 range_check=lambda x: 0 <= x < 255 or 256 <= x < 511,
244 avc=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800245 ECA(ByteField("actual_plugin_unit_type", None), {AA.R}),
246 ECA(ByteField("expected_plugin_unit_type", None), {AA.R, AA.W}),
247 ECA(ByteField("expected_port_count", None), {AA.R, AA.W},
248 optional=True),
249 ECA(StrFixedLenField("expected_equipment_id", None, 20), {AA.R, AA.W},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600250 optional=True, avc=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800251 ECA(StrFixedLenField("actual_equipment_id", None, 20), {AA.R},
252 optional=True),
253 ECA(ByteField("protection_profile_pointer", None), {AA.R},
254 optional=True),
255 ECA(ByteField("invoke_protection_switch", None), {AA.R, AA.W},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600256 optional=True, range_check=lambda x: 0 <= x <= 3),
257 ECA(ByteField("arc", 0), {AA.R, AA.W},
258 range_check=lambda x: 0 <= x <= 1, optional=True, avc=True),
259 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800260 ]
261 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600262 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500263 alarms = {
264 0: 'Plug-in circuit pack missing',
265 1: 'Plug-in type mismatch alarm',
266 2: 'Improper card removal',
267 3: 'Plug-in equipment ID mismatch alarm',
268 4: 'Protection switch',
269 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800270
271
272class CircuitPack(EntityClass):
273 class_id = 6
274 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600275 ECA(StrFixedLenField("managed_entity_id", None, 22), {AA.R, AA.SBC},
276 range_check=lambda x: 0 <= x < 255 or 256 <= x < 511),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800277 ECA(ByteField("type", None), {AA.R, AA.SBC}),
278 ECA(ByteField("number_of_ports", None), {AA.R}, optional=True),
Craig Lutgenc37a0062018-11-09 17:26:16 +0000279 ECA(OmciSerialNumberField("serial_number"), {AA.R}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800280 ECA(StrFixedLenField("version", None, 14), {AA.R}),
281 ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600282 ECA(ByteField("administrative_state", None), {AA.R, AA.W}),
283 ECA(ByteField("operational_state", None), {AA.R}, optional=True, avc=True),
284 ECA(ByteField("bridged_or_ip_ind", None), {AA.R, AA.W}, optional=True,
285 range_check=lambda x: 0 <= x <= 2),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800286 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600287 ECA(ByteField("card_configuration", None), {AA.R, AA.W, AA.SBC},
288 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
289 ECA(ByteField("total_tcont_buffer_number", None), {AA.R},
290 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
291 ECA(ByteField("total_priority_queue_number", None), {AA.R},
292 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
293 ECA(ByteField("total_traffic_scheduler_number", None), {AA.R},
294 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800295 ECA(IntField("power_sched_override", None), {AA.R, AA.W},
296 optional=True)
297 ]
298 mandatory_operations = {OP.Get, OP.Set, OP.Reboot}
299 optional_operations = {OP.Create, OP.Delete, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600300 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500301 alarms = {
302 0: 'Equipment alarm',
303 1: 'Powering alarm',
304 2: 'Self-test failure',
305 3: 'Laser end of life',
306 4: 'Temperature yellow',
307 5: 'Temperature red',
308 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800309
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800310class SoftwareImage(EntityClass):
311 class_id = 7
312 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600313 ECA(ShortField("managed_entity_id", None), {AA.R},
314 range_check=lambda x: 0 <= x/256 <= 254 or 0 <= x % 256 <= 1),
315 ECA(StrFixedLenField("version", None, 14), {AA.R}, avc=True),
316 ECA(ByteField("is_committed", None), {AA.R}, avc=True,
317 range_check=lambda x: 0 <= x <= 1),
318 ECA(ByteField("is_active", None), {AA.R}, avc=True,
319 range_check=lambda x: 0 <= x <= 1),
320 ECA(ByteField("is_valid", None), {AA.R}, avc=True,
321 range_check=lambda x: 0 <= x <= 1),
322 ECA(StrFixedLenField("product_code", None, 25), {AA.R}, optional=True, avc=True),
323 ECA(StrFixedLenField("image_hash", None, 16), {AA.R}, optional=True, avc=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800324 ]
Chip Bolinge2e64a02018-02-06 12:58:07 -0600325 mandatory_operations = {OP.Get, OP.StartSoftwareDownload, OP.DownloadSection,
326 OP.EndSoftwareDownload, OP.ActivateSoftware,
327 OP.CommitSoftware}
328 notifications = {OP.AttributeValueChange}
329
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800330
Nathan Knuth61a039c2017-03-23 13:50:29 -0700331class PptpEthernetUni(EntityClass):
332 class_id = 11
333 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600334 ECA(ShortField("managed_entity_id", None), {AA.R}),
335 ECA(ByteField("expected_type", 0), {AA.R, AA.W},
336 range_check=lambda x: 0 <= x <= 254),
337 ECA(ByteField("sensed_type", 0), {AA.R}, optional=True, avc=True),
Chip Boling688e0ed2018-08-24 14:20:44 -0500338 # TODO: For sensed_type AVC, see note in AT&T OMCI Specification, V3.0, page 123
Chip Bolinge2e64a02018-02-06 12:58:07 -0600339 ECA(ByteField("autodetection_config", 0), {AA.R, AA.W},
340 range_check=lambda x: x in [0, 1, 2, 3, 4, 5,
341 0x10, 0x11, 0x12, 0x13, 0x14,
342 0x20, 0x30], optional=True), # See ITU-T G.988
343 ECA(ByteField("ethernet_loopback_config", 0), {AA.R, AA.W},
344 range_check=lambda x: x in [0, 3]),
345 ECA(ByteField("administrative_state", 1), {AA.R, AA.W},
346 range_check=lambda x: 0 <= x <= 1),
347 ECA(ByteField("operational_state", 1), {AA.R, AA.W},
348 range_check=lambda x: 0 <= x <= 1, optional=True, avc=True),
349 ECA(ByteField("config_ind", 0), {AA.R},
350 range_check=lambda x: x in [0, 1, 2, 3, 4, 0x11, 0x12, 0x13]),
Chip Bolingf60a5322018-05-15 09:03:02 -0500351 ECA(ShortField("max_frame_size", 1518), {AA.R, AA.W}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600352 ECA(ByteField("dte_dce_ind", 0), {AA.R, AA.W},
353 range_check=lambda x: 0 <= x <= 2),
354 ECA(ShortField("pause_time", 0), {AA.R, AA.W}, optional=True),
Chip Bolingf60a5322018-05-15 09:03:02 -0500355 ECA(ByteField("bridged_ip_ind", 2), {AA.R, AA.W},
356 optional=True, range_check=lambda x: 0 <= x <= 2),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600357 ECA(ByteField("arc", 0), {AA.R, AA.W}, optional=True,
358 range_check=lambda x: 0 <= x <= 1, avc=True),
359 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True),
360 ECA(ByteField("pppoe_filter", 0), {AA.R, AA.W}, optional=True),
361 ECA(ByteField("power_control", 0), {AA.R, AA.W}, optional=True),
Nathan Knuth61a039c2017-03-23 13:50:29 -0700362 ]
363 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600364 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500365 alarms = {
366 0: 'LAN Loss Of Signal',
367 }
Chip Bolinge2e64a02018-02-06 12:58:07 -0600368
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800369
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800370class MacBridgeServiceProfile(EntityClass):
371 class_id = 45
372 attributes = [
373 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600374 ECA(ByteField("spanning_tree_ind", None), {AA.R, AA.W, AA.SBC},
375 range_check=lambda x: 0 <= x <= 1),
376 ECA(ByteField("learning_ind", None), {AA.R, AA.W, AA.SBC},
377 range_check=lambda x: 0 <= x <= 1),
378 ECA(ByteField("port_bridging_ind", None), {AA.R, AA.W, AA.SBC},
379 range_check=lambda x: 0 <= x <= 1),
380 ECA(ShortField("priority", None), {AA.R, AA.W, AA.SBC}),
381 ECA(ShortField("max_age", None), {AA.R, AA.W, AA.SBC},
382 range_check=lambda x: 0x0600 <= x <= 0x2800),
383 ECA(ShortField("hello_time", None), {AA.R, AA.W, AA.SBC},
384 range_check=lambda x: 0x0100 <= x <= 0x0A00),
385 ECA(ShortField("forward_delay", None), {AA.R, AA.W, AA.SBC},
386 range_check=lambda x: 0x0400 <= x <= 0x1E00),
387 ECA(ByteField("unknown_mac_address_discard", None),
388 {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1),
389 ECA(ByteField("mac_learning_depth", None),
390 {AA.R, AA.W, AA.SBC}, optional=True),
391 ECA(ByteField("dynamic_filtering_ageing_time", None),
392 {AA.R, AA.W, AA.SBC}, optional=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800393 ]
394 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
395
396
397class MacBridgePortConfigurationData(EntityClass):
398 class_id = 47
399 attributes = [
400 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
401 ECA(ShortField("bridge_id_pointer", None), {AA.R, AA.W, AA.SBC}),
402 ECA(ByteField("port_num", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600403 ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC},
404 range_check=lambda x: 1 <= x <= 12),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800405 ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}),
406 ECA(ShortField("port_priority", None), {AA.R, AA.W, AA.SBC}),
407 ECA(ShortField("port_path_cost", None), {AA.R, AA.W, AA.SBC}),
408 ECA(ByteField("port_spanning_tree_in", None), {AA.R, AA.W, AA.SBC}),
409 ECA(ByteField("encapsulation_methods", None), {AA.R, AA.W, AA.SBC},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600410 optional=True, deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800411 ECA(ByteField("lan_fcs_ind", None), {AA.R, AA.W, AA.SBC},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600412 optional=True, deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800413 ECA(MACField("port_mac_address", None), {AA.R}, optional=True),
414 ECA(ShortField("outbound_td_pointer", None), {AA.R, AA.W},
415 optional=True),
416 ECA(ShortField("inbound_td_pointer", None), {AA.R, AA.W},
417 optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600418 # TODO:
419 ECA(ByteField("mac_learning_depth", 0), {AA.R, AA.W, AA.SBC},
420 optional=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800421 ]
422 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600423 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500424 alarms = {
425 0: 'Port blocking',
426 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800427
428
Chip Bolinge6c416f2018-05-01 15:07:51 -0500429class MacBridgePortFilterPreAssignTable(EntityClass):
430 class_id = 79
431 attributes = [
432 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
433 ECA(ShortField("ipv4_multicast", 0), {AA.R, AA.W},
434 range_check=lambda x: 0 <= x <= 1),
435 ECA(ShortField("ipv6_multicast", 0), {AA.R, AA.W},
436 range_check=lambda x: 0 <= x <= 1),
437 ECA(ShortField("ipv4_broadcast", 0), {AA.R, AA.W},
438 range_check=lambda x: 0 <= x <= 1),
439 ECA(ShortField("rarp", 0), {AA.R, AA.W},
440 range_check=lambda x: 0 <= x <= 1),
441 ECA(ShortField("ipx", 0), {AA.R, AA.W},
442 range_check=lambda x: 0 <= x <= 1),
443 ECA(ShortField("netbeui", 0), {AA.R, AA.W},
444 range_check=lambda x: 0 <= x <= 1),
445 ECA(ShortField("appletalk", 0), {AA.R, AA.W},
446 range_check=lambda x: 0 <= x <= 1),
447 ECA(ShortField("bridge_management_information", 0), {AA.R, AA.W},
448 range_check=lambda x: 0 <= x <= 1),
449 ECA(ShortField("arp", 0), {AA.R, AA.W},
450 range_check=lambda x: 0 <= x <= 1),
451 ECA(ShortField("pppoe_broadcast", 0), {AA.R, AA.W},
452 range_check=lambda x: 0 <= x <= 1)
453 ]
454 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge6c416f2018-05-01 15:07:51 -0500455
456
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800457class VlanTaggingFilterData(EntityClass):
458 class_id = 84
459 attributes = [
460 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Boling4c06db92018-05-24 15:02:26 -0500461 ECA(FieldListField("vlan_filter_list", None,
462 ShortField('', 0), count_from=lambda _: 12),
463 {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600464 ECA(ByteField("forward_operation", None), {AA.R, AA.W, AA.SBC},
465 range_check=lambda x: 0x00 <= x <= 0x21),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800466 ECA(ByteField("number_of_entries", None), {AA.R, AA.W, AA.SBC})
467 ]
468 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
469
470
471class Ieee8021pMapperServiceProfile(EntityClass):
472 class_id = 130
473 attributes = [
474 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600475 ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}),
476 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_0",
477 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
478 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_1",
479 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
480 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_2",
481 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
482 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_3",
483 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
484 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_4",
485 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
486 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_5",
487 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
488 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_6",
489 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
490 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_7",
491 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800492 ECA(ByteField("unmarked_frame_option", None),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600493 {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800494 ECA(StrFixedLenField("dscp_to_p_bit_mapping", None, length=24),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600495 {AA.R, AA.W}), # TODO: Would a custom 3-bit group bitfield work better?
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800496 ECA(ByteField("default_p_bit_marking", None),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600497 {AA.R, AA.W, AA.SBC}),
498 ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC},
499 optional=True, range_check=lambda x: 0 <= x <= 8)
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800500 ]
501 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
502
503
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800504class OltG(EntityClass):
505 class_id = 131
506 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600507 ECA(ShortField("managed_entity_id", None), {AA.R},
508 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800509 ECA(StrFixedLenField("olt_vendor_id", None, 4), {AA.R, AA.W}),
510 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R, AA.W}),
511 ECA(StrFixedLenField("version", None, 14), {AA.R, AA.W}),
512 ECA(StrFixedLenField("time_of_day", None, 14), {AA.R, AA.W})
513 ]
514 mandatory_operations = {OP.Get, OP.Set}
515
516
517class OntPowerShedding(EntityClass):
518 class_id = 133
519 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600520 ECA(ShortField("managed_entity_id", None), {AA.R},
521 range_check=lambda x: x == 0),
522 ECA(ShortField("restore_power_time_reset_interval", 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800523 {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600524 ECA(ShortField("data_class_shedding_interval", 0), {AA.R, AA.W}),
525 ECA(ShortField("voice_class_shedding_interval", 0), {AA.R, AA.W}),
526 ECA(ShortField("video_overlay_class_shedding_interval", 0), {AA.R, AA.W}),
527 ECA(ShortField("video_return_class_shedding_interval", 0), {AA.R, AA.W}),
528 ECA(ShortField("dsl_class_shedding_interval", 0), {AA.R, AA.W}),
529 ECA(ShortField("atm_class_shedding_interval", 0), {AA.R, AA.W}),
530 ECA(ShortField("ces_class_shedding_interval", 0), {AA.R, AA.W}),
531 ECA(ShortField("frame_class_shedding_interval", 0), {AA.R, AA.W}),
532 ECA(ShortField("sonet_class_shedding_interval", 0), {AA.R, AA.W}),
533 ECA(ShortField("shedding_status", None), {AA.R, AA.W}, optional=True,
534 avc=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800535 ]
536 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600537 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800538
539
540class IpHostConfigData(EntityClass):
541 class_id = 134
542 attributes = [
543 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600544 ECA(BitField("ip_options", 0, size=8), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800545 ECA(MACField("mac_address", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600546 ECA(StrFixedLenField("onu_identifier", None, 25), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800547 ECA(IPField("ip_address", None), {AA.R, AA.W}),
548 ECA(IPField("mask", None), {AA.R, AA.W}),
549 ECA(IPField("gateway", None), {AA.R, AA.W}),
550 ECA(IPField("primary_dns", None), {AA.R, AA.W}),
551 ECA(IPField("secondary_dns", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600552 ECA(IPField("current_address", None), {AA.R}, avc=True),
553 ECA(IPField("current_mask", None), {AA.R}, avc=True),
554 ECA(IPField("current_gateway", None), {AA.R}, avc=True),
555 ECA(IPField("current_primary_dns", None), {AA.R}, avc=True),
556 ECA(IPField("current_secondary_dns", None), {AA.R}, avc=True),
557 ECA(StrFixedLenField("domain_name", None, 25), {AA.R}, avc=True),
558 ECA(StrFixedLenField("host_name", None, 25), {AA.R}, avc=True),
559 ECA(ShortField("relay_agent_options", None), {AA.R, AA.W},
560 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800561 ]
562 mandatory_operations = {OP.Get, OP.Set, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600563 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800564
565
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800566class VlanTaggingOperation(Packet):
567 name = "VlanTaggingOperation"
568 fields_desc = [
569 BitField("filter_outer_priority", 0, 4),
570 BitField("filter_outer_vid", 0, 13),
571 BitField("filter_outer_tpid_de", 0, 3),
572 BitField("pad1", 0, 12),
573
574 BitField("filter_inner_priority", 0, 4),
575 BitField("filter_inner_vid", 0, 13),
576 BitField("filter_inner_tpid_de", 0, 3),
577 BitField("pad2", 0, 8),
578 BitField("filter_ether_type", 0, 4),
579
580 BitField("treatment_tags_to_remove", 0, 2),
581 BitField("pad3", 0, 10),
582 BitField("treatment_outer_priority", 0, 4),
583 BitField("treatment_outer_vid", 0, 13),
584 BitField("treatment_outer_tpid_de", 0, 3),
585
586 BitField("pad4", 0, 12),
587 BitField("treatment_inner_priority", 0, 4),
588 BitField("treatment_inner_vid", 0, 13),
589 BitField("treatment_inner_tpid_de", 0, 3),
590 ]
591
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500592 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500593 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500594
Chip Boling77c01802018-06-22 09:49:20 -0500595 @staticmethod
596 def json_from_value(value):
597 bits = BitArray(hex=hexlify(value))
598 temp = VlanTaggingOperation(
599 filter_outer_priority=bits[0:4].uint, # 4 <-size
600 filter_outer_vid=bits[4:17].uint, # 13
601 filter_outer_tpid_de=bits[17:20].uint, # 3
602 # pad 12
603 filter_inner_priority=bits[32:36].uint, # 4
604 filter_inner_vid=bits[36:49].uint, # 13
605 filter_inner_tpid_de=bits[49:52].uint, # 3
606 # pad 8
607 filter_ether_type=bits[60:64].uint, # 4
608 treatment_tags_to_remove=bits[64:66].uint, # 2
609 # pad 10
610 treatment_outer_priority=bits[76:80].uint, # 4
611 treatment_outer_vid=bits[80:93].uint, # 13
612 treatment_outer_tpid_de=bits[93:96].uint, # 3
613 # pad 12
614 treatment_inner_priority=bits[108:112].uint, # 4
615 treatment_inner_vid=bits[112:125].uint, # 13
616 treatment_inner_tpid_de=bits[125:128].uint, # 3
617 )
618 return json.dumps(temp.fields, separators=(',', ':'))
619
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800620
621class ExtendedVlanTaggingOperationConfigurationData(EntityClass):
622 class_id = 171
623 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600624 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
625 ECA(ByteField("association_type", None), {AA.R, AA.W, AA.SBC},
626 range_check=lambda x: 0 <= x <= 11),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800627 ECA(ShortField("received_vlan_tagging_operation_table_max_size", None),
628 {AA.R}),
629 ECA(ShortField("input_tpid", None), {AA.R, AA.W}),
630 ECA(ShortField("output_tpid", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600631 ECA(ByteField("downstream_mode", None), {AA.R, AA.W},
632 range_check=lambda x: 0 <= x <= 8),
633 ECA(StrFixedLenField("received_frame_vlan_tagging_operation_table",
634 VlanTaggingOperation, 16), {AA.R, AA.W}),
635 ECA(ShortField("associated_me_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Boling4069a512018-06-06 15:51:38 -0500636 ECA(FieldListField("dscp_to_p_bit_mapping", None,
637 BitField('', 0, size=3), count_from=lambda _: 64),
638 {AA.R, AA.W}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800639 ]
640 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600641 optional_operations = {OP.SetTable}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800642
643
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800644class OntG(EntityClass):
645 class_id = 256
646 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600647 ECA(ShortField("managed_entity_id", None), {AA.R},
648 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800649 ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}),
650 ECA(StrFixedLenField("version", None, 14), {AA.R}),
Craig Lutgenc37a0062018-11-09 17:26:16 +0000651 ECA(OmciSerialNumberField("serial_number"), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600652 ECA(ByteField("traffic_management_options", None), {AA.R},
653 range_check=lambda x: 0 <= x <= 2),
654 ECA(ByteField("vp_vc_cross_connection_option", 0), {AA.R},
655 optional=True, deprecated=True),
656 ECA(ByteField("battery_backup", None), {AA.R, AA.W},
657 range_check=lambda x: 0 <= x <= 1),
658 ECA(ByteField("administrative_state", None), {AA.R, AA.W},
659 range_check=lambda x: 0 <= x <= 1),
660 ECA(ByteField("operational_state", None), {AA.R}, optional=True,
661 range_check=lambda x: 0 <= x <= 1, avc=True),
662 ECA(ByteField("ont_survival_time", None), {AA.R}, optional=True),
663 ECA(StrFixedLenField("logical_onu_id", None, 24), {AA.R},
664 optional=True, avc=True),
665 ECA(StrFixedLenField("logical_password", None, 12), {AA.R},
666 optional=True, avc=True),
667 ECA(ByteField("credentials_status", None), {AA.R, AA.W},
668 optional=True, range_check=lambda x: 0 <= x <= 4),
669 ECA(BitField("extended_tc_layer_options", None, size=16), {AA.R},
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800670 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800671 ]
672 mandatory_operations = {
673 OP.Get, OP.Set, OP.Reboot, OP.Test, OP.SynchronizeTime}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600674 notifications = {OP.TestResult, OP.AttributeValueChange,
675 OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500676 alarms = {
677 0: 'Equipment alarm',
678 1: 'Powering alarm',
679 2: 'Battery missing',
680 3: 'Battery failure',
681 4: 'Battery low',
682 5: 'Physical intrusion',
683 6: 'Self-test failure',
684 7: 'Dying gasp',
685 8: 'Temperature yellow',
686 9: 'Temperature red',
687 10: 'Voltage yellow',
688 11: 'Voltage red',
689 12: 'ONU manual power off',
690 13: 'Invalid image',
691 14: 'PSE overload yellow',
692 15: 'PSE overload red',
693 }
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800694
695
696class Ont2G(EntityClass):
697 class_id = 257
698 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600699 ECA(ShortField("managed_entity_id", None), {AA.R},
700 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800701 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600702 ECA(ByteField("omcc_version", None), {AA.R}, avc=True),
703 ECA(ShortField("vendor_product_code", None), {AA.R}),
704 ECA(ByteField("security_capability", None), {AA.R},
705 range_check=lambda x: 0 <= x <= 1),
706 ECA(ByteField("security_mode", None), {AA.R, AA.W},
707 range_check=lambda x: 0 <= x <= 1),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800708 ECA(ShortField("total_priority_queue_number", None), {AA.R}),
709 ECA(ByteField("total_traffic_scheduler_number", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600710 ECA(ByteField("mode", None), {AA.R}, deprecated=True),
711 ECA(ShortField("total_gem_port_id_number", None), {AA.R}),
712 ECA(IntField("sys_uptime", None), {AA.R}),
713 ECA(BitField("connectivity_capability", None, size=16), {AA.R}),
714 ECA(ByteField("current_connectivity_mode", None), {AA.R, AA.W},
715 range_check=lambda x: 0 <= x <= 7),
716 ECA(BitField("qos_configuration_flexibility", None, size=16),
717 {AA.R}, optional=True),
718 ECA(ShortField("priority_queue_scale_factor", None), {AA.R, AA.W},
719 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800720 ]
721 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600722 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800723
724
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800725class Tcont(EntityClass):
726 class_id = 262
727 attributes = [
728 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600729 ECA(ShortField("alloc_id", None), {AA.R, AA.W}),
730 ECA(ByteField("mode_indicator", 1), {AA.R}, deprecated=True),
731 ECA(ByteField("policy", None), {AA.R, AA.W},
732 range_check=lambda x: 0 <= x <= 2),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800733 ]
734 mandatory_operations = {OP.Get, OP.Set}
735
736
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800737class AniG(EntityClass):
738 class_id = 263
739 attributes = [
740 ECA(ShortField("managed_entity_id", None), {AA.R}),
741 ECA(ByteField("sr_indication", None), {AA.R}),
742 ECA(ShortField("total_tcont_number", None), {AA.R}),
743 ECA(ShortField("gem_block_length", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600744 ECA(ByteField("piggyback_dba_reporting", None), {AA.R},
745 range_check=lambda x: 0 <= x <= 4),
746 ECA(ByteField("whole_ont_dba_reporting", None), {AA.R},
747 deprecated=True),
748 ECA(ByteField("sf_threshold", 5), {AA.R, AA.W}),
749 ECA(ByteField("sd_threshold", 9), {AA.R, AA.W}),
750 ECA(ByteField("arc", 0), {AA.R, AA.W},
751 range_check=lambda x: 0 <= x <= 1, avc=True),
752 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800753 ECA(ShortField("optical_signal_level", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600754 ECA(ByteField("lower_optical_threshold", 0xFF), {AA.R, AA.W}),
755 ECA(ByteField("upper_optical_threshold", 0xFF), {AA.R, AA.W}),
Chip Boling5123cfb2018-10-03 15:34:58 -0500756 ECA(ShortField("ont_response_time", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600757 ECA(ShortField("transmit_optical_level", None), {AA.R}),
758 ECA(ByteField("lower_transmit_power_threshold", 0x81), {AA.R, AA.W}),
759 ECA(ByteField("upper_transmit_power_threshold", 0x81), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800760 ]
761 mandatory_operations = {OP.Get, OP.Set, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600762 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500763 alarms = {
764 0: 'Low received optical power',
765 1: 'High received optical power',
766 2: 'Signal fail',
767 3: 'Signal degrade',
768 4: 'Low transmit optical power',
769 5: 'High transmit optical power',
770 6: 'Laser bias current',
771 }
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800772
773
774class UniG(EntityClass):
775 class_id = 264
776 attributes = [
777 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600778 ECA(ShortField("configuration_option_status", None), {AA.R, AA.W},
779 deprecated=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800780 ECA(ByteField("administrative_state", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600781 ECA(ByteField("management_capability", None), {AA.R},
782 range_check=lambda x: 0 <= x <= 2),
783 ECA(ShortField("non_omci_management_identifier", None), {AA.R, AA.W}),
784 ECA(ShortField("relay_agent_options", None), {AA.R, AA.W},
785 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800786 ]
787 mandatory_operations = {OP.Get, OP.Set}
788
789
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800790class GemInterworkingTp(EntityClass):
791 class_id = 266
792 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600793 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800794 ECA(ShortField("gem_port_network_ctp_pointer", None),
795 {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600796 ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC},
797 range_check=lambda x: 0 <= x <= 7),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800798 ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
799 ECA(ShortField("interworking_tp_pointer", None), {AA.R, AA.W, AA.SBC}),
800 ECA(ByteField("pptp_counter", None), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600801 ECA(ByteField("operational_state", None), {AA.R}, optional=True,
802 range_check=lambda x: 0 <= x <= 1, avc=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800803 ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600804 ECA(ByteField("gal_loopback_configuration", 0),
805 {AA.R, AA.W}, range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800806 ]
Chip Bolingeada0c92017-12-27 09:45:26 -0600807 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600808 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500809 alarms = {
810 6: 'Operational state change',
811 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800812
813
814class GemPortNetworkCtp(EntityClass):
815 class_id = 268
816 attributes = [
817 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
818 ECA(ShortField("port_id", None), {AA.R, AA.W, AA.SBC}),
819 ECA(ShortField("tcont_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600820 ECA(ByteField("direction", None), {AA.R, AA.W, AA.SBC},
821 range_check=lambda x: 1 <= x <= 3),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800822 ECA(ShortField("traffic_management_pointer_upstream", None),
823 {AA.R, AA.W, AA.SBC}),
824 ECA(ShortField("traffic_descriptor_profile_pointer", None),
825 {AA.R, AA.W, AA.SBC}, optional=True),
826 ECA(ByteField("uni_counter", None), {AA.R}, optional=True),
827 ECA(ShortField("priority_queue_pointer_downstream", None),
828 {AA.R, AA.W, AA.SBC}),
Nathan Knuth61a039c2017-03-23 13:50:29 -0700829 ECA(ByteField("encryption_state", None), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600830 ECA(ShortField("traffic_desc_profile_pointer_downstream", None),
831 {AA.R, AA.W, AA.SBC}, optional=True),
832 ECA(ShortField("encryption_key_ring", None), {AA.R, AA.W, AA.SBC},
833 range_check=lambda x: 0 <= x <= 3)
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800834 ]
835 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600836 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500837 alarms = {
838 5: 'End-to-end loss of continuity',
839 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800840
841
842class GalEthernetProfile(EntityClass):
843 class_id = 272
844 attributes = [
845 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
846 ECA(ShortField("max_gem_payload_size", None), {AA.R, AA.W, AA.SBC}),
847 ]
848 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
849
850
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800851class PriorityQueueG(EntityClass):
852 class_id = 277
853 attributes = [
854 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600855 ECA(ByteField("queue_configuration_option", None), {AA.R},
856 range_check=lambda x: 0 <= x <= 1),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800857 ECA(ShortField("maximum_queue_size", None), {AA.R}),
858 ECA(ShortField("allocated_queue_size", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600859 ECA(ShortField("discard_block_counter_reset_interval", None), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800860 ECA(ShortField("threshold_value_for_discarded_blocks", None), {AA.R, AA.W}),
861 ECA(IntField("related_port", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600862 ECA(ShortField("traffic_scheduler_pointer", 0), {AA.R, AA.W}),
863 ECA(ByteField("weight", 1), {AA.R, AA.W}),
864 ECA(ShortField("back_pressure_operation", 0), {AA.R, AA.W},
865 range_check=lambda x: 0 <= x <= 1),
866 ECA(IntField("back_pressure_time", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800867 ECA(ShortField("back_pressure_occur_queue_threshold", None), {AA.R, AA.W}),
868 ECA(ShortField("back_pressure_clear_queue_threshold", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600869 # TODO: Custom field of 4 2-byte values would help below
870 ECA(LongField("packet_drop_queue_thresholds", None), {AA.R, AA.W},
871 optional=True),
872 ECA(ShortField("packet_drop_max_p", 0xFFFF), {AA.R, AA.W}, optional=True),
873 ECA(ByteField("queue_drop_w_q", 9), {AA.R, AA.W}, optional=True),
874 ECA(ByteField("drop_precedence_colour_marking", 0), {AA.R, AA.W},
875 optional=True, range_check=lambda x: 0 <= x <= 7),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800876 ]
877 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600878 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500879 alarms = {
880 0: 'Block loss',
881 }
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800882
883
884class TrafficSchedulerG(EntityClass):
885 class_id = 278
886 attributes = [
887 ECA(ShortField("managed_entity_id", None), {AA.R}),
888 ECA(ShortField("tcont_pointer", None), {AA.R}),
889 ECA(ShortField("traffic_scheduler_pointer", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600890 ECA(ByteField("policy", None), {AA.R, AA.W},
891 range_check=lambda x: 0 <= x <= 2),
892 ECA(ByteField("priority_weight", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800893 ]
894 mandatory_operations = {OP.Get, OP.Set}
895
896
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800897class MulticastGemInterworkingTp(EntityClass):
898 class_id = 281
899 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600900 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC},
901 range_check=lambda x: x != OmciNullPointer),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800902 ECA(ShortField("gem_port_network_ctp_pointer", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600903 ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC},
904 range_check=lambda x: x in [0, 1, 3, 5]),
905 ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
906 ECA(ShortField("interworking_tp_pointer", 0), {AA.R, AA.W, AA.SBC},
907 deprecated=True),
908 ECA(ByteField("pptp_counter", None), {AA.R}),
909 ECA(ByteField("operational_state", None), {AA.R}, avc=True,
910 range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800911 ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600912 ECA(ByteField("gal_loopback_configuration", None), {AA.R, AA.W, AA.SBC},
913 deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800914 # TODO add multicast_address_table here (page 85 of spec.)
915 # ECA(...("multicast_address_table", None), {AA.R, AA.W})
916 ]
917 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.GetNext, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600918 optional_operations = {OP.SetTable}
919 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -0500920 alarms = {
921 0: 'Deprecated',
922 }
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800923
924
Steve Crooks9e85ce82017-03-20 12:00:53 -0400925class AccessControlRow0(Packet):
926 name = "AccessControlRow0"
927 fields_desc = [
928 BitField("set_ctrl", 0, 2),
929 BitField("row_part_id", 0, 3),
930 BitField("test", 0, 1),
931 BitField("row_key", 0, 10),
932
933 ShortField("gem_port_id", None),
934 ShortField("vlan_id", None),
935 IPField("src_ip", None),
936 IPField("dst_ip_start", None),
937 IPField("dst_ip_end", None),
938 IntField("ipm_group_bw", None),
939 ShortField("reserved0", 0)
940 ]
941
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500942 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500943 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500944
Chip Bolinge2e64a02018-02-06 12:58:07 -0600945
Steve Crooks9e85ce82017-03-20 12:00:53 -0400946class AccessControlRow1(Packet):
947 name = "AccessControlRow1"
948 fields_desc = [
949 BitField("set_ctrl", 0, 2),
950 BitField("row_part_id", 0, 3),
951 BitField("test", 0, 1),
952 BitField("row_key", 0, 10),
953
954 StrFixedLenField("ipv6_src_addr_start_bytes", None, 12),
955 ShortField("preview_length", None),
956 ShortField("preview_repeat_time", None),
957 ShortField("preview_repeat_count", None),
958 ShortField("preview_reset_time", None),
959 ShortField("reserved1", 0)
960 ]
961
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500962 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500963 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500964
Chip Bolinge2e64a02018-02-06 12:58:07 -0600965
Steve Crooks9e85ce82017-03-20 12:00:53 -0400966class AccessControlRow2(Packet):
967 name = "AccessControlRow2"
968 fields_desc = [
969 BitField("set_ctrl", 0, 2),
970 BitField("row_part_id", 0, 3),
971 BitField("test", 0, 1),
972 BitField("row_key", 0, 10),
973
974 StrFixedLenField("ipv6_dst_addr_start_bytes", None, 12),
975 StrFixedLenField("reserved2", None, 10)
976 ]
977
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500978 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500979 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolinge2e64a02018-02-06 12:58:07 -0600980
Chip Boling9b7a11a2018-04-15 13:33:21 -0500981
Steve Crooks9e85ce82017-03-20 12:00:53 -0400982class DownstreamIgmpMulticastTci(Packet):
983 name = "DownstreamIgmpMulticastTci"
984 fields_desc = [
985 ByteField("ctrl_type", None),
986 ShortField("tci", None)
987 ]
988
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500989 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500990 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500991
Chip Bolinge2e64a02018-02-06 12:58:07 -0600992
Steve Crooks89b94b72017-02-01 10:06:30 -0500993class MulticastOperationsProfile(EntityClass):
994 class_id = 309
995 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600996 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC},
997 range_check=lambda x: x != 0 and x != OmciNullPointer),
998 ECA(ByteField("igmp_version", None), {AA.R, AA.W, AA.SBC},
999 range_check=lambda x: x in [1, 2, 3, 16, 17]),
1000 ECA(ByteField("igmp_function", None), {AA.R, AA.W, AA.SBC},
1001 range_check=lambda x: 0 <= x <= 2),
1002 ECA(ByteField("immediate_leave", None), {AA.R, AA.W, AA.SBC},
1003 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001004 ECA(ShortField("us_igmp_tci", None), {AA.R, AA.W, AA.SBC}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001005 ECA(ByteField("us_igmp_tag_ctrl", None), {AA.R, AA.W, AA.SBC},
1006 range_check=lambda x: 0 <= x <= 3, optional=True),
Steve Crooks89b94b72017-02-01 10:06:30 -05001007 ECA(IntField("us_igmp_rate", None), {AA.R, AA.W, AA.SBC}, optional=True),
1008 # TODO: need to make table and add column data
1009 ECA(StrFixedLenField(
1010 "dynamic_access_control_list_table", None, 24), {AA.R, AA.W}),
1011 # TODO: need to make table and add column data
1012 ECA(StrFixedLenField(
1013 "static_access_control_list_table", None, 24), {AA.R, AA.W}),
1014 # TODO: need to make table and add column data
Chip Bolinge2e64a02018-02-06 12:58:07 -06001015 ECA(StrFixedLenField("lost_groups_list_table", None, 10), {AA.R}),
1016 ECA(ByteField("robustness", None), {AA.R, AA.W, AA.SBC}),
1017 ECA(IntField("querier_ip", None), {AA.R, AA.W, AA.SBC}),
1018 ECA(IntField("query_interval", None), {AA.R, AA.W, AA.SBC}),
1019 ECA(IntField("querier_max_response_time", None), {AA.R, AA.W, AA.SBC}),
1020 ECA(IntField("last_member_response_time", 10), {AA.R, AA.W}),
1021 ECA(ByteField("unauthorized_join_behaviour", None), {AA.R, AA.W}),
Steve Crooks9e85ce82017-03-20 12:00:53 -04001022 ECA(StrFixedLenField("ds_igmp_mcast_tci", None, 3), {AA.R, AA.W, AA.SBC}, optional=True)
Steve Crooks89b94b72017-02-01 10:06:30 -05001023 ]
1024 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -06001025 optional_operations = {OP.SetTable}
1026 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001027 alarms = {
1028 0: 'Lost multicast group',
1029 }
Chip Bolinge2e64a02018-02-06 12:58:07 -06001030
Steve Crooks89b94b72017-02-01 10:06:30 -05001031
Steve Crooks9e85ce82017-03-20 12:00:53 -04001032class MulticastServicePackage(Packet):
1033 name = "MulticastServicePackage"
1034 fields_desc = [
1035 BitField("set_ctrl", 0, 2),
1036 BitField("reserved0", 0, 4),
1037 BitField("row_key", 0, 10),
1038
1039 ShortField("vid_uni", None),
1040 ShortField("max_simultaneous_groups", None),
1041 IntField("max_multicast_bw", None),
1042 ShortField("mcast_operations_profile_pointer", None),
1043 StrFixedLenField("reserved1", None, 8)
1044 ]
1045
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001046 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -05001047 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001048
Chip Bolinge2e64a02018-02-06 12:58:07 -06001049
Steve Crooks9e85ce82017-03-20 12:00:53 -04001050class AllowedPreviewGroupsRow0(Packet):
1051 name = "AllowedPreviewGroupsRow0"
1052 fields_desc = [
1053 BitField("set_ctrl", 0, 2),
1054 BitField("row_part_id", 0, 3),
1055 BitField("reserved0", 0, 1),
1056 BitField("row_key", 0, 10),
1057
1058 StrFixedLenField("ipv6_pad", 0, 12),
1059 IPField("src_ip", None),
1060 ShortField("vlan_id_ani", None),
1061 ShortField("vlan_id_uni", None)
1062 ]
1063
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001064 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -05001065 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001066
Chip Bolinge2e64a02018-02-06 12:58:07 -06001067
Steve Crooks9e85ce82017-03-20 12:00:53 -04001068class AllowedPreviewGroupsRow1(Packet):
1069 name = "AllowedPreviewGroupsRow1"
1070 fields_desc = [
1071 BitField("set_ctrl", 0, 2),
1072 BitField("row_part_id", 0, 3),
1073 BitField("reserved0", 0, 1),
1074 BitField("row_key", 0, 10),
1075
1076 StrFixedLenField("ipv6_pad", 0, 12),
1077 IPField("dst_ip", None),
1078 ShortField("duration", None),
1079 ShortField("time_left", None)
1080 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001081
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001082 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -05001083 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001084
Chip Bolinge2e64a02018-02-06 12:58:07 -06001085
Steve Crooks89b94b72017-02-01 10:06:30 -05001086class MulticastSubscriberConfigInfo(EntityClass):
1087 class_id = 310
1088 attributes = [
1089 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001090 ECA(ByteField("me_type", None), {AA.R, AA.W, AA.SBC},
1091 range_check=lambda x: 0 <= x <= 1),
1092 ECA(ShortField("mcast_operations_profile_pointer", None),
1093 {AA.R, AA.W, AA.SBC}),
1094 ECA(ShortField("max_simultaneous_groups", None), {AA.R, AA.W, AA.SBC}),
1095 ECA(IntField("max_multicast_bandwidth", None), {AA.R, AA.W, AA.SBC}),
1096 ECA(ByteField("bandwidth_enforcement", None), {AA.R, AA.W, AA.SBC},
1097 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001098 # TODO: need to make table and add column data
1099 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001100 "multicast_service_package_table", None, 20), {AA.R, AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001101 # TODO: need to make table and add column data
1102 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001103 "allowed_preview_groups_table", None, 22), {AA.R, AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001104 ]
Chip Bolinge2e64a02018-02-06 12:58:07 -06001105 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext,
1106 OP.SetTable}
Steve Crooks89b94b72017-02-01 10:06:30 -05001107
1108
1109class VirtualEthernetInterfacePt(EntityClass):
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001110 class_id = 329
1111 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -06001112 ECA(ShortField("managed_entity_id", None), {AA.R},
1113 range_check=lambda x: x != 0 and x != OmciNullPointer),
1114 ECA(ByteField("administrative_state", None), {AA.R, AA.W},
1115 range_check=lambda x: 0 <= x <= 1),
1116 ECA(ByteField("operational_state", None), {AA.R}, avc=True,
1117 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001118 ECA(StrFixedLenField(
1119 "interdomain_name", None, 25), {AA.R, AA.W}, optional=True),
1120 ECA(ShortField("tcp_udp_pointer", None), {AA.R, AA.W}, optional=True),
1121 ECA(ShortField("iana_assigned_port", None), {AA.R}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001122 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001123 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -06001124 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001125 alarms = {
1126 0: 'Connecting function fail',
1127 }
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001128
1129
Chip Boling28155862018-06-07 11:13:39 -05001130class Omci(EntityClass):
1131 class_id = 287
Chip Boling50432882018-09-28 14:14:35 -05001132 hidden = True
Chip Boling28155862018-06-07 11:13:39 -05001133 attributes = [
1134 ECA(ShortField("managed_entity_id", None), {AA.R},
1135 range_check=lambda x: x == 0),
1136
1137 # TODO: Can this be expressed better in SCAPY, probably not?
1138 # On the initial, Get request for either the me_type or message_type
1139 # attributes, you will receive a 4 octet value (big endian) that is
1140 # the number of octets to 'get-next' to fully load the desired
1141 # attribute. For a basic OMCI formatted message, that will be 29
1142 # octets per get-request.
1143 #
1144 # For the me_type_table, these are 16-bit values (ME Class IDs)
1145 #
1146 # For the message_type_table, these are 8-bit values (Actions)
1147
1148 ECA(FieldListField("me_type_table", None, ByteField('', 0),
1149 count_from=lambda _: 29), {AA.R}),
1150 ECA(FieldListField("message_type_table", None, ByteField('', 0),
1151 count_from=lambda _: 29), {AA.R}),
1152 ]
1153 mandatory_operations = {OP.Get, OP.GetNext}
1154
1155
Chip Bolingf0b3a062018-01-18 13:53:58 -06001156class EnhSecurityControl(EntityClass):
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001157 class_id = 332
1158 attributes = [
Steve Crooks89b94b72017-02-01 10:06:30 -05001159 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001160 ECA(BitField("olt_crypto_capabilities", None, 16*8), {AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001161 # TODO: need to make table and add column data
1162 ECA(StrFixedLenField(
1163 "olt_random_challenge_table", None, 17), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001164 ECA(ByteField("olt_challenge_status", 0), {AA.R, AA.W},
1165 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001166 ECA(ByteField("onu_selected_crypto_capabilities", None), {AA.R}),
1167 # TODO: need to make table and add column data
1168 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001169 "onu_random_challenge_table", None, 16), {AA.R}, avc=True),
Steve Crooks89b94b72017-02-01 10:06:30 -05001170 # TODO: need to make table and add column data
1171 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001172 "onu_authentication_result_table", None, 16), {AA.R}, avc=True),
Steve Crooks89b94b72017-02-01 10:06:30 -05001173 # TODO: need to make table and add column data
1174 ECA(StrFixedLenField(
1175 "olt_authentication_result_table", None, 17), {AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001176 ECA(ByteField("olt_result_status", None), {AA.R, AA.W},
1177 range_check=lambda x: 0 <= x <= 1),
1178 ECA(ByteField("onu_authentication_status", None), {AA.R}, avc=True,
1179 range_check=lambda x: 0 <= x <= 5),
Steve Crooks89b94b72017-02-01 10:06:30 -05001180 ECA(StrFixedLenField(
1181 "master_session_key_name", None, 16), {AA.R}),
1182 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001183 "broadcast_key_table", None, 18), {AA.R, AA.W}),
1184 ECA(ShortField("effective_key_length", None), {AA.R}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001185
1186 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001187 mandatory_operations = {OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -06001188 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001189
Chip Bolingac7b5622018-07-12 18:53:55 -05001190
1191class EthernetPMMonitoringHistoryData(EntityClass):
1192 class_id = 24
Chip Boling50432882018-09-28 14:14:35 -05001193 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001194 attributes = [
1195 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1196 ECA(ByteField("interval_end_time", None), {AA.R}),
1197 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1198 ECA(IntField("fcs_errors", None), {AA.R}, tca=True, counter=True),
1199 ECA(IntField("excessive_collision_counter", None), {AA.R}, tca=True, counter=True),
1200 ECA(IntField("late_collision_counter", None), {AA.R}, tca=True, counter=True),
1201 ECA(IntField("frames_too_long", None), {AA.R}, tca=True, counter=True),
1202 ECA(IntField("buffer_overflows_on_rx", None), {AA.R}, tca=True, counter=True),
1203 ECA(IntField("buffer_overflows_on_tx", None), {AA.R}, tca=True, counter=True),
1204 ECA(IntField("single_collision_frame_counter", None), {AA.R}, tca=True, counter=True),
1205 ECA(IntField("multiple_collisions_frame_counter", None), {AA.R}, tca=True, counter=True),
1206 ECA(IntField("sqe_counter", None), {AA.R}, tca=True, counter=True),
1207 ECA(IntField("deferred_tx_counter", None), {AA.R}, tca=True, counter=True),
1208 ECA(IntField("internal_mac_tx_error_counter", None), {AA.R}, tca=True, counter=True),
1209 ECA(IntField("carrier_sense_error_counter", None), {AA.R}, tca=True, counter=True),
1210 ECA(IntField("alignment_error_counter", None), {AA.R}, tca=True, counter=True),
1211 ECA(IntField("internal_mac_rx_error_counter", None), {AA.R}, tca=True, counter=True)
1212 ]
1213 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1214 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001215 alarms = {
1216 0: 'FCS errors',
1217 1: 'Excessive collision counter',
1218 2: 'Late collision counter',
1219 3: 'Frames too long',
1220 4: 'Buffer overflows on receive',
1221 5: 'Buffer overflows on transmit',
1222 6: 'Single collision frame counter',
1223 7: 'Multiple collision frame counter',
1224 8: 'SQE counter',
1225 9: 'Deferred transmission counter',
1226 10: 'Internal MAC transmit error counter',
1227 11: 'Carrier sense error counter',
1228 12: 'Alignment error counter',
1229 13: 'Internal MAC receive error counter',
1230 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001231
1232
1233class FecPerformanceMonitoringHistoryData(EntityClass):
1234 class_id = 312
Chip Boling50432882018-09-28 14:14:35 -05001235 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001236 attributes = [
1237 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1238 ECA(ByteField("interval_end_time", None), {AA.R}),
1239 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1240 ECA(IntField("corrected_bytes", None), {AA.R}, tca=True, counter=True),
1241 ECA(IntField("corrected_code_words", None), {AA.R}, tca=True, counter=True),
1242 ECA(IntField("uncorrectable_code_words", None), {AA.R}, tca=True, counter=True),
1243 ECA(IntField("total_code_words", None), {AA.R}, counter=True),
1244 ECA(ShortField("fec_seconds", None), {AA.R}, tca=True, counter=True)
1245 ]
1246 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1247 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001248 alarms = {
1249 0: 'Corrected bytes',
1250 1: 'Corrected code words',
1251 2: 'Uncorrectable code words',
1252 4: 'FEC seconds',
1253 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001254
1255
1256class EthernetFrameDownstreamPerformanceMonitoringHistoryData(EntityClass):
1257 class_id = 321
Chip Boling50432882018-09-28 14:14:35 -05001258 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001259 attributes = [
1260 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1261 ECA(ByteField("interval_end_time", None), {AA.R}),
1262 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1263 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1264 ECA(IntField("octets", None), {AA.R}, counter=True),
1265 ECA(IntField("packets", None), {AA.R}, counter=True),
1266 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1267 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1268 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1269 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1270 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1271 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1272 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1273 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1274 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1275 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1276 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1277 ]
1278 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1279 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001280 alarms = {
1281 0: 'Drop events',
1282 1: 'CRC errored packets',
1283 2: 'Undersize packets',
1284 3: 'Oversize packets',
1285 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001286
1287
1288class EthernetFrameUpstreamPerformanceMonitoringHistoryData(EntityClass):
1289 class_id = 322
Chip Boling50432882018-09-28 14:14:35 -05001290 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001291 attributes = [
1292 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1293 ECA(ByteField("interval_end_time", None), {AA.R}),
1294 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1295 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1296 ECA(IntField("octets", None), {AA.R}, counter=True),
1297 ECA(IntField("packets", None), {AA.R}, counter=True),
1298 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1299 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1300 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1301 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1302 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1303 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1304 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1305 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1306 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1307 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1308 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1309 ]
1310 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1311 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001312 alarms = {
1313 0: 'Drop events',
1314 1: 'CRC errored packets',
1315 2: 'Undersize packets',
1316 3: 'Oversize packets',
1317 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001318
1319
Matt Jeanneretf78f6aa2018-11-01 11:20:17 -04001320class VeipUni(EntityClass):
1321 class_id = 329
1322 attributes = [
1323 ECA(ShortField("managed_entity_id", None), {AA.R}),
1324 ECA(ByteField("administrative_state", 1), {AA.R, AA.W},
1325 range_check=lambda x: 0 <= x <= 1),
1326 ECA(ByteField("operational_state", 1), {AA.R, AA.W},
1327 range_check=lambda x: 0 <= x <= 1, optional=True, avc=True),
1328 ECA(StrFixedLenField("interdomain_name", None, 25), {AA.R, AA.W},
1329 optional=True),
1330 ECA(ShortField("tcp_udp_pointer", None), {AA.R, AA.W}, optional=True),
1331 ECA(ShortField("iana_assigned_port", 0xFFFF), {AA.R})
1332 ]
1333 mandatory_operations = {OP.Get, OP.Set}
1334 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001335 alarms = {
1336 0: 'Connecting function fail'
1337 }
Matt Jeanneretf78f6aa2018-11-01 11:20:17 -04001338
1339
Chip Bolingac7b5622018-07-12 18:53:55 -05001340class EthernetFrameExtendedPerformanceMonitoring(EntityClass):
1341 class_id = 334
Chip Boling50432882018-09-28 14:14:35 -05001342 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001343 attributes = [
1344 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1345 ECA(ByteField("interval_end_time", None), {AA.R}),
1346 # 2-octet field -> Threshold data 1/2 ID
1347 # 2-octet field -> Parent ME Class
1348 # 2-octet field -> Parent ME Instance
1349 # 2-octet field -> Accumulation disable
1350 # 2-octet field -> TCA Disable
1351 # 2-octet field -> Control fields bitmap
1352 # 2-octet field -> TCI
1353 # 2-octet field -> Reserved
1354 ECA(FieldListField("control_block", None, ShortField('', 0),
1355 count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}),
1356 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1357 ECA(IntField("octets", None), {AA.R}, counter=True),
1358 ECA(IntField("packets", None), {AA.R}, counter=True),
1359 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1360 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1361 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1362 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1363 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1364 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1365 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1366 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1367 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1368 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1369 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1370 ]
1371 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1372 optional_operations = {OP.GetCurrentData}
1373 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001374 alarms = {
1375 0: 'Drop events',
1376 1: 'CRC errored packets',
1377 2: 'Undersize packets',
1378 3: 'Oversize packets',
1379 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001380
1381
1382class EthernetFrameExtendedPerformanceMonitoring64Bit(EntityClass):
1383 class_id = 426
Chip Boling50432882018-09-28 14:14:35 -05001384 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001385 attributes = [
1386 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1387 ECA(ByteField("interval_end_time", None), {AA.R}),
1388 # 2-octet field -> Threshold data 1/2 ID
1389 # 2-octet field -> Parent ME Class
1390 # 2-octet field -> Parent ME Instance
1391 # 2-octet field -> Accumulation disable
1392 # 2-octet field -> TCA Disable
1393 # 2-octet field -> Control fields bitmap
1394 # 2-octet field -> TCI
1395 # 2-octet field -> Reserved
1396 ECA(FieldListField("control_block", None, ShortField('', 0),
1397 count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}),
1398 ECA(LongField("drop_events", None), {AA.R}, tca=True, counter=True),
1399 ECA(LongField("octets", None), {AA.R}, counter=True),
1400 ECA(LongField("packets", None), {AA.R}, counter=True),
1401 ECA(LongField("broadcast_packets", None), {AA.R}, counter=True),
1402 ECA(LongField("multicast_packets", None), {AA.R}, counter=True),
1403 ECA(LongField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1404 ECA(LongField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1405 ECA(LongField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1406 ECA(LongField("64_octets", None), {AA.R}, counter=True),
1407 ECA(LongField("65_to_127_octets", None), {AA.R}, counter=True),
1408 ECA(LongField("128_to_255_octets", None), {AA.R}, counter=True),
1409 ECA(LongField("256_to_511_octets", None), {AA.R}, counter=True),
1410 ECA(LongField("512_to_1023_octets", None), {AA.R}, counter=True),
1411 ECA(LongField("1024_to_1518_octets", None), {AA.R}, counter=True)
1412 ]
1413 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1414 optional_operations = {OP.GetCurrentData}
1415 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001416 alarms = {
1417 0: 'Drop events',
1418 1: 'CRC errored packets',
1419 2: 'Undersize packets',
1420 3: 'Oversize packets',
1421 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001422
1423
1424class GemPortNetworkCtpMonitoringHistoryData(EntityClass):
1425 class_id = 341
Chip Boling50432882018-09-28 14:14:35 -05001426 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001427 attributes = [
1428 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1429 ECA(ByteField("interval_end_time", None), {AA.R}),
1430 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1431 ECA(IntField("transmitted_gem_frames", None), {AA.R}, counter=True),
1432 ECA(IntField("received_gem_frames", None), {AA.R}, counter=True),
1433 ECA(LongField("received_payload_bytes", None), {AA.R}, counter=True),
1434 ECA(LongField("transmitted_payload_bytes", None), {AA.R}, counter=True),
1435 ECA(IntField("encryption_key_errors", None), {AA.R}, tca=True, counter=True)
1436 ]
1437 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1438 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001439 alarms = {
1440 1: 'Encryption key errors',
1441 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001442
1443
1444class XgPonTcPerformanceMonitoringHistoryData(EntityClass):
1445 class_id = 344
Chip Boling50432882018-09-28 14:14:35 -05001446 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001447 attributes = [
1448 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1449 ECA(ByteField("interval_end_time", None), {AA.R}),
1450 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1451 ECA(IntField("psbd_hec_error_count", None), {AA.R}, tca=True, counter=True),
1452 ECA(IntField("xgtc_hec_error_count", None), {AA.R}, tca=True, counter=True),
1453 ECA(IntField("unknown_profile_count", None), {AA.R}, tca=True, counter=True),
1454 ECA(IntField("transmitted_xgem_frames", None), {AA.R}, counter=True),
1455 ECA(IntField("fragment_xgem_frames", None), {AA.R}, counter=True),
1456 ECA(IntField("xgem_hec_lost_words_count", None), {AA.R}, tca=True, counter=True),
1457 ECA(IntField("xgem_key_errors", None), {AA.R}, tca=True, counter=True),
1458 ECA(IntField("xgem_hec_error_count", None), {AA.R}, tca=True, counter=True)
1459 ]
1460 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1461 optional_operations = {OP.GetCurrentData}
1462 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001463 alarms = {
1464 1: 'PSBd HEC error count',
1465 2: 'XGTC HEC error count',
1466 3: 'Unknown profile count',
1467 4: 'XGEM HEC loss count',
1468 5: 'XGEM key errors',
1469 6: 'XGEM HEC error count',
1470 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001471
1472
1473class XgPonDownstreamPerformanceMonitoringHistoryData(EntityClass):
1474 class_id = 345
Chip Boling50432882018-09-28 14:14:35 -05001475 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001476 attributes = [
1477 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1478 ECA(ByteField("interval_end_time", None), {AA.R},),
1479 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1480 ECA(IntField("ploam_mic_error_count", None), {AA.R}, tca=True, counter=True),
1481 ECA(IntField("downstream_ploam_messages_count", None), {AA.R}, counter=True),
1482 ECA(IntField("profile_messages_received", None), {AA.R}, counter=True),
1483 ECA(IntField("ranging_time_messages_received", None), {AA.R}, counter=True),
1484 ECA(IntField("deactivate_onu_id_messages_received", None), {AA.R}, counter=True),
1485 ECA(IntField("disable_serial_number_messages_received", None), {AA.R}, counter=True),
Chip Boling688e0ed2018-08-24 14:20:44 -05001486 ECA(IntField("request_registration_messages_received", None), {AA.R}, counter=True),
Chip Bolingac7b5622018-07-12 18:53:55 -05001487 ECA(IntField("assign_alloc_id_messages_received", None), {AA.R}, counter=True),
1488 ECA(IntField("key_control_messages_received", None), {AA.R}, counter=True),
1489 ECA(IntField("sleep_allow_messages_received", None), {AA.R}, counter=True),
1490 ECA(IntField("baseline_omci_messages_received_count", None), {AA.R}, counter=True),
1491 ECA(IntField("extended_omci_messages_received_count", None), {AA.R}, counter=True),
1492 ECA(IntField("assign_onu_id_messages_received", None), {AA.R}, counter=True),
1493 ECA(IntField("omci_mic_error_count", None), {AA.R}, tca=True, counter=True),
1494 ]
1495 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1496 optional_operations = {OP.GetCurrentData}
1497 notifications = {OP.AlarmNotification}
Chip Boling3186eb52018-11-02 14:28:01 -05001498 alarms = {
1499 1: 'PLOAM MIC error count',
1500 2: 'OMCI MIC error count',
1501 }
Chip Bolingac7b5622018-07-12 18:53:55 -05001502
1503
1504class XgPonUpstreamPerformanceMonitoringHistoryData(EntityClass):
1505 class_id = 346
Chip Boling50432882018-09-28 14:14:35 -05001506 hidden = True
Chip Bolingac7b5622018-07-12 18:53:55 -05001507 attributes = [
1508 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1509 ECA(ByteField("interval_end_time", None), {AA.R}),
1510 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1511 ECA(IntField("upstream_ploam_message_count", None), {AA.R}, counter=True),
1512 ECA(IntField("serial_number_onu_message_count", None), {AA.R}, counter=True),
1513 ECA(IntField("registration_message_count", None), {AA.R}, counter=True),
1514 ECA(IntField("key_report_message_count", None), {AA.R}, counter=True),
1515 ECA(IntField("acknowledge_message_count", None), {AA.R}, counter=True),
1516 ECA(IntField("sleep_request_message_count", None), {AA.R}, counter=True),
1517 ]
1518 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1519 optional_operations = {OP.GetCurrentData}
1520
1521
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -08001522# entity class lookup table from entity_class values
1523entity_classes_name_map = dict(
1524 inspect.getmembers(sys.modules[__name__],
1525 lambda o: inspect.isclass(o) and \
1526 issubclass(o, EntityClass) and \
1527 o is not EntityClass)
1528)
1529
1530entity_classes = [c for c in entity_classes_name_map.itervalues()]
1531entity_id_to_class_map = dict((c.class_id, c) for c in entity_classes)