Adding timeout to pull_step request to avoid blocking the thread if VOLTHA is not answering
Change-Id: Ia4b34807d3a059c1c35e564c692a2481000a235c
diff --git a/VERSION b/VERSION
index cd57a8b..08ec77d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.5
+2.1.6-dev
diff --git a/xos/synchronizer/pull_steps/pull_olts.py b/xos/synchronizer/pull_steps/pull_olts.py
index 6c57cde..d832200 100644
--- a/xos/synchronizer/pull_steps/pull_olts.py
+++ b/xos/synchronizer/pull_steps/pull_olts.py
@@ -38,7 +38,7 @@
voltha_url = Helpers.get_voltha_info(o.volt_service)['url']
voltha_port = Helpers.get_voltha_info(o.volt_service)['port']
- r = requests.get("%s:%s/api/v1/logical_devices" % (voltha_url, voltha_port))
+ r = requests.get("%s:%s/api/v1/logical_devices" % (voltha_url, voltha_port), timeout=1)
if r.status_code != 200:
raise Exception("Failed to retrieve logical devices from VOLTHA: %s" % r.text)
@@ -66,7 +66,7 @@
voltha_port = Helpers.get_voltha_info(self.volt_service)['port']
try:
- r = requests.get("%s:%s/api/v1/devices" % (voltha_url, voltha_port))
+ r = requests.get("%s:%s/api/v1/devices" % (voltha_url, voltha_port), timeout=1)
if r.status_code != 200:
log.debug("[OLT pull step] It was not possible to fetch devices from VOLTHA")
@@ -150,7 +150,7 @@
voltha_port = Helpers.get_voltha_info(self.volt_service)['port']
try:
- r = requests.get("%s:%s/api/v1/devices/%s/ports" % (voltha_url, voltha_port, olt.device_id))
+ r = requests.get("%s:%s/api/v1/devices/%s/ports" % (voltha_url, voltha_port, olt.device_id), timeout=1)
if r.status_code != 200:
log.warn("[OLT pull step] It was not possible to fetch ports from VOLTHA for device %s" % olt.device_id)
diff --git a/xos/synchronizer/pull_steps/pull_onus.py b/xos/synchronizer/pull_steps/pull_onus.py
index 4c7c344..7c558a4 100644
--- a/xos/synchronizer/pull_steps/pull_onus.py
+++ b/xos/synchronizer/pull_steps/pull_onus.py
@@ -46,7 +46,7 @@
voltha_port = Helpers.get_voltha_info(self.volt_service)['port']
try:
- r = requests.get("%s:%s/api/v1/devices" % (voltha_url, voltha_port))
+ r = requests.get("%s:%s/api/v1/devices" % (voltha_url, voltha_port), timeout=1)
if r.status_code != 200:
log.warn("It was not possible to fetch devices from VOLTHA")
@@ -119,7 +119,7 @@
voltha_port = Helpers.get_voltha_info(self.volt_service)['port']
try:
- r = requests.get("%s:%s/api/v1/devices/%s/ports" % (voltha_url, voltha_port, onu.device_id))
+ r = requests.get("%s:%s/api/v1/devices/%s/ports" % (voltha_url, voltha_port, onu.device_id), timeout=1)
if r.status_code != 200:
log.warn("It was not possible to fetch ports from VOLTHA for ONUDevice %s" % onu.device_id)
@@ -153,7 +153,7 @@
voltha_port = Helpers.get_voltha_info(self.volt_service)['port']
try:
- r = requests.get("%s:%s/api/v1/logical_devices/%s/ports" % (voltha_url, voltha_port, logical_device_id))
+ r = requests.get("%s:%s/api/v1/logical_devices/%s/ports" % (voltha_url, voltha_port, logical_device_id), timeout=1)
if r.status_code != 200:
log.warn("It was not possible to fetch ports from VOLTHA for logical_device %s" % logical_device_id)