CORD-898: Re-formatting files to meet line length restriction.

Change-Id: Id961b577d62f0789d87028f69a1942fafd9c8c23
diff --git a/tests/itests/voltha/test_voltha_alarm_events.py b/tests/itests/voltha/test_voltha_alarm_events.py
index 7f932be..769b7f2 100644
--- a/tests/itests/voltha/test_voltha_alarm_events.py
+++ b/tests/itests/voltha/test_voltha_alarm_events.py
@@ -1,6 +1,7 @@
 from unittest import main
 from common.utils.consulhelpers import get_endpoint_from_consul
-from tests.itests.docutests.test_utils import run_long_running_command_with_timeout
+from tests.itests.docutests.test_utils import \
+    run_long_running_command_with_timeout
 from tests.itests.voltha.rest_base import RestBase
 from google.protobuf.json_format import MessageToDict
 from voltha.protos.device_pb2 import Device
@@ -37,7 +38,7 @@
 }
 
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 class VolthaAlarmEventTests(RestBase):
@@ -67,7 +68,8 @@
                 found = True
                 break
 
-        self.assertTrue(found, 'Failed to find topic {}'.format(expected_pattern))
+        self.assertTrue(found,
+                        'Failed to find topic {}'.format(expected_pattern))
 
     def test_alarm_generated_by_adapter(self):
         # Verify that REST calls can be made
@@ -99,10 +101,12 @@
         device = Device(
             type='simulated_olt',
         )
-        device = self.post('/api/v1/local/devices', MessageToDict(device), expected_code=200)
+        device = self.post('/api/v1/local/devices', MessageToDict(device),
+                           expected_code=200)
         return device
 
-    # Active the simulated device.  This will trigger the simulation of random alarms
+    # Active the simulated device.
+    # This will trigger the simulation of random alarms
     def activate_device(self, device_id):
         path = '/api/v1/local/devices/{}'.format(device_id)
         self.post(path + '/activate', expected_code=200)
@@ -129,7 +133,9 @@
                 found = True
                 break
 
-        self.assertTrue(found, 'Failed to find kafka alarm with device id:{}'.format(device_id))
+        self.assertTrue(
+            found,
+            'Failed to find kafka alarm with device id:{}'.format(device_id))
 
         return self.alarm_data
 
@@ -138,17 +144,28 @@
         try:
             jsonschema.validate(alarm, ALARM_SCHEMA)
         except Exception as e:
-            self.assertTrue(False, 'Validation failed for alarm : {}'.format(e.message))
+            self.assertTrue(
+                False, 'Validation failed for alarm : {}'.format(e.message))
 
     # Verify that alarm identifier based on the format generated by default.
     def verify_alarm_event_id(self, device_id, alarm_id):
         prefix = re.findall(r"(voltha)\.(\w+)\.(\w+)", alarm_id)
 
-        self.assertEqual(len(prefix), 1, 'Failed to parse the alarm id: {}'.format(alarm_id))
-        self.assertEqual(len(prefix[0]), 3, 'Expected id format: voltha.<adapter name>.<device id>')
-        self.assertEqual(prefix[0][0], 'voltha', 'Expected id format: voltha.<adapter name>.<device id>')
-        self.assertEqual(prefix[0][1], 'simulated_olt', 'Expected id format: voltha.<adapter name>.<device id>')
-        self.assertEqual(prefix[0][2], device_id, 'Expected id format: voltha.<adapter name>.<device id>')
+        self.assertEqual(
+            len(prefix), 1,
+            'Failed to parse the alarm id: {}'.format(alarm_id))
+        self.assertEqual(
+            len(prefix[0]), 3,
+            'Expected id format: voltha.<adapter name>.<device id>')
+        self.assertEqual(
+            prefix[0][0], 'voltha',
+            'Expected id format: voltha.<adapter name>.<device id>')
+        self.assertEqual(
+            prefix[0][1], 'simulated_olt',
+            'Expected id format: voltha.<adapter name>.<device id>')
+        self.assertEqual(
+            prefix[0][2], device_id,
+            'Expected id format: voltha.<adapter name>.<device id>')
 
 
 if __name__ == '__main__':
