Enhance CSIT for Daexim's inclusions feature 25/74225/17
authorRichard Kosegi <richard.kosegi@gmail.com>
Thu, 19 Jul 2018 09:31:24 +0000 (11:31 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 30 Jul 2018 18:19:19 +0000 (18:19 +0000)
Fix variables and KWs according to guideline.

Signed-off-by: Richard Kosegi <richard.kosegi@gmail.com>
Change-Id: I64f908c67d698ac19a286ead7896de3a0c68a973

csit/libraries/DaeximKeywords.robot
csit/suites/daexim/040-export-inclusions.robot
csit/variables/daexim/DaeximVariables.robot
csit/variables/daexim/import.json
csit/variables/daexim/schedule_export.json
csit/variables/daexim/schedule_export_exclude.json
csit/variables/daexim/schedule_export_include.json
csit/variables/daexim/schedule_export_include_exclude.json [new file with mode: 0644]

index 22484f231234a6242c3f88bf49999a00aeeb4380..5ed266ad900dcaf98a7c2f0c7b78669ea298bb9a 100644 (file)
@@ -41,7 +41,7 @@ Cleanup The Export Files
     [Arguments]    ${host_index}
     [Documentation]    Verify if the export directory exists and delete the files if needed
     ${host_index}    Builtin.Convert To Integer    ${host_index}
-    Builtin.Run Keyword And Ignore Error    ClusterManagement.Delete_And_Check_Member_List_Or_All    ${TOPOLOGY_URL}    ${host_index}
+    Builtin.Run Keyword And Ignore Error    ClusterManagement.Delete And Check Member List Or All    ${TOPOLOGY_URL}    ${host_index}
     ${output1}    Builtin.Run Keyword and IgnoreError    ClusterManagement.Run Bash Command On Member    sudo rm -rf ${WORKSPACE}/${BUNDLEFOLDER}/daexim;clear    ${host_index}
     ${output2}    Builtin.Run Keyword and IgnoreError    ClusterManagement.Run Bash Command On Member    rm -rf ${WORKSPACE}/${BUNDLEFOLDER}/daexim;clear    ${host_index}
     ${output}    ClusterManagement.Run Bash Command On Member    ls -lart ${WORKSPACE}/${BUNDLEFOLDER}    ${host_index}
@@ -51,7 +51,7 @@ Cleanup The Export Files
 Verify Export Status
     [Arguments]    ${status}    ${controller_index}
     [Documentation]    Verify export status is as expected
-    ${response_json}    ClusterManagement.Post_As_Json_To_Member    ${STATUS_EXPORT_URL}    ${EMPTY}    ${controller_index}
+    ${response_json}    ClusterManagement.Post As Json To Member    ${STATUS_EXPORT_URL}    ${EMPTY}    ${controller_index}
     Builtin.Log    ${response_json}
     ${response_json}    Builtin.Convert To String    ${response_json}
     Verify Export Status Message    ${status}    ${response_json}
@@ -59,7 +59,7 @@ Verify Export Status
 Verify Scheduled Export Timestamp
     [Arguments]    ${controller_index}    ${time}
     [Documentation]    Verify export timestamp is as expected
-    ${response_json}    ClusterManagement.Post_As_Json_To_Member    ${STATUS_EXPORT_URL}    ${EMPTY}    ${controller_index}
+    ${response_json}    ClusterManagement.Post As Json To Member    ${STATUS_EXPORT_URL}    ${EMPTY}    ${controller_index}
     Builtin.Log    ${response_json}
     ${response_json}    Builtin.Convert To String    ${response_json}
     Builtin.Should Match Regexp    ${response_json}    .*"run-at": "${time}"
@@ -88,15 +88,15 @@ 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}    ${FLAG}=false
-    ...    ${INCLUDE}=${FALSE}
+    [Arguments]    ${controller_index}    ${time}=500    ${exclude}=${FALSE}    ${module}=${EMPTY}    ${store}=${EMPTY}    ${flag}=false
+    ...    ${include}=${FALSE}
     [Documentation]    Schedule Export job
-    ${file}=    Builtin.Run Keyword If    ${INCLUDE}    Builtin.Set Variable    ${EXPORT_INCLUDE_FILE}
+    ${file} =    Builtin.Run Keyword If    ${include}    Builtin.Set Variable    ${EXPORT_INCLUDE_FILE}
     ...    ELSE    Builtin.Set Variable If    ${exclude}    ${EXPORT_EXCLUDE_FILE}    ${EXPORT_FILE}
-    ${JSON1}    OperatingSystem.Get File    ${file}
-    ${JSON2}    Builtin.Replace Variables    ${JSON1}
+    ${json}    OperatingSystem.Get File    ${file}
+    ${json}    Builtin.Replace Variables    ${json}
     Cleanup The Export Files    ${controller_index}
-    ${response_json}    ClusterManagement.Post_As_Json_To_Member    ${SCHEDULE_EXPORT_URL}    ${JSON2}    ${controller_index}
+    ${response_json}    ClusterManagement.Post As Json To Member    ${SCHEDULE_EXPORT_URL}    ${json}    ${controller_index}
     Builtin.Log    ${response_json}
 
 Schedule Exclude Export
