blob: e1f1054eb8d2daf6921ef9383634d699844f9139 [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
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -080028from voltha.extensions.omci.omci_defs import bitpos_from_mask
29
30
31class 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()
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800141
142 # will be map of attr_name -> index in attributes, initialized by metaclass
143 attribute_name_to_index_map = None
144 __metaclass__ = EntityClassMeta
145
146 def __init__(self, **kw):
147 assert(isinstance(kw, dict))
148 for k, v in kw.iteritems():
149 assert(k in self.attribute_name_to_index_map)
150 self._data = kw
151
152 def serialize(self, mask=None, operation=None):
Chip Bolinge2e64a02018-02-06 12:58:07 -0600153 octets = ''
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800154
155 # generate ordered list of attribute indices needed to be processed
156 # if mask is provided, we use that explicitly
157 # if mask is not provided, we determine attributes from the self._data
158 # content also taking into account the type of operation in hand
159 if mask is not None:
160 attribute_indices = EntityClass.attribute_indices_from_mask(mask)
161 else:
162 attribute_indices = self.attribute_indices_from_data()
163
164 # Serialize each indexed field (ignoring entity id)
165 for index in attribute_indices:
Chip Bolinge2e64a02018-02-06 12:58:07 -0600166 eca = self.attributes[index]
167 field = eca.field
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800168 try:
169 value = self._data[field.name]
Chip Bolinge2e64a02018-02-06 12:58:07 -0600170
171 if not eca.valid(value):
172 raise OmciInvalidTypeError(
173 'Value "{}" for Entity field "{}" is not valid'.format(value,
174 field.name))
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800175 except KeyError:
176 raise OmciUninitializedFieldError(
Chip Bolinge2e64a02018-02-06 12:58:07 -0600177 'Entity field "{}" not set'.format(field.name))
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800178
Chip Bolinge2e64a02018-02-06 12:58:07 -0600179 octets = field.addfield(None, octets, value)
180
181 return octets
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800182
183 def attribute_indices_from_data(self):
184 return sorted(
185 self.attribute_name_to_index_map[attr_name]
186 for attr_name in self._data.iterkeys())
187
188 byte1_mask_to_attr_indices = dict(
189 (m, bitpos_from_mask(m, 8, -1)) for m in range(256))
190 byte2_mask_to_attr_indices = dict(
191 (m, bitpos_from_mask(m, 16, -1)) for m in range(256))
Chip Bolinge2e64a02018-02-06 12:58:07 -0600192
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800193 @classmethod
194 def attribute_indices_from_mask(cls, mask):
195 # each bit in the 2-byte field denote an attribute index; we use a
196 # lookup table to make lookup a bit faster
197 return \
198 cls.byte1_mask_to_attr_indices[(mask >> 8) & 0xff] + \
199 cls.byte2_mask_to_attr_indices[(mask & 0xff)]
200
201 @classmethod
202 def mask_for(cls, *attr_names):
203 """
204 Return mask value corresponding to given attributes names
205 :param attr_names: Attribute names
206 :return: integer mask value
207 """
208 mask = 0
209 for attr_name in attr_names:
210 index = cls.attribute_name_to_index_map[attr_name]
211 mask |= (1 << (16 - index))
212 return mask
213
214
215# abbreviations
216ECA = EntityClassAttribute
217AA = AttributeAccess
218OP = EntityOperations
219
220
221class OntData(EntityClass):
222 class_id = 2
223 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600224 ECA(ShortField("managed_entity_id", None), {AA.R},
225 range_check=lambda x: x == 0),
Chip Boling9b7a11a2018-04-15 13:33:21 -0500226 # Only 1 octet used if GET/SET operation
227 ECA(ShortField("mib_data_sync", 0), {AA.R, AA.W})
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800228 ]
229 mandatory_operations = {OP.Get, OP.Set,
230 OP.GetAllAlarms, OP.GetAllAlarmsNext,
231 OP.MibReset, OP.MibUpload, OP.MibUploadNext}
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800232
233
234class Cardholder(EntityClass):
235 class_id = 5
236 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600237 ECA(ShortField("managed_entity_id", None), {AA.R},
238 range_check=lambda x: 0 <= x < 255 or 256 <= x < 511,
239 avc=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800240 ECA(ByteField("actual_plugin_unit_type", None), {AA.R}),
241 ECA(ByteField("expected_plugin_unit_type", None), {AA.R, AA.W}),
242 ECA(ByteField("expected_port_count", None), {AA.R, AA.W},
243 optional=True),
244 ECA(StrFixedLenField("expected_equipment_id", None, 20), {AA.R, AA.W},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600245 optional=True, avc=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800246 ECA(StrFixedLenField("actual_equipment_id", None, 20), {AA.R},
247 optional=True),
248 ECA(ByteField("protection_profile_pointer", None), {AA.R},
249 optional=True),
250 ECA(ByteField("invoke_protection_switch", None), {AA.R, AA.W},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600251 optional=True, range_check=lambda x: 0 <= x <= 3),
252 ECA(ByteField("arc", 0), {AA.R, AA.W},
253 range_check=lambda x: 0 <= x <= 1, optional=True, avc=True),
254 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True),
Zsolt Harasztie3ece3c2016-12-19 23:32:38 -0800255 ]
256 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600257 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800258
259
260class CircuitPack(EntityClass):
261 class_id = 6
262 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600263 ECA(StrFixedLenField("managed_entity_id", None, 22), {AA.R, AA.SBC},
264 range_check=lambda x: 0 <= x < 255 or 256 <= x < 511),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800265 ECA(ByteField("type", None), {AA.R, AA.SBC}),
266 ECA(ByteField("number_of_ports", None), {AA.R}, optional=True),
267 ECA(StrFixedLenField("serial_number", None, 8), {AA.R}),
268 ECA(StrFixedLenField("version", None, 14), {AA.R}),
269 ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600270 ECA(ByteField("administrative_state", None), {AA.R, AA.W}),
271 ECA(ByteField("operational_state", None), {AA.R}, optional=True, avc=True),
272 ECA(ByteField("bridged_or_ip_ind", None), {AA.R, AA.W}, optional=True,
273 range_check=lambda x: 0 <= x <= 2),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800274 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600275 ECA(ByteField("card_configuration", None), {AA.R, AA.W, AA.SBC},
276 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
277 ECA(ByteField("total_tcont_buffer_number", None), {AA.R},
278 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
279 ECA(ByteField("total_priority_queue_number", None), {AA.R},
280 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
281 ECA(ByteField("total_traffic_scheduler_number", None), {AA.R},
282 optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800283 ECA(IntField("power_sched_override", None), {AA.R, AA.W},
284 optional=True)
285 ]
286 mandatory_operations = {OP.Get, OP.Set, OP.Reboot}
287 optional_operations = {OP.Create, OP.Delete, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600288 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800289
290
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800291class SoftwareImage(EntityClass):
292 class_id = 7
293 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600294 ECA(ShortField("managed_entity_id", None), {AA.R},
295 range_check=lambda x: 0 <= x/256 <= 254 or 0 <= x % 256 <= 1),
296 ECA(StrFixedLenField("version", None, 14), {AA.R}, avc=True),
297 ECA(ByteField("is_committed", None), {AA.R}, avc=True,
298 range_check=lambda x: 0 <= x <= 1),
299 ECA(ByteField("is_active", None), {AA.R}, avc=True,
300 range_check=lambda x: 0 <= x <= 1),
301 ECA(ByteField("is_valid", None), {AA.R}, avc=True,
302 range_check=lambda x: 0 <= x <= 1),
303 ECA(StrFixedLenField("product_code", None, 25), {AA.R}, optional=True, avc=True),
304 ECA(StrFixedLenField("image_hash", None, 16), {AA.R}, optional=True, avc=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800305 ]
Chip Bolinge2e64a02018-02-06 12:58:07 -0600306 mandatory_operations = {OP.Get, OP.StartSoftwareDownload, OP.DownloadSection,
307 OP.EndSoftwareDownload, OP.ActivateSoftware,
308 OP.CommitSoftware}
309 notifications = {OP.AttributeValueChange}
310
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800311
Nathan Knuth61a039c2017-03-23 13:50:29 -0700312class PptpEthernetUni(EntityClass):
313 class_id = 11
314 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600315 ECA(ShortField("managed_entity_id", None), {AA.R}),
316 ECA(ByteField("expected_type", 0), {AA.R, AA.W},
317 range_check=lambda x: 0 <= x <= 254),
318 ECA(ByteField("sensed_type", 0), {AA.R}, optional=True, avc=True),
Chip Boling688e0ed2018-08-24 14:20:44 -0500319 # TODO: For sensed_type AVC, see note in AT&T OMCI Specification, V3.0, page 123
Chip Bolinge2e64a02018-02-06 12:58:07 -0600320 ECA(ByteField("autodetection_config", 0), {AA.R, AA.W},
321 range_check=lambda x: x in [0, 1, 2, 3, 4, 5,
322 0x10, 0x11, 0x12, 0x13, 0x14,
323 0x20, 0x30], optional=True), # See ITU-T G.988
324 ECA(ByteField("ethernet_loopback_config", 0), {AA.R, AA.W},
325 range_check=lambda x: x in [0, 3]),
326 ECA(ByteField("administrative_state", 1), {AA.R, AA.W},
327 range_check=lambda x: 0 <= x <= 1),
328 ECA(ByteField("operational_state", 1), {AA.R, AA.W},
329 range_check=lambda x: 0 <= x <= 1, optional=True, avc=True),
330 ECA(ByteField("config_ind", 0), {AA.R},
331 range_check=lambda x: x in [0, 1, 2, 3, 4, 0x11, 0x12, 0x13]),
Chip Bolingf60a5322018-05-15 09:03:02 -0500332 ECA(ShortField("max_frame_size", 1518), {AA.R, AA.W}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600333 ECA(ByteField("dte_dce_ind", 0), {AA.R, AA.W},
334 range_check=lambda x: 0 <= x <= 2),
335 ECA(ShortField("pause_time", 0), {AA.R, AA.W}, optional=True),
Chip Bolingf60a5322018-05-15 09:03:02 -0500336 ECA(ByteField("bridged_ip_ind", 2), {AA.R, AA.W},
337 optional=True, range_check=lambda x: 0 <= x <= 2),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600338 ECA(ByteField("arc", 0), {AA.R, AA.W}, optional=True,
339 range_check=lambda x: 0 <= x <= 1, avc=True),
340 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}, optional=True),
341 ECA(ByteField("pppoe_filter", 0), {AA.R, AA.W}, optional=True),
342 ECA(ByteField("power_control", 0), {AA.R, AA.W}, optional=True),
Nathan Knuth61a039c2017-03-23 13:50:29 -0700343 ]
344 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600345 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
346
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800347
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800348class MacBridgeServiceProfile(EntityClass):
349 class_id = 45
350 attributes = [
351 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600352 ECA(ByteField("spanning_tree_ind", None), {AA.R, AA.W, AA.SBC},
353 range_check=lambda x: 0 <= x <= 1),
354 ECA(ByteField("learning_ind", None), {AA.R, AA.W, AA.SBC},
355 range_check=lambda x: 0 <= x <= 1),
356 ECA(ByteField("port_bridging_ind", None), {AA.R, AA.W, AA.SBC},
357 range_check=lambda x: 0 <= x <= 1),
358 ECA(ShortField("priority", None), {AA.R, AA.W, AA.SBC}),
359 ECA(ShortField("max_age", None), {AA.R, AA.W, AA.SBC},
360 range_check=lambda x: 0x0600 <= x <= 0x2800),
361 ECA(ShortField("hello_time", None), {AA.R, AA.W, AA.SBC},
362 range_check=lambda x: 0x0100 <= x <= 0x0A00),
363 ECA(ShortField("forward_delay", None), {AA.R, AA.W, AA.SBC},
364 range_check=lambda x: 0x0400 <= x <= 0x1E00),
365 ECA(ByteField("unknown_mac_address_discard", None),
366 {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1),
367 ECA(ByteField("mac_learning_depth", None),
368 {AA.R, AA.W, AA.SBC}, optional=True),
369 ECA(ByteField("dynamic_filtering_ageing_time", None),
370 {AA.R, AA.W, AA.SBC}, optional=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800371 ]
372 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
373
374
375class MacBridgePortConfigurationData(EntityClass):
376 class_id = 47
377 attributes = [
378 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
379 ECA(ShortField("bridge_id_pointer", None), {AA.R, AA.W, AA.SBC}),
380 ECA(ByteField("port_num", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600381 ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC},
382 range_check=lambda x: 1 <= x <= 12),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800383 ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}),
384 ECA(ShortField("port_priority", None), {AA.R, AA.W, AA.SBC}),
385 ECA(ShortField("port_path_cost", None), {AA.R, AA.W, AA.SBC}),
386 ECA(ByteField("port_spanning_tree_in", None), {AA.R, AA.W, AA.SBC}),
387 ECA(ByteField("encapsulation_methods", None), {AA.R, AA.W, AA.SBC},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600388 optional=True, deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800389 ECA(ByteField("lan_fcs_ind", None), {AA.R, AA.W, AA.SBC},
Chip Bolinge2e64a02018-02-06 12:58:07 -0600390 optional=True, deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800391 ECA(MACField("port_mac_address", None), {AA.R}, optional=True),
392 ECA(ShortField("outbound_td_pointer", None), {AA.R, AA.W},
393 optional=True),
394 ECA(ShortField("inbound_td_pointer", None), {AA.R, AA.W},
395 optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600396 # TODO:
397 ECA(ByteField("mac_learning_depth", 0), {AA.R, AA.W, AA.SBC},
398 optional=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800399 ]
400 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600401 notifications = {OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800402
403
Chip Bolinge6c416f2018-05-01 15:07:51 -0500404class MacBridgePortFilterPreAssignTable(EntityClass):
405 class_id = 79
406 attributes = [
407 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
408 ECA(ShortField("ipv4_multicast", 0), {AA.R, AA.W},
409 range_check=lambda x: 0 <= x <= 1),
410 ECA(ShortField("ipv6_multicast", 0), {AA.R, AA.W},
411 range_check=lambda x: 0 <= x <= 1),
412 ECA(ShortField("ipv4_broadcast", 0), {AA.R, AA.W},
413 range_check=lambda x: 0 <= x <= 1),
414 ECA(ShortField("rarp", 0), {AA.R, AA.W},
415 range_check=lambda x: 0 <= x <= 1),
416 ECA(ShortField("ipx", 0), {AA.R, AA.W},
417 range_check=lambda x: 0 <= x <= 1),
418 ECA(ShortField("netbeui", 0), {AA.R, AA.W},
419 range_check=lambda x: 0 <= x <= 1),
420 ECA(ShortField("appletalk", 0), {AA.R, AA.W},
421 range_check=lambda x: 0 <= x <= 1),
422 ECA(ShortField("bridge_management_information", 0), {AA.R, AA.W},
423 range_check=lambda x: 0 <= x <= 1),
424 ECA(ShortField("arp", 0), {AA.R, AA.W},
425 range_check=lambda x: 0 <= x <= 1),
426 ECA(ShortField("pppoe_broadcast", 0), {AA.R, AA.W},
427 range_check=lambda x: 0 <= x <= 1)
428 ]
429 mandatory_operations = {OP.Get, OP.Set}
430 notifications = {OP.AlarmNotification}
431
432
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800433class VlanTaggingFilterData(EntityClass):
434 class_id = 84
435 attributes = [
436 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Boling4c06db92018-05-24 15:02:26 -0500437 ECA(FieldListField("vlan_filter_list", None,
438 ShortField('', 0), count_from=lambda _: 12),
439 {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600440 ECA(ByteField("forward_operation", None), {AA.R, AA.W, AA.SBC},
441 range_check=lambda x: 0x00 <= x <= 0x21),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800442 ECA(ByteField("number_of_entries", None), {AA.R, AA.W, AA.SBC})
443 ]
444 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
445
446
447class Ieee8021pMapperServiceProfile(EntityClass):
448 class_id = 130
449 attributes = [
450 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600451 ECA(ShortField("tp_pointer", None), {AA.R, AA.W, AA.SBC}),
452 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_0",
453 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
454 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_1",
455 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
456 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_2",
457 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
458 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_3",
459 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
460 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_4",
461 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
462 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_5",
463 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
464 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_6",
465 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
466 ECA(ShortField("interwork_tp_pointer_for_p_bit_priority_7",
467 OmciNullPointer), {AA.R, AA.W, AA.SBC}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800468 ECA(ByteField("unmarked_frame_option", None),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600469 {AA.R, AA.W, AA.SBC}, range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800470 ECA(StrFixedLenField("dscp_to_p_bit_mapping", None, length=24),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600471 {AA.R, AA.W}), # TODO: Would a custom 3-bit group bitfield work better?
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800472 ECA(ByteField("default_p_bit_marking", None),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600473 {AA.R, AA.W, AA.SBC}),
474 ECA(ByteField("tp_type", None), {AA.R, AA.W, AA.SBC},
475 optional=True, range_check=lambda x: 0 <= x <= 8)
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800476 ]
477 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
478
479
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800480class OltG(EntityClass):
481 class_id = 131
482 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600483 ECA(ShortField("managed_entity_id", None), {AA.R},
484 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800485 ECA(StrFixedLenField("olt_vendor_id", None, 4), {AA.R, AA.W}),
486 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R, AA.W}),
487 ECA(StrFixedLenField("version", None, 14), {AA.R, AA.W}),
488 ECA(StrFixedLenField("time_of_day", None, 14), {AA.R, AA.W})
489 ]
490 mandatory_operations = {OP.Get, OP.Set}
491
492
493class OntPowerShedding(EntityClass):
494 class_id = 133
495 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600496 ECA(ShortField("managed_entity_id", None), {AA.R},
497 range_check=lambda x: x == 0),
498 ECA(ShortField("restore_power_time_reset_interval", 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800499 {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600500 ECA(ShortField("data_class_shedding_interval", 0), {AA.R, AA.W}),
501 ECA(ShortField("voice_class_shedding_interval", 0), {AA.R, AA.W}),
502 ECA(ShortField("video_overlay_class_shedding_interval", 0), {AA.R, AA.W}),
503 ECA(ShortField("video_return_class_shedding_interval", 0), {AA.R, AA.W}),
504 ECA(ShortField("dsl_class_shedding_interval", 0), {AA.R, AA.W}),
505 ECA(ShortField("atm_class_shedding_interval", 0), {AA.R, AA.W}),
506 ECA(ShortField("ces_class_shedding_interval", 0), {AA.R, AA.W}),
507 ECA(ShortField("frame_class_shedding_interval", 0), {AA.R, AA.W}),
508 ECA(ShortField("sonet_class_shedding_interval", 0), {AA.R, AA.W}),
509 ECA(ShortField("shedding_status", None), {AA.R, AA.W}, optional=True,
510 avc=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800511 ]
512 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600513 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800514
515
516class IpHostConfigData(EntityClass):
517 class_id = 134
518 attributes = [
519 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600520 ECA(BitField("ip_options", 0, size=8), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800521 ECA(MACField("mac_address", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600522 ECA(StrFixedLenField("onu_identifier", None, 25), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800523 ECA(IPField("ip_address", None), {AA.R, AA.W}),
524 ECA(IPField("mask", None), {AA.R, AA.W}),
525 ECA(IPField("gateway", None), {AA.R, AA.W}),
526 ECA(IPField("primary_dns", None), {AA.R, AA.W}),
527 ECA(IPField("secondary_dns", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600528 ECA(IPField("current_address", None), {AA.R}, avc=True),
529 ECA(IPField("current_mask", None), {AA.R}, avc=True),
530 ECA(IPField("current_gateway", None), {AA.R}, avc=True),
531 ECA(IPField("current_primary_dns", None), {AA.R}, avc=True),
532 ECA(IPField("current_secondary_dns", None), {AA.R}, avc=True),
533 ECA(StrFixedLenField("domain_name", None, 25), {AA.R}, avc=True),
534 ECA(StrFixedLenField("host_name", None, 25), {AA.R}, avc=True),
535 ECA(ShortField("relay_agent_options", None), {AA.R, AA.W},
536 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800537 ]
538 mandatory_operations = {OP.Get, OP.Set, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600539 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800540
541
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800542class VlanTaggingOperation(Packet):
543 name = "VlanTaggingOperation"
544 fields_desc = [
545 BitField("filter_outer_priority", 0, 4),
546 BitField("filter_outer_vid", 0, 13),
547 BitField("filter_outer_tpid_de", 0, 3),
548 BitField("pad1", 0, 12),
549
550 BitField("filter_inner_priority", 0, 4),
551 BitField("filter_inner_vid", 0, 13),
552 BitField("filter_inner_tpid_de", 0, 3),
553 BitField("pad2", 0, 8),
554 BitField("filter_ether_type", 0, 4),
555
556 BitField("treatment_tags_to_remove", 0, 2),
557 BitField("pad3", 0, 10),
558 BitField("treatment_outer_priority", 0, 4),
559 BitField("treatment_outer_vid", 0, 13),
560 BitField("treatment_outer_tpid_de", 0, 3),
561
562 BitField("pad4", 0, 12),
563 BitField("treatment_inner_priority", 0, 4),
564 BitField("treatment_inner_vid", 0, 13),
565 BitField("treatment_inner_tpid_de", 0, 3),
566 ]
567
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500568 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500569 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500570
Chip Boling77c01802018-06-22 09:49:20 -0500571 @staticmethod
572 def json_from_value(value):
573 bits = BitArray(hex=hexlify(value))
574 temp = VlanTaggingOperation(
575 filter_outer_priority=bits[0:4].uint, # 4 <-size
576 filter_outer_vid=bits[4:17].uint, # 13
577 filter_outer_tpid_de=bits[17:20].uint, # 3
578 # pad 12
579 filter_inner_priority=bits[32:36].uint, # 4
580 filter_inner_vid=bits[36:49].uint, # 13
581 filter_inner_tpid_de=bits[49:52].uint, # 3
582 # pad 8
583 filter_ether_type=bits[60:64].uint, # 4
584 treatment_tags_to_remove=bits[64:66].uint, # 2
585 # pad 10
586 treatment_outer_priority=bits[76:80].uint, # 4
587 treatment_outer_vid=bits[80:93].uint, # 13
588 treatment_outer_tpid_de=bits[93:96].uint, # 3
589 # pad 12
590 treatment_inner_priority=bits[108:112].uint, # 4
591 treatment_inner_vid=bits[112:125].uint, # 13
592 treatment_inner_tpid_de=bits[125:128].uint, # 3
593 )
594 return json.dumps(temp.fields, separators=(',', ':'))
595
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800596
597class ExtendedVlanTaggingOperationConfigurationData(EntityClass):
598 class_id = 171
599 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600600 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
601 ECA(ByteField("association_type", None), {AA.R, AA.W, AA.SBC},
602 range_check=lambda x: 0 <= x <= 11),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800603 ECA(ShortField("received_vlan_tagging_operation_table_max_size", None),
604 {AA.R}),
605 ECA(ShortField("input_tpid", None), {AA.R, AA.W}),
606 ECA(ShortField("output_tpid", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600607 ECA(ByteField("downstream_mode", None), {AA.R, AA.W},
608 range_check=lambda x: 0 <= x <= 8),
609 ECA(StrFixedLenField("received_frame_vlan_tagging_operation_table",
610 VlanTaggingOperation, 16), {AA.R, AA.W}),
611 ECA(ShortField("associated_me_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Boling4069a512018-06-06 15:51:38 -0500612 ECA(FieldListField("dscp_to_p_bit_mapping", None,
613 BitField('', 0, size=3), count_from=lambda _: 64),
614 {AA.R, AA.W}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800615 ]
616 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600617 optional_operations = {OP.SetTable}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800618
619
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800620class OntG(EntityClass):
621 class_id = 256
622 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600623 ECA(ShortField("managed_entity_id", None), {AA.R},
624 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800625 ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}),
626 ECA(StrFixedLenField("version", None, 14), {AA.R}),
627 ECA(StrFixedLenField("serial_number", None, 8), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600628 ECA(ByteField("traffic_management_options", None), {AA.R},
629 range_check=lambda x: 0 <= x <= 2),
630 ECA(ByteField("vp_vc_cross_connection_option", 0), {AA.R},
631 optional=True, deprecated=True),
632 ECA(ByteField("battery_backup", None), {AA.R, AA.W},
633 range_check=lambda x: 0 <= x <= 1),
634 ECA(ByteField("administrative_state", None), {AA.R, AA.W},
635 range_check=lambda x: 0 <= x <= 1),
636 ECA(ByteField("operational_state", None), {AA.R}, optional=True,
637 range_check=lambda x: 0 <= x <= 1, avc=True),
638 ECA(ByteField("ont_survival_time", None), {AA.R}, optional=True),
639 ECA(StrFixedLenField("logical_onu_id", None, 24), {AA.R},
640 optional=True, avc=True),
641 ECA(StrFixedLenField("logical_password", None, 12), {AA.R},
642 optional=True, avc=True),
643 ECA(ByteField("credentials_status", None), {AA.R, AA.W},
644 optional=True, range_check=lambda x: 0 <= x <= 4),
645 ECA(BitField("extended_tc_layer_options", None, size=16), {AA.R},
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800646 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800647 ]
648 mandatory_operations = {
649 OP.Get, OP.Set, OP.Reboot, OP.Test, OP.SynchronizeTime}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600650 notifications = {OP.TestResult, OP.AttributeValueChange,
651 OP.AlarmNotification}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800652
653
654class Ont2G(EntityClass):
655 class_id = 257
656 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600657 ECA(ShortField("managed_entity_id", None), {AA.R},
658 range_check=lambda x: x == 0),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800659 ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600660 ECA(ByteField("omcc_version", None), {AA.R}, avc=True),
661 ECA(ShortField("vendor_product_code", None), {AA.R}),
662 ECA(ByteField("security_capability", None), {AA.R},
663 range_check=lambda x: 0 <= x <= 1),
664 ECA(ByteField("security_mode", None), {AA.R, AA.W},
665 range_check=lambda x: 0 <= x <= 1),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800666 ECA(ShortField("total_priority_queue_number", None), {AA.R}),
667 ECA(ByteField("total_traffic_scheduler_number", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600668 ECA(ByteField("mode", None), {AA.R}, deprecated=True),
669 ECA(ShortField("total_gem_port_id_number", None), {AA.R}),
670 ECA(IntField("sys_uptime", None), {AA.R}),
671 ECA(BitField("connectivity_capability", None, size=16), {AA.R}),
672 ECA(ByteField("current_connectivity_mode", None), {AA.R, AA.W},
673 range_check=lambda x: 0 <= x <= 7),
674 ECA(BitField("qos_configuration_flexibility", None, size=16),
675 {AA.R}, optional=True),
676 ECA(ShortField("priority_queue_scale_factor", None), {AA.R, AA.W},
677 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800678 ]
679 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600680 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800681
682
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800683class Tcont(EntityClass):
684 class_id = 262
685 attributes = [
686 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600687 ECA(ShortField("alloc_id", None), {AA.R, AA.W}),
688 ECA(ByteField("mode_indicator", 1), {AA.R}, deprecated=True),
689 ECA(ByteField("policy", None), {AA.R, AA.W},
690 range_check=lambda x: 0 <= x <= 2),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800691 ]
692 mandatory_operations = {OP.Get, OP.Set}
693
694
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800695class AniG(EntityClass):
696 class_id = 263
697 attributes = [
698 ECA(ShortField("managed_entity_id", None), {AA.R}),
699 ECA(ByteField("sr_indication", None), {AA.R}),
700 ECA(ShortField("total_tcont_number", None), {AA.R}),
701 ECA(ShortField("gem_block_length", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600702 ECA(ByteField("piggyback_dba_reporting", None), {AA.R},
703 range_check=lambda x: 0 <= x <= 4),
704 ECA(ByteField("whole_ont_dba_reporting", None), {AA.R},
705 deprecated=True),
706 ECA(ByteField("sf_threshold", 5), {AA.R, AA.W}),
707 ECA(ByteField("sd_threshold", 9), {AA.R, AA.W}),
708 ECA(ByteField("arc", 0), {AA.R, AA.W},
709 range_check=lambda x: 0 <= x <= 1, avc=True),
710 ECA(ByteField("arc_interval", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800711 ECA(ShortField("optical_signal_level", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600712 ECA(ByteField("lower_optical_threshold", 0xFF), {AA.R, AA.W}),
713 ECA(ByteField("upper_optical_threshold", 0xFF), {AA.R, AA.W}),
714 ECA(ByteField("ont_response_time", None), {AA.R}),
715 ECA(ShortField("transmit_optical_level", None), {AA.R}),
716 ECA(ByteField("lower_transmit_power_threshold", 0x81), {AA.R, AA.W}),
717 ECA(ByteField("upper_transmit_power_threshold", 0x81), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800718 ]
719 mandatory_operations = {OP.Get, OP.Set, OP.Test}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600720 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800721
722
723class UniG(EntityClass):
724 class_id = 264
725 attributes = [
726 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600727 ECA(ShortField("configuration_option_status", None), {AA.R, AA.W},
728 deprecated=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800729 ECA(ByteField("administrative_state", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600730 ECA(ByteField("management_capability", None), {AA.R},
731 range_check=lambda x: 0 <= x <= 2),
732 ECA(ShortField("non_omci_management_identifier", None), {AA.R, AA.W}),
733 ECA(ShortField("relay_agent_options", None), {AA.R, AA.W},
734 optional=True),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800735 ]
736 mandatory_operations = {OP.Get, OP.Set}
737
738
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800739class GemInterworkingTp(EntityClass):
740 class_id = 266
741 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600742 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800743 ECA(ShortField("gem_port_network_ctp_pointer", None),
744 {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600745 ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC},
746 range_check=lambda x: 0 <= x <= 7),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800747 ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
748 ECA(ShortField("interworking_tp_pointer", None), {AA.R, AA.W, AA.SBC}),
749 ECA(ByteField("pptp_counter", None), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600750 ECA(ByteField("operational_state", None), {AA.R}, optional=True,
751 range_check=lambda x: 0 <= x <= 1, avc=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800752 ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600753 ECA(ByteField("gal_loopback_configuration", 0),
754 {AA.R, AA.W}, range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800755 ]
Chip Bolingeada0c92017-12-27 09:45:26 -0600756 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600757 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800758
759
760class GemPortNetworkCtp(EntityClass):
761 class_id = 268
762 attributes = [
763 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
764 ECA(ShortField("port_id", None), {AA.R, AA.W, AA.SBC}),
765 ECA(ShortField("tcont_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600766 ECA(ByteField("direction", None), {AA.R, AA.W, AA.SBC},
767 range_check=lambda x: 1 <= x <= 3),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800768 ECA(ShortField("traffic_management_pointer_upstream", None),
769 {AA.R, AA.W, AA.SBC}),
770 ECA(ShortField("traffic_descriptor_profile_pointer", None),
771 {AA.R, AA.W, AA.SBC}, optional=True),
772 ECA(ByteField("uni_counter", None), {AA.R}, optional=True),
773 ECA(ShortField("priority_queue_pointer_downstream", None),
774 {AA.R, AA.W, AA.SBC}),
Nathan Knuth61a039c2017-03-23 13:50:29 -0700775 ECA(ByteField("encryption_state", None), {AA.R}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600776 ECA(ShortField("traffic_desc_profile_pointer_downstream", None),
777 {AA.R, AA.W, AA.SBC}, optional=True),
778 ECA(ShortField("encryption_key_ring", None), {AA.R, AA.W, AA.SBC},
779 range_check=lambda x: 0 <= x <= 3)
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800780 ]
781 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600782 notifications = {OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800783
784
785class GalEthernetProfile(EntityClass):
786 class_id = 272
787 attributes = [
788 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
789 ECA(ShortField("max_gem_payload_size", None), {AA.R, AA.W, AA.SBC}),
790 ]
791 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
792
793
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800794class PriorityQueueG(EntityClass):
795 class_id = 277
796 attributes = [
797 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600798 ECA(ByteField("queue_configuration_option", None), {AA.R},
799 range_check=lambda x: 0 <= x <= 1),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800800 ECA(ShortField("maximum_queue_size", None), {AA.R}),
801 ECA(ShortField("allocated_queue_size", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600802 ECA(ShortField("discard_block_counter_reset_interval", None), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800803 ECA(ShortField("threshold_value_for_discarded_blocks", None), {AA.R, AA.W}),
804 ECA(IntField("related_port", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600805 ECA(ShortField("traffic_scheduler_pointer", 0), {AA.R, AA.W}),
806 ECA(ByteField("weight", 1), {AA.R, AA.W}),
807 ECA(ShortField("back_pressure_operation", 0), {AA.R, AA.W},
808 range_check=lambda x: 0 <= x <= 1),
809 ECA(IntField("back_pressure_time", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800810 ECA(ShortField("back_pressure_occur_queue_threshold", None), {AA.R, AA.W}),
811 ECA(ShortField("back_pressure_clear_queue_threshold", None), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600812 # TODO: Custom field of 4 2-byte values would help below
813 ECA(LongField("packet_drop_queue_thresholds", None), {AA.R, AA.W},
814 optional=True),
815 ECA(ShortField("packet_drop_max_p", 0xFFFF), {AA.R, AA.W}, optional=True),
816 ECA(ByteField("queue_drop_w_q", 9), {AA.R, AA.W}, optional=True),
817 ECA(ByteField("drop_precedence_colour_marking", 0), {AA.R, AA.W},
818 optional=True, range_check=lambda x: 0 <= x <= 7),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800819 ]
820 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600821 notifications = {OP.AlarmNotification}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800822
823
824class TrafficSchedulerG(EntityClass):
825 class_id = 278
826 attributes = [
827 ECA(ShortField("managed_entity_id", None), {AA.R}),
828 ECA(ShortField("tcont_pointer", None), {AA.R}),
829 ECA(ShortField("traffic_scheduler_pointer", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600830 ECA(ByteField("policy", None), {AA.R, AA.W},
831 range_check=lambda x: 0 <= x <= 2),
832 ECA(ByteField("priority_weight", 0), {AA.R, AA.W}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -0800833 ]
834 mandatory_operations = {OP.Get, OP.Set}
835
836
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800837class MulticastGemInterworkingTp(EntityClass):
838 class_id = 281
839 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600840 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC},
841 range_check=lambda x: x != OmciNullPointer),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800842 ECA(ShortField("gem_port_network_ctp_pointer", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600843 ECA(ByteField("interworking_option", None), {AA.R, AA.W, AA.SBC},
844 range_check=lambda x: x in [0, 1, 3, 5]),
845 ECA(ShortField("service_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
846 ECA(ShortField("interworking_tp_pointer", 0), {AA.R, AA.W, AA.SBC},
847 deprecated=True),
848 ECA(ByteField("pptp_counter", None), {AA.R}),
849 ECA(ByteField("operational_state", None), {AA.R}, avc=True,
850 range_check=lambda x: 0 <= x <= 1),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800851 ECA(ShortField("gal_profile_pointer", None), {AA.R, AA.W, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600852 ECA(ByteField("gal_loopback_configuration", None), {AA.R, AA.W, AA.SBC},
853 deprecated=True),
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800854 # TODO add multicast_address_table here (page 85 of spec.)
855 # ECA(...("multicast_address_table", None), {AA.R, AA.W})
856 ]
857 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.GetNext, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600858 optional_operations = {OP.SetTable}
859 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -0800860
861
Steve Crooks9e85ce82017-03-20 12:00:53 -0400862class AccessControlRow0(Packet):
863 name = "AccessControlRow0"
864 fields_desc = [
865 BitField("set_ctrl", 0, 2),
866 BitField("row_part_id", 0, 3),
867 BitField("test", 0, 1),
868 BitField("row_key", 0, 10),
869
870 ShortField("gem_port_id", None),
871 ShortField("vlan_id", None),
872 IPField("src_ip", None),
873 IPField("dst_ip_start", None),
874 IPField("dst_ip_end", None),
875 IntField("ipm_group_bw", None),
876 ShortField("reserved0", 0)
877 ]
878
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500879 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500880 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500881
Chip Bolinge2e64a02018-02-06 12:58:07 -0600882
Steve Crooks9e85ce82017-03-20 12:00:53 -0400883class AccessControlRow1(Packet):
884 name = "AccessControlRow1"
885 fields_desc = [
886 BitField("set_ctrl", 0, 2),
887 BitField("row_part_id", 0, 3),
888 BitField("test", 0, 1),
889 BitField("row_key", 0, 10),
890
891 StrFixedLenField("ipv6_src_addr_start_bytes", None, 12),
892 ShortField("preview_length", None),
893 ShortField("preview_repeat_time", None),
894 ShortField("preview_repeat_count", None),
895 ShortField("preview_reset_time", None),
896 ShortField("reserved1", 0)
897 ]
898
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500899 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500900 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500901
Chip Bolinge2e64a02018-02-06 12:58:07 -0600902
Steve Crooks9e85ce82017-03-20 12:00:53 -0400903class AccessControlRow2(Packet):
904 name = "AccessControlRow2"
905 fields_desc = [
906 BitField("set_ctrl", 0, 2),
907 BitField("row_part_id", 0, 3),
908 BitField("test", 0, 1),
909 BitField("row_key", 0, 10),
910
911 StrFixedLenField("ipv6_dst_addr_start_bytes", None, 12),
912 StrFixedLenField("reserved2", None, 10)
913 ]
914
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500915 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500916 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolinge2e64a02018-02-06 12:58:07 -0600917
Chip Boling9b7a11a2018-04-15 13:33:21 -0500918
Steve Crooks9e85ce82017-03-20 12:00:53 -0400919class DownstreamIgmpMulticastTci(Packet):
920 name = "DownstreamIgmpMulticastTci"
921 fields_desc = [
922 ByteField("ctrl_type", None),
923 ShortField("tci", None)
924 ]
925
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500926 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500927 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500928
Chip Bolinge2e64a02018-02-06 12:58:07 -0600929
Steve Crooks89b94b72017-02-01 10:06:30 -0500930class MulticastOperationsProfile(EntityClass):
931 class_id = 309
932 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -0600933 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC},
934 range_check=lambda x: x != 0 and x != OmciNullPointer),
935 ECA(ByteField("igmp_version", None), {AA.R, AA.W, AA.SBC},
936 range_check=lambda x: x in [1, 2, 3, 16, 17]),
937 ECA(ByteField("igmp_function", None), {AA.R, AA.W, AA.SBC},
938 range_check=lambda x: 0 <= x <= 2),
939 ECA(ByteField("immediate_leave", None), {AA.R, AA.W, AA.SBC},
940 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -0500941 ECA(ShortField("us_igmp_tci", None), {AA.R, AA.W, AA.SBC}, optional=True),
Chip Bolinge2e64a02018-02-06 12:58:07 -0600942 ECA(ByteField("us_igmp_tag_ctrl", None), {AA.R, AA.W, AA.SBC},
943 range_check=lambda x: 0 <= x <= 3, optional=True),
Steve Crooks89b94b72017-02-01 10:06:30 -0500944 ECA(IntField("us_igmp_rate", None), {AA.R, AA.W, AA.SBC}, optional=True),
945 # TODO: need to make table and add column data
946 ECA(StrFixedLenField(
947 "dynamic_access_control_list_table", None, 24), {AA.R, AA.W}),
948 # TODO: need to make table and add column data
949 ECA(StrFixedLenField(
950 "static_access_control_list_table", None, 24), {AA.R, AA.W}),
951 # TODO: need to make table and add column data
Chip Bolinge2e64a02018-02-06 12:58:07 -0600952 ECA(StrFixedLenField("lost_groups_list_table", None, 10), {AA.R}),
953 ECA(ByteField("robustness", None), {AA.R, AA.W, AA.SBC}),
954 ECA(IntField("querier_ip", None), {AA.R, AA.W, AA.SBC}),
955 ECA(IntField("query_interval", None), {AA.R, AA.W, AA.SBC}),
956 ECA(IntField("querier_max_response_time", None), {AA.R, AA.W, AA.SBC}),
957 ECA(IntField("last_member_response_time", 10), {AA.R, AA.W}),
958 ECA(ByteField("unauthorized_join_behaviour", None), {AA.R, AA.W}),
Steve Crooks9e85ce82017-03-20 12:00:53 -0400959 ECA(StrFixedLenField("ds_igmp_mcast_tci", None, 3), {AA.R, AA.W, AA.SBC}, optional=True)
Steve Crooks89b94b72017-02-01 10:06:30 -0500960 ]
961 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -0600962 optional_operations = {OP.SetTable}
963 notifications = {OP.AlarmNotification}
964
Steve Crooks89b94b72017-02-01 10:06:30 -0500965
Steve Crooks9e85ce82017-03-20 12:00:53 -0400966class MulticastServicePackage(Packet):
967 name = "MulticastServicePackage"
968 fields_desc = [
969 BitField("set_ctrl", 0, 2),
970 BitField("reserved0", 0, 4),
971 BitField("row_key", 0, 10),
972
973 ShortField("vid_uni", None),
974 ShortField("max_simultaneous_groups", None),
975 IntField("max_multicast_bw", None),
976 ShortField("mcast_operations_profile_pointer", None),
977 StrFixedLenField("reserved1", None, 8)
978 ]
979
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500980 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500981 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500982
Chip Bolinge2e64a02018-02-06 12:58:07 -0600983
Steve Crooks9e85ce82017-03-20 12:00:53 -0400984class AllowedPreviewGroupsRow0(Packet):
985 name = "AllowedPreviewGroupsRow0"
986 fields_desc = [
987 BitField("set_ctrl", 0, 2),
988 BitField("row_part_id", 0, 3),
989 BitField("reserved0", 0, 1),
990 BitField("row_key", 0, 10),
991
992 StrFixedLenField("ipv6_pad", 0, 12),
993 IPField("src_ip", None),
994 ShortField("vlan_id_ani", None),
995 ShortField("vlan_id_uni", None)
996 ]
997
Chip Bolingc7d3e2d2018-04-06 10:16:29 -0500998 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -0500999 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001000
Chip Bolinge2e64a02018-02-06 12:58:07 -06001001
Steve Crooks9e85ce82017-03-20 12:00:53 -04001002class AllowedPreviewGroupsRow1(Packet):
1003 name = "AllowedPreviewGroupsRow1"
1004 fields_desc = [
1005 BitField("set_ctrl", 0, 2),
1006 BitField("row_part_id", 0, 3),
1007 BitField("reserved0", 0, 1),
1008 BitField("row_key", 0, 10),
1009
1010 StrFixedLenField("ipv6_pad", 0, 12),
1011 IPField("dst_ip", None),
1012 ShortField("duration", None),
1013 ShortField("time_left", None)
1014 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001015
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001016 def to_json(self):
Chip Bolingbed4c6b2018-05-09 08:52:16 -05001017 return json.dumps(self.fields, separators=(',', ':'))
Chip Bolingc7d3e2d2018-04-06 10:16:29 -05001018
Chip Bolinge2e64a02018-02-06 12:58:07 -06001019
Steve Crooks89b94b72017-02-01 10:06:30 -05001020class MulticastSubscriberConfigInfo(EntityClass):
1021 class_id = 310
1022 attributes = [
1023 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001024 ECA(ByteField("me_type", None), {AA.R, AA.W, AA.SBC},
1025 range_check=lambda x: 0 <= x <= 1),
1026 ECA(ShortField("mcast_operations_profile_pointer", None),
1027 {AA.R, AA.W, AA.SBC}),
1028 ECA(ShortField("max_simultaneous_groups", None), {AA.R, AA.W, AA.SBC}),
1029 ECA(IntField("max_multicast_bandwidth", None), {AA.R, AA.W, AA.SBC}),
1030 ECA(ByteField("bandwidth_enforcement", None), {AA.R, AA.W, AA.SBC},
1031 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001032 # TODO: need to make table and add column data
1033 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001034 "multicast_service_package_table", None, 20), {AA.R, AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001035 # TODO: need to make table and add column data
1036 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001037 "allowed_preview_groups_table", None, 22), {AA.R, AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001038 ]
Chip Bolinge2e64a02018-02-06 12:58:07 -06001039 mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext,
1040 OP.SetTable}
Steve Crooks89b94b72017-02-01 10:06:30 -05001041
1042
1043class VirtualEthernetInterfacePt(EntityClass):
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001044 class_id = 329
1045 attributes = [
Chip Bolinge2e64a02018-02-06 12:58:07 -06001046 ECA(ShortField("managed_entity_id", None), {AA.R},
1047 range_check=lambda x: x != 0 and x != OmciNullPointer),
1048 ECA(ByteField("administrative_state", None), {AA.R, AA.W},
1049 range_check=lambda x: 0 <= x <= 1),
1050 ECA(ByteField("operational_state", None), {AA.R}, avc=True,
1051 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001052 ECA(StrFixedLenField(
1053 "interdomain_name", None, 25), {AA.R, AA.W}, optional=True),
1054 ECA(ShortField("tcp_udp_pointer", None), {AA.R, AA.W}, optional=True),
1055 ECA(ShortField("iana_assigned_port", None), {AA.R}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001056 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001057 mandatory_operations = {OP.Get, OP.Set}
Chip Bolinge2e64a02018-02-06 12:58:07 -06001058 notifications = {OP.AttributeValueChange, OP.AlarmNotification}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001059
1060
Chip Boling28155862018-06-07 11:13:39 -05001061class Omci(EntityClass):
1062 class_id = 287
1063 attributes = [
1064 ECA(ShortField("managed_entity_id", None), {AA.R},
1065 range_check=lambda x: x == 0),
1066
1067 # TODO: Can this be expressed better in SCAPY, probably not?
1068 # On the initial, Get request for either the me_type or message_type
1069 # attributes, you will receive a 4 octet value (big endian) that is
1070 # the number of octets to 'get-next' to fully load the desired
1071 # attribute. For a basic OMCI formatted message, that will be 29
1072 # octets per get-request.
1073 #
1074 # For the me_type_table, these are 16-bit values (ME Class IDs)
1075 #
1076 # For the message_type_table, these are 8-bit values (Actions)
1077
1078 ECA(FieldListField("me_type_table", None, ByteField('', 0),
1079 count_from=lambda _: 29), {AA.R}),
1080 ECA(FieldListField("message_type_table", None, ByteField('', 0),
1081 count_from=lambda _: 29), {AA.R}),
1082 ]
1083 mandatory_operations = {OP.Get, OP.GetNext}
1084
1085
Chip Bolingf0b3a062018-01-18 13:53:58 -06001086class EnhSecurityControl(EntityClass):
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001087 class_id = 332
1088 attributes = [
Steve Crooks89b94b72017-02-01 10:06:30 -05001089 ECA(ShortField("managed_entity_id", None), {AA.R}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001090 ECA(BitField("olt_crypto_capabilities", None, 16*8), {AA.W}),
Steve Crooks89b94b72017-02-01 10:06:30 -05001091 # TODO: need to make table and add column data
1092 ECA(StrFixedLenField(
1093 "olt_random_challenge_table", None, 17), {AA.R, AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001094 ECA(ByteField("olt_challenge_status", 0), {AA.R, AA.W},
1095 range_check=lambda x: 0 <= x <= 1),
Steve Crooks89b94b72017-02-01 10:06:30 -05001096 ECA(ByteField("onu_selected_crypto_capabilities", None), {AA.R}),
1097 # TODO: need to make table and add column data
1098 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001099 "onu_random_challenge_table", None, 16), {AA.R}, avc=True),
Steve Crooks89b94b72017-02-01 10:06:30 -05001100 # TODO: need to make table and add column data
1101 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001102 "onu_authentication_result_table", None, 16), {AA.R}, avc=True),
Steve Crooks89b94b72017-02-01 10:06:30 -05001103 # TODO: need to make table and add column data
1104 ECA(StrFixedLenField(
1105 "olt_authentication_result_table", None, 17), {AA.W}),
Chip Bolinge2e64a02018-02-06 12:58:07 -06001106 ECA(ByteField("olt_result_status", None), {AA.R, AA.W},
1107 range_check=lambda x: 0 <= x <= 1),
1108 ECA(ByteField("onu_authentication_status", None), {AA.R}, avc=True,
1109 range_check=lambda x: 0 <= x <= 5),
Steve Crooks89b94b72017-02-01 10:06:30 -05001110 ECA(StrFixedLenField(
1111 "master_session_key_name", None, 16), {AA.R}),
1112 ECA(StrFixedLenField(
Chip Bolinge2e64a02018-02-06 12:58:07 -06001113 "broadcast_key_table", None, 18), {AA.R, AA.W}),
1114 ECA(ShortField("effective_key_length", None), {AA.R}),
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001115
1116 ]
Steve Crooks89b94b72017-02-01 10:06:30 -05001117 mandatory_operations = {OP.Set, OP.Get, OP.GetNext}
Chip Bolinge2e64a02018-02-06 12:58:07 -06001118 notifications = {OP.AttributeValueChange}
Zsolt Haraszti578a46c2016-12-20 16:38:43 -08001119
Chip Bolingac7b5622018-07-12 18:53:55 -05001120
1121class EthernetPMMonitoringHistoryData(EntityClass):
1122 class_id = 24
1123 attributes = [
1124 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1125 ECA(ByteField("interval_end_time", None), {AA.R}),
1126 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1127 ECA(IntField("fcs_errors", None), {AA.R}, tca=True, counter=True),
1128 ECA(IntField("excessive_collision_counter", None), {AA.R}, tca=True, counter=True),
1129 ECA(IntField("late_collision_counter", None), {AA.R}, tca=True, counter=True),
1130 ECA(IntField("frames_too_long", None), {AA.R}, tca=True, counter=True),
1131 ECA(IntField("buffer_overflows_on_rx", None), {AA.R}, tca=True, counter=True),
1132 ECA(IntField("buffer_overflows_on_tx", None), {AA.R}, tca=True, counter=True),
1133 ECA(IntField("single_collision_frame_counter", None), {AA.R}, tca=True, counter=True),
1134 ECA(IntField("multiple_collisions_frame_counter", None), {AA.R}, tca=True, counter=True),
1135 ECA(IntField("sqe_counter", None), {AA.R}, tca=True, counter=True),
1136 ECA(IntField("deferred_tx_counter", None), {AA.R}, tca=True, counter=True),
1137 ECA(IntField("internal_mac_tx_error_counter", None), {AA.R}, tca=True, counter=True),
1138 ECA(IntField("carrier_sense_error_counter", None), {AA.R}, tca=True, counter=True),
1139 ECA(IntField("alignment_error_counter", None), {AA.R}, tca=True, counter=True),
1140 ECA(IntField("internal_mac_rx_error_counter", None), {AA.R}, tca=True, counter=True)
1141 ]
1142 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1143 notifications = {OP.AlarmNotification}
1144
1145
1146class FecPerformanceMonitoringHistoryData(EntityClass):
1147 class_id = 312
1148 attributes = [
1149 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1150 ECA(ByteField("interval_end_time", None), {AA.R}),
1151 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1152 ECA(IntField("corrected_bytes", None), {AA.R}, tca=True, counter=True),
1153 ECA(IntField("corrected_code_words", None), {AA.R}, tca=True, counter=True),
1154 ECA(IntField("uncorrectable_code_words", None), {AA.R}, tca=True, counter=True),
1155 ECA(IntField("total_code_words", None), {AA.R}, counter=True),
1156 ECA(ShortField("fec_seconds", None), {AA.R}, tca=True, counter=True)
1157 ]
1158 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1159 notifications = {OP.AlarmNotification}
1160
1161
1162class EthernetFrameDownstreamPerformanceMonitoringHistoryData(EntityClass):
1163 class_id = 321
1164 attributes = [
1165 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1166 ECA(ByteField("interval_end_time", None), {AA.R}),
1167 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1168 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1169 ECA(IntField("octets", None), {AA.R}, counter=True),
1170 ECA(IntField("packets", None), {AA.R}, counter=True),
1171 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1172 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1173 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1174 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1175 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1176 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1177 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1178 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1179 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1180 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1181 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1182 ]
1183 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1184 notifications = {OP.AlarmNotification}
1185
1186
1187class EthernetFrameUpstreamPerformanceMonitoringHistoryData(EntityClass):
1188 class_id = 322
1189 attributes = [
1190 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1191 ECA(ByteField("interval_end_time", None), {AA.R}),
1192 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1193 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1194 ECA(IntField("octets", None), {AA.R}, counter=True),
1195 ECA(IntField("packets", None), {AA.R}, counter=True),
1196 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1197 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1198 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1199 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1200 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1201 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1202 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1203 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1204 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1205 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1206 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1207 ]
1208 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1209 notifications = {OP.AlarmNotification}
1210
1211
1212class EthernetFrameExtendedPerformanceMonitoring(EntityClass):
1213 class_id = 334
1214
1215 attributes = [
1216 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1217 ECA(ByteField("interval_end_time", None), {AA.R}),
1218 # 2-octet field -> Threshold data 1/2 ID
1219 # 2-octet field -> Parent ME Class
1220 # 2-octet field -> Parent ME Instance
1221 # 2-octet field -> Accumulation disable
1222 # 2-octet field -> TCA Disable
1223 # 2-octet field -> Control fields bitmap
1224 # 2-octet field -> TCI
1225 # 2-octet field -> Reserved
1226 ECA(FieldListField("control_block", None, ShortField('', 0),
1227 count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}),
1228 ECA(IntField("drop_events", None), {AA.R}, tca=True, counter=True),
1229 ECA(IntField("octets", None), {AA.R}, counter=True),
1230 ECA(IntField("packets", None), {AA.R}, counter=True),
1231 ECA(IntField("broadcast_packets", None), {AA.R}, counter=True),
1232 ECA(IntField("multicast_packets", None), {AA.R}, counter=True),
1233 ECA(IntField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1234 ECA(IntField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1235 ECA(IntField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1236 ECA(IntField("64_octets", None), {AA.R}, counter=True),
1237 ECA(IntField("65_to_127_octets", None), {AA.R}, counter=True),
1238 ECA(IntField("128_to_255_octets", None), {AA.R}, counter=True),
1239 ECA(IntField("256_to_511_octets", None), {AA.R}, counter=True),
1240 ECA(IntField("512_to_1023_octets", None), {AA.R}, counter=True),
1241 ECA(IntField("1024_to_1518_octets", None), {AA.R}, counter=True)
1242 ]
1243 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1244 optional_operations = {OP.GetCurrentData}
1245 notifications = {OP.AlarmNotification}
1246
1247
1248class EthernetFrameExtendedPerformanceMonitoring64Bit(EntityClass):
1249 class_id = 426
1250
1251 attributes = [
1252 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1253 ECA(ByteField("interval_end_time", None), {AA.R}),
1254 # 2-octet field -> Threshold data 1/2 ID
1255 # 2-octet field -> Parent ME Class
1256 # 2-octet field -> Parent ME Instance
1257 # 2-octet field -> Accumulation disable
1258 # 2-octet field -> TCA Disable
1259 # 2-octet field -> Control fields bitmap
1260 # 2-octet field -> TCI
1261 # 2-octet field -> Reserved
1262 ECA(FieldListField("control_block", None, ShortField('', 0),
1263 count_from=lambda _: 8), {AA.R, AA.W, AA.SBC}),
1264 ECA(LongField("drop_events", None), {AA.R}, tca=True, counter=True),
1265 ECA(LongField("octets", None), {AA.R}, counter=True),
1266 ECA(LongField("packets", None), {AA.R}, counter=True),
1267 ECA(LongField("broadcast_packets", None), {AA.R}, counter=True),
1268 ECA(LongField("multicast_packets", None), {AA.R}, counter=True),
1269 ECA(LongField("crc_errored_packets", None), {AA.R}, tca=True, counter=True),
1270 ECA(LongField("undersize_packets", None), {AA.R}, tca=True, counter=True),
1271 ECA(LongField("oversize_packets", None), {AA.R}, tca=True, counter=True),
1272 ECA(LongField("64_octets", None), {AA.R}, counter=True),
1273 ECA(LongField("65_to_127_octets", None), {AA.R}, counter=True),
1274 ECA(LongField("128_to_255_octets", None), {AA.R}, counter=True),
1275 ECA(LongField("256_to_511_octets", None), {AA.R}, counter=True),
1276 ECA(LongField("512_to_1023_octets", None), {AA.R}, counter=True),
1277 ECA(LongField("1024_to_1518_octets", None), {AA.R}, counter=True)
1278 ]
1279 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1280 optional_operations = {OP.GetCurrentData}
1281 notifications = {OP.AlarmNotification}
1282
1283
1284class GemPortNetworkCtpMonitoringHistoryData(EntityClass):
1285 class_id = 341
1286 attributes = [
1287 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1288 ECA(ByteField("interval_end_time", None), {AA.R}),
1289 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1290 ECA(IntField("transmitted_gem_frames", None), {AA.R}, counter=True),
1291 ECA(IntField("received_gem_frames", None), {AA.R}, counter=True),
1292 ECA(LongField("received_payload_bytes", None), {AA.R}, counter=True),
1293 ECA(LongField("transmitted_payload_bytes", None), {AA.R}, counter=True),
1294 ECA(IntField("encryption_key_errors", None), {AA.R}, tca=True, counter=True)
1295 ]
1296 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set, OP.GetCurrentData}
1297 notifications = {OP.AlarmNotification}
1298
1299
1300class XgPonTcPerformanceMonitoringHistoryData(EntityClass):
1301 class_id = 344
1302 attributes = [
1303 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1304 ECA(ByteField("interval_end_time", None), {AA.R}),
1305 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1306 ECA(IntField("psbd_hec_error_count", None), {AA.R}, tca=True, counter=True),
1307 ECA(IntField("xgtc_hec_error_count", None), {AA.R}, tca=True, counter=True),
1308 ECA(IntField("unknown_profile_count", None), {AA.R}, tca=True, counter=True),
1309 ECA(IntField("transmitted_xgem_frames", None), {AA.R}, counter=True),
1310 ECA(IntField("fragment_xgem_frames", None), {AA.R}, counter=True),
1311 ECA(IntField("xgem_hec_lost_words_count", None), {AA.R}, tca=True, counter=True),
1312 ECA(IntField("xgem_key_errors", None), {AA.R}, tca=True, counter=True),
1313 ECA(IntField("xgem_hec_error_count", None), {AA.R}, tca=True, counter=True)
1314 ]
1315 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1316 optional_operations = {OP.GetCurrentData}
1317 notifications = {OP.AlarmNotification}
1318
1319
1320class XgPonDownstreamPerformanceMonitoringHistoryData(EntityClass):
1321 class_id = 345
1322 attributes = [
1323 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1324 ECA(ByteField("interval_end_time", None), {AA.R},),
1325 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1326 ECA(IntField("ploam_mic_error_count", None), {AA.R}, tca=True, counter=True),
1327 ECA(IntField("downstream_ploam_messages_count", None), {AA.R}, counter=True),
1328 ECA(IntField("profile_messages_received", None), {AA.R}, counter=True),
1329 ECA(IntField("ranging_time_messages_received", None), {AA.R}, counter=True),
1330 ECA(IntField("deactivate_onu_id_messages_received", None), {AA.R}, counter=True),
1331 ECA(IntField("disable_serial_number_messages_received", None), {AA.R}, counter=True),
Chip Boling688e0ed2018-08-24 14:20:44 -05001332 ECA(IntField("request_registration_messages_received", None), {AA.R}, counter=True),
Chip Bolingac7b5622018-07-12 18:53:55 -05001333 ECA(IntField("assign_alloc_id_messages_received", None), {AA.R}, counter=True),
1334 ECA(IntField("key_control_messages_received", None), {AA.R}, counter=True),
1335 ECA(IntField("sleep_allow_messages_received", None), {AA.R}, counter=True),
1336 ECA(IntField("baseline_omci_messages_received_count", None), {AA.R}, counter=True),
1337 ECA(IntField("extended_omci_messages_received_count", None), {AA.R}, counter=True),
1338 ECA(IntField("assign_onu_id_messages_received", None), {AA.R}, counter=True),
1339 ECA(IntField("omci_mic_error_count", None), {AA.R}, tca=True, counter=True),
1340 ]
1341 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1342 optional_operations = {OP.GetCurrentData}
1343 notifications = {OP.AlarmNotification}
1344
1345
1346class XgPonUpstreamPerformanceMonitoringHistoryData(EntityClass):
1347 class_id = 346
1348 attributes = [
1349 ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
1350 ECA(ByteField("interval_end_time", None), {AA.R}),
1351 ECA(ShortField("threshold_data_1_2_id", None), {AA.R, AA.W, AA.SBC}),
1352 ECA(IntField("upstream_ploam_message_count", None), {AA.R}, counter=True),
1353 ECA(IntField("serial_number_onu_message_count", None), {AA.R}, counter=True),
1354 ECA(IntField("registration_message_count", None), {AA.R}, counter=True),
1355 ECA(IntField("key_report_message_count", None), {AA.R}, counter=True),
1356 ECA(IntField("acknowledge_message_count", None), {AA.R}, counter=True),
1357 ECA(IntField("sleep_request_message_count", None), {AA.R}, counter=True),
1358 ]
1359 mandatory_operations = {OP.Create, OP.Delete, OP.Get, OP.Set}
1360 optional_operations = {OP.GetCurrentData}
1361
1362
Zsolt Harasztie0acd8f2016-12-16 14:53:55 -08001363# entity class lookup table from entity_class values
1364entity_classes_name_map = dict(
1365 inspect.getmembers(sys.modules[__name__],
1366 lambda o: inspect.isclass(o) and \
1367 issubclass(o, EntityClass) and \
1368 o is not EntityClass)
1369)
1370
1371entity_classes = [c for c in entity_classes_name_map.itervalues()]
1372entity_id_to_class_map = dict((c.class_id, c) for c in entity_classes)