aboutsummaryrefslogtreecommitdiffstats
path: root/framework/scripts/function_test
diff options
context:
space:
mode:
Diffstat (limited to 'framework/scripts/function_test')
-rw-r--r--framework/scripts/function_test/Teston/Readme.txt5
-rw-r--r--framework/scripts/function_test/Teston/__init__.py0
-rw-r--r--framework/scripts/function_test/Teston/adapters/__init__.py0
-rw-r--r--framework/scripts/function_test/Teston/adapters/foundation.py64
-rw-r--r--framework/scripts/function_test/Teston/config.yaml16
-rw-r--r--framework/scripts/function_test/Teston/dependencies/onos23
-rw-r--r--framework/scripts/function_test/Teston/log/temp.log0
-rw-r--r--framework/scripts/function_test/Teston/onosfunctest.py21
8 files changed, 129 insertions, 0 deletions
diff --git a/framework/scripts/function_test/Teston/Readme.txt b/framework/scripts/function_test/Teston/Readme.txt
new file mode 100644
index 00000000..7393f59a
--- /dev/null
+++ b/framework/scripts/function_test/Teston/Readme.txt
@@ -0,0 +1,5 @@
+1.This is a basic test run about onos,we will make them better and better
+2.This test include two suites:
+(1)Test northbound(network/subnet/ports create/update/delete)
+(2)Ovsdb test,default configuration,openflow connection,vm go onlines.
+3.Later we will make a framework to do this test \ No newline at end of file
diff --git a/framework/scripts/function_test/Teston/__init__.py b/framework/scripts/function_test/Teston/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/framework/scripts/function_test/Teston/__init__.py
diff --git a/framework/scripts/function_test/Teston/adapters/__init__.py b/framework/scripts/function_test/Teston/adapters/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/framework/scripts/function_test/Teston/adapters/__init__.py
diff --git a/framework/scripts/function_test/Teston/adapters/foundation.py b/framework/scripts/function_test/Teston/adapters/foundation.py
new file mode 100644
index 00000000..c909d36b
--- /dev/null
+++ b/framework/scripts/function_test/Teston/adapters/foundation.py
@@ -0,0 +1,64 @@
+"""
+Description:
+ This file include basis functions
+ lanqinglong@huawei.com
+"""
+
+import logging
+import os
+import time
+import yaml
+
+class foundation:
+
+ def __init__(self):
+
+ currentpath = os.getcwd()
+ self.logdir = os.path.join( currentpath, 'log' )
+ self.workhome = currentpath[0:currentpath.rfind('testcases')-1]
+ self.Result_DB = ''
+
+ def log (self, loginfo):
+ """
+ Record log in log directory for deploying test environment
+ parameters:
+ loginfo(input): record info
+ """
+ filename = time.strftime( '%Y-%m-%d-%H-%M-%S' ) + '.log'
+ filepath = os.path.join( self.logdir, filename )
+ logging.basicConfig( level=logging.INFO,
+ format = '%(asctime)s %(filename)s:%(message)s',
+ datefmt = '%d %b %Y %H:%M:%S',
+ filename = filepath,
+ filemode = 'w')
+ filelog = logging.FileHandler( filepath )
+ logging.getLogger( 'Functest' ).addHandler( filelog )
+ print loginfo
+ logging.info(loginfo)
+
+ def getdefaultpara( self ):
+ """
+ Get Default Parameters value
+ """
+ with open(self.workhome + "testcases/config_functest.yaml") as f:
+ functest_yaml = yaml.safe_load(f)
+ f.close()
+
+ self.Result_DB = str(functest_yaml.get("results").get("test_db_url"))
+ self.masterusername = str(functest_yaml.get("ONOS").get("general").\
+ get('onosbench_username'))
+ self.masterpassword = str(functest_yaml.get("ONOS").get("general").\
+ get("onosbench_password"))
+ self.agentusername = str(functest_yaml.get("ONOS").get("general").\
+ get("onoscli_username"))
+ self.agentpassword = str(functest_yaml.get("ONOS").get("general").\
+ get("onoscli_password"))
+ self.runtimeout = functest_yaml.get("ONOS").get("general").get("runtimeout")
+ self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT"))
+ self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1"))
+ self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2"))
+ self.OC3 = str(functest_yaml.get("ONOS").get("environment").get("OC3"))
+ self.OCN = str(functest_yaml.get("ONOS").get("environment").get("OCN"))
+ self.OCN2 = str(functest_yaml.get("ONOS").get("environment").get("OCN2"))
+ self.localhost = self.OCT
+ return True \ No newline at end of file
diff --git a/framework/scripts/function_test/Teston/config.yaml b/framework/scripts/function_test/Teston/config.yaml
new file mode 100644
index 00000000..78afb01b
--- /dev/null
+++ b/framework/scripts/function_test/Teston/config.yaml
@@ -0,0 +1,16 @@
+ONOS:
+ general:
+ onosbench_username: 'root'
+ onosbench_password: 'root'
+ onoscli_username: 'root'
+ onoscli_password: 'root'
+ runtimeout: 300
+ environment:
+ OCT: '189.42.8.99'
+ OC1: '189.42.8.101'
+ OC2: '189.42.8.102'
+ OC3: '189.42.8.103'
+ OCN: '189.42.8.104'
+ OCN2: '189.42.8.105'
+results:
+ test_db_url: http://213.77.62.197 \ No newline at end of file
diff --git a/framework/scripts/function_test/Teston/dependencies/onos b/framework/scripts/function_test/Teston/dependencies/onos
new file mode 100644
index 00000000..d4d59e0f
--- /dev/null
+++ b/framework/scripts/function_test/Teston/dependencies/onos
@@ -0,0 +1,23 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# ONOS remote command-line client.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. /root/.bashrc
+. $ONOS_ROOT/tools/build/envDefaults
+. $ONOS_ROOT/tools/test/bin/find-node.sh
+
+[ "$1" = "-w" ] && shift && onos-wait-for-start $1
+
+[ -n "$1" ] && OCI=$(find_node $1) && shift
+
+if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
+ # Use Karaf client only if we can and are allowed to
+ unset KARAF_HOME
+ client -h $OCI -u karaf "$@" 2>/dev/null
+else
+ # Otherwise use raw ssh; strict checking is off for dev environments only
+ #ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@"
+ sshpass -p karaf ssh -l karaf -p 8101 $OCI "$@"
+fi
diff --git a/framework/scripts/function_test/Teston/log/temp.log b/framework/scripts/function_test/Teston/log/temp.log
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/framework/scripts/function_test/Teston/log/temp.log
diff --git a/framework/scripts/function_test/Teston/onosfunctest.py b/framework/scripts/function_test/Teston/onosfunctest.py
new file mode 100644
index 00000000..e8524430
--- /dev/null
+++ b/framework/scripts/function_test/Teston/onosfunctest.py
@@ -0,0 +1,21 @@
+"""
+Description: This test is to run onos Teston VTN scripts
+
+List of test cases:
+CASE1 - Northbound NBI test network/subnet/ports
+CASE2 - Ovsdb test&Default configuration&Vm go online
+
+lanqinglong@huawei.com
+"""
+from adapters.client import client
+
+if __name__=="__main__":
+
+ main = client()
+ main.getdefaultpara()
+
+ #scripts to run
+ runhandle = main.onosstart()
+ main.RunScript(runhandle, "FUNCvirNetNB")
+ main.RunScript(runhandle, "FUNCovsdbtest")
+ main.onosclean( runhandle )