diff --git a/voltha/adapters/simulated_olt/simulated_olt.py b/voltha/adapters/simulated_olt/simulated_olt.py
index 01fc8e6..1116ac1 100644
--- a/voltha/adapters/simulated_olt/simulated_olt.py
+++ b/voltha/adapters/simulated_olt/simulated_olt.py
@@ -44,7 +44,8 @@
 from voltha.protos.openflow_13_pb2 import ofp_desc, ofp_port, OFPPF_1GB_FD, \
     OFPPF_FIBER, OFPPS_LIVE, ofp_switch_features, OFPC_PORT_STATS, \
     OFPC_GROUP_STATS, OFPC_TABLE_STATS, OFPC_FLOW_STATS
-from voltha.protos.events_pb2 import AlarmEvent, AlarmEventType, AlarmEventSeverity, AlarmEventState, AlarmEventCategory
+from voltha.protos.events_pb2 import AlarmEvent, AlarmEventType, \
+    AlarmEventSeverity, AlarmEventState, AlarmEventCategory
 
 log = structlog.get_logger()
 
@@ -590,7 +591,7 @@
                     tx_128_255=self.nni_tx_128_255 + random.randint(60, 65),
                     tx_256_511=self.nni_tx_256_511 + random.randint(85, 90),
                     tx_512_1023=self.nni_tx_512_1023 + random.randint(90, 95),
-                    tx_1024_1518=self.nni_tx_1024_1518 + random.randint(60, 65),
+                    tx_1024_1518=self.nni_tx_1024_1518 + random.randint(60,65),
                     tx_1519_9k=self.nni_tx_1519_9k + random.randint(50, 55),
 
                     rx_64=self.nni_tx_64 + random.randint(50, 55),
@@ -598,7 +599,7 @@
                     rx_128_255=self.nni_tx_128_255 + random.randint(60, 65),
                     rx_256_511=self.nni_tx_256_511 + random.randint(85, 90),
                     rx_512_1023=self.nni_tx_512_1023 + random.randint(90, 95),
-                    rx_1024_1518=self.nni_tx_1024_1518 + random.randint(60, 65),
+                    rx_1024_1518=self.nni_tx_1024_1518 + random.randint(60,65),
                     rx_1519_9k=self.nni_tx_1519_9k + random.randint(50, 55)
                 )
                 pon_port_metrics = yield dict(
@@ -611,7 +612,7 @@
                     tx_128_255=self.pon_tx_128_255 + random.randint(60, 65),
                     tx_256_511=self.pon_tx_256_511 + random.randint(85, 90),
                     tx_512_1023=self.pon_tx_512_1023 + random.randint(90, 95),
-                    tx_1024_1518=self.pon_tx_1024_1518 + random.randint(60, 65),
+                    tx_1024_1518=self.pon_tx_1024_1518 + random.randint(60,65),
                     tx_1519_9k=self.pon_tx_1519_9k + random.randint(50, 55),
 
                     rx_64=self.pon_tx_64 + random.randint(50, 55),
@@ -619,7 +620,7 @@
                     rx_128_255=self.pon_tx_128_255 + random.randint(60, 65),
                     rx_256_511=self.pon_tx_256_511 + random.randint(85, 90),
                     rx_512_1023=self.pon_tx_512_1023 + random.randint(90, 95),
-                    rx_1024_1518=self.pon_tx_1024_1518 + random.randint(60, 65),
+                    rx_1024_1518=self.pon_tx_1024_1518 + random.randint(60,65),
                     rx_1519_9k=self.pon_tx_1519_9k + random.randint(50, 55)
                 )
                 self.pon_tx_pkts = pon_port_metrics['tx_pkts']
@@ -679,9 +680,11 @@
                         # OLT-level
                         prefix: MetricValuePairs(metrics=olt_metrics),
                         # OLT NNI port
-                        prefix + '.nni': MetricValuePairs(metrics=nni_port_metrics),
+                        prefix + '.nni': MetricValuePairs(
+                            metrics=nni_port_metrics),
                         # OLT PON port
