Small fixes

Change-Id: I55a163cbedf5e2a764fe79ede9000b5c76db5308
diff --git a/voltha/adapters/loader.py b/voltha/adapters/loader.py
index 712fb35..374b495 100644
--- a/voltha/adapters/loader.py
+++ b/voltha/adapters/loader.py
@@ -69,8 +69,8 @@
 
     def _find_adapters(self):
         subdirs = os.walk(mydir).next()[1]
-        try:
-            for subdir in subdirs:
+        for subdir in subdirs:
+            try:
                 adapter_name = subdir
                 py_file = os.path.join(mydir, subdir, subdir + '.py')
                 if os.path.isfile(py_file):
@@ -88,5 +88,5 @@
                                 IAdapterInterface.implementedBy(cls):
                             verifyClass(IAdapterInterface, cls)
                             yield adapter_name, cls
-        except Exception, e:
-            log.exception('failed', e=e)
+            except Exception, e:
+                log.exception('failed', e=e)
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index 1fcb3b3..2313bb1 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -20,11 +20,13 @@
 from uuid import uuid4
 
 import structlog
+from google.protobuf.json_format import MessageToJson
 from scapy.packet import Packet
 from twisted.internet.defer import inlineCallbacks, returnValue
 from zope.interface import implementer
 
 from common.event_bus import EventBusClient
+from common.frameio.frameio import hexify
 from voltha.adapters.interface import IAdapterAgent
 from voltha.protos import third_party
 from voltha.protos.device_pb2 import Device, Port
@@ -265,12 +267,12 @@
 
     def _gen_rx_proxy_address_topic(self, proxy_address):
         """Generate unique topic name specific to this proxy address for rx"""
-        topic = 'rx:' + proxy_address.SerializeToString()
+        topic = 'rx:' + MessageToJson(proxy_address)
         return topic
 
     def _gen_tx_proxy_address_topic(self, proxy_address):
         """Generate unique topic name specific to this proxy address for tx"""
-        topic = 'tx:' + proxy_address.SerializeToString()
+        topic = 'tx:' + MessageToJson(proxy_address)
         return topic
 
     def register_for_proxied_messages(self, proxy_address):
@@ -296,7 +298,7 @@
 
     def send_packet_in(self, logical_device_id, logical_port_no, packet):
         self.log.debug('send-packet-in', logical_device_id=logical_device_id,
-                       logical_port_no=logical_port_no, packet=packet)
+                       logical_port_no=logical_port_no, packet=hexify(packet))
 
         if isinstance(packet, Packet):
             packet = str(packet)
diff --git a/voltha/core/logical_device_agent.py b/voltha/core/logical_device_agent.py
index 02662fc..4e8eec4 100644
--- a/voltha/core/logical_device_agent.py
+++ b/voltha/core/logical_device_agent.py
@@ -293,12 +293,12 @@
             return False
 
         # Check out_port
-        if flow_mod.out_port != ofp.OFPP_ANY and \
+        if (flow_mod.out_port & 0x7fffffff) != ofp.OFPP_ANY and \
                 not cls.flow_has_out_port(flow, flow_mod.out_port):
             return False
 
         # Check out_group
-        if flow_mod.out_group != ofp.OFPG_ANY and \
+        if (flow_mod.out_group & 0x7fffffff) != ofp.OFPG_ANY and \
                 not cls.flow_has_out_group(flow, flow_mod.out_group):
             return False