Merge "WIP: Submit fewer intents in intent throughput test with FlowObjective"
diff --git a/DELTA/README.md b/DELTA/README.md
new file mode 100644
index 0000000..8a7cc5d
--- /dev/null
+++ b/DELTA/README.md
@@ -0,0 +1,15 @@
+The scripts in this directory automates DELTA security tests against ONOS.
+
+run-DELTA.sh automates DELTA tests (All-In-One Single Machine mode). It installs DELTA and all dependencies; brings up VMs and configures the network; triggers tests using a python script (run-DELTA.py); cleans up the environment after tests are done.
+Usage of run-DELTA.sh:
+-h show help message
+-d initialize DELTA repo, build and configure DELTA
+-v destroy and reinstall vagrant VMs
+-o <name> specify name of ONOS nightly build file
+-p <path> specify path of DELTA
+
+run-DELTA.py uses pexpect to talk to DELTA manager and triggers all CONTROL_PLANE_OF and ADVANCED test cases. It also reads the DELTA log and prints the results for each test case. run-DELTA.py can take one argument for specifying DELTA directory.
+
+Note: run-DELTA.sh and run-DELTA.py should be put into the same folder.
+
+For more information of DELTA, please go to https://github.com/OpenNetworkingFoundation/delta
diff --git a/DELTA/run-DELTA.py b/DELTA/run-DELTA.py
new file mode 100755
index 0000000..1bfd7a3
--- /dev/null
+++ b/DELTA/run-DELTA.py
@@ -0,0 +1,116 @@
+#!/usr/bin/python
+'''
+This script uses pexpect to talk to DELTA manager and triggers all CONTROL_PLANE_OF and
+ADVANCED test cases. It also reads the DELTA log and prints the results for each case
+'''
+
+import sys
+import pexpect
+import time
+import datetime
+
+DELTA_DIR = '/home/sdn/DELTA'
+DELTA_LOG = 'delta.log'
+RESULT_FILE = 'summary.txt'
+LOG_CHECK_INTERVAL = 10
+# TODO: get attack codes from DELTA CLI
+CODES = ['2.1.010','2.1.020','2.1.030','2.1.040','2.1.050','2.1.060','2.1.070','2.1.071','2.1.072','2.1.073','2.1.080','3.1.010','3.1.020','3.1.030','3.1.040','3.1.050','3.1.060','3.1.070','3.1.080','3.1.090','3.1.100','3.1.110','3.1.120','3.1.130','3.1.140','3.1.150','3.1.160','3.1.170','3.1.180','3.1.190','3.1.200']
+CODE_TO_SKIP = ['3.1.090','3.1.160']
+# Timeout for each test case
+TIMEOUT = 1800
+
+def triggerTest( handle, code ):
+ testAvailable = True
+ print datetime.datetime.now(), "Starting test", code
+ # TODO: expect Exceptions thrown by DELTA
+ i = handle.expect( ['Command>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+ if i != 0:
+ print "pexpect EOF or TIMEOUT, exiting..."
+ return -1
+ time.sleep(0.5)
+
+ handle.sendline( 'k' )
+ i = handle.expect( ['Select the attack code>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+ if i != 0:
+ print "pexpect EOF or TIMEOUT, exiting..."
+ return -1
+ time.sleep(0.5)
+
+ handle.sendline( code )
+ i = handle.expect( ['not available', 'Press ENTER key to continue..', pexpect.EOF, pexpect.TIMEOUT], 60 )
+ if i == 0:
+ testAvailable = False
+ elif i == 1:
+ testAvailable = True
+ else:
+ print "pexpect EOF or TIMEOUT, exiting..."
+ return -1
+ time.sleep(0.5)
+
+ handle.sendline( '' )
+ if not testAvailable:
+ print "Test", code, "is not available"
+ return 0
+
+ return 1
+
+def waitForTest( code ):
+ startTime = time.time()
+ while True:
+ if time.time() - startTime > TIMEOUT:
+ print "Test timeout, exiting..."
+ return -1
+ time.sleep( LOG_CHECK_INTERVAL )
+ log = open( DELTA_LOG ).read()
+ log = log.split( code )
+ if len( log ) == 1:
+ pass
+ elif "done" in log[-1]:
+ try:
+ testName = log[1].split( ' - ' )[1]
+ except IndexError:
+ print "Error getting test name"
+ testName = "Unknown Test Name"
+ result = "UNKNOWN"
+ if "FAIL" in log[-1]:
+ result = "FAIL"
+ elif "PASS" in log[-1]:
+ result = "PASS"
+ print datetime.datetime.now(), "Test result:", result, "Time taken:", time.time() - startTime, "seconds"
+ resultFile = open( RESULT_FILE, 'a' )
+ resultFile.write( code + " " + testName + ": " + result + "\n" )
+ resultFile.close()
+ return 1
+ else:
+ pass
+
+def runTests():
+ resultFile = open( RESULT_FILE, 'w' )
+ resultFile.write( "Test started on " + str(datetime.datetime.now())+"\n" )
+ resultFile.close()
+ handle=pexpect.spawn( 'java -jar ' + DELTA_DIR + '/manager/target/delta-manager-1.0-SNAPSHOT-jar-with-dependencies.jar ' + DELTA_DIR + '/tools/config/manager.cfg' )
+ for code in CODES:
+ # Skip some broken cases
+ if code in CODE_TO_SKIP:
+ continue
+ triggerResult = triggerTest( handle, code )
+ # pexpect failures
+ if triggerResult == -1:
+ return
+ # Test not available
+ elif triggerResult == 0:
+ continue
+ testResult = waitForTest( code )
+ # Test timed out
+ if testResult == -1:
+ break
+ # Exit DELTA
+ print "All tests done, exiting DELTA"
+ i = handle.expect( ['Command>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+ handle.sendline( 'q' )
+
+if __name__ == '__main__':
+ if len( sys.argv ) >= 2:
+ DELTA_DIR = sys.argv[1]
+ print 'DELTA directory is', DELTA_DIR
+ runTests()
diff --git a/DELTA/run-DELTA.sh b/DELTA/run-DELTA.sh
new file mode 100755
index 0000000..c1f3aab
--- /dev/null
+++ b/DELTA/run-DELTA.sh
@@ -0,0 +1,157 @@
+#!/bin/bash
+# This script automates DELTA tests (All-In-One Single Machine mode). It
+# installs DELTA and all dependencies; brings up VMs and configures the
+# network; triggers tests using a python script (run-DELTA.py); cleans
+# up the environment after tests are done.
+# Note: run-DELTA.py and this script should be put in the same folder
+
+set -e
+
+DELTA_PATH=/home/sdn
+
+# Install DELTA and dependencies
+function init_delta() {
+ echo "*** Initialize DELTA ***"
+ if [ ! -d "$DELTA_DIR" ]
+ then
+ echo "Downloading DELTA..."
+ (cd $DELTA_PATH && git clone https://github.com/OpenNetworkingFoundation/DELTA.git)
+ cd $DELTA_DIR
+ echo "Installing DELTA dependencies..."
+ ./tools/dev/delta-setup/delta-setup-devenv-ubuntu
+ echo "Building DELTA..."
+ source ./tools/dev/delta-setup/bash_profile
+ mvn clean install
+ echo "Installing virtualbox and vagrant..."
+ ./tools/dev/delta-setup/delta-setup-vms-ubuntu
+ # TODO: change ./tools/config/manager.cfg
+ cd -
+ fi
+}
+
+# Bring up VMs and config network
+function setup_vm() {
+ echo "*** Setting up VMs ***"
+ echo "Bringing up VMs..."
+ cd $DELTA_DIR"/tools/dev/vagrant/"
+ vagrant up >/dev/null 2>&1
+ echo "Checking if all VMs are up..."
+ vagrant status | grep controller | grep running
+ vagrant status | grep channel | grep running
+ vagrant status | grep mininet | grep running
+ echo "Setting up NAT network..."
+ VBoxManage natnetwork add --netname NatNetwork --network 10.0.2.0/24 --enable --dhcp on
+ VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nic1 natnetwork NatNetwork
+ VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nicpromisc1 allow-all
+ source ../delta-setup/bash_profile
+ if [[ $INIT_VM -eq 1 ]]
+ then
+ INIT_VM=0
+ echo "Setting up passwordless login..."
+ for vm in $DELTA_APP $DELTA_CHANNEL $DELTA_HOST
+ do
+ IFS=@ read name ip <<< $vm
+ ssh-keygen -f "$HOME/.ssh/known_hosts" -R $ip
+ cat ~/.ssh/id_rsa.pub | sshpass -p "vagrant" ssh -o StrictHostKeyChecking=no $vm 'cat >> .ssh/authorized_keys'
+ done
+ echo "Setting up DELTA_APP VM..."
+ ssh $DELTA_APP "sudo echo 'export JAVA_HOME=/usr/lib/jvm/java-8-oracle' | sudo tee --append /etc/environment;\
+ sudo echo 'export ONOS_APPS=drivers,openflow,proxyarp,mobility,fwd' | sudo tee --append /etc/environment"
+ echo "Copying files to VMs..."
+ ../onos-setup/onos-1.6.0-scp
+ ../delta-setup/delta-agents-scp
+ fi
+ echo "Setting up ONOS..."
+ ssh $DELTA_APP "echo 'Downloading ONOS nightly build...';\
+ set -e;\
+ wget -c http://downloads.onosproject.org/nightly/$NIGHTLY_FILE_NAME.tar.gz >/dev/null 2>&1;\
+ tar xzf $NIGHTLY_FILE_NAME.tar.gz;\
+ rm $NIGHTLY_FILE_NAME.tar.gz;\
+ if [ -d onos ]; then rm -r onos; fi;\
+ mv onos-*-SNAPSHOT onos;\
+ cp delta-agent-app-onos-1.6-1.0-SNAPSHOT.jar onos/apache-karaf-*/deploy/"
+ cd -
+}
+
+# Run DELTA tests
+function run_test() {
+ echo "*** Run tests ***"
+ cd $DELTA_DIR
+ source ./tools/dev/delta-setup/bash_profile
+ cd -
+ ./run-DELTA.py $DELTA_DIR
+}
+
+# Clean up
+function teardown_vm() {
+ echo "*** Tearing down VMs ***"
+ echo "Killing DELTA..."
+ sudo kill -9 $(ps -ef | grep delta-manager | grep -v grep | awk '{print $2}')
+ echo "Deleting NAT network..."
+ VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nic1 nat || echo "nic1 of mininet VM not reset"
+ VBoxManage natnetwork remove --netname NatNetwork || echo "NAT network not removed"
+ echo "Bringing down VMs..."
+ cd $DELTA_DIR"/tools/dev/vagrant/"
+ if [[ $INIT_VM -eq 1 ]]
+ then
+ vagrant destroy -f
+ echo "Checking if all VMs are gone..."
+ vagrant status | grep controller | grep "not created"
+ vagrant status | grep channel | grep "not created"
+ vagrant status | grep mininet | grep "not created"
+ else
+ vagrant halt
+ echo "Checking if all VMs are down..."
+ vagrant status | grep controller | grep poweroff
+ vagrant status | grep channel | grep poweroff
+ vagrant status | grep mininet | grep poweroff
+ fi
+ cd -
+}
+
+INIT_DELTA=0
+INIT_VM=0
+NIGHTLY_FILE_NAME="onos-1.10.0.20170223-NIGHTLY"
+
+while getopts "hdvo:p:" opt; do
+ case ${opt} in
+ h )
+ echo "Usage:"
+ echo "-h show this help message"
+ echo "-d initialize DELTA repo, build and configure DELTA"
+ echo "-v destroy and reinstall vagrant VMs"
+ echo "-o <name> specify name of ONOS nightly build file"
+ echo "-p <path> specify path of DELTA"
+ exit 0
+ ;;
+ d ) INIT_DELTA=1
+ ;;
+ v ) INIT_VM=1
+ ;;
+ o ) NIGHTLY_FILE_NAME=$OPTARG
+ ;;
+ p ) DELTA_PATH=$OPTARG
+ ;;
+ \? ) echo "Invalid option: -$OPTARG"
+ exit 1
+ ;;
+ esac
+done
+
+DELTA_DIR=$DELTA_PATH"/DELTA"
+
+teardown_vm
+
+if [[ $INIT_DELTA -eq 1 ]]
+then
+ init_delta
+fi
+
+setup_vm
+
+run_test
+
+teardown_vm
+
+echo "Done"
+exit 0
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 3a9a3c9..2d75c39 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -397,7 +397,7 @@
main.cleanup()
main.exit()
- def log( self, cmdStr, level="",noExit=False):
+ def log( self, cmdStr, level="", noExit=False ):
"""
log the commands in the onos CLI.
returns main.TRUE on success
@@ -405,6 +405,7 @@
if noExit is True, TestON will not exit, but clean up
Available level: DEBUG, TRACE, INFO, WARN, ERROR
Level defaults to INFO
+ if cmdStr has spaces then put quotes in the passed string
"""
try:
lvlStr = ""
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 47baeb0..9c9e70d 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2152,7 +2152,7 @@
main.cleanup()
main.exit()
- def logReport( self, nodeIp, searchTerms, outputMode="s" ):
+ def logReport( self, nodeIp, searchTerms, outputMode="s", startStr=None, endStr=None ):
"""
Searches the latest ONOS log file for the given search terms and
prints the total occurances of each term. Returns to combined total of
@@ -2169,6 +2169,10 @@
number of occurances of each term. Defaults to 's',
which prints the simple output of just the number
of occurances for each term.
+ * startStr - the start string to be given to stream editor command
+ as the start point for extraction of data
+ * endStr - the end string to be given to stream editor command as
+ the end point for extraction of data
"""
try:
main.log.info( " Log Report for {} ".format( nodeIp ).center( 70, '=' ) )
@@ -2182,7 +2186,14 @@
for termIndex in range( numTerms ):
term = searchTerms[termIndex]
logLines.append( [term] )
- cmd = "onos-ssh " + nodeIp + " cat /opt/onos/log/karaf.log | grep " + term
+ if startStr and endStr:
+ cmd = "onos-ssh {} \"sed -n '/{}/,/{}/p' /opt/onos/log/karaf.log | grep {}\"".format( nodeIp,
+ startStr,
+ endStr,
+ term )
+ else:
+ cmd = "onos-ssh {} cat /opt/onos/log/karaf.log | grep {}".format( nodeIp,
+ term )
self.handle.sendline( cmd )
self.handle.expect( ":~" )
before = self.handle.before.splitlines()
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index 800a864..9d049fc 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -41,6 +41,7 @@
"""
import os
+
main.log.info( "ONOS Single node start " +
"Scapy Tool - initialization" )
main.case( "Setting up test environment" )
@@ -170,10 +171,6 @@
main.cleanup()
main.exit()
-
-
-
-
def CASE2( self, main ):
"""
Discovery the topology using BGPLS
@@ -183,6 +180,7 @@
import time
main.case( "Testcase 2 : Discovery the Network Topology using BGPLS" )
+ main.ONOScli1.log( "\"testcase2 start\"" )
try:
from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
@@ -218,7 +216,7 @@
bgplsConfig.Comments()
bgplsConfig.Comments()
- main.log.info( "Sending BGPLS information " )
+ main.log.info( "Sending BGPLS information" )
bgplsConfig.Comments()
@@ -254,19 +252,25 @@
Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post)
main.step( "Configure BGP through RESTCONF" )
- utilities.assert_equals(
- expect='200',
- actual=Poststatus,
- onpass="Post Port Success",
- onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
+ utilities.assert_equals( expect='200',
+ actual=Poststatus,
+ onpass="Post Port Success",
+ onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
bgplsConfig.Comments()
- main.log.info( "Check Network devices are Updated in ONOS " )
+ main.step( "Check Network devices are Updated in ONOS " )
bgplsConfig.Comments()
time.sleep(15)
-
response = main.ONOScli1.devices()
+ responseCheck = main.FALSE
+ if response:
+ responseCheck = main.TRUE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=responseCheck,
+ onpass="Network Devices update in ONOS successful",
+ onfail="Network Devices update in ONOS failed" )
+
main.step( "Check the nodes are discovered" )
if response.find( Ne_id[1][0]) and response.find(Ne_id[1][1]) and response.find(Ne_id[1][2]) != -1:
stepResult = main.TRUE
@@ -276,8 +280,17 @@
actual=stepResult,
onpass="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " sucess",
onfail="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " failed" )
+ main.ONOScli1.log( "\"testcase2 end\"" )
-
+ main.step( "Check for Errors or Exception in testcase2" )
+ startStr = "testcase2 start"
+ endStr = "testcase2 end"
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"], "s",
+ startStr, endStr )
+ utilities.assert_equals( expect=0, actual=errorLog,
+ onpass="No Exception or Error occured in testcase2",
+ onfail="Exception or Error occured in testcase2" )
bgplsConfig.Comments()
main.log.info( "Kill Scapy process" )
bgplsConfig.Comments()
@@ -285,9 +298,6 @@
main.Scapy1.handle.sendline( "\x03" )
time.sleep( 90 ) #This Sleep time gives time for the socket to close.
-
-
-
def CASE3( self, main ):
"""
Addition of new Node to existing topology
@@ -297,6 +307,7 @@
import time
main.case( "Testcase 3: Addition of New Node to existing topology" )
+ main.ONOScli1.log( "\"testcase3 start\"" )
try:
from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
except ImportError:
@@ -360,11 +371,17 @@
bgplsConfig.Comments()
bgplsConfig.Comments()
- main.log.info( "Check Network devices are Updated in ONOS " )
+ main.step( "Check Network devices are Updated in ONOS" )
bgplsConfig.Comments()
time.sleep(120)
-
response = main.ONOScli1.devices()
+ responseCheck = main.FALSE
+ if response:
+ responseCheck = main.TRUE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=responseCheck,
+ onpass="Network Devices update in ONOS successful",
+ onfail="Network Devices update in ONOS failed" )
main.step( "Check Newly added Node is getting updated" )
if response.find( Ne_id[1][3]) != -1:
@@ -375,13 +392,23 @@
actual=stepResult,
onpass="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update sucess",
onfail="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update failed" )
+ main.ONOScli1.log( "\"testcase3 end\"" )
+
+ main.step( "Check for Errors or Exception in testcase3" )
+ startStr = "testcase3 start"
+ endStr = "testcase3 end"
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"], "s",
+ startStr, endStr )
+ utilities.assert_equals( expect=0, actual=errorLog,
+ onpass="No Exception or Error occured in testcase3",
+ onfail="Exception or Error occured in testcase3" )
bgplsConfig.Comments()
main.log.info( "Kill Scapy process" )
bgplsConfig.Comments()
main.Scapy1.handle.sendline( "\x03" )
time.sleep( 90 ) #This Sleep time gives time for the socket to close.
-
def CASE4( self, main ):
"""
Verification of Links in existing topology
@@ -390,6 +417,7 @@
import time
import os
main.case( "Testcase 4: Verification of Links thats is discovered" )
+ main.ONOScli1.log( "\"testcase4 start\"" )
try:
from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
except ImportError:
@@ -436,7 +464,7 @@
onpass="Install onos-app-bgp successful",
onfail="Install onos-app-bgp failed" )
bgplsConfig.Comments()
- main.log.info( "Checking the Link Discovery Status" )
+ main.step( "Checking the Link Discovery Status" )
bgplsConfig.Comments()
time.sleep( 120 ) # Time taken to discovery the links
response = main.ONOScli1.links()
@@ -445,10 +473,20 @@
if check_link == True:
reply_Check_Link = main.TRUE
- utilities.assert_equals( expect= main.TRUE,
- actual=reply_Check_Link ,
- onpass="Link Discovery Success.",
- onfail="Link Discovery Failed." )
+ utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+ onpass="Link Discovery Success.",
+ onfail="Link Discovery Failed." )
+ main.ONOScli1.log( "\"testcase4 end\"" )
+
+ main.step( "Check for Errors or Exception in testcase4 " )
+ startStr = "testcase4 start"
+ endStr = "testcase4 end"
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"], "s",
+ startStr, endStr )
+ utilities.assert_equals( expect= 0, actual=errorLog,
+ onpass="No Exception or Error occured in testcase4",
+ onfail="Exception or Error occured in testcase4" )
bgplsConfig.Comments()
main.log.info( "Kill Scapy process" )
bgplsConfig.Comments()
@@ -463,6 +501,8 @@
import time
import os
main.case( "Testcase 5: Deletion of Link in existing topology" )
+
+ main.ONOScli1.log( "\"testcase5 start\"" )
try:
from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
except ImportError:
@@ -494,7 +534,7 @@
main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
bgplsConfig.Comments()
- main.log.info( "Enable BGPlS plugin in ONOS" )
+ main.log.info( "Enable BGPlS plugin in ONOS " )
bgplsConfig.Comments()
main.step( "UnInstall onos-app-bgp" )
@@ -509,7 +549,7 @@
onpass="Install onos-app-bgp successful",
onfail="Install onos-app-bgp failed" )
bgplsConfig.Comments()
- main.log.info( "Checking whether the links is deleted" )
+ main.step( "Checking whether the links is deleted" )
bgplsConfig.Comments()
time.sleep( 120 ) # Time taken to discovery the links
response = main.ONOScli1.links()
@@ -517,10 +557,20 @@
check_link = bgplsConfig.checkLinks( linksResp )
if check_link == False:
reply_Check_Link = main.TRUE
- utilities.assert_equals( expect= main.TRUE,
- actual=reply_Check_Link ,
- onpass="Link is Deleted Successfully.",
- onfail="Link is Deletion Failed." )
+ utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+ onpass="Link is Deleted Successfully.",
+ onfail="Link is Deletion Failed." )
+ main.ONOScli1.log( "\"testcase5 end\"" )
+
+ main.step( "Check for Errors or Exception in testcase5" )
+ startStr = "testcase5 start"
+ endStr = "testcase5 end"
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"], "s",
+ startStr, endStr )
+ utilities.assert_equals( expect=0, actual=errorLog,
+ onpass="No Exception or Error occured in testcase5",
+ onfail="Exception or Error occured in testcase5" )
bgplsConfig.Comments()
main.log.info( "Kill Scapy process" )
bgplsConfig.Comments()
@@ -535,7 +585,8 @@
import re
import time
- main.case( "TestCase 5: UnInstalling of app" )
+ main.case( "TestCase 6: UnInstalling of app" )
+ main.ONOScli1.log( "\"testcase6 start\"" )
try:
from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
except ImportError:
@@ -575,7 +626,7 @@
cellResult = main.ONOSbench.setCell( cellName )
bgplsConfig.Comments()
- main.log.info( "Logging into ONOS CLI " )
+ main.step( "Logging into ONOS CLI " )
bgplsConfig.Comments()
cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
@@ -592,9 +643,20 @@
onpass="Uninstall onos-app-bgp successful",
onfail="Uninstall onos-app-bgp failed" )
- main.log.info( "Check for Errors or Exception End of the Script" )
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address, ["ERROR",\
- "EXCEPT"] )
- utilities.assert_equals( expect= 0, actual=errorLog,
+ main.ONOScli1.log( "\"testcase6 end\"" )
+ main.step( "Check for Errors or Exception in testcase6" )
+ startStr = "testcase6 start"
+ endStr = "testcase6 end"
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"], "s",
+ startStr, endStr )
+ utilities.assert_equals( expect=0, actual=errorLog,
+ onpass="No Exception or Error occured in testcase6",
+ onfail="Exception or Error occured in testcase6" )
+
+ main.step( "Check for Errors or Exception End of the Script" )
+ errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+ ["ERROR","EXCEPT"] )
+ utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured",
onfail="Exception or Error occured" )
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
index 936bf3d..fee655b 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
@@ -80,7 +80,8 @@
main.step("Safety check, killing all ONOS processes")
main.step("before initiating environment setup")
for node in range(1, maxNodes + 1):
- main.ONOSbench.onosDie(ONOSIp[node])
+ main.ONOSbench.onosStop(ONOSIp[node])
+ main.ONOSbench.onosKill(ONOSIp[node])
#Uninstall everywhere
main.step( "Cleaning Enviornment..." )
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index 2915864..559f30f 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -88,7 +88,8 @@
main.step("Safety check, killing all ONOS processes")
main.step("before initiating environment setup")
for node in range(1, main.maxNodes + 1):
- main.ONOSbench.onosDie(ONOSIp[node])
+ main.ONOSbench.onosStop(ONOSIp[node])
+ main.ONOSbench.onosKill(ONOSIp[node])
#Uninstall everywhere
main.step( "Cleaning Enviornment..." )
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index 6c382e4..12b93e6 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -116,7 +116,8 @@
" before initiating environment setup" )
for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ main.ONOSbench.onosKill( main.ONOSip[ i ] )
main.log.info( "NODE COUNT = %s" % main.numCtrls)
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index ab6e34d..75c0aa1 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -121,7 +121,8 @@
" before initiating environment setup")
for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[i] )
+ main.ONOSbench.onosStop( main.ONOSip[i] )
+ main.ONOSbench.onosKill( main.ONOSip[i] )
main.log.info( "NODE COUNT = %s" % main.numCtrls )
main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 412ef29..c6b1f34 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -118,7 +118,8 @@
" before initiating environment setup")
for i in range(main.numCtrls):
- main.ONOSbench.onosDie(main.ONOSip[i])
+ main.ONOSbench.onosStop(main.ONOSip[i])
+ main.ONOSbench.onosKill(main.ONOSip[i])
main.log.info("NODE COUNT = %s" % main.numCtrls)
main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 5138950..4d72293 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -143,7 +143,8 @@
" before initiating environment setup")
for i in range(main.numCtrls):
- main.ONOSbench.onosDie(main.ONOSip[i])
+ main.ONOSbench.onosStop(main.ONOSip[i])
+ main.ONOSbench.onosKill(main.ONOSip[i])
main.log.info("NODE COUNT = %s" % main.numCtrls)
main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index ae38911..b29ca81 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
@@ -122,7 +122,8 @@
" before initiating environment setup")
for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[i] )
+ main.ONOSbench.onosStop( main.ONOSip[i] )
+ main.ONOSbench.onosKill( main.ONOSip[i] )
main.log.info( "NODE COUNT = %s" % main.numCtrls )
main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index ea2a6dd..3304d27 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -167,7 +167,8 @@
" before initiating environment setup" )
for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ main.ONOSbench.onosKill( main.ONOSip[ i ] )
tempOnosIp = []
for i in range( main.numCtrls ):
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 46714ac..f82d684 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -140,7 +140,8 @@
" before initiating environment setup" )
for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ main.ONOSbench.onosKill( main.ONOSip[ i ] )
main.log.info( "NODE COUNT = %s" % main.numCtrls)
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 46a5f47..e62951a 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -125,7 +125,8 @@
" before initiating environment setup")
for i in range(main.numCtrls):
- main.ONOSbench.onosDie(main.ONOSip[i])
+ main.ONOSbench.onosStop(main.ONOSip[i])
+ main.ONOSbench.onosKill(main.ONOSip[i])
main.log.info("NODE COUNT = %s" % main.numCtrls)
main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index 78d0d37..4f46e48 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -195,6 +195,13 @@
resultFile.close()
FinAckSeq = processPackage( FinAckText )[ 'Seq' ]
FinAckOFseq = findSeqBySeqAck( FinAckSeq, resultText )
+ if FinAckOFseq == None:
+ main.log.warn( "Tshark Result was incorrect!" )
+ main.log.warn( resultText )
+ main.wrong[ 'TsharkValueIncorrect' ] += 1
+ main.wrong[ 'totalWrong' ] += 1
+ checkTotalWrongNum()
+ return
with open( main.tsharkResultPath[ 'down' ][ 'ACK' ], "r" ) as resultFile:
ACKlines = resultFile.readlines()
resultFile.close()