[ONOS-6747] New TestON test: VPLSfailsafe and various VPLS test fixes

Change-Id: If88512777256880ea3e627502473ce4eb336292a
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
index 62889c9..4b4c1ef 100644
--- a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
@@ -85,9 +85,9 @@
                             main.Mininet1.home,
                             direction="to" )
         topo = " --custom " + main.Mininet1.home + topoFile + " --topo " + topoName
-        args = " --switch ovs,protocols=OpenFlow13 --controller=remote"
+        args = " --switch ovs,protocols=OpenFlow13"
         for node in main.nodes:
-            args += ",ip=" + node.ip_address
+            args += " --controller=remote,ip=" + node.ip_address
         mnCmd = "sudo mn" + topo + args
         mnResult = main.Mininet1.startNet( mnCmd=mnCmd )
         utilities.assert_equals( expect=main.TRUE, actual=mnResult,
@@ -223,6 +223,7 @@
         import os.path
         from tests.USECASE.VPLS.dependencies import vpls
 
+        main.vpls = vpls
         pprint = main.ONOSrest1.pprint
         hosts = int( main.params[ 'vpls' ][ 'hosts' ] )
         SLEEP = int( main.params[ 'SLEEP' ][ 'netcfg' ] )
@@ -237,14 +238,19 @@
             pingResult = main.Mininet1.pingHost( SRC=src, TARGET=dst )
 
         main.step( "Load VPLS configurations" )
-        # TODO: load from params
         fileName = main.params[ 'DEPENDENCY' ][ 'topology' ]
         app = main.params[ 'vpls' ][ 'name' ]
-        # TODO make this a function?
-        main.ONOSbench.handle.sendline( "onos-netcfg $OC1 " + fileName )
+
+        loadVPLSResult = main.ONOSbench.onosNetCfg( main.nodes[ 0 ].ip_address, "", fileName )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=loadVPLSResult,
+                                 onpass="Loaded vpls configuration.",
+                                 onfail="Failed to load vpls configuration." )
+
         # Time for netcfg to load data
         time.sleep( SLEEP )
         # 'Master' copy of test configuration
+
         try:
             with open( os.path.expanduser( fileName ) ) as dataFile:
                 originalCfg = json.load( dataFile )
@@ -284,6 +290,13 @@
         # Run a bunch of checks to verify functionality based on configs
         vpls.verify( main )
 
+        main.step( "Loading vpls configuration in case any configuration was missed." )
+        loadVPLSResult = main.ONOSbench.onosNetCfg( main.nodes[ 0 ].ip_address, "", fileName )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=loadVPLSResult,
+                                 onpass="Loaded vpls configuration.",
+                                 onfail="Failed to load vpls configuration." )
+
     def CASE3( self, main ):
         """
         Test VPLS cli commands