VOL-597: Added OMCI Autonomous Message definitions (Alarm, AVC, & Test Results)
Change-Id: I2fd8ee359061bca3563bccd2ed44973ed3683cc9
diff --git a/tests/utests/voltha/extensions/omci/test_omci.py b/tests/utests/voltha/extensions/omci/test_omci.py
index 9660b20..1fa4397 100644
--- a/tests/utests/voltha/extensions/omci/test_omci.py
+++ b/tests/utests/voltha/extensions/omci/test_omci.py
@@ -542,6 +542,36 @@
)
self.assertGeneratedFrameEquals(frame, ref)
+ def test_parse_enh_security_avc(self):
+ refs = [
+ "0000110a014c0000008000202020202020202020202020202020202020202020"
+ "2020202020202020000000280be43cf4"
+ ]
+ for i, data in enumerate(refs):
+ frame = OmciFrame(hex2raw(data))
+ omci = frame.omci_message
+ # frame.show()
+
+ def test_parse_alarm_message(self):
+ refs = [
+ "0000100a00050101000000000000000000000000000000000000000000000000"
+ "0000000220000000000000280be43cf4"
+ ]
+ for i, data in enumerate(refs):
+ frame = OmciFrame(hex2raw(data))
+ omci = frame.omci_message
+ # frame.show()
+
+ def test_parse_results(self):
+ refs = [
+ "00001B0a014c0000008000202020202020202020202020202020202020202020"
+ "2020202020202020000000280be43cf4"
+ ]
+ for i, data in enumerate(refs):
+ frame = OmciFrame(hex2raw(data))
+ omci = frame.omci_message
+ # frame.show()
+
def test_parsing_mib_upload_next_responses(self):
refs = [
"00032e0a00020000000200008000000000000000000000000000000000000000"
diff --git a/voltha/extensions/omci/omci_frame.py b/voltha/extensions/omci/omci_frame.py
index edff530..28dc298 100644
--- a/voltha/extensions/omci/omci_frame.py
+++ b/voltha/extensions/omci/omci_frame.py
@@ -23,7 +23,8 @@
OmciGetAllAlarms, OmciGetAllAlarmsResponse, OmciGetAllAlarmsNext, \
OmciMibResetResponse, OmciMibReset, OmciMibUploadNextResponse, \
OmciMibUploadNext, OmciMibUploadResponse, OmciMibUpload, \
- OmciGetAllAlarmsNextResponse
+ OmciGetAllAlarmsNextResponse, OmciAttributeValueChange, \
+ OmciTestResult, OmciAlarmNotification
from voltha.extensions.omci.omci_messages import OmciCreateResponse
@@ -95,8 +96,19 @@
PacketField("omci_message", None, OmciMibResetResponse), align=36),
lambda pkt: pkt.message_type == OmciMibResetResponse.message_id),
+ ConditionalField(FixedLenField(
+ PacketField("omci_message", None, OmciAlarmNotification), align=36),
+ lambda pkt: pkt.message_type == OmciAlarmNotification.message_id),
+ ConditionalField(FixedLenField(
+ PacketField("omci_message", None, OmciAttributeValueChange), align=36),
+ lambda pkt: pkt.message_type == OmciAttributeValueChange.message_id),
+ ConditionalField(FixedLenField(
+ PacketField("omci_message", None, OmciTestResult), align=36),
+ lambda pkt: pkt.message_type == OmciTestResult.message_id),
+
# TODO add entries for remaining OMCI message types
+
IntField("omci_trailer", 0x00000028)
]
diff --git a/voltha/extensions/omci/omci_messages.py b/voltha/extensions/omci/omci_messages.py
index 90a0cea..e728bff 100644
--- a/voltha/extensions/omci/omci_messages.py
+++ b/voltha/extensions/omci/omci_messages.py
@@ -16,7 +16,7 @@
import structlog
from enum import Enum
from scapy.fields import ByteField, StrFixedLenField, ConditionalField, Field
-from scapy.fields import ShortField
+from scapy.fields import ShortField, BitField
from scapy.packet import Packet
from voltha.extensions.omci.omci_defs import AttributeAccess
@@ -298,3 +298,36 @@
ShortField("entity_id", 0),
ByteField("success_code", 0)
]
+
+
+class OmciAlarmNotification(OmciMessage):
+ name = "AlarmNotification"
+ message_id = 0x10
+ fields_desc = [
+ ShortField("entity_class", None),
+ ShortField("entity_id", 0),
+ BitField("alarm_bit_map", 0, 224),
+ ByteField("alarm_sequence_number", None)
+ ]
+
+
+class OmciAttributeValueChange(OmciMessage):
+ name = "AttributeValueChange"
+ message_id = 0x11
+ fields_desc = [
+ ShortField("entity_class", None),
+ ShortField("entity_id", 0),
+ ShortField("attributes_mask", None),
+ OmciMaskedData("data")
+ ]
+
+
+class OmciTestResult(OmciMessage):
+ name = "TestResult"
+ message_id = 0x1B
+ fields_desc = [
+ ShortField("entity_class", None),
+ ShortField("entity_id", 0)
+ # ME Test specific message contents starts here
+ # TODO: Can this be coded easily with scapy?
+ ]