-                        prefix + '.pon': MetricValuePairs(metrics=pon_port_metrics)
+                        prefix + '.pon': MetricValuePairs(
+                            metrics=pon_port_metrics)
                     }
                 )
 
@@ -704,28 +707,45 @@
 
             try:
                 # Randomly choose values for each enum types
-                severity = random.choice(list(v for k, v in AlarmEventSeverity.DESCRIPTOR.enum_values_by_name.items()))
-                state = random.choice(list(v for k, v in AlarmEventState.DESCRIPTOR.enum_values_by_name.items()))
-                type = random.choice(list(v for k, v in AlarmEventType.DESCRIPTOR.enum_values_by_name.items()))
-                category = random.choice(list(v for k, v in AlarmEventCategory.DESCRIPTOR.enum_values_by_name.items()))
+                severity = random.choice(list(
+                    v for k, v in
+                    AlarmEventSeverity.DESCRIPTOR.enum_values_by_name.items()))
 
-                description = "Simulated alarm - device:{} type:{} severity:{} state:{} category:{}".format(device_id,
-                                                                                                            type.name,
-                                                                                                            severity.name,
-                                                                                                            state.name,
-                                                                                                            category.name)
+                state = random.choice(list(
+                    v for k, v in
+                    AlarmEventState.DESCRIPTOR.enum_values_by_name.items()))
+
+                type = random.choice(list(
+                    v for k, v in
+                    AlarmEventType.DESCRIPTOR.enum_values_by_name.items()))
+
+                category = random.choice(list(
+                    v for k, v in
+                    AlarmEventCategory.DESCRIPTOR.enum_values_by_name.items()))
+
+                description = "Simulated alarm - " \
+                              "device:{} " \
+                              "type:{} " \
+                              "severity:{} " \
+                              "state:{} " \
+                              "category:{}".format(device_id,
+                                                   type.name,
+                                                   severity.name,
+                                                   state.name,
+                                                   category.name)
 
                 current_context = {}
                 for key, value in self.__dict__.items():
                     current_context[key] = str(value)
 
-                alarm_event = self.adapter_agent.create_alarm(resource_id=device_id,
-                                                              type=type.number,
-                                                              category=category.number,
-                                                              severity=severity.number,
-                                                              state=state.number,
-                                                              description=description,
-                                                              context=current_context)
+                alarm_event = self.adapter_agent.create_alarm(
+                    resource_id=device_id,
+                    type=type.number,
+                    category=category.number,
+                    severity=severity.number,
+                    state=state.number,
+                    description=description,
+                    context=current_context)
 
                 self.adapter_agent.submit_alarm(alarm_event)
 
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index 485869e..edcf236 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -32,7 +32,8 @@
 from voltha.adapters.interface import IAdapterAgent
 from voltha.protos import third_party
 from voltha.protos.device_pb2 import Device, Port
-from voltha.protos.events_pb2 import KpiEvent, AlarmEvent, AlarmEventType, AlarmEventSeverity, AlarmEventState, AlarmEventCategory
+from voltha.protos.events_pb2 import KpiEvent, AlarmEvent, AlarmEventType, \
+    AlarmEventSeverity, AlarmEventState, AlarmEventCategory
 from voltha.protos.voltha_pb2 import DeviceGroup, LogicalDevice, \
     LogicalPort, AdminState
 from voltha.registry import registry
@@ -281,7 +282,8 @@
     def register_for_proxied_messages(self, proxy_address):
         topic = self._gen_rx_proxy_address_topic(proxy_address)
         self._rx_event_subscriptions[topic] = self.event_bus.subscribe(
-            topic, lambda t, m: self._receive_proxied_message(proxy_address, m))
+            topic,
+            lambda t, m: self._receive_proxied_message(proxy_address, m))
 
     def _receive_proxied_message(self, proxy_address, msg):
         self.adapter.receive_proxied_message(proxy_address, msg)
@@ -321,9 +323,12 @@
 
     # ~~~~~~~~~~~~~~~~~~~ Handle alarm submissions ~~~~~~~~~~~~~~~~~~~~~
 
