VOL-1377 code changes required in voltha-go for flow handling in openolt adapter

Change-Id: I3edb766788cdd0b9c55efda8ca548f04e6d41c31
diff --git a/adapters/simulated_onu/adaptercore/device_handler.go b/adapters/simulated_onu/adaptercore/device_handler.go
index 2e3271c..e3d20fc 100644
--- a/adapters/simulated_onu/adaptercore/device_handler.go
+++ b/adapters/simulated_onu/adaptercore/device_handler.go
@@ -126,16 +126,32 @@
 	if err := dh.coreProxy.PortCreated(nil, cloned.Id, dh.uniPort); err != nil {
 		log.Errorw("error-creating-nni-port", log.Fields{"deviceId": device.Id, "error": err})
 	}
+        // Create UNI port in parent device
+        uniPort := &voltha.Port{
+		PortNo:     uni_port,
+		Label:      fmt.Sprintf("uni-%d", uni_port),
+		Type:       voltha.Port_ETHERNET_UNI,
+		AdminState: voltha.AdminState_ENABLED,
+		OperStatus: voltha.OperStatus_ACTIVE,
+	}
+	if err := dh.coreProxy.PortCreated(nil, cloned.ParentId, uniPort); err != nil {
+		log.Errorw("error-creating-nni-port", log.Fields{"deviceId": device.Id, "error": err})
+	}
 
+        // use Pon port number on which this ONU has been detected
+        ponPortNo := uint32(1)
+        if device.ParentPortNo != 0 {
+            ponPortNo = device.ParentPortNo
+        }
 	//	Now create the PON Port
 	dh.ponPort = &voltha.Port{
-		PortNo:     1,
-		Label:      fmt.Sprintf("pon-%d", 1),
+		PortNo:     ponPortNo,
+		Label:      fmt.Sprintf("pon-%d", ponPortNo),
 		Type:       voltha.Port_PON_ONU,
 		AdminState: voltha.AdminState_ENABLED,
 		OperStatus: voltha.OperStatus_ACTIVE,
-		Peers: []*voltha.Port_PeerPort{{DeviceId: cloned.ParentId,
-			PortNo: cloned.ParentPortNo}},
+		Peers: []*voltha.Port_PeerPort{{DeviceId: cloned.ParentId, // Peer device  is OLT
+			PortNo: uni_port}},            // Peer port is UNI port
 	}
 
 	// Synchronous call to update device - this method is run in its own go routine