Basic clustering tests for daexim 15/66715/13
authorSreekalyan Devaraj <kalyan.ds@gmail.com>
Thu, 21 Dec 2017 18:47:19 +0000 (10:47 -0800)
committerLuis Gomez <ecelgp@gmail.com>
Mon, 1 Jan 2018 20:17:13 +0000 (20:17 +0000)
  - Executing pre-existing tests on cluster
  - Adding basic export testcase to cluster
  - Adding a new kw and testsuite for localized export
  - Swapping out initial state with skipped and removed unwanted json
  - Modifying kw to verify files
  - Changing the order of test cases
  - Cleaning up the export files before export call
  - Adding basic import to a cluster
  - Correcting a typo
  - Modifying the kw as per comments

Change-Id: I06cc3570e413edfa527a87ac4944d916fa5bc39e
Signed-off-by: Sreekalyan Devaraj <kalyan.ds@gmail.com>
csit/libraries/DaeximKeywords.robot
csit/suites/daexim/110-cluster-local-export-basic.robot [new file with mode: 0644]
csit/suites/daexim/120-cluster-export-basic.robot [new file with mode: 0644]
csit/suites/daexim/130-cluster-import-basic.robot [new file with mode: 0644]
csit/testplans/daexim-clustering-basic.txt [new file with mode: 0644]
csit/variables/daexim/DaeximVariables.robot
csit/variables/daexim/schedule_export.json

index 31e5263393343f109574065cb3165244232a95b8..65833c2fe5847cd83c89af7ac587af0d5304ea04 100644 (file)
@@ -23,6 +23,20 @@ Verify Export Files
     Builtin.Log    ${opr}
     Builtin.Should Match Regexp    ${opr}    .*${EXP_OPER_FILE}
 
+Verify Export Files Not Present
+    [Arguments]    ${host_index}
+    [Documentation]    Verify if the backedup files are not present in the controller
+    ${host_index}    Builtin.Convert To Integer    ${host_index}
+    ${cfg}    ClusterManagement.Run Bash Command On Member    ls -lart ${WORKSPACE}/${BUNDLEFOLDER}/daexim/${EXP_DATA_FILE}    ${host_index}
+    Builtin.Log    ${cfg}
+    Builtin.Should Not Match Regexp    ${cfg}    .*${EXP_DATA_FILE}
+    ${mdl}    ClusterManagement.Run Bash Command On Member    ls -lart ${WORKSPACE}/${BUNDLEFOLDER}/daexim/${MODELS_FILE}    ${host_index}
+    Builtin.Log    ${mdl}
+    Builtin.Should Not Match Regexp    ${mdl}    .*${MODELS_FILE}
+    ${opr}    ClusterManagement.Run Bash Command On Member    ls -lart ${WORKSPACE}/${BUNDLEFOLDER}/daexim/${EXP_OPER_FILE}    ${host_index}
+    Builtin.Log    ${opr}
+    Builtin.Should Not Match Regexp    ${opr}    .*${EXP_OPER_FILE}
+
 Cleanup The Export Files
     [Arguments]    ${host_index}
     [Documentation]    Verify if the export directory exists and delete the files if needed
@@ -54,7 +68,7 @@ Verify Export Status Message
     [Arguments]    ${status}    ${output}
     [Documentation]    Verify export restconf response message is as expected
     Builtin.Should Match Regexp    ${output}    "status": "${status}"
-    Builtin.Run Keyword If    "${status}" == "initial" or "${status}" == "scheduled"    Verify Json Files Not Present    ${output}
+    Builtin.Run Keyword If    "${status}" == "initial" or "${status}" == "scheduled" or "${status}" == "skipped"    Verify Json Files Not Present    ${output}
     ...    ELSE    Verify Json Files Present    ${output}
 
 Verify Json Files Present
@@ -74,7 +88,7 @@ Verify Json Files Not Present
     Builtin.Log    Did not Find all Json Files
 
 Schedule Export
-    [Arguments]    ${controller_index}    ${TIME}=500    ${exclude}=${FALSE}    ${MODULE}=${EMPTY}    ${STORE}=${EMPTY}
+    [Arguments]    ${controller_index}    ${TIME}=500    ${exclude}=${FALSE}    ${MODULE}=${EMPTY}    ${STORE}=${EMPTY}    ${FLAG}=false
     [Documentation]    Schedule Export job
     ${file}    Builtin.Set Variable If    ${exclude}    ${EXPORT_EXCLUDE_FILE}    ${EXPORT_FILE}
     ${JSON1}    OperatingSystem.Get File    ${file}
@@ -193,3 +207,10 @@ Schedule Import
     Builtin.Log    ${resp}
     Builtin.Should Match Regexp    ${resp}    .*"result": ${result}
     Builtin.Run Keyword If    "${reason}" != "${EMPTY}"    Builtin.Should Match Regexp    ${response_json}    .*"reason":"${reason}
