Added CLI and REST support for auxLocations

Change-Id: I04e78f766dcbb18bce4a2f9160d3740ec2fbd846
(cherry picked from commit eb5bd4998289bf78862db927d58b76cb12979459)
diff --git a/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java b/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
index b820573..310c8fd 100644
--- a/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
+++ b/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
@@ -126,18 +126,19 @@
      *
      * @param mac       MAC address of the host
      * @param vlan      VLAN ID of the host
-     * @param locations Location of the host
+     * @param locations Locations of the host
+     * @param auxLocations auxiliary locations of the host
      * @param ips       Set of IP addresses of the host
      * @param innerVlan host inner VLAN identifier
      * @param outerTpid outer TPID of a host
      */
-    protected void addHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<IpAddress> ips,
-                           VlanId innerVlan, EthType outerTpid) {
+    protected void addHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<HostLocation> auxLocations,
+                           Set<IpAddress> ips, VlanId innerVlan, EthType outerTpid) {
         HostId hid = HostId.hostId(mac, vlan);
         HostDescription desc = (ips != null) ?
-                new DefaultHostDescription(mac, vlan, locations, ips,
+                new DefaultHostDescription(mac, vlan, locations, auxLocations, ips,
                                            innerVlan, outerTpid, true) :
-                new DefaultHostDescription(mac, vlan, locations, Collections.emptySet(),
+                new DefaultHostDescription(mac, vlan, locations, auxLocations, Collections.emptySet(),
                                            innerVlan, outerTpid, true);
         providerService.hostDetected(hid, desc, true);
     }
@@ -163,15 +164,16 @@
      *
      * @param mac       MAC address of the host
      * @param vlan      VLAN ID of the host
-     * @param locations Location of the host
+     * @param locations Locations of the host
+     * @param auxLocations auxiliary locations of the host
      * @param ips       Set of IP addresses of the host
      * @param innerVlan host inner VLAN identifier
      * @param outerTpid outer TPID of a host
      */
-    protected void updateHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<IpAddress> ips,
-                              VlanId innerVlan, EthType outerTpid) {
+    protected void updateHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<HostLocation> auxLocations,
+                              Set<IpAddress> ips, VlanId innerVlan, EthType outerTpid) {
         HostId hid = HostId.hostId(mac, vlan);
-        HostDescription desc = new DefaultHostDescription(mac, vlan, locations, ips,
+        HostDescription desc = new DefaultHostDescription(mac, vlan, locations, auxLocations, ips,
                                                           innerVlan, outerTpid, true);
         providerService.hostDetected(hid, desc, true);
     }
@@ -199,9 +201,18 @@
                 Set<HostLocation> locations = locs.stream()
                         .map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis()))
                         .collect(Collectors.toSet());
+
+                // auxLocations allows to be null
+                Set<HostLocation> auxLocations = hostConfig.auxLocations();
+                if (auxLocations != null) {
+                    auxLocations = auxLocations.stream()
+                            .map(auxLocation -> new HostLocation(auxLocation, System.currentTimeMillis()))
+                            .collect(Collectors.toSet());
+                }
+
                 VlanId innerVlan = hostConfig.innerVlan();
                 EthType outerTpid = hostConfig.outerTpid();
-                addHost(mac, vlan, locations, ipAddresses, innerVlan, outerTpid);
+                addHost(mac, vlan, locations, auxLocations, ipAddresses, innerVlan, outerTpid);
             } else {
                 log.warn("Host {} configuration {} is missing locations", hostId, hostConfig);
             }
@@ -224,6 +235,7 @@
             BasicHostConfig hostConfig = networkConfigRegistry.getConfig(hostId, BasicHostConfig.class);
             Set<IpAddress> ipAddresses = null;
             Set<HostLocation> locations = null;
+            Set<HostLocation> auxLocations = null;
             VlanId innerVlan = VlanId.NONE;
             EthType outerTpid = EthType.EtherType.UNKNOWN.ethType();
 
@@ -238,16 +250,25 @@
                 locations = locations.stream()
                         .map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis()))
                         .collect(Collectors.toSet());
+
+                // auxLocations allows to be null
+                auxLocations = hostConfig.auxLocations();
+                if (auxLocations != null) {
+                    auxLocations = auxLocations.stream()
+                            .map(auxLocation -> new HostLocation(auxLocation, System.currentTimeMillis()))
+                            .collect(Collectors.toSet());
+                }
+
                 innerVlan = hostConfig.innerVlan();
                 outerTpid = hostConfig.outerTpid();
             }
 
             switch (event.type()) {
                 case CONFIG_ADDED:
-                    addHost(mac, vlan, locations, ipAddresses, innerVlan, outerTpid);
+                    addHost(mac, vlan, locations, auxLocations, ipAddresses, innerVlan, outerTpid);
                     break;
                 case CONFIG_UPDATED:
-                    updateHost(mac, vlan, locations, ipAddresses, innerVlan, outerTpid);
+                    updateHost(mac, vlan, locations, auxLocations, ipAddresses, innerVlan, outerTpid);
                     break;
                 case CONFIG_REMOVED:
                     removeHost(mac, vlan);