Merge "Add Network Configuration subsytem test"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 7afcfa8..07acc01 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1900,18 +1900,32 @@
         else:
             main.log.error( "Connection failed to the Mininet host" )
 
-    def flowComp( self, flow1, flow2 ):
-        if flow1 == flow2:
-            return main.TRUE
-        else:
-            main.log.info( "Flow tables do not match, printing tables:" )
-            main.log.info( "Flow Table 1:" )
-            main.log.info( flow1 )
-            main.log.info( "Flow Table 2:" )
-            main.log.info( flow2 )
-            return main.FALSE
+    def flowTableComp( self, flowTable1, flowTable2 ):
+        # This function compares the selctors and treatments of each flow
+        try:
+            if len(flowTable1) != len(flowTable2):
+                main.log.warn( "Flow table lengths do not match" )
+                return main.FALSE
 
-    def parseFlowTable( self, flows, debug=True ):
+            for i in range( len(flowTable1) ):
+                flow1 = str(flowTable1[i].get( "selector" )) + str(flowTable1[i].get( "treatment" ))
+                flow2 = str(flowTable2[i].get( "selector" )) + str(flowTable2[i].get( "treatment" ))
+                if flow1 != flow2:
+                    main.log.info( "Flow tables do not match, printing tables:" )
+                    main.log.info( "Before:" )
+                    main.log.info( flow1 )
+                    main.log.info( "After:" )
+                    main.log.info( flow2 )
+                    return main.FALSE
+
+            return main.TRUE
+
+        except Exception:
+            main.log.exception( "Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def parseFlowTable( self, flowTable, version="", debug=True ):
         '''
         Discription: Parses flows into json format.
         NOTE: this can parse any string thats separated with commas
@@ -1923,30 +1937,74 @@
                 debug: prints out the final result
         returns: A list of flows in json format
         '''
-        # Parse the flows
-        jsonFlows = []
-        for flow in flows:
-            # split on the comma
-            flow = flow.split(",")
-            # get rid of empty elements
-            flow = [f for f in flow if f != ""]
+        jsonFlowTable = []
+        for flow in flowTable:
             jsonFlow = {}
-            for f in flow:
-                # separate the key and the value
-                if "=" in f:
-                    f = f.split("=")
-                    key = f[0]
-                    # get rid of unwanted spaces
-                    if key[0] == " ": key = key[1:]
-                    val = f[1]
-                    jsonFlow.update( {key:val} )
-            jsonFlows.append( jsonFlow )
+            # split up the fields of the flow
+            parsedFlow = flow.split(", ")
+            # get rid of any spaces in front of the field
+            for i in range( len(parsedFlow) ):
+                item = parsedFlow[i]
+                if item[0] == " ":
+                    parsedFlow[i] = item[1:]
+            # grab the selector and treatment from the parsed flow
+            # the last element is the selector and the treatment
+            temp = parsedFlow.pop(-1)
+            # split up the selector and the treatment
+            temp = temp.split(" ")
+            index = 0
+            # parse the flags
+            # NOTE: This only parses one flag
+            flag = {}
+            if version == "1.3":
+                flag = {"flag":[temp[index]]}
+                index += 1
+            # the first element is the selector and split it up
+            sel = temp[index]
+            index += 1
+            sel = sel.split(",")
+            # the priority is stuck in the selecter so put it back
+            # in the flow
+            parsedFlow.append(sel.pop(0))
+            # parse selector
+            criteria = []
+            for item in sel:
+                # this is the type of the packet e.g. "arp"
+                if "=" not in item:
+                    criteria.append( {"type":item} )
+                else:
+                    field = item.split("=")
+                    criteria.append( {field[0]:field[1]} )
+            selector = {"selector": {"criteria":sorted(criteria)} }
+            treat = temp[index]
+            # get rid of the action part e.g. "action=output:2"
+            # we will add it back later
+            treat = treat.split("=")
+            treat.pop(0)
+            # parse treatment
+            action = []
+            for item in treat:
+                field = item.split(":")
+                action.append( {field[0]:field[1]} )
+            # create the treatment field and add the actions
+            treatment = {"treatment": {"action":sorted(action)} }
+            # parse the rest of the flow
+            for item in parsedFlow:
+                field = item.split("=")
+                jsonFlow.update( {field[0]:field[1]} )
+            # add the treatment and the selector to the json flow
+            jsonFlow.update( selector )
+            jsonFlow.update( treatment )
+            jsonFlow.update( flag )
 
-        if debug: print "jsonFlows:\n{}\n\n".format(jsonFlows)
+            if debug: main.log.debug( "\033[94mJson flow:\033[0m\n{}\n".format(jsonFlow) )
 
-        return jsonFlows
+            # add the json flow to the json flow table
+            jsonFlowTable.append( jsonFlow )
 
-    def getFlowTable( self, sw, version="1.3", debug=True):
+        return jsonFlowTable
+
+    def getFlowTable( self, sw, version="", debug=True):
         '''
         Discription: Returns the flow table(s) on a switch or switches in a list.
             Each element is a flow.
@@ -1961,16 +2019,17 @@
         try:
             switches = []
             if type(sw) is list:
-                switches.extends(sw)
+                switches.extend(sw)
             else: switches.append(sw)
 
             flows = []
             for s in switches:
                 cmd = "sh ovs-ofctl dump-flows " + s
 
-                if "1.3" in version:
+                if "1.0" == version:
+                    cmd += " -F OpenFlow10-table_id"
+                elif "1.3" == version:
                     cmd += " -O OpenFlow13"
-                else: cmd += " -F OpenFlow10-table_id"
 
                 main.log.info( "Sending: " + cmd )
                 self.handle.sendline( cmd )
@@ -1986,7 +2045,7 @@
 
             if debug: print "Flows:\n{}\n\n".format(flows)
 
-            return self.parseFlowTable( flows, debug )
+            return self.parseFlowTable( flows, version, debug )
 
         except pexpect.TIMEOUT:
             main.log.exception( self.name + ": Command timed out" )
diff --git a/TestON/tests/FUNCflow/FUNCflow.params b/TestON/tests/FUNCflow/FUNCflow.params
index d1a3c58..b97ff7b 100755
--- a/TestON/tests/FUNCflow/FUNCflow.params
+++ b/TestON/tests/FUNCflow/FUNCflow.params
@@ -16,7 +16,7 @@
     # 1500 - Add flows with UDP selectors
     # 2000 - Delete flows
 
-    <testcases>1,2,10,1000,2000,1200,2000,1300,2000,1400,2000,1500,100</testcases>
+    <testcases>1,2,10,1000,2000,1100,2000,1200,2000,1300,2000,1400,2000,1500,100</testcases>
 
     <SCALE>
         <max>1</max>
diff --git a/TestON/tests/FUNCflow/FUNCflow.py b/TestON/tests/FUNCflow/FUNCflow.py
index 929596c..1e22fd2 100644
--- a/TestON/tests/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNCflow/FUNCflow.py
@@ -116,7 +116,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
@@ -236,7 +236,7 @@
 
         time.sleep( main.startMNSleep )
 
-        main.step( "Conmparing MN topology to ONOS topology" )
+        main.step( "Comparing MN topology to ONOS topology" )
         main.log.info( "Gathering topology information" )
         devicesResults = main.TRUE
         linksResults = main.TRUE
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 483b2b4..e5d0654 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -142,7 +142,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
@@ -264,7 +264,7 @@
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
 
-        main.step( "Conmparing Mininet topology to ONOS topology" )
+        main.step( "Comparing Mininet topology to ONOS topology" )
 
         while ( attempts >= 0 ) and\
             ( not devicesResults or not linksResults or not hostsResults ):
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNCintentRest/FUNCintentRest.py
index 489fdd1..c5f12ab 100644
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.py
@@ -152,7 +152,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
@@ -262,7 +262,7 @@
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
 
-        main.step( "Conmparing MN topology to ONOS topology" )
+        main.step( "Comparing MN topology to ONOS topology" )
         for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
             if devices[ controller ] and ports[ controller ] and\
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
index 724e14b..0d189e3 100644
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
@@ -142,7 +142,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
diff --git a/TestON/tests/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNCoptical/FUNCoptical.py
index b5ca189..3ab0df4 100644
--- a/TestON/tests/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNCoptical/FUNCoptical.py
@@ -136,7 +136,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
@@ -345,7 +345,7 @@
         mnLinks = 46
         mnHosts = 6
 
-        main.step( "Conmparing Mininet topology to ONOS topology" )
+        main.step( "Comparing Mininet topology to ONOS topology" )
 
         while ( attempts >= 0 ) and\
             ( not devicesResults or not linksResults or not hostsResults ):
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index 7197d5e..79d575b 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -1413,7 +1413,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( "s" + str( i ), version="1.3" ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -2060,18 +2060,13 @@
         main.step( "Get the OF Table entries and compare to before " +
                    "component failure" )
         FlowTables = main.TRUE
-        flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet1.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
+            tmpFlows = main.Mininet1.getFlowTable( "s" + str( i + 1 ), version="1.3", debug=False )
+            FlowTables = FlowTables and main.Mininet1.flowTableComp( flows[i], tmpFlows )
             if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
+                main.log.warn( "Differences in flow table for switch: s{}".format( i + 1 ) )
+
         utilities.assert_equals(
             expect=main.TRUE,
             actual=FlowTables,
diff --git a/TestON/tests/HAkillNodes/HAkillNodes.py b/TestON/tests/HAkillNodes/HAkillNodes.py
index 9bfe947..d26df2f 100644
--- a/TestON/tests/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HAkillNodes/HAkillNodes.py
@@ -1437,7 +1437,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( "s" + str( i ), version="1.3", debug=False ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -2049,18 +2049,13 @@
         main.step( "Get the OF Table entries and compare to before " +
                    "component failure" )
         FlowTables = main.TRUE
-        flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet1.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
+            tmpFlows = main.Mininet1.getFlowTable( "s" + str( i + 1 ), version="1.3", debug=False )
+            FlowTables = FlowTables and main.Mininet1.flowTableComp( flows[i], tmpFlows )
             if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
+                main.log.warn( "Differences in flow table for switch: s{}".format( i + 1 ) )
+
         utilities.assert_equals(
             expect=main.TRUE,
             actual=FlowTables,
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index c64e05e..7de57b5 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -1392,10 +1392,11 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( "s" + str( i ), version="1.3", debug=False ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
+
         # TODO: Compare switch flow tables with ONOS flow tables
 
         main.step( "Start continuous pings" )
@@ -1953,18 +1954,13 @@
         main.step( "Get the OF Table entries and compare to before " +
                    "component failure" )
         FlowTables = main.TRUE
-        flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet1.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
+            tmpFlows = main.Mininet1.getFlowTable( "s" + str( i + 1 ), version="1.3", debug=False )
+            FlowTables = FlowTables and main.Mininet1.flowTableComp( flows[i], tmpFlows )
             if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
+                main.log.warn( "Differences in flow table for switch: s{}".format( i + 1 ) )
+
         utilities.assert_equals(
             expect=main.TRUE,
             actual=FlowTables,
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index a1652e9..52bf2f9 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -1044,7 +1044,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( "s" + str( i ), version="1.3", debug=False ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -1368,18 +1368,13 @@
         main.step( "Get the OF Table entries and compare to before " +
                    "component failure" )
         FlowTables = main.TRUE
-        flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet1.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
+            tmpFlows = main.Mininet1.getFlowTable( "s" + str( i + 1 ), version="1.3", debug=False )
+            FlowTables = FlowTables and main.Mininet1.flowTableComp( flows[i], tmpFlows )
             if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
+                main.log.warn( "Differences in flow table for switch: s{}".format( i + 1 ) )
+
         utilities.assert_equals(
             expect=main.TRUE,
             actual=FlowTables,
diff --git a/TestON/tests/HAstopNodes/HAstopNodes.py b/TestON/tests/HAstopNodes/HAstopNodes.py
index 1088374..ce3bb6c 100644
--- a/TestON/tests/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HAstopNodes/HAstopNodes.py
@@ -1426,7 +1426,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( "s" + str( i ), version="1.3", debug=False ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -2038,18 +2038,13 @@
         main.step( "Get the OF Table entries and compare to before " +
                    "component failure" )
         FlowTables = main.TRUE
-        flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet1.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
+            tmpFlows = main.Mininet1.getFlowTable( "s" + str( i + 1 ), version="1.3", debug=False )
+            FlowTables = FlowTables and main.Mininet1.flowTableComp( flows[i], tmpFlows )
             if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
+                main.log.warn( "Differences in flow table for switch: s{}".format( i + 1 ) )
+
         utilities.assert_equals(
             expect=main.TRUE,
             actual=FlowTables,
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
index 5152306..2122570 100644
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
@@ -110,7 +110,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPFcbench/SCPFcbench.py
index a2cbee0..382b16f 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPFcbench/SCPFcbench.py
@@ -77,7 +77,7 @@
 
         #kill off all onos processes
         main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
+        main.log.step("before initiating environment setup")
         for node in range(1, maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
 
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
index ac2c0ad..ddb9d7c 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
@@ -86,7 +86,7 @@
 
         #kill off all onos processes
         main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
+        main.log.step("before initiating environment setup")
         for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
 
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
index eb581ea..e017a48 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
@@ -101,7 +101,7 @@
 
         #kill off all onos processes
         main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
+        main.log.step("before initiating environment setup")
         for node in range(maxNodes):
             main.ONOSbench.onosDie(ONOSIp[node])
 
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 1c9f1c3..325cdbf 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -81,7 +81,7 @@
 
         #kill off all onos processes
         main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
+        main.log.step("before initiating environment setup")
         for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
 
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 0dafc51..7d70d7f 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -82,7 +82,7 @@
 
         #kill off all onos processes
         main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
+        main.log.step("before initiating environment setup")
         for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
 
diff --git a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
index a790864..011b275 100644
--- a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
+++ b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
@@ -110,7 +110,7 @@
 
         main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
diff --git a/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
index 4e29115..8664f21 100644
--- a/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
@@ -134,7 +134,7 @@
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating enviornment setup" )
+                       " before initiating environment setup" )
 
         for i in range( main.numCtrls ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
diff --git a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
index 4ad87be..1f4510f 100644
--- a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
@@ -108,7 +108,7 @@
         scale.remove(scale[0])
 
         #kill off all onos processes
-        main.log.step("Safety check, killing all ONOS processes before initiating enviornment setup")
+        main.log.step("Safety check, killing all ONOS processes before initiating environment setup")
         for node in range(main.maxNodes):
             main.ONOSbench.onosDie(main.ONOSIp[node])
 
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py
new file mode 100644
index 0000000..ddd8c1e
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py
@@ -0,0 +1,143 @@
+
+def checkRouteNum( main, routeNumExpected ):
+    main.step( "Check routes installed" )
+    main.log.info( "Route number expected:" )
+    main.log.info( routeNumExpected )
+    main.log.info( "Route number from ONOS CLI:" )
+
+    routeNumActual = main.ONOScli.ipv4RouteNumber()
+    main.log.info( routeNumActual )
+    utilities.assertEquals( \
+        expect = routeNumExpected, actual = routeNumActual,
+        onpass = "Route number is correct!",
+        onfail = "Route number is wrong!" )
+
+def checkM2SintentNum( main, intentNumExpected ):
+    main.step( "Check M2S intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "multiPointToSinglePoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "M2S intent number is correct!",
+        onfail = "M2S intent number is wrong!" )
+
+def checkP2PintentNum( main, intentNumExpected ):
+    main.step( "Check P2P intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "pointToPoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "P2P intent number is correct!",
+        onfail = "P2P intent number is wrong!" )
+
+def checkFlowNum( main, switch, flowNumExpected ):
+    main.step( "Check flow entry number in " + switch )
+    main.log.info( "Flow number expected:" )
+    main.log.info( flowNumExpected )
+    main.log.info( "Flow number actual:" )
+    flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    main.log.info( flowNumActual )
+    utilities.assertEquals( \
+        expect = flowNumExpected, actual = flowNumActual,
+        onpass = "Flow number in " + switch + " is correct!",
+        onfail = "Flow number in " + switch + " is wrong!" )
+
+
+def pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP speaker and peer pair
+    Optional argument:
+        * speakers - BGP speakers
+        * peers - BGP peers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    if len( speakers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.cleanup()
+        main.exit()
+    if len( peers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.cleanup()
+        main.exit()
+
+    if expectAllSuccess:
+        main.step( "BGP speakers ping peers, expect all tests to succeed" )
+    else:
+        main.step( "BGP speakers ping peers, expect all tests to fail" )
+
+    result = True
+    if expectAllSuccess:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+                result = result and ( tmpResult == main.TRUE )
+    else:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    if result == False:
+        main.cleanup()
+        main.exit()
+
+
+def pingHostToHost( main, hosts = ["host64514", "host64515", "host64516"],
+                expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP host pair
+    Optional argument:
+        * hosts - hosts behind BGP peer routers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    main.step( "Check ping between each host pair" )
+    if len( hosts ) == 0:
+        main.log.error( "Parameter hosts can not be empty." )
+        main.cleanup()
+        main.exit()
+
+    result = True
+    if expectAllSuccess:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.TRUE )
+    else:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.FALSE )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    '''
+    if result == False:
+        main.cleanup()
+        main.exit()
+    '''
+
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/USECASE_SdnipI2MN.py b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/USECASE_SdnipI2MN.py
new file mode 100755
index 0000000..b034d34
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/USECASE_SdnipI2MN.py
@@ -0,0 +1,387 @@
+#!/usr/bin/python
+
+"""
+Set up the SDN-IP topology as same as it on Internet2
+"""
+
+"""
+AS 64513, (SDN AS)
+AS 64514, reachable by 10.0.4.1
+AS 64515, reachable by 10.0.5.1
+AS 64516, reachable by 10.0.6.1
+"""
+
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+
+import os.path
+import time
+from subprocess import Popen, STDOUT, PIPE
+
+QUAGGA_DIR = '/usr/lib/quagga'
+QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/'
+# onos1IP = '10.254.1.201'
+numSw = 39
+
+
+class SDNTopo( Topo ):
+    "SDN Topology"
+
+    def __init__( self, *args, **kwargs ):
+
+        Topo.__init__( self, *args, **kwargs )
+
+        # BGP peer hosts
+        peer64514 = self.addHost( 'peer64514' )
+        peer64515 = self.addHost( 'peer64515' )
+        peer64516 = self.addHost( 'peer64516' )
+
+        '''
+        sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' )
+        sw2 = self.addSwitch( 'PORT', dpid = '00000000000000a2' )
+        sw3 = self.addSwitch( 'SUNN', dpid = '00000000000000a3' )
+        sw4 = self.addSwitch( 'RENO', dpid = '00000000000000a4' )
+        sw5 = self.addSwitch( 'LOSA', dpid = '00000000000000a5' )
+        sw6 = self.addSwitch( 'MISS', dpid = '00000000000000a6' )
+        sw7 = self.addSwitch( 'LASV', dpid = '00000000000000a7' )
+        sw8 = self.addSwitch( 'SALT', dpid = '00000000000000a8' )
+        sw9 = self.addSwitch( 'PHOE', dpid = '00000000000000a9' )
+        sw10 = self.addSwitch( 'TUCS', dpid = '0000000000000a10' )
+        sw11 = self.addSwitch( 'DENV', dpid = '0000000000000a11' )
+        sw12 = self.addSwitch( 'ELPA', dpid = '0000000000000a12' )
+        sw13 = self.addSwitch( 'MINN', dpid = '0000000000000a13' )
+        sw14 = self.addSwitch( 'KANS', dpid = '0000000000000a14' )
+        sw15 = self.addSwitch( 'TULS', dpid = '0000000000000a15' )
+        sw16 = self.addSwitch( 'DALL', dpid = '0000000000000a16' )
+        sw17 = self.addSwitch( 'HOUH', dpid = '0000000000000a17' )
+        sw18 = self.addSwitch( 'COLU', dpid = '0000000000000a18' )
+        sw19 = self.addSwitch( 'JCSN', dpid = '0000000000000a19' )
+        sw20 = self.addSwitch( 'BATO', dpid = '0000000000000a20' )
+        sw21 = self.addSwitch( 'EQCH', dpid = '0000000000000a21' )
+        sw22 = self.addSwitch( 'STAR', dpid = '0000000000000a22' )
+        sw23 = self.addSwitch( 'CHIC', dpid = '0000000000000a23' )
+        sw24 = self.addSwitch( 'INDI', dpid = '0000000000000a24' )
+        sw25 = self.addSwitch( 'CINC', dpid = '0000000000000a25' )
+        sw26 = self.addSwitch( 'LOUI', dpid = '0000000000000a26' )
+        sw27 = self.addSwitch( 'ATLA', dpid = '0000000000000a27' )
+        sw28 = self.addSwitch( 'JACK', dpid = '0000000000000a28' )
+        sw29 = self.addSwitch( 'CLEV', dpid = '0000000000000a29' )
+        sw30 = self.addSwitch( 'PITT', dpid = '0000000000000a30' )
+        sw31 = self.addSwitch( 'ASHB', dpid = '0000000000000a31' )
+        sw32 = self.addSwitch( 'WASH', dpid = '0000000000000a32' )
+        sw33 = self.addSwitch( 'RALE', dpid = '0000000000000a33' )
+        sw34 = self.addSwitch( 'CHAR', dpid = '0000000000000a34' )
+        sw35 = self.addSwitch( 'ALBA', dpid = '0000000000000a35' )
+        sw36 = self.addSwitch( 'BOST', dpid = '0000000000000a36' )
+        sw37 = self.addSwitch( 'HART', dpid = '0000000000000a37' )
+        sw38 = self.addSwitch( 'NEWY', dpid = '0000000000000a38' )
+        sw39 = self.addSwitch( 'PHIL', dpid = '0000000000000a39' )
+        '''
+        sw1 = self.addSwitch( 'sw1', dpid = '00000000000000a1' )
+        sw2 = self.addSwitch( 'sw2', dpid = '00000000000000a2' )
+        sw3 = self.addSwitch( 'sw3', dpid = '00000000000000a3' )
+        sw4 = self.addSwitch( 'sw4', dpid = '00000000000000a4' )
+        sw5 = self.addSwitch( 'sw5', dpid = '00000000000000a5' )
+        sw6 = self.addSwitch( 'sw6', dpid = '00000000000000a6' )
+        sw7 = self.addSwitch( 'sw7', dpid = '00000000000000a7' )
+        sw8 = self.addSwitch( 'sw8', dpid = '00000000000000a8' )
+        sw9 = self.addSwitch( 'sw9', dpid = '00000000000000a9' )
+        sw10 = self.addSwitch( 'sw10', dpid = '0000000000000a10' )
+        sw11 = self.addSwitch( 'sw11', dpid = '0000000000000a11' )
+        sw12 = self.addSwitch( 'sw12', dpid = '0000000000000a12' )
+        sw13 = self.addSwitch( 'sw13', dpid = '0000000000000a13' )
+        sw14 = self.addSwitch( 'sw14', dpid = '0000000000000a14' )
+        sw15 = self.addSwitch( 'sw15', dpid = '0000000000000a15' )
+        sw16 = self.addSwitch( 'sw16', dpid = '0000000000000a16' )
+        sw17 = self.addSwitch( 'sw17', dpid = '0000000000000a17' )
+        sw18 = self.addSwitch( 'sw18', dpid = '0000000000000a18' )
+        sw19 = self.addSwitch( 'sw19', dpid = '0000000000000a19' )
+        sw20 = self.addSwitch( 'sw20', dpid = '0000000000000a20' )
+        sw21 = self.addSwitch( 'sw21', dpid = '0000000000000a21' )
+        sw22 = self.addSwitch( 'sw22', dpid = '0000000000000a22' )
+        sw23 = self.addSwitch( 'sw23', dpid = '0000000000000a23' )
+        sw24 = self.addSwitch( 'sw24', dpid = '0000000000000a24' )
+        sw25 = self.addSwitch( 'sw25', dpid = '0000000000000a25' )
+        sw26 = self.addSwitch( 'sw26', dpid = '0000000000000a26' )
+        sw27 = self.addSwitch( 'sw27', dpid = '0000000000000a27' )
+        sw28 = self.addSwitch( 'sw28', dpid = '0000000000000a28' )
+        sw29 = self.addSwitch( 'sw29', dpid = '0000000000000a29' )
+        sw30 = self.addSwitch( 'sw30', dpid = '0000000000000a30' )
+        sw31 = self.addSwitch( 'sw31', dpid = '0000000000000a31' )
+        sw32 = self.addSwitch( 'sw32', dpid = '0000000000000a32' )
+        sw33 = self.addSwitch( 'sw33', dpid = '0000000000000a33' )
+        sw34 = self.addSwitch( 'sw34', dpid = '0000000000000a34' )
+        sw35 = self.addSwitch( 'sw35', dpid = '0000000000000a35' )
+        sw36 = self.addSwitch( 'sw36', dpid = '0000000000000a36' )
+        sw37 = self.addSwitch( 'sw37', dpid = '0000000000000a37' )
+        sw38 = self.addSwitch( 'sw38', dpid = '0000000000000a38' )
+        sw39 = self.addSwitch( 'sw39', dpid = '0000000000000a39' )
+
+
+        # Add a layer2 switch for control plane connectivity
+        # This switch isn't part of the SDN topology
+        # We'll use the ovs-controller to turn this into a learning switch
+        swCtl100 = self.addSwitch( 'swCtl100', dpid = '0000000000000100' )
+
+
+        # BGP speaker hosts
+        speaker1 = self.addHost( 'speaker1' )
+        speaker2 = self.addHost( 'speaker2' )
+
+        root = self.addHost( 'root', inNamespace = False , ip = '0' )
+
+        # hosts behind each AS
+        host64514 = self.addHost( 'host64514' )
+        host64515 = self.addHost( 'host64515' )
+        host64516 = self.addHost( 'host64516' )
+
+        self.addLink( 'speaker1', sw24 )
+        self.addLink( 'speaker2', sw24 )
+
+        # connect all switches
+        self.addLink( sw1, sw2 )
+        self.addLink( sw1, sw6 )
+        self.addLink( sw1, sw8 )
+        self.addLink( sw2, sw3 )
+        self.addLink( sw3, sw4 )
+        self.addLink( sw3, sw5 )
+        self.addLink( sw4, sw8 )
+        self.addLink( sw5, sw7 )
+        self.addLink( sw5, sw9 )
+        self.addLink( sw6, sw13 )
+        self.addLink( sw7, sw8 )
+        self.addLink( sw8, sw11 )
+        self.addLink( sw9, sw10 )
+        self.addLink( sw10, sw12 )
+        self.addLink( sw11, sw12 )
+        self.addLink( sw11, sw14 )
+        self.addLink( sw12, sw17 )
+        self.addLink( sw13, sw14 )
+        self.addLink( sw13, sw21 )
+        self.addLink( sw14, sw15 )
+        self.addLink( sw14, sw18 )
+        self.addLink( sw14, sw23 )
+        self.addLink( sw15, sw16 )
+        self.addLink( sw16, sw17 )
+        self.addLink( sw17, sw19 )
+        self.addLink( sw17, sw20 )
+        self.addLink( sw18, sw23 )
+        self.addLink( sw19, sw27 )
+        self.addLink( sw20, sw28 )
+        self.addLink( sw21, sw22 )
+        self.addLink( sw21, sw29 )
+        self.addLink( sw22, sw23 )
+        self.addLink( sw23, sw24 )
+        self.addLink( sw23, sw31 )
+        self.addLink( sw24, sw25 )
+        self.addLink( sw25, sw26 )
+        self.addLink( sw26, sw27 )
+        self.addLink( sw27, sw28 )
+        self.addLink( sw27, sw34 )
+        self.addLink( sw29, sw30 )
+        self.addLink( sw29, sw35 )
+        self.addLink( sw30, sw31 )
+        self.addLink( sw31, sw32 )
+        self.addLink( sw32, sw33 )
+        self.addLink( sw32, sw39 )
+        self.addLink( sw33, sw34 )
+        self.addLink( sw35, sw36 )
+        self.addLink( sw36, sw37 )
+        self.addLink( sw37, sw38 )
+        self.addLink( sw38, sw39 )
+
+        # connection between switches and peers
+        self.addLink( peer64514, sw32 )
+        self.addLink( peer64515, sw8 )
+        self.addLink( peer64516, sw28 )
+
+        # connection between BGP peer and hosts behind the BGP peer
+        self.addLink( peer64514, host64514 )
+        self.addLink( peer64515, host64515 )
+        self.addLink( peer64516, host64516 )
+
+        # Internal Connection To Hosts
+        self.addLink( swCtl100, peer64514 )
+        self.addLink( swCtl100, peer64515 )
+        self.addLink( swCtl100, peer64516 )
+        self.addLink( swCtl100, speaker1 )
+        self.addLink( swCtl100, speaker2 )
+
+
+
+        # add host64514 to control plane for ping test
+        self.addLink( swCtl100, host64514 )
+        self.addLink( swCtl100, root )
+
+
+def startsshd( host ):
+    "Start sshd on host"
+    info( '*** Starting sshd\n' )
+    name, intf, ip = host.name, host.defaultIntf(), host.IP()
+    banner = '/tmp/%s.banner' % name
+    host.cmd( 'echo "Welcome to %s at %s" >  %s' % ( name, ip, banner ) )
+    host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+    info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+    for h in hosts:
+        startsshd( h )
+
+def stopsshd():
+    "Stop *all* sshd processes with a custom banner"
+    info( '*** Shutting down stale sshd/Banner processes ',
+          quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def startquagga( host, num, config_file ):
+    info( '*** Starting Quagga on %s\n' % host )
+    host.cmd( "cd %s" % QUAGGA_CONFIG_DIR )
+    zebra_cmd = \
+    '%s/zebra -d -f  ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid'\
+     % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+    quagga_cmd = '%s/bgpd -d -f %s -z %s/zserv%s.api -i %s/bgpd%s.pid' \
+    % ( QUAGGA_DIR, config_file, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+
+    print zebra_cmd
+    print quagga_cmd
+
+    host.cmd( zebra_cmd )
+    host.cmd( quagga_cmd )
+
+def startquaggahost5( host, num ):
+    info( '*** Starting Quagga on %s\n' % host )
+    zebra_cmd = \
+    '%s/zebra -d -f  ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' \
+    % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+    quagga_cmd = \
+    '%s/bgpd -d -f ./as4quaggas/quagga%s.conf -z %s/zserv%s.api -i %s/bgpd%s.pid'\
+     % ( QUAGGA_DIR, num, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+
+    host.cmd( zebra_cmd )
+    host.cmd( quagga_cmd )
+
+
+def stopquagga():
+    quietRun( 'sudo pkill -9 -f bgpd' )
+    quietRun( 'sudo pkill -9 -f zebra' )
+
+def sdn1net():
+    topo = SDNTopo()
+    info( '*** Creating network\n' )
+   # time.sleep( 30 )
+    net = Mininet( topo = topo, controller = RemoteController )
+
+
+    speaker1, speaker2, peer64514, peer64515, peer64516 = \
+    net.get( 'speaker1', 'speaker2' ,
+             'peer64514', 'peer64515', 'peer64516' )
+
+    # Adding addresses to host64513_1 interface connected to sw24
+    # for BGP peering
+    speaker1.setMAC( '00:00:00:00:00:01', 'speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.4.101/24 dev speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.5.101/24 dev speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.6.101/24 dev speaker1-eth0' )
+
+    speaker1.defaultIntf().setIP( '10.1.4.101/24' )
+    speaker1.defaultIntf().setMAC( '00:00:00:00:00:01' )
+
+    # Net has to be start after adding the above link
+    net.start()
+
+    # setup configuration on the interface connected to switch
+    peer64514.cmd( "ifconfig  peer64514-eth0 10.0.4.1 up" )
+    peer64514.setMAC( '00:00:00:00:00:04', 'peer64514-eth0' )
+    peer64515.cmd( "ifconfig  peer64515-eth0 10.0.5.1 up" )
+    peer64515.setMAC( '00:00:00:00:00:05', 'peer64515-eth0' )
+    peer64516.cmd( "ifconfig  peer64516-eth0 10.0.6.1 up" )
+    peer64516.setMAC( '00:00:00:00:00:06', 'peer64516-eth0' )
+
+    # setup configuration on the interface connected to hosts
+    peer64514.setIP( "4.0.0.254", 8, "peer64514-eth1" )
+    peer64514.setMAC( '00:00:00:00:00:44', 'peer64514-eth1' )
+    peer64515.setIP( "5.0.0.254", 8, "peer64515-eth1" )
+    peer64515.setMAC( '00:00:00:00:00:55', 'peer64515-eth1' )
+    peer64516.setIP( "6.0.0.254", 8, "peer64516-eth1" )
+    peer64516.setMAC( '00:00:00:00:00:66', 'peer64516-eth1' )
+
+    # enable forwarding on BGP peer hosts
+    peer64514.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    peer64515.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    peer64516.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+
+    # config interface for control plane connectivity
+    peer64514.setIP( "192.168.0.4", 24, "peer64514-eth2" )
+    peer64515.setIP( "192.168.0.5", 24, "peer64515-eth2" )
+    peer64516.setIP( "192.168.0.6", 24, "peer64516-eth2" )
+
+    # Setup hosts in each non-SDN AS
+    host64514, host64515, host64516 = \
+    net.get( 'host64514', 'host64515', 'host64516' )
+    host64514.cmd( 'ifconfig host64514-eth0 4.0.0.1 up' )
+    host64514.cmd( 'ip route add default via 4.0.0.254' )
+    host64514.setIP( '192.168.0.44', 24, 'host64514-eth1' )  # for control plane
+    host64515.cmd( 'ifconfig host64515-eth0 5.0.0.1 up' )
+    host64515.cmd( 'ip route add default via 5.0.0.254' )
+    host64516.cmd( 'ifconfig host64516-eth0 6.0.0.1 up' )
+    host64516.cmd( 'ip route add default via 6.0.0.254' )
+
+
+    # set up swCtl100 as a learning
+    swCtl100 = net.get( 'swCtl100' )
+    swCtl100.cmd( 'ovs-vsctl set-controller swCtl100 none' )
+    swCtl100.cmd( 'ovs-vsctl set-fail-mode swCtl100 standalone' )
+
+    # connect all switches to controller
+    '''
+    for i in range ( 1, numSw + 1 ):
+        swX = net.get( 'sw%s' % ( i ) )
+        swX.cmd( 'ovs-vsctl set-controller sw%s tcp:%s:6653' % ( i, onos1IP ) )
+    '''
+    # Start Quagga on border routers
+    '''
+    for i in range ( 64514, 64516 + 1 ):
+        startquagga( 'peer%s' % ( i ), i, 'quagga%s.conf' % ( i ) )
+    '''
+    startquagga( peer64514, 64514, 'quagga64514.conf' )
+    startquagga( peer64515, 64515, 'quagga64515.conf' )
+    startquagga( peer64516, 64516, 'quagga64516.conf' )
+
+    # start Quagga in SDN network
+    startquagga( speaker1, 64513, 'quagga-sdn.conf' )
+
+
+    root = net.get( 'root' )
+    root.intf( 'root-eth0' ).setIP( '1.1.1.2/24' )
+    root.cmd( 'ip addr add 192.168.0.100/24 dev root-eth0' )
+
+    speaker1.intf( 'speaker1-eth1' ).setIP( '1.1.1.1/24' )
+
+
+    stopsshd()
+
+    hosts = [ peer64514, peer64515, peer64516, host64514];
+    startsshds( hosts )
+    #
+    '''
+    forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', onos1IP )
+    root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \
+    -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, onos1IP ) )
+
+    '''
+    # time.sleep( 3000000000 )
+    CLI( net )
+
+
+    stopsshd()
+    stopquagga()
+    net.stop()
+
+if __name__ == '__main__':
+    setLogLevel( 'debug' )
+    sdn1net()
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/fsfw.xml b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/fsfw.xml
new file mode 100644
index 0000000..8e57ad5
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/fsfw.xml
@@ -0,0 +1,440 @@
+<flowspace_firewall>
+    <switch name="sw1" dpid="00000000000000a1" flush_rules_on_connect="false" />
+    <switch name="sw2" dpid="00000000000000a2" flush_rules_on_connect="false" />
+    <switch name="sw3" dpid="00000000000000a3" flush_rules_on_connect="false" />
+    <switch name="sw4" dpid="00000000000000a4" flush_rules_on_connect="false" />
+    <switch name="sw5" dpid="00000000000000a5" flush_rules_on_connect="false" />
+    <switch name="sw6" dpid="00000000000000a6" flush_rules_on_connect="false" />
+    <switch name="sw7" dpid="00000000000000a7" flush_rules_on_connect="false" />
+    <switch name="sw8" dpid="00000000000000a8" flush_rules_on_connect="false" />
+    <switch name="sw9" dpid="00000000000000a9" flush_rules_on_connect="false" />
+    <switch name="sw10" dpid="0000000000000a10" flush_rules_on_connect="false" />
+    <switch name="sw11" dpid="0000000000000a11" flush_rules_on_connect="false" />
+    <switch name="sw12" dpid="0000000000000a12" flush_rules_on_connect="false" />
+    <switch name="sw13" dpid="0000000000000a13" flush_rules_on_connect="false" />
+    <switch name="sw14" dpid="0000000000000a14" flush_rules_on_connect="false" />
+    <switch name="sw15" dpid="0000000000000a15" flush_rules_on_connect="false" />
+    <switch name="sw16" dpid="0000000000000a16" flush_rules_on_connect="false" />
+    <switch name="sw17" dpid="0000000000000a17" flush_rules_on_connect="false" />
+    <switch name="sw18" dpid="0000000000000a18" flush_rules_on_connect="false" />
+    <switch name="sw19" dpid="0000000000000a19" flush_rules_on_connect="false" />
+    <switch name="sw20" dpid="0000000000000a20" flush_rules_on_connect="false" />
+    <switch name="sw21" dpid="0000000000000a21" flush_rules_on_connect="false" />
+    <switch name="sw22" dpid="0000000000000a22" flush_rules_on_connect="false" />
+    <switch name="sw23" dpid="0000000000000a23" flush_rules_on_connect="false" />
+    <switch name="sw24" dpid="0000000000000a24" flush_rules_on_connect="false" />
+    <switch name="sw25" dpid="0000000000000a25" flush_rules_on_connect="false" />
+    <switch name="sw26" dpid="0000000000000a26" flush_rules_on_connect="false" />
+    <switch name="sw27" dpid="0000000000000a27" flush_rules_on_connect="false" />
+    <switch name="sw28" dpid="0000000000000a28" flush_rules_on_connect="false" />
+    <switch name="sw29" dpid="0000000000000a29" flush_rules_on_connect="false" />
+    <switch name="sw30" dpid="0000000000000a30" flush_rules_on_connect="false" />
+    <switch name="sw31" dpid="0000000000000a31" flush_rules_on_connect="false" />
+    <switch name="sw32" dpid="0000000000000a32" flush_rules_on_connect="false" />
+    <switch name="sw33" dpid="0000000000000a33" flush_rules_on_connect="false" />
+    <switch name="sw34" dpid="0000000000000a34" flush_rules_on_connect="false" />
+    <switch name="sw35" dpid="0000000000000a35" flush_rules_on_connect="false" />
+    <switch name="sw36" dpid="0000000000000a36" flush_rules_on_connect="false" />
+    <switch name="sw37" dpid="0000000000000a37" flush_rules_on_connect="false" />
+    <switch name="sw38" dpid="0000000000000a38" flush_rules_on_connect="false" />
+    <switch name="sw39" dpid="0000000000000a39" flush_rules_on_connect="false" />
+
+    <slice name="P10-ONOS-demo1">
+        <switch name="sw1" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw1-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw1-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw1-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw2" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw2-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw2-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw3" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw3-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw3-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw3-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw4" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw4-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw4-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw5" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw5-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw5-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw5-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw6" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw6-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw6-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw7" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw7-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw7-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw8" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw8-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw8-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw8-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw8-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw8-eth5">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw9" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw9-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw9-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw10" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw10-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw10-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw11" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw11-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw11-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw11-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw12" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw12-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw12-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw12-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw13" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw13-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw13-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw13-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw14" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw14-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw14-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw14-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw14-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw14-eth5">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw15" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw15-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw15-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw16" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw16-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw16-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw17" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw17-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw17-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw17-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw17-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw18" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw18-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw18-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw19" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw19-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw19-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw20" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw20-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw20-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw21" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw21-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw21-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw21-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw22" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw22-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw22-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw23" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw23-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw23-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw23-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw23-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw23-eth5">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw24" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw24-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw24-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw24-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw24-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw25" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw25-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw25-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw26" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw26-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw26-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw27" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw27-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw27-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw27-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw27-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw28" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw28-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw28-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw28-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw29" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw29-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw29-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw29-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw30" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw30-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw30-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw31" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw31-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw31-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw31-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw32" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw32-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw32-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw32-eth3">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw32-eth4">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw33" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw33-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw33-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw34" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw34-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw34-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw35" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw35-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw35-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw36" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw36-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw36-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw37" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw37-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw37-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw38" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw38-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw38-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+        <switch name="sw39" max_flows="200" flow_rate="400" packet_in_rate="100" flush_rules_on_connect="false" tag_management="true">
+            <port name="sw39-eth1">
+                 <range start="2511" end="2511"/>
+            </port>
+            <port name="sw39-eth2">
+                 <range start="2511" end="2511"/>
+            </port>
+        </switch>
+
+        <controller ip_address="10.128.20.11" ssl="false" port="6633"/>
+    </slice>
+
+</flowspace_firewall>
\ No newline at end of file
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga-sdn.conf b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga-sdn.conf
new file mode 100644
index 0000000..b5d8b12
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga-sdn.conf
@@ -0,0 +1,41 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+!
+router bgp 64513
+  bgp router-id 10.0.4.101
+  timers bgp 1 3
+  !timers bgp 3 9
+  neighbor 10.0.4.1 remote-as 64514
+  neighbor 10.0.4.1 ebgp-multihop
+  neighbor 10.0.4.1 timers connect 5
+  neighbor 10.0.5.1 remote-as 64515
+  neighbor 10.0.5.1 ebgp-multihop
+  neighbor 10.0.5.1 timers connect 5
+  neighbor 10.0.6.1 remote-as 64516
+  neighbor 10.0.6.1 ebgp-multihop
+  neighbor 10.0.6.1 timers connect 5
+
+  neighbor 1.1.1.2 remote-as 64513
+  neighbor 1.1.1.2 port 2000
+  neighbor 1.1.1.2 timers connect 5
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64514.conf b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64514.conf
new file mode 100644
index 0000000..09440af
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64514.conf
@@ -0,0 +1,28 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64514
+  bgp router-id 10.0.4.1
+!  timers bgp 1 3
+ neighbor 10.0.4.101 remote-as 64513
+ network 4.0.0.0/24
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
\ No newline at end of file
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64515.conf b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64515.conf
new file mode 100644
index 0000000..6d0b701
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64515.conf
@@ -0,0 +1,28 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64515
+  bgp router-id 10.0.5.1
+!  timers bgp 1 3
+ neighbor 10.0.5.101 remote-as 64513
+ network 5.0.0.0/24
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64516.conf b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64516.conf
new file mode 100644
index 0000000..5401c05
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/quagga64516.conf
@@ -0,0 +1,31 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64516
+  bgp router-id 10.0.6.1
+!  timers bgp 1 3
+ neighbor 10.0.6.101 remote-as 64513
+ network 6.0.0.0/24
+
+! neighbor 10.0.0.2 route-map set-nexthop out
+! neighbor 10.0.0.2 ebgp-multihop
+! neighbor 10.0.0.2 next-hop-self
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/zebra.conf b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/zebra.conf
new file mode 100644
index 0000000..517db94
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/zebra.conf
@@ -0,0 +1,26 @@
+! -*- zebra -*-
+!
+! zebra sample configuration file
+!
+! $Id: zebra.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
+!
+hostname zebra
+password hello
+enable password 0fw0rk
+log stdout
+!
+! Interfaces description.
+!
+!interface lo
+! description test of desc.
+!
+!interface sit0
+! multicast
+
+!
+! Static default route sample.
+!
+!ip route 0.0.0.0/0 203.181.89.241
+!
+
+!log file /usr/local/var/log/quagga/zebra.log
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/README b/TestON/tests/USECASE_SdnipFunction_fsfw/README
new file mode 100644
index 0000000..8322bd0
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/README
@@ -0,0 +1,77 @@
+This is a tutorial for you to manually run this test.
+Normally, we run it from Jenkins, most of steps below are configured on Jenkins,
+and will be automatically run by Jenkins.
+But here, we need to manually run all the steps.
+
+In this test environment, we use 3 nodes:
+    1) One is for running Mininet, Quagga, TestON, compiling ONOS.
+    2) The second one is running ONOS.
+    3) The third one is running FlowSpace Firewall (FSFW).
+
+
+Step 1: Install and configure Quagga.
+
+SDN-IP application uses Quagga as the BGP speaker. You need to install Quagga
+on the Mininet node, and I assume you already have Mininet in the first node.
+$ sudo apt-get install quagga
+
+After installation, check whether the Quagga directory is /usr/lib/quagga,
+otherwise you need to change the Quagga directory in USECASE_SdnipI2MN.py.
+
+Then create a running directory for Quagga:
+$cd /usr/local/var/run/
+$sudo mkdir quagga
+$sudo chmod 777 quagga
+
+
+Step 2: SDN-IP/ONOS configuration.
+
+Copy the SDN-IP/ONOS file to your ONOS directory:
+$cp ~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json ~/onos/tools/package/config/network-cfg.json
+$cp ~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction_fsfw/sdnip_single_instance ~/onos/tools/test/cells/sdnip_single_instance
+
+Then enable the cell file:
+$cell sdnip_single_instance
+
+You also need to compile ONOS:
+$cd ~/onos
+$mcis
+
+Step 3: Copy public RSA keys from first node to second node.
+
+Copy public RSA key of the "root" user (not other users) from the first node to
+second node which is running ONOS.
+This is because we need to set up a tunnel from Mninet node to ONOS node for
+communication between Quagga and SDN-IP.
+
+The location of the root key is:
+$ sudo su root
+# cat ~/.ssh/id_rsa.pub
+
+Copy the key above to this file on the second node:
+$vim ~/.ssh/authorized_keys
+
+To correctly run ONOS, also make sure that the public key of the user which
+compiles ONOS is also in "authorized_keys" file on the second node.
+
+
+Step 4: Install, configure, and run FSFW.
+
+Install FSFW, and copy the FSFW configuration file from TestON directory in the first node to the FSFW node.
+$scp ~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/fsfw.xml root@10.128.10.12:/etc/fsfw/
+
+Change the controller IP address in fsfw.xml to your IP address of the node
+running ONOS.
+$service fsfw start
+
+Note: you only need to do Step 1, 2, 3, and 4 once.
+
+
+Step 5: Each time, before starting the test, run the following command to clean
+the whole environment.
+$ ~/OnosSystemTest/TestON/bin/cleanup.sh
+
+
+Step 6: Finally you can run TestON script.
+$cd ~/OnosSystemTest/TestON/bin
+$./cli.py run USECASE_SdnipFunction_fsfw
\ No newline at end of file
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
new file mode 100644
index 0000000..18bfde6
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
@@ -0,0 +1,46 @@
+<PARAMS>
+
+    <testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
+
+    #Environment variables
+    <ENV>
+        <cellName>sdnip_single_instance</cellName>
+    </ENV>
+
+    <CTRL>
+        <numCtrl>1</numCtrl>
+        <ip1>OC1</ip1>
+        <port1>6653</port1>
+    </CTRL>
+
+    <GIT>
+        <branch1>master</branch1>
+        <branch2>onos-1.3</branch2>
+    </GIT>
+
+    <JSON>
+        <prefix>prefix</prefix>
+        <nextHop>nextHop</nextHop>
+    </JSON>
+
+    <DEPENDENCY>
+        <path>/USECASE_SdnipFunction_fsfw/Dependency/</path>
+        <topology>USECASE_SdnipI2MN.py</topology>
+        <wrapper1>Functions</wrapper1>
+    </DEPENDENCY>
+
+    <config>
+        <peerNum> 3 </peerNum>
+        <switchNum> 39 </switchNum>
+    </config>
+
+    <timers>
+        <SdnIpSetup>10</SdnIpSetup>
+        <TopoDiscovery>60</TopoDiscovery>
+        <PingTestWithRoutes>20</PingTestWithRoutes>
+        <PingTestWithoutRoutes>100</PingTestWithoutRoutes>
+        <RouteDelivery>60</RouteDelivery>
+        <PathAvailable>20</PathAvailable>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
new file mode 100644
index 0000000..4636bcc
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -0,0 +1,664 @@
+# Testing the functionality of SDN-IP with single ONOS instance
+class USECASE_SdnipFunction_fsfw:
+
+    def __init__( self ):
+        self.default = ''
+        global branchName
+
+    # This case is to setup Mininet testbed
+    def CASE100( self, main ):
+        """
+            Start mininet
+        """
+        import os
+        import imp
+        main.log.case( "Setup the Mininet testbed" )
+        main.dependencyPath = main.testDir + \
+                              main.params[ 'DEPENDENCY' ][ 'path' ]
+        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+
+        main.step( "Starting Mininet Topology" )
+        topology = main.dependencyPath + main.topology
+        topoResult = main.Mininet.startNet( topoFile = topology )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = topoResult,
+                                 onpass = "Successfully loaded topology",
+                                 onfail = "Failed to load topology" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+        main.step( "Connect switches to controller" )
+
+        global ONOS1Ip
+        ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        # connect all switches to controller
+        swResult = main.TRUE
+        for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
+            sw = "sw%s" % ( i )
+            swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip )
+            # swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip, port = "6633" )
+        utilities.assert_equals( expect = main.TRUE,
+                             actual = swResult,
+                             onpass = "Successfully connect all switches to ONOS",
+                             onfail = "Failed to connect all switches to ONOS" )
+        if not swResult:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Set up tunnel from Mininet node to onos node" )
+        forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip )
+        command = 'ssh -nNT -o "PasswordAuthentication no" \
+        -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip )
+
+        tunnelResult = main.TRUE
+        tunnelResult = main.Mininet.node( "root", command )
+        utilities.assert_equals( expect = True,
+                             actual = ( "PasswordAuthentication" in tunnelResult ),
+                             onpass = "Created tunnel succeeded",
+                             onfail = "Create tunnel failed" )
+        if ("PasswordAuthentication" not in tunnelResult) :
+            main.cleanup()
+            main.exit()
+
+
+    # This case is to setup ONOS
+    def CASE101( self, main ):
+        """
+           Package ONOS and install it
+           Startup sequence:
+           cell <name>
+           onos-verify-cell
+           onos-package
+           onos-install -f
+           onos-wait-for-start
+        """
+        import json
+        import time
+        from operator import eq
+
+        main.case( "Setting up test environment" )
+
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        utilities.assert_equals( expect = main.TRUE,
+                             actual = cellResult,
+                             onpass = "Set cell succeeded",
+                             onfail = "Set cell failed" )
+
+        verifyResult = main.ONOSbench.verifyCell()
+        utilities.assert_equals( expect = main.TRUE,
+                             actual = verifyResult,
+                             onpass = "Verify cell succeeded",
+                             onfail = "Verify cell failed" )
+
+        branchName = main.ONOSbench.getBranchName()
+        main.log.report( "ONOS is on branch: " + branchName )
+
+        main.log.step( "Uninstalling ONOS" )
+        uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+        utilities.assert_equals( expect = main.TRUE,
+                                actual = uninstallResult,
+                                onpass = "Uninstall ONOS succeeded",
+                                onfail = "Uninstall ONOS failed" )
+        '''
+        main.step( "Git pull" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "gitPullResult" )
+        main.log.info( gitPullResult )
+        gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
+        utilities.assert_equals( expect = True,
+                                 actual = gitPullResult2,
+                                 onpass = "Git pull ONOS succeeded",
+                                 onfail = "Git pull ONOS failed" )
+
+        main.step( "Using mvn clean install" )
+        if gitPullResult == main.TRUE:
+            mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
+            utilities.assert_equals( expect = main.TRUE,
+                                     actual = mciResult,
+                                     onpass = "Maven clean install ONOS succeeded",
+                                     onfail = "Maven clean install ONOS failed" )
+        else:
+             main.log.warn( "Did not pull new code so skipping mvn " +
+                            "clean install" )
+             mciResult = main.TRUE
+        '''
+
+        main.ONOSbench.getVersion( report = True )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = packageResult,
+                                 onpass = "Package ONOS succeeded",
+                                 onfail = "Package ONOS failed" )
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
+                                                         node = ONOS1Ip )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = onos1InstallResult,
+                                 onpass = "Install ONOS succeeded",
+                                 onfail = "Install ONOS failed" )
+
+        main.step( "Checking if ONOS is up yet" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = onos1UpResult,
+                                 onpass = "ONOS is up",
+                                 onfail = "ONOS is NOT up" )
+
+        main.step( "Checking if ONOS CLI is ready" )
+        cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
+                commandlineTimeout = 100, onosStartTimeout = 600 )
+        utilities.assert_equals( expect = main.TRUE,
+                         actual = cliResult,
+                         onpass = "ONOS CLI is ready",
+                         onfail = "ONOS CLI is NOT ready" )
+
+        caseResult = ( cellResult and verifyResult and
+                       packageResult and
+                       onos1InstallResult and onos1UpResult and cliResult )
+
+        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
+                                 onpass = "ONOS startup successful",
+                                 onfail = "ONOS startup NOT successful" )
+
+        if caseResult == main.FALSE:
+            main.log.info( "ONOS startup failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.log.info( "Get links in the network" )
+        time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
+        summaryResult = main.ONOScli.summary()
+        linkNum = json.loads( summaryResult )[ "links" ]
+        if linkNum < 100:
+            main.log.info( "Link number is wrong!" )
+            listResult = main.ONOScli.links( jsonFormat = False )
+            main.log.info( listResult )
+            main.cleanup()
+            main.exit()
+
+        listResult = main.ONOScli.links( jsonFormat = False )
+        main.log.info( listResult )
+
+        main.step( "Activate sdn-ip application" )
+        activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = activeSDNIPresult,
+                                 onpass = "Activate SDN-IP succeeded",
+                                 onfail = "Activate SDN-IP failed" )
+        if not activeSDNIPresult:
+            main.log.info( "Activate SDN-IP failed!" )
+            main.cleanup()
+            main.exit()
+
+
+        main.log.info( "Wait SDN-IP to finish installing connectivity intents \
+        and the BGP paths in data plane are ready..." )
+        time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
+        main.log.info( "Wait Quagga to finish delivery all routes to each \
+        other and to sdn-ip, plus finish installing all intents..." )
+        time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+        time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
+
+
+    def CASE102( self, main ):
+        '''
+        This test case is to load the methods from other Python files.
+        '''
+        main.case( "Loading methods from other Python file" )
+        # load the methods from other file
+        wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        main.Functions = imp.load_source( wrapperFile,
+                                          main.dependencyPath +
+                                          wrapperFile +
+                                          ".py" )
+
+
+    def CASE1( self, main ):
+        '''
+        ping test from 3 bgp peers to BGP speaker
+        '''
+
+        main.case( "Ping tests between BGP peers and speakers" )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+
+
+    def CASE2( self, main ):
+        '''
+        point-to-point intents test for each BGP peer and BGP speaker pair
+        '''
+        main.case( "Check point-to-point intents" )
+        main.log.info( "There are %s BGP peers in total "
+                       % main.params[ 'config' ][ 'peerNum' ] )
+        main.step( "Check P2P intents number from ONOS CLI" )
+
+        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        bgpIntentsActualNum = \
+            main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
+        bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
+        main.log.info( "bgpIntentsExpected num is:" )
+        main.log.info( bgpIntentsExpectedNum )
+        main.log.info( "bgpIntentsActual num is:" )
+        main.log.info( bgpIntentsActualNum )
+        utilities.assertEquals( \
+            expect = True,
+            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass = "PointToPointIntent Intent Num is correct!",
+            onfail = "PointToPointIntent Intent Num is wrong!" )
+
+
+    def CASE3( self, main ):
+        '''
+        routes and intents check to all BGP peers
+        '''
+        main.case( "Check routes and M2S intents to all BGP peers" )
+
+        allRoutesExpected = []
+        allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
+        allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
+        allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
+
+        getRoutesResult = main.ONOScli.routes( jsonFormat = True )
+        allRoutesActual = \
+            main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+        allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+        allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+
+        main.step( "Check routes installed" )
+        main.log.info( "Routes expected:" )
+        main.log.info( allRoutesStrExpected )
+        main.log.info( "Routes get from ONOS CLI:" )
+        main.log.info( allRoutesStrActual )
+        utilities.assertEquals( \
+            expect = allRoutesStrExpected, actual = allRoutesStrActual,
+            onpass = "Routes are correct!",
+            onfail = "Routes are wrong!" )
+
+        main.step( "Check M2S intents installed" )
+        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        routeIntentsActualNum = \
+            main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
+        routeIntentsExpectedNum = 3
+
+        main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
+        main.log.info( routeIntentsExpectedNum )
+        main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
+        main.log.info( routeIntentsActualNum )
+        utilities.assertEquals( \
+            expect = True,
+            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
+            onpass = "MultiPointToSinglePoint Intent Num is correct!",
+            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+
+    def CASE4( self, main ):
+        '''
+        Ping test in data plane for each route
+        '''
+        main.case( "Ping test for each route, all hosts behind BGP peers" )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE5( self, main ):
+        '''
+        Cut links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "Bring down links and check routes/intents" )
+        main.step( "Bring down the link between sw32 and peer64514" )
+        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult1,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+
+        if linkResult1 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.info( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring down the link between sw8 and peer64515" )
+        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult2,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+        if linkResult2 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.info( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring down the link between sw28 and peer64516" )
+        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult3,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+        if linkResult3 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 0 )
+            main.Functions.checkM2SintentNum( main, 0 )
+        else:
+            main.log.info( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = False )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = False )
+
+
+    def CASE6( self, main ):
+        '''
+        Recover links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "Bring up links and check routes/intents" )
+        main.step( "Bring up the link between sw32 and peer64514" )
+        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult1,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult1 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.info( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring up the link between sw8 and peer64515" )
+        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult2,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult2 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.info( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring up the link between sw28 and peer64516" )
+        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult3,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult3 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+        else:
+            main.log.info( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE7( self, main ):
+        '''
+        Shut down a edge switch, check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
+        main.step( "Stop sw32" )
+        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
+        utilities.assertEquals( expect = main.TRUE, actual = result,
+                                onpass = "Stopping switch succeeded!",
+                                onfail = "Stopping switch failed!" )
+
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkP2PintentNum( main, 12 )
+        else:
+            main.log.info( "Stopping switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between hosts behind BGP peers" )
+        result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
+        result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
+        result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
+
+        pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
+                                                and ( result3 == main.FALSE )
+        utilities.assert_equals( expect = True, actual = pingResult1,
+                                 onpass = "Ping test result is correct",
+                                 onfail = "Ping test result is wrong" )
+
+        if pingResult1 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between BGP peers and speakers" )
+        result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
+        result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
+        result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+
+        pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
+                                                and ( result6 == main.TRUE )
+        utilities.assert_equals( expect = True, actual = pingResult2,
+                                 onpass = "Speaker1 ping peers successful",
+                                 onfail = "Speaker1 ping peers NOT successful" )
+
+        if pingResult2 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+
+    def CASE8( self, main ):
+        '''
+        Bring up the edge switch (sw32) which was shut down in CASE7,
+        check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
+        main.step( "Start sw32" )
+        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = result1,
+            onpass = "Starting switch succeeded!",
+            onfail = "Starting switch failed!" )
+
+        result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = result2,
+            onpass = "Connect switch to ONOS succeeded!",
+            onfail = "Connect switch to ONOS failed!" )
+
+        if result1 and result2:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+        else:
+            main.log.info( "Starting switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE9( self, main ):
+        '''
+        Bring down a switch in best path, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "Stop sw11 located in best path, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+
+        main.log.info( "Check the flow number correctness before stopping sw11" )
+        main.Functions.checkFlowNum( main, "sw11", 13 )
+        main.Functions.checkFlowNum( main, "sw1", 3 )
+        main.Functions.checkFlowNum( main, "sw7", 3 )
+        main.log.info( main.Mininet.checkFlows( "sw11" ) )
+        main.log.info( main.Mininet.checkFlows( "sw1" ) )
+        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+        main.step( "Stop sw11" )
+        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
+        utilities.assertEquals( expect = main.TRUE, actual = result,
+                                onpass = "Stopping switch succeeded!",
+                                onfail = "Stopping switch failed!" )
+        if result:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+        else:
+            main.log.info( "Stopping switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE10( self, main ):
+        '''
+        Bring up the switch which was stopped in CASE9, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "Start sw11 which was stopped in CASE9, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+
+        main.log.info( "Check the flow status before starting sw11" )
+        main.Functions.checkFlowNum( main, "sw1", 11 )
+        main.Functions.checkFlowNum( main, "sw7", 5 )
+        main.log.info( main.Mininet.checkFlows( "sw1" ) )
+        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+        main.step( "Start sw11" )
+        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
+        utilities.assertEquals( expect = main.TRUE, actual = result1,
+                                onpass = "Starting switch succeeded!",
+                                onfail = "Starting switch failed!" )
+        result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
+        utilities.assertEquals( expect = main.TRUE, actual = result2,
+                                onpass = "Connect switch to ONOS succeeded!",
+                                onfail = "Connect switch to ONOS failed!" )
+        if result1 and result2:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+
+            main.log.debug( main.Mininet.checkFlows( "sw11" ) )
+            main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+            main.log.debug( main.Mininet.checkFlows( "sw7" ) )
+        else:
+            main.log.info( "Starting switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.topo b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.topo
new file mode 100644
index 0000000..07109ba
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.topo
@@ -0,0 +1,53 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli>
+
+        <ONOS1>
+            <host>OC1</host>
+            <user>sdn</user>
+            <password></password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <QuaggaCliSpeaker1>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>QuaggaCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </QuaggaCliSpeaker1>
+
+        <Mininet>
+            <host>OCN</host>
+            <user>admin</user>
+            <password></password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                <home>~/Mininet/mininet/custom/</home>
+            </COMPONENTS>
+        </Mininet>
+
+    </COMPONENT>
+</TOPOLOGY>
+
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/__init__.py b/TestON/tests/USECASE_SdnipFunction_fsfw/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/__init__.py
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json b/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json
new file mode 100644
index 0000000..303b1bd
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json
@@ -0,0 +1,44 @@
+{
+    "ports" : {
+        "of:00000000000000a8/5" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.5.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                }
+            ]
+        },
+        "of:0000000000000a32/4" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.4.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                }
+            ]
+        },
+        "of:0000000000000a28/3" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.6.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                }
+            ]
+        }
+    },
+    "apps" : {
+        "org.onosproject.router" : {
+            "bgp" : {
+                "bgpSpeakers" : [
+                    {
+                        "connectPoint" : "of:0000000000000a24/1",
+                        "peers" : [
+                            "10.0.4.1",
+                            "10.0.5.1",
+                            "10.0.6.1"
+                        ]
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json1.3.1.rc1 b/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json1.3.1.rc1
new file mode 100644
index 0000000..a28dedf
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/network-cfg.json1.3.1.rc1
@@ -0,0 +1,50 @@
+{
+    "ports" : {
+        "of:00000000000000a8/5" : {
+            "interfaces" : {
+                "interfaces" : [
+                    {
+                        "ips"  : [ "10.0.5.101/24" ],
+                        "mac"  : "00:00:00:00:00:01"
+                    }
+                ]
+            }
+        },
+        "of:0000000000000a32/4" : {
+            "interfaces" : {
+                "interfaces" : [
+                    {
+                        "ips"  : [ "10.0.4.101/24" ],
+                        "mac"  : "00:00:00:00:00:01"
+                    }
+                ]
+            }
+        },
+        "of:0000000000000a28/3" : {
+            "interfaces" : {
+                "interfaces" : [
+                    {
+                        "ips"  : [ "10.0.6.101/24" ],
+                        "mac"  : "00:00:00:00:00:01"
+                    }
+                ]
+            }
+        }
+    },
+    "apps" : {
+        "org.onosproject.router" : {
+            "bgp" : {
+                "bgpSpeakers" : [
+                    {
+                        "connectPoint" : "of:0000000000000a24/1",
+                        "peers" : [
+                            "10.0.4.1",
+                            "10.0.5.1",
+                            "10.0.6.1"
+                        ]
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/sdnip_single_instance b/TestON/tests/USECASE_SdnipFunction_fsfw/sdnip_single_instance
new file mode 100644
index 0000000..d0375e8
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/sdnip_single_instance
@@ -0,0 +1,13 @@
+export ONOS_CELL="sdnip_single_instance"
+
+export ONOS_INSTALL_DIR="/opt/onos"
+export ONOS_NIC=10.128.20.*
+export OC1="10.128.20.11"
+export OCN="10.128.10.12"
+export OCI="${OC1}"
+export ONOS_USER="sdn"                  # ONOS user on remote system
+export ONOS_PWD="rocks"
+
+#export ONOS_APPS="drivers,openflow,config,proxyarp"
+export ONOS_APPS="drivers,openflow,proxyarp"
+