CORD-339 Network config host provider

* Implement new application org.onosproject.netcfghost
* Implement BasicHostConfig to include IP and location information
    - Update network-cfg.json to add host config example
    - Add network-cfg-2x2-leaf-spine.json for 2x2 leaf-spine network in SegmentRouting
* Update Segment Rounting
    - Punt ARP packets
      (which is done by HostLocationProvider previously)
    - Check existing hosts when device connected or configured

Change-Id: I03986ddc8203d740b5bf26903e3dbf866d4d4600
diff --git a/tools/package/config/samples/network-cfg.json b/tools/package/config/samples/network-cfg.json
index 9e9257e..a6bcafc 100644
--- a/tools/package/config/samples/network-cfg.json
+++ b/tools/package/config/samples/network-cfg.json
@@ -1,27 +1,27 @@
 {
     "ports" : {
-	"of:0000000000000002/1" : {
-	    "interfaces" : [
-		{
-		    "ips" : [ "192.168.10.101/24" ],
-		    "mac" : "08:9e:01:82:38:68",
-		    "vlan" : "100"
-		}
-	    ]
-	},
-	"of:0000000000000002/20" : {
-	    "interfaces" : [
-		{
-		    "ips" : [ "192.168.20.101/24" ],
-		    "mac" : "08:9e:01:82:38:68",
-		    "vlan" : "200"
-		}
-	    ]
-	}
+    "of:0000000000000002/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "192.168.10.101/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "100"
+        }
+        ]
+    },
+    "of:0000000000000002/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "192.168.20.101/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "200"
+        }
+        ]
+    }
     },
     "devices" : {
-    	"of:0000000000000002" : {
-    		"segmentrouting" : {
+        "of:0000000000000002" : {
+            "segmentrouting" : {
                 "name" : "Leaf-R1",
                 "nodeSid" : 101,
                 "routerIp" : "10.0.1.254",
@@ -32,36 +32,54 @@
                     { "sid" : 200, "ports" : [4, 5] }
                 ]
             }
-    	},
-    	"of:0000000000000191" : {
-    		"segmentrouting" : {
+        },
+        "of:0000000000000191" : {
+            "segmentrouting" : {
                 "name" : "Spine-R1",
                 "nodeSid" : 105,
                 "routerIp" : "192.168.0.11",
                 "routerMac" : "00:00:01:00:11:80",
                 "isEdgeRouter" : false
             }
-    	}
+        }
     },
     "apps" : {
-	"org.onosproject.router" : {
-	    "bgp" : {
-		"bgpSpeakers" : [
-		    {
-			"connectPoint" : "of:00000000000000aa/10",
-			"peers" : [
-			    "192.168.10.1"
-			]
-		    },
-		    {
-			"connectPoint" : "of:00000000000000aa/20",
-			"peers" : [
-			    "192.168.20.1"
-			]
-		    }
-		]
-	    }
-	}
+    "org.onosproject.router" : {
+        "bgp" : {
+        "bgpSpeakers" : [
+            {
+            "connectPoint" : "of:00000000000000aa/10",
+            "peers" : [
+                "192.168.10.1"
+            ]
+            },
+            {
+            "connectPoint" : "of:00000000000000aa/20",
+            "peers" : [
+                "192.168.20.1"
+            ]
+            }
+        ]
+        }
+    }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/4093": {
+            "basic": {
+                "ips": [
+                    "10.0.1.1"
+                ],
+                "location": "of:0000000000000001/3"
+            }
+        },
+        "00:00:00:00:00:02/4093": {
+            "basic": {
+                "ips": [
+                    "10.0.1.2"
+                ],
+                "location": "of:0000000000000001/4"
+            }
+        }
     }
 }
 
diff --git a/tools/test/configs/network-cfg-2x2-leaf-spine.json b/tools/test/configs/network-cfg-2x2-leaf-spine.json
new file mode 100644
index 0000000..15d6c95
--- /dev/null
+++ b/tools/test/configs/network-cfg-2x2-leaf-spine.json
@@ -0,0 +1,104 @@
+{
+    "ports" : {
+    "of:0000000000000001/3" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "100"
+        }
+        ]
+    },
+    "of:0000000000000001/4" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "100"
+        }
+        ]
+    },
+    "of:0000000000000002/3" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "100"
+        }
+        ]
+    },
+    "of:0000000000000002/4" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ],
+            "mac" : "08:9e:01:82:38:68",
+            "vlan" : "100"
+        }
+        ]
+    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "name" : "Leaf-R1",
+                "nodeSid" : 101,
+                "routerIp" : "10.0.1.254",
+                "routerMac" : "00:00:00:00:01:80",
+                "isEdgeRouter" : true
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "name" : "Leaf-R2",
+                "nodeSid" : 102,
+                "routerIp" : "10.0.2.254",
+                "routerMac" : "00:00:00:00:02:80",
+                "isEdgeRouter" : true
+            }
+        },
+        "of:0000000000000191" : {
+            "segmentrouting" : {
+                "name" : "Spine-R1",
+                "nodeSid" : 103,
+                "routerIp" : "192.168.0.11",
+                "routerMac" : "00:00:01:00:11:80",
+                "isEdgeRouter" : false
+            }
+        },
+        "of:0000000000000192" : {
+            "segmentrouting" : {
+                "name" : "Spine-R2",
+                "nodeSid" : 104,
+                "routerIp" : "192.168.0.22",
+                "routerMac" : "00:00:01:00:22:80",
+                "isEdgeRouter" : false
+            }
+        }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/4093" : {
+            "basic": {
+                "ips": ["10.0.1.1"],
+                "location": "of:0000000000000001/3"
+            }
+        },
+        "00:00:00:00:00:02/4093" : {
+            "basic": {
+                "ips": ["10.0.1.2"],
+                "location": "of:0000000000000001/4"
+            }
+        },
+        "00:00:00:00:00:03/4093" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "location": "of:0000000000000002/3"
+            }
+        },
+        "00:00:00:00:00:04/4093" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "location": "of:0000000000000002/4"
+            }
+        }
+    }
+}