Initial base for routing tests.

Change-Id: I4279c50053900aa53bf7192334863ab830d4bc06
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
new file mode 100644
index 0000000..33c7be0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -0,0 +1,72 @@
+"""
+Copyright 2017 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+    TestON is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 2 of the License, or
+    ( at your option ) any later version.
+
+    TestON is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with TestON.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
+
+class SRRoutingTest ():
+
+    topo = {}
+
+    def __init__( self ):
+        self.default = ''
+
+    @staticmethod
+    def runTest( main, test_idx, onosNodes, dhcp, routers, ipv4, ipv6, h1, h2, description):
+
+        skipPackage = False
+        init = False
+        if not hasattr( main, 'apps' ):
+            init = True
+            run.initTest( main )
+
+        # Skip onos packaging if the cluster size stays the same
+        if not init and onosNodes == main.Cluster.numCtrls:
+            skipPackage = True
+
+        main.case('%s, ONOS instance%s' %
+                  (description, onosNodes))
+
+        main.cfgName = 'COMCAST_CONFIG_ipv4=%d_ipv6=%d_dhcp=%d_routers=%d' % \
+            (ipv4, ipv6, dhcp, routers)
+        main.configPath = main.path + "/dependencies/"
+        main.resultFileName = 'CASE%02d' % test_idx
+        main.Cluster.setRunningNode(onosNodes)
+
+        run.installOnos(main, skipPackage=skipPackage, cliSleep=5,
+                        parallel=False)
+
+        if hasattr(main, 'Mininet1'):
+            # Run the test with Mininet
+            mininet_args = ' --dhcp=%s --routers=%s --ipv6=%s --ipv4=%s' % (dhcp, routers, ipv6, ipv4)
+            run.startMininet(main, 'comcast_fabric.py', args=mininet_args)
+        else:
+            # Run the test with physical devices
+            # TODO: connect TestON to the physical network
+            pass
+
+        # ping hosts
+        main.Network.pingHost(src=h1, target=h2)
+
+        if hasattr(main, 'Mininet1'):
+            run.cleanup(main)
+        else:
+            # TODO: disconnect TestON from the physical network
+            pass
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
new file mode 100644
index 0000000..b4cf1dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
@@ -0,0 +1,307 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.1.0.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.1.10.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.0.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.30.254/24" ],
+                    "vlan-untagged": 15
+                }
+            ]
+        },
+        "of:0000000000000002/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.20.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000003/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.10.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+	"of:0000000000000003/9" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.40.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.30.254/24" ],
+                    "vlan-untagged": 15
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.20.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        }, 
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.0.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.10.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000004/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.30.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.20.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.10.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.30.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        } 
+    },
+    "hosts" : { 
+ 	"00:aa:00:00:00:01/None" : {
+		"basic": {
+			"locations": ["of:0000000000000001/3"],
+			"ips": ["10.1.0.1"]
+		     }
+	    },
+	"00:aa:00:00:01:01/None" : {
+		"basic": {
+			"locations": ["of:0000000000000001/4"],
+			"ips": ["10.1.10.1"]
+		     }
+	    },
+	"00:aa:00:00:00:02/None" : {
+		"basic": {
+			"locations": ["of:0000000000000002/6"],
+			"ips": ["10.2.0.1"]
+		     }
+	    },
+	"00:aa:00:00:00:03/None" : {
+		"basic": {
+			"locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+			"ips": ["10.2.30.1"]
+		     }
+	    },
+	"00:aa:00:00:00:04/30" : {
+		"basic": {
+			"locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+			"ips": ["10.2.20.1"]
+		     }
+	    },
+	"00:aa:00:00:00:05/20" : {
+		"basic": {
+			"locations": ["of:0000000000000003/8"],
+			"ips": ["10.2.10.1"]
+		     }
+	    },
+	"00:aa:00:00:01:05/40" : {
+		"basic": {
+			"locations": ["of:0000000000000003/9"],
+			"ips": ["10.2.40.1"]
+		     }
+	    },
+	"00:aa:00:00:00:06/30" : {
+		"basic": {
+			"locations": ["of:0000000000000004/6"],
+			"ips": ["10.3.0.1"]
+		     }
+	    },
+	"00:aa:00:00:00:07/40" : {
+		"basic": {
+			"locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+			"ips": ["10.3.10.1"]
+		     }
+	    },
+	"00:aa:00:00:00:08/40" : {
+		"basic": {
+			"locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+			"ips": ["10.3.30.1"]
+		     }
+	    },
+	"00:aa:00:00:00:0A/40" : {
+		"basic": {
+			"locations": ["of:0000000000000005/8"],
+			"ips": ["10.3.20.1"]
+		     }
+	    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "name" : "s001",
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-105
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "name" : "s002",
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000003",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-95
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "name" : "s003",
+                "ipv4NodeSid" : 3,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:03",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000002",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-90
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "name" : "s004",
+                "ipv4NodeSid" : 4,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:04",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000005",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-85
+            }
+        },
+        "of:0000000000000005" : {
+            "segmentrouting" : {
+                "name" : "s005",
+                "ipv4NodeSid" : 5,
+                "ipv4Loopback" : "192.168.0.5",
+                "routerMac" : "00:00:00:00:00:05",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000004",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-80
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "name" : "s101",
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":42,
+                "longitude":-100
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "name" : "s102",
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                 "driver" : "ofdpa-ovs",
+		 "latitude":42,
+		 "longitude":-95
+            }
+        }   
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
new file mode 100644
index 0000000..b4cf1dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
@@ -0,0 +1,307 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.1.0.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.1.10.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.0.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.30.254/24" ],
+                    "vlan-untagged": 15
+                }
+            ]
+        },
+        "of:0000000000000002/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.20.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000003/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.10.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+	"of:0000000000000003/9" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.40.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.30.254/24" ],
+                    "vlan-untagged": 15
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.2.20.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        }, 
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.0.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.10.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000004/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.30.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/8" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.20.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.10.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000005/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.3.30.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        } 
+    },
+    "hosts" : { 
+ 	"00:aa:00:00:00:01/None" : {
+		"basic": {
+			"locations": ["of:0000000000000001/3"],
+			"ips": ["10.1.0.1"]
+		     }
+	    },
+	"00:aa:00:00:01:01/None" : {
+		"basic": {
+			"locations": ["of:0000000000000001/4"],
+			"ips": ["10.1.10.1"]
+		     }
+	    },
+	"00:aa:00:00:00:02/None" : {
+		"basic": {
+			"locations": ["of:0000000000000002/6"],
+			"ips": ["10.2.0.1"]
+		     }
+	    },
+	"00:aa:00:00:00:03/None" : {
+		"basic": {
+			"locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+			"ips": ["10.2.30.1"]
+		     }
+	    },
+	"00:aa:00:00:00:04/30" : {
+		"basic": {
+			"locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+			"ips": ["10.2.20.1"]
+		     }
+	    },
+	"00:aa:00:00:00:05/20" : {
+		"basic": {
+			"locations": ["of:0000000000000003/8"],
+			"ips": ["10.2.10.1"]
+		     }
+	    },
+	"00:aa:00:00:01:05/40" : {
+		"basic": {
+			"locations": ["of:0000000000000003/9"],
+			"ips": ["10.2.40.1"]
+		     }
+	    },
+	"00:aa:00:00:00:06/30" : {
+		"basic": {
+			"locations": ["of:0000000000000004/6"],
+			"ips": ["10.3.0.1"]
+		     }
+	    },
+	"00:aa:00:00:00:07/40" : {
+		"basic": {
+			"locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+			"ips": ["10.3.10.1"]
+		     }
+	    },
+	"00:aa:00:00:00:08/40" : {
+		"basic": {
+			"locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+			"ips": ["10.3.30.1"]
+		     }
+	    },
+	"00:aa:00:00:00:0A/40" : {
+		"basic": {
+			"locations": ["of:0000000000000005/8"],
+			"ips": ["10.3.20.1"]
+		     }
+	    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "name" : "s001",
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-105
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "name" : "s002",
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000003",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-95
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "name" : "s003",
+                "ipv4NodeSid" : 3,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:03",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000002",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-90
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "name" : "s004",
+                "ipv4NodeSid" : 4,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:04",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000005",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-85
+            }
+        },
+        "of:0000000000000005" : {
+            "segmentrouting" : {
+                "name" : "s005",
+                "ipv4NodeSid" : 5,
+                "ipv4Loopback" : "192.168.0.5",
+                "routerMac" : "00:00:00:00:00:05",
+                "isEdgeRouter" : true,
+                "pairLocalPort" : 5,
+                "pairDeviceId": "of:0000000000000004",
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":34,	
+		"longitude":-80
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "name" : "s101",
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs",
+		"latitude":42,
+                "longitude":-100
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "name" : "s102",
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                 "driver" : "ofdpa-ovs",
+		 "latitude":42,
+		 "longitude":-95
+            }
+        }   
+    }
+}