[SEBA-297] Standardized onu.events format
Change-Id: Ic487d18bcfe01460e0325d4fb7d87e45280fd2fa
diff --git a/VERSION b/VERSION
index fb9818b..9a6e25f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-1.2.1-dev
+1.2.1-dev2
diff --git a/docs/README.md b/docs/README.md
index 030951b..9519d64 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -106,9 +106,9 @@
{
"timestamp": "2018-09-11T01:00:49.506Z",
"status": "activated", // or disabled
- "serial_number": "ALPHe3d1cfde", // ONU serial number
- "uni_port_id": 16, // uni port
- "of_dpid": "of:000000000a5a0072" // OLT OpenFlow Id
+ "serialNumber": "ALPHe3d1cfde", // ONU serial number
+ "portNumber": "16", // uni port
+ "deviceId": "of:000000000a5a0072" // OLT OpenFlow Id
}
```
diff --git a/xos/synchronizer/event_steps/onu_event.py b/xos/synchronizer/event_steps/onu_event.py
index 0db61df..bc55f16 100644
--- a/xos/synchronizer/event_steps/onu_event.py
+++ b/xos/synchronizer/event_steps/onu_event.py
@@ -30,18 +30,18 @@
def get_att_si(self, event):
try:
att_si = self.model_accessor.AttWorkflowDriverServiceInstance.objects.get(
- serial_number=event["serial_number"])
+ serial_number=event["serialNumber"])
att_si.no_sync = False
- att_si.uni_port_id = event["uni_port_id"]
- att_si.of_dpid = event["of_dpid"]
+ att_si.uni_port_id = long(event["portNumber"])
+ att_si.of_dpid = event["deviceId"]
self.log.debug("onu.events: Found existing AttWorkflowDriverServiceInstance", si=att_si)
except IndexError:
# create an AttWorkflowDriverServiceInstance, the validation will be
# triggered in the corresponding sync step
att_si = self.model_accessor.AttWorkflowDriverServiceInstance(
- serial_number=event["serial_number"],
- of_dpid=event["of_dpid"],
- uni_port_id=event["uni_port_id"],
+ serial_number=event["serialNumber"],
+ of_dpid=event["deviceId"],
+ uni_port_id=long(event["portNumber"]),
# we assume there is only one AttWorkflowDriverService
owner=self.model_accessor.AttWorkflowDriverService.objects.first()
)
diff --git a/xos/synchronizer/event_steps/test_onu_events.py b/xos/synchronizer/event_steps/test_onu_events.py
index 4543357..fe8f87e 100644
--- a/xos/synchronizer/event_steps/test_onu_events.py
+++ b/xos/synchronizer/event_steps/test_onu_events.py
@@ -60,9 +60,9 @@
self.event = Mock()
self.event_dict = {
'status': 'activated',
- 'serial_number': 'BRCM1234',
- 'of_dpid': 'of:109299321',
- 'uni_port_id': 16
+ 'serialNumber': 'BRCM1234',
+ 'deviceId': 'of:109299321',
+ 'portNumber': '16'
}
self.event.value = json.dumps(self.event_dict)
@@ -86,15 +86,15 @@
self.assertEqual(mock_save.call_count, 1)
- self.assertEqual(att_si.serial_number, self.event_dict['serial_number'])
- self.assertEqual(att_si.of_dpid, self.event_dict['of_dpid'])
- self.assertEqual(att_si.uni_port_id, self.event_dict['uni_port_id'])
+ self.assertEqual(att_si.serial_number, self.event_dict['serialNumber'])
+ self.assertEqual(att_si.of_dpid, self.event_dict['deviceId'])
+ self.assertEqual(att_si.uni_port_id, long(self.event_dict['portNumber']))
self.assertEqual(att_si.onu_state, "ENABLED")
def test_reuse_instance(self):
si = AttWorkflowDriverServiceInstance(
- serial_number=self.event_dict["serial_number"],
+ serial_number=self.event_dict["serialNumber"],
of_dpid="foo",
uni_port_id="foo"
)
@@ -110,17 +110,17 @@
self.assertEqual(mock_save.call_count, 1)
- self.assertEqual(att_si.serial_number, self.event_dict['serial_number'])
- self.assertEqual(att_si.of_dpid, self.event_dict['of_dpid'])
- self.assertEqual(att_si.uni_port_id, self.event_dict['uni_port_id'])
+ self.assertEqual(att_si.serial_number, self.event_dict['serialNumber'])
+ self.assertEqual(att_si.of_dpid, self.event_dict['deviceId'])
+ self.assertEqual(att_si.uni_port_id, long(self.event_dict['portNumber']))
self.assertEqual(att_si.onu_state, "ENABLED")
def test_disable_onu(self):
self.event_dict = {
'status': 'disabled',
- 'serial_number': 'BRCM1234',
- 'of_dpid': 'of:109299321',
- 'uni_port_id': 16
+ 'serialNumber': 'BRCM1234',
+ 'deviceId': 'of:109299321',
+ 'portNumber': '16'
}
self.event.value = json.dumps(self.event_dict)