Clean up logs
Change-Id: Ia2931331a8f4610d8e65b7fed08ca82ffcd8721d
diff --git a/voltha/adapters/openolt/openolt_kafka_admin.py b/voltha/adapters/openolt/openolt_kafka_admin.py
index fe00bb6..a61415e 100644
--- a/voltha/adapters/openolt/openolt_kafka_admin.py
+++ b/voltha/adapters/openolt/openolt_kafka_admin.py
@@ -87,9 +87,9 @@
for topic, f in fs.items():
try:
f.result() # The result itself is None
- print("Topic {} deleted".format(topic))
+ log.info("Topic {} deleted".format(topic))
except Exception as e:
- print("Failed to delete topic {}: {}".format(topic, e))
+ log.error("Failed to delete topic {}: {}".format(topic, e))
def kafka_create_partitions(a, topics):
@@ -106,9 +106,9 @@
for topic, f in fs.items():
try:
f.result() # The result itself is None
- print("Additional partitions created for topic {}".format(topic))
+ log.info("Additional partitions created for topic {}".format(topic))
except Exception as e:
- print("Failed to add partitions to topic {}: {}".format(topic, e))
+ log.error("Failed to add partitions to topic {}: {}".format(topic, e))
def print_config(config, depth):
diff --git a/voltha/coordinator_etcd.py b/voltha/coordinator_etcd.py
index 9550744..8469050 100644
--- a/voltha/coordinator_etcd.py
+++ b/voltha/coordinator_etcd.py
@@ -21,6 +21,7 @@
from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
from txaioetcd import Client, KeySet, Transaction, CompVersion, OpGet, OpSet, Failed
from zope.interface import implementer
+from twisted.internet.error import DNSLookupError
from leader import Leader
from common.utils.asleep import asleep
@@ -207,7 +208,7 @@
wait_time = self.RETRY_BACKOFF[min(self.retries,
len(self.RETRY_BACKOFF) - 1)]
self.retries += 1
- log.error(msg, retry_in=wait_time)
+ log.warn(msg, retry_in=wait_time)
return asleep(wait_time)
def _clear_backoff(self):
@@ -435,7 +436,7 @@
yield self._assert_nonleadership(leader)
except Exception as e:
- log.exception('unexpected-error-leader-tracking', e=e)
+ log.warn('unexpected-error-leader-tracking', e=e)
finally:
# Except in shutdown, the loop must continue (after a short delay)
@@ -563,6 +564,10 @@
result = yield operation(*args, **kw)
self._clear_backoff()
break
+ except DNSLookupError, e:
+ log.warn('dns-lookup-failed', operation=operation, args=args,
+ reason=e)
+ yield self._backoff('dns-lookup-failed')
except Exception as e:
if not self.shutting_down:
log.exception(e)
diff --git a/voltha/core/flow_decomposer.py b/voltha/core/flow_decomposer.py
index 29c5e34..5944a5e 100644
--- a/voltha/core/flow_decomposer.py
+++ b/voltha/core/flow_decomposer.py
@@ -620,8 +620,8 @@
route = self.get_route(in_port_no, out_port_no)
if route is None:
- log.error('no-route', in_port_no=in_port_no,
- out_port_no=out_port_no, comment='deleting flow')
+ log.warn('no-route', in_port_no=in_port_no,
+ out_port_no=out_port_no, comment='deleting flow')
self.flow_delete(flow)
return device_rules
diff --git a/voltha/core/logical_device_agent.py b/voltha/core/logical_device_agent.py
index db2eba4..1d2a282 100644
--- a/voltha/core/logical_device_agent.py
+++ b/voltha/core/logical_device_agent.py
@@ -1025,7 +1025,9 @@
for (ingress, egress), route in self._routes.iteritems():
if egress == self._nni_logical_port_no:
return [route[1], route[1]]
- raise Exception('not a single upstream route')
+ # raise Exception('not a single upstream route')
+ self.log.warn('not a single upstream route')
+ return None
# for a trap flow from the UNI, treat it as if the output port
# is the NNI of the OLT
egress_port_no = self._nni_logical_port_no
@@ -1041,7 +1043,9 @@
for (ingress, egress), route in self._routes.iteritems():
if egress == self._nni_logical_port_no:
return [None, route[1]]
- raise Exception('not a single upstream route')
+ # raise Exception('not a single upstream route')
+ self.log.warn('not a single upstream route')
+ return None
# If egress_port is not specified (None), we can also can return a
# "half" route
diff --git a/voltha/extensions/omci/state_machines/performance_intervals.py b/voltha/extensions/omci/state_machines/performance_intervals.py
index 73e145b..5c4c94e 100644
--- a/voltha/extensions/omci/state_machines/performance_intervals.py
+++ b/voltha/extensions/omci/state_machines/performance_intervals.py
@@ -292,7 +292,8 @@
self._add_pm_me[key] = entry
if self._add_me_deferred is None:
- self._add_me_deferred = reactor.callLater(0, self.add_me)
+ if self.state == 'idle':
+ self._add_me_deferred = reactor.callLater(0, self.add_me)
if (pm_class_id, pm_entity_id) in self._del_pm_me:
self._del_pm_me.remove((pm_class_id, pm_entity_id))
diff --git a/voltha/main.py b/voltha/main.py
index c27f6a6..19b8dfc 100755
--- a/voltha/main.py
+++ b/voltha/main.py
@@ -541,7 +541,7 @@
self.log.debug('start-kafka-heartbeat')
kafka_proxy.send_message(topic, dumps(message))
else:
- self.log.error('kafka-proxy-unavailable')
+ self.log.warn('kafka-proxy-unavailable')
except Exception, e:
self.log.exception('failed-sending-message-heartbeat', e=e)