bug 537 SDN-assist does not connect new instances over an existing vim network

Change-Id: I47115d0957cd9c64606085132fd3f7e4003e7fc2
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/openmanod b/openmanod
index 367b505..3fd1ae0 100755
--- a/openmanod
+++ b/openmanod
@@ -48,7 +48,7 @@
 
 __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
 __date__ = "$26-aug-2014 11:09:29$"
-__version__ = "0.5.77-r587"
+__version__ = "0.5.78-r588"
 version_date = "Sep 2018"
 database_version = 32      # expected database schema version
 
diff --git a/osm_ro/vim_thread.py b/osm_ro/vim_thread.py
index 089e7b9..c981e31 100644
--- a/osm_ro/vim_thread.py
+++ b/osm_ro/vim_thread.py
@@ -941,8 +941,9 @@
         sdn_net_id = None
         with self.db_lock:
             result = self.db.get_rows(SELECT=('sdn_net_id',), FROM='instance_nets',
-                                      WHERE={'vim_net_id': vim_net_id, 'instance_scenario_id': None,
-                                             'datacenter_tenant_id': self.datacenter_tenant_id})
+                                      WHERE={'vim_net_id': vim_net_id,
+                                             'datacenter_tenant_id': self.datacenter_tenant_id},
+                                      ORDER="instance_scenario_id")
         if result:
             sdn_net_id = result[0]['sdn_net_id']