VOL-1452 pep8 cleanup and tab/space fixes
Change-Id: Iad55faad2455bbe0a13178f36efd13bb6f06409c
diff --git a/python/adapters/openolt/main.py b/python/adapters/openolt/main.py
index 0621017..85d3518 100755
--- a/python/adapters/openolt/main.py
+++ b/python/adapters/openolt/main.py
@@ -15,7 +15,7 @@
# limitations under the License.
#
-"""Ponsim OLT Adapter main entry point"""
+"""OpenOLT Adapter main entry point"""
import argparse
import os
@@ -241,14 +241,12 @@
dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(dir, path)
path = os.path.abspath(path)
-
+
with open(path) as fd:
config = yaml.load(fd)
return config
-
-
def print_banner(log):
log.info(' ____ _____ ___ _ ___ ___ _ _____ ')
log.info('/ _ \| _ \| __| | / | / _ \| | |_ _| ')
@@ -264,13 +262,14 @@
log.info(' |_| ')
log.info('(to stop: press Ctrl-C)')
+
@implementer(IComponent)
class Main(object):
def __init__(self):
self.args = args = parse_args()
- self.config = load_config(args)
+ self.config = load_config(args)
verbosity_adjust = (args.verbose or 0) - (args.quiet or 0)
self.log = setup_logging(self.config.get('logging', {}),
@@ -278,10 +277,10 @@
verbosity_adjust=verbosity_adjust)
self.log.info('container-number-extractor',
regex=args.container_name_regex)
-
+
self.openolt_adapter_version = self.get_version()
- self.log.info('Open-OLT-Adapter-Version', version=
- self.openolt_adapter_version)
+ self.log.info('Open-OLT-Adapter-Version',
+ version=self.openolt_adapter_version)
if not args.no_banner:
print_banner(self.log)
@@ -362,8 +361,7 @@
self.core_proxy = CoreProxy(
kafka_proxy=None,
core_topic=self.core_topic,
- my_listening_topic=self.listening_topic,
- adapter_name=self.args.name)
+ my_listening_topic=self.listening_topic)
self.adapter_proxy = AdapterProxy(
kafka_proxy=None,
@@ -371,8 +369,8 @@
my_listening_topic=self.listening_topic)
self.adapter = OpenoltAdapter(core_proxy=self.core_proxy,
- adapter_proxy=self.adapter_proxy,
- config=config)
+ adapter_proxy=self.adapter_proxy,
+ config=config)
openolt_request_handler = AdapterRequestFacade(adapter=self.adapter)
@@ -383,7 +381,7 @@
# TODO: Add KV Store object reference
kv_store=self.args.backend,
default_topic=self.args.name,
- group_id_prefix=self.args.instance_id,
+ group_id_prefix=self.args.instance_id,
# Needs to assign a real class
target_cls=openolt_request_handler
diff --git a/python/adapters/openolt/openolt.py b/python/adapters/openolt/openolt.py
index fd4e6d1..b786e2d 100644
--- a/python/adapters/openolt/openolt.py
+++ b/python/adapters/openolt/openolt.py
@@ -57,7 +57,7 @@
from openolt_platform import OpenOltPlatform
from openolt_resource_manager import OpenOltResourceMgr
from openolt_device import OpenoltDevice
-
+
from pyvoltha.protos.events_pb2 import KpiEvent, KpiEventType, MetricValuePairs
from pyvoltha.protos.logical_device_pb2 import LogicalPort
from pyvoltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
@@ -241,8 +241,8 @@
def update_flows_bulk(self, device, flows, groups):
log.info('bulk-flow-update', device_id=device.id,
- number_of_flows=len(flows.items), number_of_groups=len(
- groups.items))
+ number_of_flows=len(flows.items),
+ number_of_groups=len(groups.items))
log.debug('flows and grousp details', flows=flows, groups=groups)
assert len(groups.items) == 0, "Cannot yet deal with groups"
handler = self.devices[device.id]
@@ -430,7 +430,7 @@
log.error("Device does not exist", device_id=device.id)
return OperationResp(code=OperationResp.OPERATION_FAILURE,
additional_info="Device %s does not exist"
- % device.id)
+ % device.id)
handler = self.devices[device.id]
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 162f323..0ebf04f 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -42,6 +42,7 @@
from pyvoltha.protos.logical_device_pb2 import LogicalDevice, LogicalPort
+
class OpenoltDevice(object):
"""
OpenoltDevice state machine:
@@ -103,7 +104,7 @@
self.extra_args = device.extra_args
self.log = structlog.get_logger(id=self.device_id,
ip=self.host_and_port)
- #self.proxy = registry('core').get_proxy('/')
+ # self.proxy = registry('core').get_proxy('/')
self.log.info('openolt-device-init')
@@ -135,7 +136,7 @@
send_event=True, initial='state_null')
self.go_state_init()
-def create_logical_device(self, device_info):
+ def create_logical_device(self, device_info):
dpid = device_info.device_id
serial_number = device_info.device_serial_number
@@ -289,15 +290,15 @@
# TODO: check for uptime and reboot if too long (VOL-1192)
device.connect_status = ConnectStatus.REACHABLE
- device.mac_address = "AA:BB:CC:DD:EE:FF"
+ device.mac_address = "AA:BB:CC:DD:EE:FF"
self.adapter_agent.device_update(device)
-
+
def do_state_up(self, event):
self.log.debug("do_state_up")
- self.adapter_agent.device_state_update(self.device_id,
- connect_status=ConnectStatus.REACHABLE,
- oper_status=OperStatus.ACTIVE)
+ self.adapter_agent.device_state_update(self.device_id,
+ connect_status=ConnectStatus.REACHABLE,
+ oper_status=OperStatus.ACTIVE)
def do_state_down(self, event):
self.log.debug("do_state_down")
@@ -875,8 +876,8 @@
port = Port(port_no=port_no, label=label, type=port_type,
admin_state=AdminState.ENABLED, oper_status=oper_status)
- yield self.adapter_agent.port_created(self.device_id, port)
- #self.adapter_agent.add_port(self.device_id, port)
+ yield self.adapter_agent.port_created(self.device_id, port)
+ # self.adapter_agent.add_port(self.device_id, port)
returnValue(port_no, label)