SEBA-206 add switch context to PORT_LOS alarm;
add olt name to PORT_LOS alarm;
rename alarm
Change-Id: I3c5d65c27178dc4e14b4e6b70f955deedaa7d352
diff --git a/VERSION b/VERSION
index 0bd62f8..9a4a230 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.1.dev2
+2.2.1.dev3
diff --git a/xos/synchronizer/event_steps/onos_event.py b/xos/synchronizer/event_steps/onos_event.py
index 574413d..3adce23 100644
--- a/xos/synchronizer/event_steps/onos_event.py
+++ b/xos/synchronizer/event_steps/onos_event.py
@@ -41,7 +41,6 @@
subscribers.append(subscriber)
return subscribers
-
def send_alarm(self, olt, value):
timestamp = time.mktime(datetime.datetime.strptime(value["timestamp"], "%Y-%m-%dT%H:%M:%S.%fZ").timetuple())
state = "RAISED" if olt.link_status == "down" else "CLEARED"
@@ -55,14 +54,18 @@
"reported_ts": time.time(),
"raised_ts": timestamp,
"state": state,
- "alarm_type_name": "OLT.LOSS_OF_AGGSWITCH",
+ "alarm_type_name": "OLT.PORT_LOS",
"severity": "MAJOR",
"resource_id": olt.device_id,
"logical_device_id": olt.dp_id,
- "context": {"affected_subscribers": subscribers},
+ "context": {"affected_subscribers": subscribers,
+ "switch_datapath_id": olt.switch_datapath_id,
+ "switch_port": olt.switch_port,
+ "oltdevice.name": olt.name},
"type": "COMMUNICATION",
- "id": "xos.voltservice.%s.OLT_LOSS_OF_AGGWSWITCH" % olt.device_id,
- "description": "xos.voltservice.%s - OLT LOSS OF AGGSWITCH Alarm - OLT_LOSS_OF_AGGSWITCH - %s" % (olt.device_id, state)}
+ "id": "xos.voltservice.%s.OLT_PORT_LOS" % olt.device_id,
+ "description": "xos.voltservice.%s - OLT PORT LOS Alarm -"
+ " OLT_PORT_LOS - %s" % (olt.device_id, state)}
topic = "xos.alarms.olt-service"
key = olt.device_id
diff --git a/xos/synchronizer/event_steps/test_onos_event.py b/xos/synchronizer/event_steps/test_onos_event.py
index 8f8f0d8..2148493 100644
--- a/xos/synchronizer/event_steps/test_onos_event.py
+++ b/xos/synchronizer/event_steps/test_onos_event.py
@@ -80,7 +80,7 @@
self.oltdevice = OLTDevice(name="myolt",
device_id="of:0000000000000001",
- switch_dsatapath_id="of:0000000000000001",
+ switch_datapath_id="of:0000000000000001",
switch_port="1")
self.ponport = PONPort(olt_device = self.oltdevice)
@@ -179,14 +179,17 @@
u"reported_ts": ANY,
u"raised_ts": raised_ts,
u"state": u"RAISED",
- u"alarm_type_name": u"OLT.LOSS_OF_AGGSWITCH",
+ u"alarm_type_name": u"OLT.PORT_LOS",
u"severity": u"MAJOR",
u"resource_id": unicode(self.oltdevice.device_id),
u"logical_device_id": self.oltdevice.dp_id,
- u"context": {u'affected_subscribers': [u'somesubscriber']},
+ u"context": {u'affected_subscribers': [u'somesubscriber'],
+ u"switch_datapath_id": "of:0000000000000001",
+ u"switch_port": "1",
+ u"oltdevice.name": "myolt"},
u"type": u"COMMUNICATION",
- u"id": u"xos.voltservice.%s.OLT_LOSS_OF_AGGWSWITCH" % self.oltdevice.device_id,
- u"description": u"xos.voltservice.%s - OLT LOSS OF AGGSWITCH Alarm - OLT_LOSS_OF_AGGSWITCH - RAISED" % self.oltdevice.device_id}
+ u"id": u"xos.voltservice.%s.OLT_PORT_LOS" % self.oltdevice.device_id,
+ u"description": u"xos.voltservice.%s - OLT PORT LOS Alarm - OLT_PORT_LOS - RAISED" % self.oltdevice.device_id}
self.assertDictEqual(expected_alarm, event)
@@ -219,14 +222,17 @@
u"reported_ts": ANY,
u"raised_ts": raised_ts,
u"state": u"CLEARED",
- u"alarm_type_name": u"OLT.LOSS_OF_AGGSWITCH",
+ u"alarm_type_name": u"OLT.PORT_LOS",
u"severity": u"MAJOR",
u"resource_id": unicode(self.oltdevice.device_id),
u"logical_device_id": self.oltdevice.dp_id,
- u"context": {u'affected_subscribers': [u'somesubscriber']},
+ u"context": {u'affected_subscribers': [u'somesubscriber'],
+ u"switch_datapath_id": "of:0000000000000001",
+ u"switch_port": "1",
+ u"oltdevice.name": "myolt"},
u"type": u"COMMUNICATION",
- u"id": u"xos.voltservice.%s.OLT_LOSS_OF_AGGWSWITCH" % self.oltdevice.device_id,
- u"description": u"xos.voltservice.%s - OLT LOSS OF AGGSWITCH Alarm - OLT_LOSS_OF_AGGSWITCH - CLEARED" % self.oltdevice.device_id}
+ u"id": u"xos.voltservice.%s.OLT_PORT_LOS" % self.oltdevice.device_id,
+ u"description": u"xos.voltservice.%s - OLT PORT LOS Alarm - OLT_PORT_LOS - CLEARED" % self.oltdevice.device_id}
self.assertDictEqual(expected_alarm, event)