Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest

Conflicts:
	drivers/common/api/onosrestapidriver.py
	drivers/common/api/onosrestapidriver.py_bak
	drivers/common/api/onosrestapidriver.pyc
	drivers/common/cli/emulator/mininetclidriver.py
	drivers/common/cli/emulator/mininetclidriver.pyc
	drivers/common/cli/onosclidriver.pyc
	tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
	tests/OnosSanity4nodes/OnosSanity4nodes.params
	tests/OnosSanity4nodes/OnosSanity4nodes.py
diff --git a/TestON/drivers/common/api/onosrestapidriver.py b/TestON/drivers/common/api/onosrestapidriver.py
index 4af2603..39c649c 100644
--- a/TestON/drivers/common/api/onosrestapidriver.py
+++ b/TestON/drivers/common/api/onosrestapidriver.py
@@ -95,10 +95,10 @@
     
     def find_host(self,RestIP,RestPort,RestAPI,hostIP):
 	retcode = 0
-        retswitch = ''
-        retport = ''
-        retmac = ''
-        foundIP = ''
+        retswitch = []
+        retport = []
+        retmac = []
+        foundIP = []
 	##### device rest API is: 'host:8080/wm/core/topology/switches/all/json' ###
 	url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
 		
@@ -122,10 +122,10 @@
                         except:
                             print "Error in detecting IP address."
                         if foundIP == hostIP:
+	                    retswitch.append(switch[1]['dpid'])
+                            retport.append(port[1]['desc'])
+                            retmac.append(port[1]['devices'][0]['mac'])
                             retcode = retcode +1
-	                    retswitch = switch[1]['dpid']
-                            retport = port[1]['desc']
-                            retmac = port[1]['devices'][0]['mac']
                             foundIP =''
         return(retcode, retswitch, retport, retmac)
 
diff --git a/TestON/drivers/common/api/onosrestapidriver.py_bak b/TestON/drivers/common/api/onosrestapidriver.py_bak
index 6194d1f..4af2603 100644
--- a/TestON/drivers/common/api/onosrestapidriver.py_bak
+++ b/TestON/drivers/common/api/onosrestapidriver.py_bak
@@ -93,8 +93,12 @@
         '''
         return response  
     
-    def find_host(self,RestIP,RestPort,RestAPI,hostMAC):
+    def find_host(self,RestIP,RestPort,RestAPI,hostIP):
 	retcode = 0
+        retswitch = ''
+        retport = ''
+        retmac = ''
+        foundIP = ''
 	##### device rest API is: 'host:8080/wm/core/topology/switches/all/json' ###
 	url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
 		
@@ -102,18 +106,26 @@
 	    command = "curl -s %s" % (url)
 	    result = os.popen(command).read()
 	    parsedResult = json.loads(result)
-            print parsedResult
+            # print parsedResult
 	except:
 	    print "REST IF %s has issue" % command
 	    parsedResult = ""  
-	if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-	    print "REST %s returned code %s" % (command, parsedResult['code'])
-	    parsedResult = ""
 
     	if parsedResult == "":
 	    return (retcode, "Rest API has an error")	
 	else:
-	    found = [item for item in parsedResult if item['mac'] == [str(hostMAC)]]
-            retcode = 1
-	    return (retcode, found)
+            for switch in enumerate(parsedResult):
+                for port in enumerate(switch[1]['ports']):
+                    if ( port[1]['devices'] != [] ):
+                        try:
+                            foundIP =  port[1]['devices'][0]['ipv4addresses'][0]['ipv4']
+                        except:
+                            print "Error in detecting IP address."
+                        if foundIP == hostIP:
+                            retcode = retcode +1
+	                    retswitch = switch[1]['dpid']
+                            retport = port[1]['desc']
+                            retmac = port[1]['devices'][0]['mac']
+                            foundIP =''
+        return(retcode, retswitch, retport, retmac)
 
diff --git a/TestON/drivers/common/api/onosrestapidriver.pyc b/TestON/drivers/common/api/onosrestapidriver.pyc
index 2476b24..5be32b9 100644
--- a/TestON/drivers/common/api/onosrestapidriver.pyc
+++ b/TestON/drivers/common/api/onosrestapidriver.pyc
Binary files differ