Dynamic configuration of SR

Change-Id: I847d1cf66f146f213947a336ca0619a3e28ace36
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart
new file mode 100755
index 0000000..0714893
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json
new file mode 100755
index 0000000..36955e1
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json
@@ -0,0 +1,77 @@
+{
+    "ports" : {
+    "of:0000000000000001/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/3" : {
+      "interfaces" : [
+        {
+          "ips" : [ "10.0.1.254/24" ]
+        }
+      ]
+    },
+    "of:0000000000000001/4" : {
+      "interfaces" : [
+        {
+          "ips" : [ "10.0.1.254/24" ]
+        }
+      ]
+    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R1",
+                "nodeSid" : 1,
+                "routerIp" : "192.168.0.1",
+                "routerMac" : "10:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/-1" : {
+            "basic": {
+                "ips": ["10.0.1.1"],
+                "location": "of:0000000000000001/1"
+            }
+        },
+        "00:00:00:00:00:02/-1" : {
+            "basic": {
+                "ips": ["10.0.1.2"],
+                "location": "of:0000000000000001/2"
+            }
+        }
+    },
+    "apps": {
+        "org.onosproject.segmentrouting": {
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5, 7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5, 8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart
new file mode 100755
index 0000000..572f85a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2", "h3", "h4"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json
new file mode 100755
index 0000000..433b594
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json
@@ -0,0 +1,136 @@
+{
+    "ports" : {
+    "of:0000000000000001/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/3" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/4" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000002/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000002/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R1",
+                "nodeSid" : 1,
+                "routerIp" : "192.168.0.1",
+                "routerMac" : "10:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000002" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R2",
+                "nodeSid" : 2,
+                "routerIp" : "192.168.0.2",
+                "routerMac" : "10:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000101" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R1",
+                "nodeSid" : 101,
+                "routerIp" : "192.168.0.101",
+                "routerMac" : "10:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000102" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R2",
+                "nodeSid" : 102,
+                "routerIp" : "192.168.0.102",
+                "routerMac" : "10:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/-1" : {
+            "basic": {
+                "ips": ["10.0.1.1"],
+                "location": "of:0000000000000001/1"
+            }
+        },
+        "00:00:00:00:00:02/-1" : {
+            "basic": {
+                "ips": ["10.0.1.2"],
+                "location": "of:0000000000000001/2"
+            }
+        },
+        "00:00:00:00:00:03/-1" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "location": "of:0000000000000002/1"
+            }
+        },
+        "00:00:00:00:00:04/-1" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "location": "of:0000000000000002/2"
+            }
+        }
+    },
+    "apps": {
+        "org.onosproject.segmentrouting": {
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5,7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5,8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart
new file mode 100755
index 0000000..31fada0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json
new file mode 100755
index 0000000..8230261
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json
@@ -0,0 +1,232 @@
+{
+    "ports" : {
+    "of:0000000000000001/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/3" : {
+        "interfaces" : [
+            {
+                "ips" : [ "10.0.1.254/24" ]
+            }
+        ]
+    },
+    "of:0000000000000001/4" : {
+        "interfaces" : [
+            {
+                "ips" : [ "10.0.1.254/24" ]
+            }
+        ]
+    },
+    "of:0000000000000002/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000002/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000003/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.3.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000003/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.3.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000004/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.4.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000004/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.4.254/24"]
+        }
+        ]
+    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R1",
+                "nodeSid" : 1,
+                "routerIp" : "192.168.0.1",
+                "routerMac" : "10:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000002" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R2",
+                "nodeSid" : 2,
+                "routerIp" : "192.168.0.2",
+                "routerMac" : "10:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000003" : {
+            "basic" :{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R3",
+                "nodeSid" : 3,
+                "routerIp" : "192.168.0.3",
+                "routerMac" : "10:00:00:00:00:03",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000004" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R4",
+                "nodeSid" : 4,
+                "routerIp" : "192.168.0.4",
+                "routerMac" : "10:00:00:00:00:04",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000101" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R1",
+                "nodeSid" : 101,
+                "routerIp" : "192.168.0.101",
+                "routerMac" : "10:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000102" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R2",
+                "nodeSid" : 102,
+                "routerIp" : "192.168.0.102",
+                "routerMac" : "10:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000103" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R3",
+                "nodeSid" : 103,
+                "routerIp" : "192.168.0.103",
+                "routerMac" : "10:00:00:00:01:03",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000104" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R4",
+                "nodeSid" : 104,
+                "routerIp" : "192.168.0.104",
+                "routerMac" : "10:00:00:00:01:04",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/-1" : {
+            "basic": {
+                "ips": ["10.0.1.1"],
+                "location": "of:0000000000000001/1"
+            }
+        },
+        "00:00:00:00:00:02/-1" : {
+            "basic": {
+                "ips": ["10.0.1.2"],
+                "location": "of:0000000000000001/2"
+            }
+        },
+        "00:00:00:00:00:03/-1" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "location": "of:0000000000000002/1"
+            }
+        },
+        "00:00:00:00:00:04/-1" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "location": "of:0000000000000002/2"
+            }
+        },
+        "00:00:00:00:00:05/-1" : {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "location": "of:0000000000000003/1"
+            }
+        },
+        "00:00:00:00:00:06/-1" : {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "location": "of:0000000000000003/2"
+            }
+        },
+        "00:00:00:00:00:07/-1" : {
+            "basic": {
+                "ips": ["10.0.4.1"],
+                "location": "of:0000000000000004/1"
+            }
+        },
+        "00:00:00:00:00:08/-1" : {
+            "basic": {
+                "ips": ["10.0.4.2"],
+                "location": "of:0000000000000004/2"
+            }
+        }
+    },
+    "apps": {
+        "org.onosproject.segmentrouting": {
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5,7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5,8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json
new file mode 100755
index 0000000..992a04c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json
@@ -0,0 +1,16 @@
+{
+    "hosts" : {
+        "00:00:00:00:00:09/-1" : {
+            "basic": {
+                "ips": ["10.0.1.9"],
+                "location": "of:0000000000000001/3"
+            }
+        },
+        "00:00:00:00:09:01/-1" : {
+            "basic": {
+                "ips": ["10.0.9.1"],
+                "location": "of:0000000000000001/4"
+            }
+        }
+    }
+}