+
+Cleanup Cluster Export Files
+    [Arguments]    ${member_index_list}=${EMPTY}
+    [Documentation]    This keyword cleansup export files of a cluster
+    ${index_list} =    List_Indices_Or_All    given_list=${member_index_list}
+    : FOR    ${index}    IN    @{index_list}    # usually: 1, 2, 3.
+    \    DaeximKeywords.Cleanup The Export Files    ${index}
diff --git a/csit/suites/daexim/110-cluster-local-export-basic.robot b/csit/suites/daexim/110-cluster-local-export-basic.robot
new file mode 100644 (file)
index 0000000..1416cc8
--- /dev/null
@@ -0,0 +1,20 @@
+*** Settings ***
+Documentation     Test suite for verifying basic export only on a local node with a netconf mount on a cluster
+Suite Setup       ClusterManagement Setup
+Suite Teardown    Delete All Sessions
+Resource          ../../libraries/DaeximKeywords.robot
+
+*** Test Cases ***
+Create Basic Local Export
+    [Documentation]    schedule a basic export/backup on a cluster node, with controller mounting itself as a netconf device.Verifies if the export is limited to a local node.
+    [Tags]    create backup
+    DaeximKeywords.Mount Netconf Endpoint    ${NETCONF_EP_NAME}    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Cleanup Cluster Export Files
+    DaeximKeywords.Schedule Export    ${FIRST_CONTROLLER_INDEX}    500    ${FALSE}    ${EMPTY}    ${EMPTY}    true
+    DaeximKeywords.Verify Export Status    ${EXPORT_SCHEDULED_STATUS}    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Status    ${EXPORT_SKIPPED_STATUS}    ${SECOND_CONTROLLER_INDEX}
+    Builtin.Wait Until Keyword Succeeds    10 sec    5 sec    DaeximKeywords.Verify Export Status    ${EXPORT_COMPLETE_STATUS}    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Files    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Files Not Present    ${THIRD_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Files Not Present    ${SECOND_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Netconf Mount    ${NETCONF_EP_NAME}    ${THIRD_CONTROLLER_INDEX}
diff --git a/csit/suites/daexim/120-cluster-export-basic.robot b/csit/suites/daexim/120-cluster-export-basic.robot
new file mode 100644 (file)
index 0000000..8d25115
--- /dev/null
@@ -0,0 +1,17 @@
+*** Settings ***
+Documentation     Test suite for verifying basic export with a netconf mount on a cluster
+Suite Setup       ClusterManagement Setup
+Suite Teardown    Delete All Sessions
+Resource          ../../libraries/DaeximKeywords.robot
+
+*** Test Cases ***
+Create Basic Export
+    [Documentation]    schedule a basic export/backup on a cluster, with controller mounting itself as a netconf device
+    [Tags]    create backup
+    DaeximKeywords.Mount Netconf Endpoint    ${NETCONF_EP_NAME}    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Cleanup Cluster Export Files
+    DaeximKeywords.Schedule Export    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Status    ${EXPORT_SCHEDULED_STATUS}    ${SECOND_CONTROLLER_INDEX}
+    Builtin.Wait Until Keyword Succeeds    10 sec    5 sec    DaeximKeywords.Verify Export Status    ${EXPORT_COMPLETE_STATUS}    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Export Files    ${SECOND_CONTROLLER_INDEX}
+    DaeximKeywords.Verify Netconf Mount    ${NETCONF_EP_NAME}    ${THIRD_CONTROLLER_INDEX}
diff --git a/csit/suites/daexim/130-cluster-import-basic.robot b/csit/suites/daexim/130-cluster-import-basic.robot
new file mode 100644 (file)
index 0000000..0eadb59
--- /dev/null
@@ -0,0 +1,16 @@
+*** Settings ***
+Documentation     Test suite for verifying basic import on a cluster
+Suite Setup       ClusterManagement Setup
+Suite Teardown    Delete All Sessions
+Resource          ../../libraries/DaeximKeywords.robot
+
+*** Test Cases ***
+Create Basic Import
+    [Documentation]    schedule a basic import/restore with data containg controller mounting itself as a netconf device on a cluster
+    [Tags]    create restore
+    DaeximKeywords.Cleanup Cluster Export Files
+    ClusterManagement.Stop_Members_From_List_Or_All
+    ClusterManagement.Start_Members_From_List_Or_All
+    DaeximKeywords.Copy Config Data To Controller    ${FIRST_CONTROLLER_INDEX}
+    DaeximKeywords.Schedule Import    ${FIRST_CONTROLLER_INDEX}
+    Builtin.Wait Until Keyword Succeeds    30 sec    5 sec    DaeximKeywords.Verify Netconf Mount    ${NETCONF_EP_NAME}    ${THIRD_CONTROLLER_INDEX}
diff --git a/csit/testplans/daexim-clustering-basic.txt b/csit/testplans/daexim-clustering-basic.txt
new file mode 100644 (file)
index 0000000..372ee65
--- /dev/null
@@ -0,0 +1,4 @@
+test/csit/suites/daexim/010-special-export.robot
+test/csit/suites/daexim/110-cluster-local-export-basic.robot
+test/csit/suites/daexim/120-cluster-export-basic.robot
+test/csit/suites/daexim/130-cluster-import-basic.robot
index 0aae6a523d572ce64a0e4b5d063d4672fe1901ad..fe3c51b78cdece6a1682c3638f7080ae8a997e7b 100644 (file)
@@ -18,7 +18,10 @@ ${NETCONF_EP_NAME}    CONTROLLER1
 ${EXPORT_INITIAL_STATUS}    initial
 ${EXPORT_SCHEDULED_STATUS}    scheduled
 ${EXPORT_COMPLETE_STATUS}    complete
+${EXPORT_SKIPPED_STATUS}    skipped
 ${FIRST_CONTROLLER_INDEX}    1
+${SECOND_CONTROLLER_INDEX}    2
+${THIRD_CONTROLLER_INDEX}    3
 ${NTCF_TPLG_OPR_URL}    /restconf/operational/network-topology:network-topology/topology/topology-netconf/node/
 ${NETCONF_PORT}    1830
 ${NTCF_OPR_STATUS}    connected
index fbdc553f0399f78a86b8f41769166532b2394fcb..6d19783d81c6bb54676a25a2ea2f80a0831fcdcf 100644 (file)
@@ -1,5 +1,6 @@
  {
    "input": {
-    "data-export-import:run-at": "${TIME}"
+    "data-export-import:run-at": "${TIME}",
+    "data-export-import:local-node-only": "${FLAG}"
    }
  }