@@ -113,11 +113,17 @@ Schedule Exclude Export
     [Return]    ${file_path}
 
 Schedule Include Export
-    [Arguments]    ${controller_index}    ${store}    ${module}
+    [Arguments]    ${controller_index}    ${store}    ${module}=${EMPTY}    ${exclude}=${FALSE}
     [Documentation]    Schedules a export with include option. Returns the file that has the included export.
     ${controller_index}    Builtin.Convert To Integer    ${controller_index}
     ${host}    ClusterManagement.Resolve IP Address For Member    ${controller_index}
-    Schedule Export    ${controller_index}    500    ${FALSE}    ${module}    ${store}    ${TRUE}
+    ${time}    Builtin.Set Variable    500
+    ${file} =    Builtin.Set Variable If    ${exclude}    ${EXPORT_INCEXCLUDE_FILE}    ${EXPORT_INCLUDE_FILE}
+    ${json}    OperatingSystem.Get File    ${file}
+    ${json}    Builtin.Replace Variables    ${json}
+    Cleanup The Export Files    ${controller_index}
+    ${response_json}    ClusterManagement.Post As Json To Member    ${SCHEDULE_EXPORT_URL}    ${json}    ${controller_index}
+    Builtin.Log    ${response_json}
     Builtin.Wait Until Keyword Succeeds    10 sec    5 sec    Verify Export Status    complete    ${controller_index}
     Verify Export Files    ${controller_index}
     Copy Export Directory To Test VM    ${host}
@@ -128,7 +134,7 @@ Schedule Include Export
 Cancel Export
     [Arguments]    ${controller_index}
     [Documentation]    Cancel the export job
-    ${response_json}    ClusterManagement.Post_As_Json_To_Member    ${CANCEL_EXPORT_URL}    ${EMPTY}    ${controller_index}
+    ${response_json}    ClusterManagement.Post As Json To Member    ${CANCEL_EXPORT_URL}    ${EMPTY}    ${controller_index}
     Builtin.Log    ${response_json}
 
 Return ConnnectionID
@@ -174,16 +180,16 @@ Mount Netconf Endpoint
     [Arguments]    ${endpoint}    ${host_index}
     [Documentation]    Mount a netconf endpoint
     ${ENDPOINT}    Builtin.Set Variable    ${endpoint}
-    ${JSON1}    OperatingSystem.Get File    ${CURDIR}/${NETCONF_PAYLOAD_JSON}
-    ${JSON2}    Builtin.Replace Variables    ${JSON1}
-    Builtin.Log    ${JSON2}
-    ${resp}    ClusterManagement.Put_As_Json_To_Member    ${NETCONF_MOUNT_URL}${endpoint}    ${JSON2}    ${host_index}
+    ${json}    OperatingSystem.Get File    ${CURDIR}/${NETCONF_PAYLOAD_JSON}
+    ${json}    Builtin.Replace Variables    ${json}
+    Builtin.Log    ${json}
+    ${resp}    ClusterManagement.Put As Json To Member    ${NETCONF_MOUNT_URL}${endpoint}    ${json}    ${host_index}
     Builtin.Log    ${resp}
 
 Fetch Status Information From Netconf Endpoint
     [Arguments]    ${endpoint}    ${host_index}
     [Documentation]    This keyword fetches netconf endpoint information
-    ${resp}    ClusterManagement.Get_From_Member    ${NTCF_TPLG_OPR_URL}${endpoint}    ${host_index}
+    ${resp}    ClusterManagement.Get From Member    ${NTCF_TPLG_OPR_URL}${endpoint}    ${host_index}
     ${output1}    Builtin.Set Variable    ${resp}
     ${output}    RequestsLibrary.To Json    ${output1}
     Builtin.Log    ${output}
@@ -212,12 +218,12 @@ Verify Netconf Mount
 Schedule Import
     [Arguments]    ${host_index}    ${result}=true    ${reason}=${EMPTY}    ${mdlflag}=${MDL_DEF_FLAG}    ${strflag}=${STR_DEF_FLAG}
     [Documentation]    Schedule an Import API
-    ${MODELFLAG}    Builtin.Set Variable    ${mdlflag}
-    ${STOREFLAG}    Builtin.Set Variable    ${strflag}
-    ${JSON1}    OperatingSystem.Get File    ${CURDIR}/${IMPORT_PAYLOAD}
-    ${JSON2}    Builtin.Replace Variables    ${JSON1}
-    Builtin.Log    ${JSON2}
-    ${resp}    Builtin.Wait Until Keyword Succeeds    120 seconds    10 seconds    ClusterManagement.Post_As_Json_To_Member    ${IMPORT_URL}    ${JSON2}
+    ${modelflag}    Builtin.Set Variable    ${mdlflag}
+    ${storeflag}    Builtin.Set Variable    ${strflag}
+    ${json}    OperatingSystem.Get File    ${CURDIR}/${IMPORT_PAYLOAD}
+    ${json}    Builtin.Replace Variables    ${json}
+    Builtin.Log    ${json}
+    ${resp}    Builtin.Wait Until Keyword Succeeds    120 seconds    10 seconds    ClusterManagement.Post As Json To Member    ${IMPORT_URL}    ${json}
     ...    ${host_index}
     Builtin.Log    ${resp}
     Builtin.Should Match Regexp    ${resp}    .*"result": ${result}
