CORD-60 Support dynamic vSG creation/deletion

We no longer need to configure /32 IP in interfaces.
SR will push a per-host route when discovering a host
with IP address(es) that does not belong to configured subnet.

Also includes:
- HostHandler refactoring

Change-Id: Ic1ad42d1ccdfee32be85f49e6fc94d9026000ffc
diff --git a/tools/package/config/samples/network-cfg-fabric-2x2-all-readme.html b/tools/package/config/samples/network-cfg-fabric-2x2-all-readme.html
index 4e76263..bfe3a2c 100644
--- a/tools/package/config/samples/network-cfg-fabric-2x2-all-readme.html
+++ b/tools/package/config/samples/network-cfg-fabric-2x2-all-readme.html
@@ -18,10 +18,10 @@
     span.s1 {font-kerning: none}
     span.s2 {font-kerning: none; color: #0433ff; -webkit-text-stroke: 0px #0433ff}
     span.s3 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000}
-    span.s4 {font-kerning: none; color: #ff40ff; -webkit-text-stroke: 0px #ff40ff}
-    span.s5 {font-kerning: none; color: #ff9300; -webkit-text-stroke: 0px #ff9300}
-    span.s6 {font-kerning: none; color: #77bb41; -webkit-text-stroke: 0px #77bb41}
-    span.s7 {font-kerning: none; color: #00c7fc; -webkit-text-stroke: 0px #00c7fc}
+    span.s4 {font-kerning: none; color: #ff9300; -webkit-text-stroke: 0px #ff9300}
+    span.s5 {font-kerning: none; color: #77bb41; -webkit-text-stroke: 0px #77bb41}
+    span.s6 {font-kerning: none; color: #00c7fc; -webkit-text-stroke: 0px #00c7fc}
+    span.s7 {font-kerning: none; color: #ff40ff; -webkit-text-stroke: 0px #ff40ff}
     span.s8 {font-kerning: none; color: #ff2600; -webkit-text-stroke: 0px #ff2600}
     span.s9 {font-kerning: none; color: #000000}
     span.s10 {font-kerning: none; color: #669c35; -webkit-text-stroke: 0px #669c35}
@@ -49,12 +49,6 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>},</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
 <p class="p2"><span class="s3"><span class="Apple-converted-space">                </span>"vlan" : "222" </span><span class="s1">// cross-connect s-tag 222 to PMC OLT</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips" : [ "A.A.A.A/32" ] </span><span class="s4">// vSG1 public IP address /32</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips" : [ "B.B.B.B/32" ] </span><span class="s4">// vSG2 public IP address /32</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>},</span></p>
@@ -65,25 +59,18 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>},</span></p>
-<p class="p3"><span class="s3"><span class="Apple-converted-space">    </span>"of:0000000000000001/30" : { </span><span class="s1">// connect to vSG3 directly without OLT (temporary)</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000001/65" : { </span><span class="s4">// connect to Fujitsu OLT</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"interfaces" : [</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips" : [ "C.C.C.C/32" ] </span><span class="s4">// vSG3 /32 public IP address</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000001/65" : { </span><span class="s5">// connect to Fujitsu OLT</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"interfaces" : [</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "fujitsu-olt", </span><span class="s5">// unused</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "fujitsu-olt", </span><span class="s4">// unused</span></p>
 <p class="p2"><span class="s3"><span class="Apple-converted-space">                </span>"vlan" : "69" </span><span class="s1">// cross-connect s-tag 69<span class="Apple-converted-space">  </span>to vSG</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000001/73" : { </span><span class="s5">// connect to PMC OLT</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000001/73" : { </span><span class="s4">// connect to PMC OLT</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"interfaces" : [</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "pmc-olt", </span><span class="s5">// unused</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "pmc-olt", </span><span class="s4">// unused</span></p>
 <p class="p2"><span class="s3"><span class="Apple-converted-space">                </span>"vlan" : "222" </span><span class="s1">// cross-connect s-tag 222 to vSG</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
@@ -95,16 +82,16 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>]</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000002/32" : { </span><span class="s6">// connect to Internet router</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>"of:0000000000000002/32" : { </span><span class="s5">// connect to Internet router</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"interfaces" : [</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>{</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "external-quagga", </span><span class="s6">// Internet router interface name</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips" : [ "10.231.254.202/30", "10.231.254.223/32" ], </span><span class="s6">// Quagga IP addresses</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"mac" : "00:16:3e:56:2b:48" </span><span class="s6">// Quagga WAN MAC</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"name" : "external-quagga", </span><span class="s5">// Internet router interface name</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips" : [ "10.231.254.202/30", "10.231.254.223/32" ], </span><span class="s5">// Quagga IP addresses</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"mac" : "00:16:3e:56:2b:48" </span><span class="s5">// Quagga WAN MAC</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>],</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"pimInterface" : { </span><span class="s7">// PIM configuration</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"interfaceName" : "external-quagga", </span><span class="s7">// port that faces the Internet router</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"pimInterface" : { </span><span class="s6">// PIM configuration</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"interfaceName" : "external-quagga", </span><span class="s6">// port that faces the Internet router</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"enabled" : true,</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"helloInterval" : 1,</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"holdTime" : 3,</span></p>
@@ -162,15 +149,15 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"location": "of:0000000000000001/5" </span><span class="s2">// node 1 location</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"02:42:cf:8d:c0:82/-1" : { </span><span class="s4">// vSG1</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"02:42:cf:8d:c0:82/-1" : { </span><span class="s7">// vSG1</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"basic": {</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["A.A.A.A"], </span><span class="s4">// vSG1 public IP address</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["A.A.A.A"], </span><span class="s7">// vSG1 public IP address</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"location": "of:0000000000000001/5"</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"02:42:cf:8d:c0:83/-1" : { </span><span class="s4">// vSG2</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"02:42:cf:8d:c0:83/-1" : { </span><span class="s7">// vSG2</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"basic": {</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["B.B.B.B"], </span><span class="s4">// vSG2 public IP address</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["B.B.B.B"], </span><span class="s7">// vSG2 public IP address</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"location": "of:0000000000000001/5"</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
@@ -180,9 +167,9 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"location": "of:0000000000000001/7"</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"74:44:01:74:61:92/-1" : { </span><span class="s4">// vSG3</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"74:44:01:74:61:92/-1" : { </span><span class="s7">// vSG3</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"basic": {</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["C.C.C.C"], </span><span class="s4">// vSG3 public IP address</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ips": ["C.C.C.C"], </span><span class="s7">// vSG3 public IP address</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"location": "of:0000000000000001/30"</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
@@ -234,7 +221,7 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"vRouterMacs" : [</span></p>
 <p class="p3"><span class="s3"><span class="Apple-converted-space">                    </span>"a4:23:05:34:56:78" </span><span class="s1">// vRouter LAN MAC (vSG’s default gateway)</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>],</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"vRouterId" : "of:0000000000000002", </span><span class="s4">// vRouter DPID (0/0 is replaced by this)</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"vRouterId" : "of:0000000000000002", </span><span class="s7">// vRouter DPID (0/0 is replaced by this)</span></p>
 <p class="p4"><span class="s3"><span class="Apple-converted-space">                 </span>"suppressSubnet" : [ </span><span class="s1">// Do not push subnet rules for these ports</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                    </span>"of:0000000000000002/31", "of:0000000000000002/32"</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>],</span></p>
@@ -246,10 +233,10 @@
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>},</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>"org.onosproject.router" : {</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>"router" : {</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"controlPlaneConnectPoint" : "of:0000000000000002/31", </span><span class="s6">// location of Quagga</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ospfEnabled" : "true", </span><span class="s6">// enable OSPF</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"pimEnabled" : "true", </span><span class="s7">// enable PIM</span></p>
-<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"interfaces" : [ "external-quagga" ] </span><span class="s10">// </span><span class="s6">VR only handles peers on these ports</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"controlPlaneConnectPoint" : "of:0000000000000002/31", </span><span class="s5">// location of Quagga</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"ospfEnabled" : "true", </span><span class="s5">// enable OSPF</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"pimEnabled" : "true", </span><span class="s6">// enable PIM</span></p>
+<p class="p7"><span class="s1"><span class="Apple-converted-space">                </span>"interfaces" : [ "external-quagga" ] </span><span class="s10">// </span><span class="s5">VR only handles peers on these ports</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">            </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">        </span>}</span></p>
 <p class="p7"><span class="s1"><span class="Apple-converted-space">    </span>}</span></p>
diff --git a/tools/package/config/samples/network-cfg-fabric-2x2-all.json b/tools/package/config/samples/network-cfg-fabric-2x2-all.json
index 5b6f036..b12d4dc 100644
--- a/tools/package/config/samples/network-cfg-fabric-2x2-all.json
+++ b/tools/package/config/samples/network-cfg-fabric-2x2-all.json
@@ -13,12 +13,6 @@
             },
             {
                 "vlan" : "222"
-            },
-            {
-                "ips" : [
-                    "A.A.A.146/32", "A.A.A.147/32", "A.A.A.148/32", "A.A.A.149/32",
-                    "A.A.A.150/32", "A.A.A.151/32", "A.A.A.152/32", "A.A.A.153/32"
-                ]
             }
         ]
     },
@@ -52,9 +46,6 @@
         "interfaces" : [
             {
                 "ips" : [ "10.0.2.254/24" ]
-            },
-            {
-                "ips" : [ "A.A.A.130/32", "A.A.A.131/32" ]
             }
         ]
     },