-    def create_alarm(self, id=None, resource_id=None, description=None, raised_ts=0, changed_ts=0,
-                     type=AlarmEventType.EQUIPMENT, category=AlarmEventCategory.GENERAL,
-                     severity=AlarmEventSeverity.MINOR, state=AlarmEventState.RAISED,
+    def create_alarm(self, id=None, resource_id=None, description=None,
+                     raised_ts=0, changed_ts=0,
+                     type=AlarmEventType.EQUIPMENT,
+                     category=AlarmEventCategory.GENERAL,
+                     severity=AlarmEventSeverity.MINOR,
+                     state=AlarmEventState.RAISED,
                      context=None):
 
         # Construct the ID if it is not provided
diff --git a/voltha/protos/events.proto b/voltha/protos/events.proto
index d9fef30..6203c3f 100644
--- a/voltha/protos/events.proto
+++ b/voltha/protos/events.proto
@@ -28,7 +28,6 @@
     }
 }
 
-
 /*
  * Struct to convey a dictionary of metric->value pairs. Typically used in
  * pure shared-timestamp or shared-timestamp + shared object prefix situations.
@@ -47,7 +46,7 @@
 
     // Fields used when for slice:
 
-    float ts = 2;  // UTC time-stamp of data in slice mode (seconds since epoc)
+    float ts = 2; // UTC time-stamp of data in slice mode (seconds since epoc)
 
     map<string, MetricValuePairs> prefixes = 3;
 
@@ -106,29 +105,40 @@
  *
  */
 message AlarmEvent {
-    string id = 1;                                      // Unique ID for this alarm.  e.g. voltha.some_olt.1234
+    // Unique ID for this alarm.  e.g. voltha.some_olt.1234
+    string id = 1;
 
-    AlarmEventType.AlarmEventType type = 2;             // Refers to the area of the system impacted by the alarm
-                                                        // COMMUNICATION, ENVIRONMENT, EQUIPMENT, SERVICE, PROCESSING, SECURITY
+    // Refers to the area of the system impacted by the alarm
+    // COMMUNICATION, ENVIRONMENT, EQUIPMENT, SERVICE, PROCESSING, SECURITY
+    AlarmEventType.AlarmEventType type = 2;
 
-    AlarmEventCategory.AlarmEventCategory category = 3; // Refers to the functional category originating the alarm
-                                                        // GENERAL, CONFIG, PON, TCA
+    // Refers to the functional category originating the alarm
+    // GENERAL, CONFIG, PON, TCA
+    AlarmEventCategory.AlarmEventCategory category = 3;
 
-    AlarmEventState.AlarmEventState state = 4;          // Current active state of the alarm
-                                                        // RAISED, CLEARED
+    // Current active state of the alarm
+    // RAISED, CLEARED
+    AlarmEventState.AlarmEventState state = 4;
 
-    AlarmEventSeverity.AlarmEventSeverity severity = 5; // Overall impact of the alarm on the system
-                                                        // INDETERMINATE, WARNING, MINOR, MAJOR, CRITICAL
+    // Overall impact of the alarm on the system
+    // INDETERMINATE, WARNING, MINOR, MAJOR, CRITICAL
+    AlarmEventSeverity.AlarmEventSeverity severity = 5;
 
-    float raised_ts = 6;                                // Timestamp at which the alarm was first raised
+    // Timestamp at which the alarm was first raised
+    float raised_ts = 6;
 
-    float reported_ts = 7;                              // Timestamp at which the alarm was reported
+    // Timestamp at which the alarm was reported
+    float reported_ts = 7;
 
-    float changed_ts = 8;                               // Timestamp at which the alarm has changed since it was raised
+    // Timestamp at which the alarm has changed since it was raised
+    float changed_ts = 8;
 
-    string resource_id = 9;                             // Identifier of the originating resource of the alarm
+    // Identifier of the originating resource of the alarm
+    string resource_id = 9;
 
-    string description = 10;                            // Textual explanation of the alarm
+    // Textual explanation of the alarm
+    string description = 10;
 
-    map<string,string> context = 11;                    // Key/Value storage for extra information that may give context to the alarm
+    // Key/Value storage for extra information that may give context to the alarm
+    map<string, string> context = 11;
 }