Adding serial_number information to OLTDevice
Change-Id: Ied682803092f0538cf5beaf59dcaeedd65be14c5
diff --git a/VERSION b/VERSION
index ac2cdeb..1ef72cb 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.3
+2.1.4-dev
diff --git a/xos/synchronizer/models/volt.xproto b/xos/synchronizer/models/volt.xproto
index 1db42e4..cd398d8 100644
--- a/xos/synchronizer/models/volt.xproto
+++ b/xos/synchronizer/models/volt.xproto
@@ -27,6 +27,7 @@
optional int32 port = 5 [help_text = "Device port", db_index = False];
optional string mac_address = 6 [help_text = "Device mac address", db_index = False];
+ optional string serial_number = 9 [help_text = "Serial Number", db_index = False, feedback_state = True];
optional string device_id = 10 [help_text = "Device ID", db_index = False, feedback_state = True];
optional string admin_state = 11 [help_text = "admin_state", db_index = False, feedback_state = True];
optional string oper_status = 12 [help_text = "oper_status", db_index = False, feedback_state = True];
diff --git a/xos/synchronizer/pull_steps/pull_olts.py b/xos/synchronizer/pull_steps/pull_olts.py
index 0f3c199..6c57cde 100644
--- a/xos/synchronizer/pull_steps/pull_olts.py
+++ b/xos/synchronizer/pull_steps/pull_olts.py
@@ -129,6 +129,7 @@
model.device_id = olt["id"]
model.admin_state = olt["admin_state"]
model.oper_status = olt["oper_status"]
+ model.serial_number = olt['serial_number']
model.volt_service = self.volt_service
model.volt_service_id = self.volt_service.id
diff --git a/xos/synchronizer/pull_steps/test_pull_olts.py b/xos/synchronizer/pull_steps/test_pull_olts.py
index fd09a1f..a06d3ff 100644
--- a/xos/synchronizer/pull_steps/test_pull_olts.py
+++ b/xos/synchronizer/pull_steps/test_pull_olts.py
@@ -89,7 +89,8 @@
"type": "simulated_olt",
"host_and_port": "172.17.0.1:50060",
"admin_state": "ENABLED",
- "oper_status": "ACTIVE"
+ "oper_status": "ACTIVE",
+ "serial_number": "serial_number",
}
]
}
diff --git a/xos/synchronizer/steps/sync_olt_device.py b/xos/synchronizer/steps/sync_olt_device.py
index 301f123..1140173 100644
--- a/xos/synchronizer/steps/sync_olt_device.py
+++ b/xos/synchronizer/steps/sync_olt_device.py
@@ -84,7 +84,9 @@
raise Exception(
'VOLTHA Device Id is empty. This probably means that the OLT device is already provisioned in VOLTHA')
else:
- model.device_id = res['id'];
+ model.device_id = res['id']
+ model.serial_number = res['serial_number']
+
return model
diff --git a/xos/synchronizer/steps/test_sync_olt_device.py b/xos/synchronizer/steps/test_sync_olt_device.py
index dd3f249..3b7e6cb 100644
--- a/xos/synchronizer/steps/test_sync_olt_device.py
+++ b/xos/synchronizer/steps/test_sync_olt_device.py
@@ -122,6 +122,8 @@
self.o = o
+ self.voltha_devices_response = {"id": "123", "serial_number": "foobar"}
+
def tearDown(self):
self.o = None
sys.path = self.sys_path_save
@@ -172,7 +174,7 @@
"""
Should print an error if device.enable fails
"""
- m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json={"id": "123"})
+ m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json=self.voltha_devices_response)
m.post("http://voltha_url:1234/api/v1/devices/123/enable", status_code=500, text="EnableError")
with self.assertRaises(Exception) as e:
@@ -191,7 +193,7 @@
"host_and_port": "%s:%s" % (self.o.host, self.o.port)
}
- m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json={"id": "123"}, additional_matcher=functools.partial(match_json, expected_conf))
+ m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json=self.voltha_devices_response, additional_matcher=functools.partial(match_json, expected_conf))
m.post("http://voltha_url:1234/api/v1/devices/123/enable", status_code=200)
m.get("http://voltha_url:1234/api/v1/devices/123", json={"oper_status": "ACTIVE", "admin_state": "ENABLED"})
logical_devices = {
@@ -247,7 +249,7 @@
m.post("http://onos:4321/onos/v1/network/configuration/", status_code=200, json=onos_expected_conf,
additional_matcher=functools.partial(match_json, onos_expected_conf))
- m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json={"id": "123"},
+ m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json=self.voltha_devices_response,
additional_matcher=functools.partial(match_json, expected_conf))
m.post("http://voltha_url:1234/api/v1/devices/123/enable", status_code=200)
m.get("http://voltha_url:1234/api/v1/devices/123", json={"oper_status": "ACTIVE", "admin_state": "ENABLED"})
@@ -276,7 +278,7 @@
"host_and_port": "%s:%s" % (self.o.host, self.o.port)
}
- m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json={"id": "123"},
+ m.post("http://voltha_url:1234/api/v1/devices", status_code=200, json=self.voltha_devices_response,
additional_matcher=functools.partial(match_json, expected_conf))
m.post("http://voltha_url:1234/api/v1/devices/123/enable", status_code=200)
m.get("http://voltha_url:1234/api/v1/devices/123", [