Merge "Cluster sanity test using openflow plugin"
authorLuis Gomez <ecelgp@gmail.com>
Sat, 28 Mar 2015 16:47:56 +0000 (16:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 28 Mar 2015 16:47:56 +0000 (16:47 +0000)
test/csit/libraries/KarafKeywords.txt [new file with mode: 0644]
test/csit/libraries/Utils.txt
test/csit/suites/openflowplugin/Performance/010_Cbench.txt.robot [new file with mode: 0644]
test/tools/VM_Tool/README.md
test/tools/VM_Tool/Vagrantfile
test/tools/VM_Tool/scripts/fedora.sh [moved from test/tools/VM_Tool/scripts/centos.sh with 52% similarity]
test/tools/VM_Tool/scripts/ubuntu.sh

diff --git a/test/csit/libraries/KarafKeywords.txt b/test/csit/libraries/KarafKeywords.txt
new file mode 100644 (file)
index 0000000..ad2f6bb
--- /dev/null
@@ -0,0 +1,20 @@
+*** Settings ***
+Library           OperatingSystem
+
+*** Variables ***
+${karaf_shell_port}     8101
+
+*** Keywords ***
+Verify Feature Is Installed
+    [Documentation]     Will Succeed if the given ${feature_name} is found in the output of "feature:list -i" by
+    ...     ssh'ing to the karaf console running on ${CONTROLLER}
+    [arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}       ${prompt}=${linux_prompt}   ${prompt_timeout}=5s
+    ${output}=  Run     sshpass -p karaf ssh -p ${karaf_port} karaf@${controller} feature:list -i
+    Should Contain  ${output}   ${feature_name}
+
+Verify Feature Is Not Installed
+    [Documentation]     Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i" by
+    ...     ssh'ing to the karaf console running on ${CONTROLLER}
+    [arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}       ${prompt}=${linux_prompt}   ${prompt_timeout}=5s
+    ${output}=  Run     sshpass -p karaf ssh -p ${karaf_port} karaf@${controller} feature:list -i
+    Should Not Contain  ${output}   ${feature_name}
\ No newline at end of file
index 913ba22c08bddba1cbbd770df8ffc98431ad8b6f..99d04622c2bf64049366772e975a1e7da56af34c 100644 (file)
@@ -104,3 +104,22 @@ Strip Quotes
     [Documentation]    Will strip ALL quotes from given string and return the new string
     ${string_to_return}=    Replace String    ${string_to_strip}    "    \    count=-1
     [Return]    ${string_to_return}
+
+Run Command On Remote System
+    [Arguments]     ${remote_system}    ${cmd}  ${user}=${MININET_USER}    ${prompt}=${LINUX_PROMPT}   ${prompt_timeout}=30s
+    [Documentation]     Reduces the common work of running a command on a remote system to a single higher level robot keyword,
+    ...     taking care to log in with a public key and.  The command given is written and the output returned.  No test conditions
+    ...     are checked.
+    Log    Attempting to execute ${cmd} on ${remote_system}
+    ${conn_id}=     Open Connection    ${remote_system}    prompt=${prompt}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any
+    Write    ${cmd}
+    ${output}=  Read Until    ${linux_prompt}
+    [Return]    ${output}
+
+Verify File Exists On Remote System
+    [Arguments]  ${remote_system}    ${file}  ${user}=${MININET_USER}    ${prompt}=${LINUX_PROMPT}   ${prompt_timeout}=5s
+    [Documentation]     Will create connection with public key and will PASS if the given ${file} exists, otherwise will FAIL
+    ${conn_id}=     Open Connection    ${remote_system}    prompt=${prompt}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any
+    SSHLibrary.File Should Exist   ${file}
diff --git a/test/csit/suites/openflowplugin/Performance/010_Cbench.txt.robot b/test/csit/suites/openflowplugin/Performance/010_Cbench.txt.robot
new file mode 100644 (file)
index 0000000..b9a6cc4
--- /dev/null
@@ -0,0 +1,72 @@
+*** Settings ***
+Documentation     Cbench Latency and Throughput tests can be run from an external
+...                 cbench.
+...                 If cbench is run with a medium number of switches or higher (e.g. 32+)
+...                 the normal openflow operations seem to break.
+...                 BUG:  https://bugs.opendaylight.org/show_bug.cgi?id=2897
+Suite Setup       Cbench Suite Setup
+Force Tags        cbench
+Library           String
+Resource          ../../../libraries/Utils.txt
+Resource          ../../../libraries/KarafKeywords.txt
+
+
+*** Variables ***
+${throughput_threshold}     30000
+${latency_threshold}        10000
+${switch_count}             8
+${duration_in_secs}         12
+${loops}                    10
+${num_of_unique_macs}       10000
+${cbench_system}            ${MININET}
+${cbench_executable}        /usr/local/bin/cbench
+
+*** Testcases ***
+Cbench Throughput Test
+    [Documentation]     cbench executed in throughput mode (-t).  Test parameters have defaults, but can be overridden
+    ...     on the pybot command line
+    [Tags]  throughput
+    [Timeout]   ${test_timeout}
+    Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
+    Run Cbench And Log Results  -t -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}     ${throughput_threshold}
+
+Cbench Latency Test
+    [Documentation]     cbench executed in default latency mode.  Test parameters have defaults, but can be overridden
+    ...     on the pybot command line
+    [Tags]  latency
+    [Timeout]   ${test_timeout}
+    Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
+    Run Cbench And Log Results  -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}     ${latency_threshold}
+
+*** Keywords ***
+Run Cbench And Log Results
+    [Arguments]    ${cbench_args}    ${average_threshold}
+    ${output}=  Run Command On Remote System    ${cbench_system}   ${cbench_executable} -c ${CONTROLLER} ${cbench_args}  prompt_timeout=${test_timeout}
+    Log     ${output}
+    Should Contain    ${output}    RESULT
+    ${result_line}=    Get Lines Containing String    ${output}    RESULT
+    @{results_list}=    Split String    ${result_line}
+    Log    ${results_list[5]}
+    Log    ${results_list[7]}
+    @{result_name_list}=    Split String    ${results_list[5]}    /
+    @{result_value_list}=    Split String    ${results_list[7]}    /
+    ${num_stats}=    Get Length    ${result_name_list}
+    : FOR    ${i}    IN RANGE    0    ${num_stats}
+    \    Log    ${result_name_list[${i}]} :: ${result_value_list[${i}]}
+    ${min}=    Set Variable    ${result_value_list[${0}]}
+    ${max}=    Set Variable    ${result_value_list[${1}]}
+    ${average}=    Set Variable    ${result_value_list[${2}]}
+    ${stdev}=    Set Variable    ${result_value_list[${3}]}
+    ${date}=    Get Time    d,m,s
+    Log    CBench Result: ${date},${cbench_args},${min},${max},${average},${stdev}
+    Should Be True    ${average} > ${average_threshold}     Flow mod per/sec threshold was not met
+
+Cbench Suite Setup
+    ${duration_in_ms}           Evaluate    ${duration_in_secs} * 1000
+    Set Suite Variable  ${duration_in_ms}
+    ##Setting the test timeout dynamically in case larger values on command line override default
+    ${test_timeout}             Evaluate    (${loops} * ${duration_in_secs}) * 1.5
+    Set Suite Variable  ${test_timeout}
+    Verify File Exists On Remote System     ${cbench_system}    ${cbench_executable}
+    Should Be True  ${loops} >= 2   If number of loops is less than 2, cbench will not run
+    Verify Feature Is Installed     odl-openflowplugin-drop-test
\ No newline at end of file
index 1d3e7965f2eef0655c19df48e9cc94b6a9faeab2..edcf71e717b3d7ebe9f1c33088809aa8739e8c73 100644 (file)
@@ -69,7 +69,7 @@ Use `vagrant status` to see the supported boxes and their current status.
 $ vagrant status
 Current machine states:
 
-centos                    not created (virtualbox)
+fedora                    not created (virtualbox)
 ubuntu                    not created (virtualbox)
 ```
 
@@ -81,10 +81,10 @@ To start a tools VM:
 $ vagrant up <name of box>
 ```
 
-For example, to start the CentOS tools VM:
+For example, to start the Fedora tools VM:
 
 ```ShellSession
-$ vagrant up centos
+$ vagrant up fedora
 ```
 
 #### Connecting to boxes
@@ -95,11 +95,11 @@ To get a shell on a tools VM:
 $ vagrant ssh <name of box>
 ```
 
-For example, to connect to the CentOS tools VM:
+For example, to connect to the Fedora tools VM:
 
 ```ShellSession
-$ vagrant ssh centos
-[vagrant@tools-centos ~]$
+$ vagrant ssh fedora
+[vagrant@tools-fedora ~]$
 ```
 
 #### Cleaning up boxes
index 0899a00333525f78bfecdf62449078c4dd413570..b81a28e5c62a4b3ae669054522c709ebe589edb1 100644 (file)
@@ -8,9 +8,14 @@ $CPU = "2"
 # Initial Vagrant configuration
 Vagrant.configure(2) do |config|
 
-  # --------------------------------
-  # Shared VirtualBox configuration
-  # --------------------------------
+  # ---------------------
+  # Shared configurations
+  # ---------------------
+
+  # Enables SSH X11 forwarding
+  config.ssh.forward_x11 = "true"
+
+  # VirtualBox configuration
   config.vm.provider "virtualbox" do |vb|
     # Set RAM in MB
     vb.memory = $MEMORY
@@ -18,49 +23,51 @@ Vagrant.configure(2) do |config|
     vb.cpus = $CPU
   end
 
-  # --------------------------
-  # Configuration for CentOS 7
-  # --------------------------
-  config.vm.define "centos" do |centos|
-    # Build Vagrant box based on CentOS 7
-    centos.vm.box = "chef/centos-7.0"
+  # ---------------------------
+  # Configuration for Fedora 20
+  # ---------------------------
+
+  # Multi-machine definition for Fedora
+  config.vm.define "fedora" do |fedora|
+    # Build Vagrant box based on Fedora 20
+    fedora.vm.box = "chef/fedora-20"
     # Set hostname of box
-    centos.vm.hostname = "tools-centos"
-    # Enable X11 SSH forwarding for GUI applications
-    config.ssh.forward_x11 = "true"
+    fedora.vm.hostname = "tools-fedora"
+    # Use PTY for provisionning
+    fedora.ssh.pty = "True"
     # Use shell provisioner to install additional packages
-    centos.vm.provision "shell", path: "scripts/centos.sh"
+    fedora.vm.provision "shell", path: "scripts/fedora.sh"
 
     # Install OpenDaylight using its Puppet module
-    centos.vm.provision "puppet" do |puppet|
+    fedora.vm.provision "puppet" do |puppet|
       puppet.module_path = ["modules"]
       puppet.manifest_file = "odl_install.pp"
     end
 
     # VirtualBox configuration specific to this box
-    centos.vm.provider "virtualbox" do |vb|
-      # Name of VirtualBox guest machine
-      vb.name = "Integration Tools: CentOS-7"
+    fedora.vm.provider "virtualbox" do |vb|
+      # Name for guest machine
+      vb.name = "Integration Tools: Fedora 20"
     end
   end
 
   # ----------------------------------
   # Configuration for Ubuntu 14.04 LTS
   # ----------------------------------
+
+  # Multi-machine definition for Ubuntu
   config.vm.define "ubuntu" do |ubuntu|
     # Build Vagrant box based on Ubuntu 14.04
     ubuntu.vm.box = "ubuntu/trusty64"
     # Set hostname of box
     ubuntu.vm.hostname = "tools-ubuntu"
-    # Enable X11 SSH forwarding for GUI applications
-    ubuntu.ssh.forward_x11 = "true"
     # Use shell provisioner to install additional packages
-    #ubuntu.vm.provision "shell", path: "scripts/ubuntu.sh"
+    ubuntu.vm.provision "shell", path: "scripts/ubuntu.sh"
 
     # VirtualBox configuration specific to this box
     ubuntu.vm.provider "virtualbox" do |vb|
-      # Name of VirtualBox guest machine
-      vb.name = "Integration Tools: Ubuntu-14.04"
+      # Name for guest machine
+      vb.name = "Integration Tools: Ubuntu 14.04"
     end
   end
 end
similarity index 52%
rename from test/tools/VM_Tool/scripts/centos.sh
rename to test/tools/VM_Tool/scripts/fedora.sh
index 02cdb07ac989d5f10f3f099a5cd03dcea82a7316..ec40d5b38cdd7cd11c8f7a78b073dabf6c49f82d 100644 (file)
@@ -1,5 +1,8 @@
-# External shell script for the vagrant shell provisioner
-# This applies for the CentOS VM
+#!/usr/bin/env bash
+
+# --------------------------------------------
+# External shell provisioner script for Fedora
+# --------------------------------------------
 
 # Add EPEL repo for access to Puppet, git-review, etc.
 sudo yum install -y epel-release
@@ -7,7 +10,4 @@ sudo yum install -y epel-release
 # Install other packages (must be done after EPEL repo add)
 sudo yum install -y \
   puppet \
-  git \
-  git-review \
-  vim \
-  nano
+  git
index 370e66caadf0ac83dcaca797205636c7b7d76e10..625c8790dd805a791756bc096a8cec379621dfb1 100644 (file)
@@ -1,4 +1,19 @@
-# External shell script for the vagrant shell provisioner
-# This applies for the Ubuntu VM
+#!/usr/bin/env bash
 
-#TODO
+# --------------------------------------------
+# External shell provisioner script for Ubuntu
+# --------------------------------------------
+
+# Install initial softwares:
+apt-get update
+apt-get install -y \
+  openjdk-7-jre \
+  openjdk-7-jdk \
+  git
+
+# Install Maven
+wget -nv http://apache.sunsite.ualberta.ca/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz
+mkdir -p /usr/local/apache-maven
+tar -C /usr/local/apache-maven/ -xzf apache-maven-3.3.1-bin.tar.gz
+echo "export PATH=$PATH:/usr/local/apache-maven/apache-maven-3.3.1/bin" >> /home/vagrant/.bash_profile
+echo "MAVEN_OPTS=\"-Xms256m -Xmx512m\"" >> /home/vagrant/.bash_profile