Updates to make more the enable process work

Change-Id: I30acddb3e0aaf76238ebb78c2c9c7fd78b7fbc31
diff --git a/python/adapters/openolt/main.py b/python/adapters/openolt/main.py
index 083a167..0621017 100755
--- a/python/adapters/openolt/main.py
+++ b/python/adapters/openolt/main.py
@@ -362,7 +362,8 @@
             self.core_proxy = CoreProxy(
                 kafka_proxy=None,
                 core_topic=self.core_topic,
-                my_listening_topic=self.listening_topic)
+                my_listening_topic=self.listening_topic,
+		adapter_name=self.args.name)
 
             self.adapter_proxy = AdapterProxy(
                 kafka_proxy=None,
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 29df184..f27c886 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -21,6 +21,7 @@
 import structlog
 import time
 from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks
 from scapy.layers.l2 import Ether, Dot1Q
 from transitions import Machine
 
@@ -158,7 +159,7 @@
         sw_desc = device_info.firmware_version
         hw_desc = device_info.model
         if device_info.hardware_version: hw_desc += '-' + device_info.hardware_version
-
+	"""
         # Create logical OF device
         ld = LogicalDevice(
             root_device_id=self.device_id,
@@ -177,8 +178,22 @@
             )
         )
         ld_init = self.adapter_agent.create_logical_device(ld,
-                                                           dpid=dpid)
-
+	
+	nni_port = Port(
+                port_no=info.nni_port,
+                label='NNI facing Ethernet port',
+                type=Port.ETHERNET_NNI,
+                oper_status=OperStatus.ACTIVE
+            )
+            self.nni_port = nni_port
+            yield self.core_proxy.port_created(device.id, nni_port)
+            yield self.core_proxy.port_created(device.id, Port(
+                port_no=1,
+                label='PON port',
+                type=Port.PON_OLT,
+                oper_status=OperStatus.ACTIVE
+            ))                                                           dpid=dpid)
+	"""
         self.logical_device_id = ld_init.id
 
         device = self.adapter_agent.get_device(self.device_id)
@@ -260,8 +275,8 @@
 
         self.log.info('Device connected', device_info=device_info)
 
-        self.create_logical_device(device_info)
-
+        #self.create_logical_device(device_info)
+	self.logical_device_id = 0
         device.serial_number = self.serial_number
 	
         self.resource_mgr = self.resource_mgr_class(self.device_id,
@@ -279,7 +294,7 @@
                                               self.logical_device_id,
                                               self.platform)
 	self.stats_mgr = self.stats_mgr_class(self, self.log, self.platform)
-        self.bw_mgr = self.bw_mgr_class(self.log, self.proxy)
+        self.bw_mgr = self.bw_mgr_class(self.log, self.adapter_agent)
 	
         device.vendor = device_info.vendor
         device.model = device_info.model
@@ -290,15 +305,17 @@
 
         device.connect_status = ConnectStatus.REACHABLE
         self.adapter_agent.device_update(device)
-
+ 
+    @inlineCallbacks
     def do_state_up(self, event):
         self.log.debug("do_state_up")
 
-        device = self.adapter_agent.get_device(self.device_id)
-
+        device = yield self.adapter_agent.get_device(self.device_id)
+	self.log.debug("do_state_up set  device active", device=device)
         # Update phys OF device
-        device.parent_id = self.logical_device_id
+        #device.parent_id = self.logical_device_id
         device.oper_status = OperStatus.ACTIVE
+	self.log.debug("Updating to Active", device=device)
         self.adapter_agent.device_update(device)
 
     def do_state_down(self, event):
diff --git a/python/adapters/openolt/openolt_flow_mgr.py b/python/adapters/openolt/openolt_flow_mgr.py
index 198ee3a..19604c5 100644
--- a/python/adapters/openolt/openolt_flow_mgr.py
+++ b/python/adapters/openolt/openolt_flow_mgr.py
@@ -79,11 +79,12 @@
         self.logical_device_id = logical_device_id
         self.nni_intf_id = None
         self.platform = platform
-        self.logical_flows_proxy = registry('core').get_proxy(
-            '/logical_devices/{}/flows'.format(self.logical_device_id))
-        self.flows_proxy = registry('core').get_proxy(
-            '/devices/{}/flows'.format(self.device_id))
-        self.root_proxy = registry('core').get_proxy('/')
+        #self.logical_flows_proxy = registry('core').get_proxy(
+        #    '/logical_devices/{}/flows'.format(self.logical_device_id))
+        self.logical_flows_proxy = adapter_agent
+	#self.flows_proxy = registry('core').get_proxy(
+        #    '/devices/{}/flows'.format(self.device_id))
+        #self.root_proxy = registry('core').get_proxy('/')
         self.resource_mgr = resource_mgr
         self.tech_profile = dict()
         self._populate_tech_profile_per_pon_port()