Merge "Test Suite for VPN Service"
authorLuis Gomez <ecelgp@gmail.com>
Thu, 30 Apr 2015 02:02:45 +0000 (02:02 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 30 Apr 2015 02:02:45 +0000 (02:02 +0000)
test/csit/libraries/KarafKeywords.txt
test/csit/suites/vpnservice/010__vpn.robot [new file with mode: 0644]

index bb44ce400c9e9cca440d1ecd7ba8860cd7221b8c..2a1ebea7b82dca210e4905ca14b6aa3cd3ff26fc 100644 (file)
@@ -3,40 +3,62 @@ Library           SSHLibrary
 Library           OperatingSystem
 
 *** Variables ***
-${WORKSPACE}            /tmp
-${BUNDLEFOLDER}         distribution-karaf-0.3.0-SNAPSHOT
-${karaf_shell_port}     8101
-${karaf_prompt}         opendaylight-user
-${karaf_user}           karaf
-${karaf_password}       karaf
+${WORKSPACE}      /tmp
+${BUNDLEFOLDER}    distribution-karaf-0.3.0-SNAPSHOT
+${karaf_shell_port}    8101
+${karaf_prompt}    opendaylight-user
+${karaf_user}     karaf
+${karaf_password}    karaf
 
 *** Keywords ***
 Check Karaf Log File Does Not Have Messages
-    [Arguments]     ${ip}   ${message}  ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
-    ${output}=  Run Command On Remote System    ${ip}   grep ${message} ${log_file}
-    Should Not Contain  ${output}   ${message}
+    [Arguments]    ${ip}    ${message}    ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
+    ${output}=    Run Command On Remote System    ${ip}    grep ${message} ${log_file}
+    Should Not Contain    ${output}    ${message}
 
 Verify Feature Is Installed
-    [Documentation]     Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
-    [Arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}
-    ${output}=  Issue Command On Karaf Console  feature:list -i | grep ${feature_name}     ${controller}   ${karaf_port}
-    Should Contain  ${output}   ${feature_name}
+    [Arguments]    ${feature_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
+    [Documentation]    Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
+    ${output}=    Issue Command On Karaf Console    feature:list -i | grep ${feature_name}    ${controller}    ${karaf_port}
+    Should Contain    ${output}    ${feature_name}
     [Return]    ${output}
 
 Verify Feature Is Not Installed
-    [Documentation]     Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i"
-    [Arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}
-    ${output}=  Issue Command On Karaf Console  feature:list -i | grep ${feature_name}     ${controller}   ${karaf_port}
-    Should Not Contain  ${output}   ${feature_name}
+    [Arguments]    ${feature_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
+    [Documentation]    Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i"
+    ${output}=    Issue Command On Karaf Console    feature:list -i | grep ${feature_name}    ${controller}    ${karaf_port}
+    Should Not Contain    ${output}    ${feature_name}
     [Return]    ${output}
 
 Issue Command On Karaf Console
-    [Documentation]     Will execute the given ${cmd} by ssh'ing to the karaf console running on ${CONTROLLER}
-    [Arguments]     ${cmd}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}    ${timeout}=5
-    Open Connection    ${controller}    port=${karaf_port}  prompt=${karaf_prompt}      timeout=${timeout}
+    [Arguments]    ${cmd}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}    ${timeout}=5
+    [Documentation]    Will execute the given ${cmd} by ssh'ing to the karaf console running on ${CONTROLLER}
+    Open Connection    ${controller}    port=${karaf_port}    prompt=${karaf_prompt}    timeout=${timeout}
     Login    ${karaf_user}    ${karaf_password}
     Write    ${cmd}
     ${output}    Read Until    ${karaf_prompt}
     Close Connection
-    Log     ${output}
+    Log    ${output}
+    [Return]    ${output}
+
+Verify Bundle Is Installed
+    [Arguments]    ${bundle_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
+    [Documentation]    Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "
+    ${output}=    Issue Command On Karaf Console    bundle:list -s | grep ${bundle_name}    ${controller}    ${karaf_port}
+    Should Contain    ${output}    ${bundle_name}
+    [Return]    ${output}
+
+Verify Bundle Is Not Installed
+    [Arguments]    ${bundle_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
+    [Documentation]    Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s"
+    ${output}=    Issue Command On Karaf Console    bundle:list -i | grep ${bundle_name}    ${controller}    ${karaf_port}
+    Should Not Contain    ${output}    ${bundle_name}
+    [Return]    ${output}
+
+Check Karaf Log Has Messages
+    [Arguments]    ${filter_string}    @{message_list}
+    [Documentation]    Will succeed if the @{messages} are found in \ the output of "log:display"
+    ${output}=    Issue Command On Karaf Console    log:display | grep ${filter_string}
+    : FOR    ${message}    IN    @{message_list}
+    \    Should Contain    ${output}    ${message}
     [Return]    ${output}
diff --git a/test/csit/suites/vpnservice/010__vpn.robot b/test/csit/suites/vpnservice/010__vpn.robot
new file mode 100644 (file)
index 0000000..0d1bd8e
--- /dev/null
@@ -0,0 +1,49 @@
+*** Settings ***
+Documentation     Test Suite that installs vpn service features, verifies the features and corresponding bundles are installed.Uninstalls the features and verifies the corresponding features and bundles are uninstalled.
+Resource          ../../libraries/KarafKeywords.txt
+
+*** Variables ***
+@{FEATURE_LIST}    odl-vpnservice-api    odl-vpnservice-impl    odl-vpnservice-impl-rest    odl-vpnservice-impl-ui    odl-vpnservice-core
+@{BUNDLE_LIST}    org.opendaylight.vpnservice.vpnmanager-impl    org.opendaylight.vpnservice.interfacemgr-impl    org.opendaylight.vpnservice.nexthopmgr-impl    org.opendaylight.vpnservice.idmanager-impl    org.opendaylight.vpnservice.fibmanager-impl    org.opendaylight.vpnservice.bgpmanager-impl    org.opendaylight.vpnservice.model-bgp
+@{MESSAGE_STRING_LIST}    VpnserviceProvider Session Initiated    InterfacemgrProvider Session Initiated    NexthopmgrProvider Session Initiated    IDManagerserviceProvider Session Initiated    FibManagerProvider Session Initiated    BgpManager Session Initiated
+
+*** Test Cases ***
+Install the VPN Service features
+    [Documentation]    Installs the vpn service featues by executing command "feature:install odl-vpnservice-core" in karaf console
+    [Tags]    Install VPN Features
+    ${output}=    Issue Command On Karaf Console    feature:install odl-vpnservice-core    timeout=120 seconds
+
+Verify if the VPN Service features are installed for vpnservice
+    [Documentation]    Executes command "feature list -i | grep <feature_name>" in karaf console and checks if output \ contain \ the specific features.
+    [Tags]    Verify Feature
+    : FOR    ${feature}    IN    @{FEATURE_LIST}
+    \    Verify Feature Is Installed    ${feature}
+
+Verify if the VPN Service bundles are loaded
+    [Documentation]    Executes command "bundle:list -s | grep <bundle name>" and checks in the output for the specific bundles
+    [Tags]    Verify VPN bundles
+    : FOR    ${bundle}    IN    @{BUNDLE_LIST}
+    \    Verify Bundle Is Installed    ${bundle}
+
+Verify if the sessions for bundles got initiated
+    [Documentation]    Executes"log:display | grep vpnservice" command in karaf console and verifies the logs for session initiation
+    [Tags]    Verify Session
+    Wait Until Keyword Succeeds    240 seconds    30 seconds    Check Karaf Log Has Messages    vpnservice    @{MESSAGE_STRING_LIST}
+
+Uninstall the VPN Service Features
+    [Documentation]    Uninstalls the VPN Service feature by executing command "feature:uninstall <feature name>" in karaf console
+    [Tags]    Uninstall VPN features
+    : FOR    ${feature}    IN    @{FEATURE_LIST}
+    \    ${output}=    Issue Command On Karaf Console    feature:uninstall ${feature}    timeout=30 seconds
+
+Verify if the VPN Service features are uninstalled
+    [Documentation]    Executes command "feature:list -i | grep <feature name>" in karaf console and checks if the output does not contain the specific features
+    [Tags]    Verify No Feature
+    : FOR    ${feature}    IN    @{FEATURE_LIST}
+    \    Verify Feature Is Not Installed    ${feature}
+
+Verify if the VPN Bundles are not loaded
+    [Documentation]    Executes "bundle:list -s | grep <bundle name>" command and checks if the output does not contain the specific bundles.
+    [Tags]    Verify No Bundles
+    : FOR    ${bundle}    IN    @{BUNDLE_LIST}
+    \    Verify Bundle Is Not Installed    ${bundle}