@@ -226,6 +232,6 @@ Schedule Import
 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}
+    ${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}
index c9641976afdd9c60553ee807ccaa017bb66ad4f7..3e2116a8964963f581a0898331152830793a2dd0 100644 (file)
@@ -7,7 +7,12 @@ Resource          ../../libraries/DaeximKeywords.robot
 *** Test Cases ***
 Create Module Include Export
     [Documentation]    schedule a basic export/backup with applied inclusion pattern
-    [Tags]    include export
-    ${file1}    DaeximKeywords.Schedule Include Export    ${FIRST_CONTROLLER_INDEX}    config    network-topology
+    [Tags]    inclusions    export
+    # Module is just included
+    ${file1}    DaeximKeywords.Schedule Include Export    ${FIRST_CONTROLLER_INDEX}    config    network-topology    ${FALSE}
     ${lines1}    OperatingSystem.Grep File    ${file1}    network-topology:
     Builtin.Should Not Be Empty    ${lines1}
+    # Module is both included and excluded
+    ${file1}    DaeximKeywords.Schedule Include Export    ${FIRST_CONTROLLER_INDEX}    config    network-topology    ${TRUE}
+    ${lines1}    OperatingSystem.Grep File    ${file1}    network-topology:
+    Builtin.Should Be Empty    ${lines1}
index 00e12249dd52edf3cc64cdbba74e4392d9eba615..a749b536fcc05f1eff5bfb30ccc026dca4d668f8 100644 (file)
@@ -7,6 +7,7 @@ ${EXPORT_FILE}    ${CURDIR}/schedule_export.json
 ${EXPORT_INCLUDE_FILE}    ${CURDIR}/schedule_export_include.json
 ${EXP_DIR}        /tmp/Export
 ${EXPORT_EXCLUDE_FILE}    ${CURDIR}/schedule_export_exclude.json
+${EXPORT_INCEXCLUDE_FILE}    ${CURDIR}/schedule_export_include_exclude.json
 ${SCHEDULE_EXPORT_URL}    /restconf/operations/data-export-import:schedule-export
 ${EXP_DATA_FILE}    odl_backup_config.json
 ${EXP_OPER_FILE}    odl_backup_operational.json
index d915cc2c4a92d7370440b469ca31b3376e0b5cea..487ba1a1d6ebb4c631c4a2d48014372c14084030 100644 (file)
@@ -1,6 +1,6 @@
 {
   "input" : {
-    "check-models" : "${MODELFLAG}",
-    "clear-stores" : "${STOREFLAG}"
+    "check-models" : "${modelflag}",
+    "clear-stores" : "${storeflag}"
   }
 }
index 6d19783d81c6bb54676a25a2ea2f80a0831fcdcf..2d8aa6763e229588590fa79d4838a9e3296878a0 100644 (file)
@@ -1,6 +1,6 @@
  {
    "input": {
-    "data-export-import:run-at": "${TIME}",
-    "data-export-import:local-node-only": "${FLAG}"
+    "data-export-import:run-at": "${time}",
+    "data-export-import:local-node-only": "${flag}"
    }
  }
index 173cf550889e4cd1d3e5fdf0328db7821d3ed0d8..f29eb59fe81b6a771a35c125a7abf490d3769a54 100644 (file)
@@ -1,10 +1,10 @@
  {
      "input": {
-         "data-export-import:run-at": ${TIME},
+         "data-export-import:run-at": ${time},
          "data-export-import:excluded-modules" : [
              {
-                 "module-name": "${MODULE}",
-                 "data-store": "${STORE}"
+                 "module-name": "${module}",
+                 "data-store": "${store}"
              }
          ]
      }
index 0f3f96fed15b3863a289f8994ec38522cb170e44..95f7761d4baabd6cf2f3271b40b57efe306b3611 100644 (file)
@@ -1,10 +1,10 @@
  {
      "input": {
-         "data-export-import:run-at": ${TIME},
+         "data-export-import:run-at": ${time},
          "data-export-import:included-modules" : [
              {
-                 "module-name": "${MODULE}",
-                 "data-store": "${STORE}"
+                 "module-name": "${module}",
+                 "data-store": "${store}"
              }
          ]
      }
diff --git a/csit/variables/daexim/schedule_export_include_exclude.json b/csit/variables/daexim/schedule_export_include_exclude.json
new file mode 100644 (file)
index 0000000..c4edb88
--- /dev/null
@@ -0,0 +1,17 @@
+ {
+     "input": {
+         "data-export-import:run-at": ${time},
+         "data-export-import:included-modules" : [
+             {
+                 "module-name": "${module}",
+                 "data-store": "${store}"
+             }
+         ],
+         "data-export-import:excluded-modules" : [
+             {
+                 "module-name": "${module}",
+                 "data-store": "${store}"
+             }
+         ]
+     }
+ }