[ONOS-6623]: Fix parsing of hosts json

Change-Id: I7e612bb9a1b8e5e63894b2698ab40db653ad6473
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 5ad6a87..4a3ae04 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -455,11 +455,11 @@
         hostInitIndex = 0
         for host in hosts:
             name = macToName[ host[ 'mac' ] ]
-            dpid = host[ 'location' ][ 'elementId' ]
+            dpid = host[ 'locations' ][ 0 ][ 'elementId' ]
             device = dpidToDevice[ dpid ]
             newHost = Host( hostInitIndex,
                             name, host[ 'id' ], host[ 'mac' ],
-                            device, host[ 'location' ][ 'port' ],
+                            device, host[ 'locations' ][ 0 ][ 'port' ],
                             host[ 'vlan' ], host[ 'ipAddresses' ] )
             print newHost
             main.hosts.append( newHost )
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index f295b11..9159e4d 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -1992,8 +1992,8 @@
                     main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
                     main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
                     main.hostsData[ host ][ 'location' ] = \
-                                hostj[ 'location' ][ 'elementId' ] + '/' + \
-                                hostj[ 'location' ][ 'port' ]
+                                hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
+                                hostj[ 'locations' ][ 0 ][ 'port' ]
                     main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
         return main.TRUE
     except ValueError:
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 4bbbd9f..38861b6 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -1335,8 +1335,8 @@
                 main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
                 main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
                 main.hostsData[ host ][ 'location' ] = \
-                            hostj[ 'location' ][ 'elementId' ] + '/' + \
-                            hostj[ 'location' ][ 'port' ]
+                            hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
+                            hostj[ 'locations' ][ 0 ][ 'port' ]
                 main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
 
     main.log.info( "Deactivating reactive forwarding app " )
@@ -1549,8 +1549,8 @@
                     main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
                     main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
                     main.hostsData[ host ][ 'location' ] = \
-                                hostj[ 'location' ][ 'elementId' ] + '/' + \
-                                hostj[ 'location' ][ 'port' ]
+                                hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
+                                hostj[ 'locations' ][ 0 ][ 'port' ]
                     main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
         return main.TRUE
     except ValueError:
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
index 511eb32..2a2330d 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -1816,8 +1816,8 @@
                 main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
                 main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
                 main.hostsData[ host ][ 'location' ] = \
-                            hostj[ 'location' ][ 'elementId' ] + '/' + \
-                            hostj[ 'location' ][ 'port' ]
+                            hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
+                            hostj[ 'locations' ][ 0 ][ 'port' ]
                 main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
 
     main.log.info( "Deactivating reactive forwarding app " )
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index 83115b9..0055f7e 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -2429,7 +2429,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 6a8283f..288da84 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -2436,7 +2436,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index 31bab52..1fe9f84 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -2491,7 +2491,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index 52f0b49..d30bdbc 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -2352,7 +2352,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index 6e13d85..aba291c 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -2494,7 +2494,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 42d88fe..ede3075 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -1758,7 +1758,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index 6b86378..20d2419 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -2465,7 +2465,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 0811287..d75ccdd 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -2488,7 +2488,7 @@
                                 mac = host.get( 'mac' )
                                 assert mac, "mac field could not be found for this host object"
 
-                                location = host.get( 'location' )
+                                location = host.get( 'locations' )[ 0 ]
                                 assert location, "location field could not be found for this host object"
 
                                 # Trim the protocol identifier off deviceId
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
index f7a8782..197ee84 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
@@ -384,8 +384,8 @@
                 main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
                 main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
                 main.hostsData[ host ][ 'location' ] = \
-                            hostj[ 'location' ][ 'elementId' ] + '/' + \
-                            hostj[ 'location' ][ 'port' ]
+                            hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
+                            hostj[ 'locations' ][ 0 ][ 'port' ]
                 main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
 
     if activateResult and main.hostsData: