From 16dda8ee22731c1798705bc5268ce608158b4d47 Mon Sep 17 00:00:00 2001 From: Michael Jendrysik Date: Fri, 30 Sep 2022 14:03:16 -0700 Subject: [PATCH 01/48] Initial tavern test commit --- .../workflows/build_and_release_ct_image.yaml | 2 +- .../run_open-api-tavern-coverage.yaml | 2 +- ...kerfile => Dockerfile.test.unit.Dockerfile | 0 docker-compose.test.ct.yaml | 10 +- test/ct/Dockerfile | 6 +- .../test_capmc_health_apis.tavern.yaml | 86 +++ .../test_get_xname_status.tavern.yaml | 658 ++++++++++++++++++ ...test_get_xname_status_negative.tavern.yaml | 168 +++++ .../test_get_xname_status.tavern.yaml | 4 +- 9 files changed, 924 insertions(+), 12 deletions(-) rename Dockerfile.testing.Dockerfile => Dockerfile.test.unit.Dockerfile (100%) create mode 100644 test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml create mode 100644 test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml create mode 100644 test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml diff --git a/.github/workflows/build_and_release_ct_image.yaml b/.github/workflows/build_and_release_ct_image.yaml index 93d5d64..a0b7505 100644 --- a/.github/workflows/build_and_release_ct_image.yaml +++ b/.github/workflows/build_and_release_ct_image.yaml @@ -7,7 +7,7 @@ jobs: build_and_release: uses: Cray-HPE/hms-build-image-workflows/.github/workflows/build_and_release_image.yaml@v1 with: - image-name: cray-capmc-test + image-name: cray-capmc-hmth-test docker-build-file: test/ct/Dockerfile #the tests/ct/Dockerfile is what we want! docker-build-context: test/ct enable-pr-comment: true diff --git a/.github/workflows/run_open-api-tavern-coverage.yaml b/.github/workflows/run_open-api-tavern-coverage.yaml index 43fe11e..fc30fd0 100644 --- a/.github/workflows/run_open-api-tavern-coverage.yaml +++ b/.github/workflows/run_open-api-tavern-coverage.yaml @@ -9,6 +9,6 @@ jobs: #the v1 tag exists now with: open-api-file: "api/swagger.yaml" - tavern-file-dir: "test/ct/functional" + tavern-file-dir: "test/ct/api" api-target-urls: "{capmc_base_url}" diff --git a/Dockerfile.testing.Dockerfile b/Dockerfile.test.unit.Dockerfile similarity index 100% rename from Dockerfile.testing.Dockerfile rename to Dockerfile.test.unit.Dockerfile diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 7836111..7381abc 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -4,7 +4,7 @@ networks: capmc: services: - ct-tests-functional-wait-for-smd: + wait-for-smd: build: context: test/ct/ dockerfile: Dockerfile.wait-for-smd.Dockerfile @@ -13,16 +13,16 @@ services: - cray-smd networks: - capmc - ct-tests-functional: + tavern-tests: build: context: test/ct/ dockerfile: Dockerfile depends_on: - cray-capmc - entrypoint: entrypoint.sh functional -c /src/app/tavern_global_config_ct_test.yaml -p /src/app + entrypoint: entrypoint.sh tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api networks: - capmc - ct-tests-smoke: + smoke-tests: build: context: test/ct/ dockerfile: Dockerfile @@ -198,4 +198,4 @@ services: image: artifactory.algol60.net/docker.io/library/redis:5.0-alpine3.12 hostname: hms-redfish-redis networks: - - capmc \ No newline at end of file + - capmc diff --git a/test/ct/Dockerfile b/test/ct/Dockerfile index 9a80c6a..843eb06 100644 --- a/test/ct/Dockerfile +++ b/test/ct/Dockerfile @@ -20,10 +20,10 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -FROM artifactory.algol60.net/csm-docker/stable/hms-test:3.2.0 +FROM artifactory.algol60.net/csm-docker/stable/hms-test:4.0.0 COPY smoke/ /src/app -COPY functional/ /src/app +COPY api/ /src/app/api COPY tavern_global_config_ct_test.yaml /src/app/tavern_global_config_ct_test.yaml ENV PATH="/src/libs:${PATH}" @@ -34,4 +34,4 @@ RUN chown -R 65534:65534 /src USER 65534:65534 # this is inherited from the hms-test container -ENTRYPOINT [ "entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "entrypoint.sh" ] diff --git a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml new file mode 100644 index 0000000..7111ae8 --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml @@ -0,0 +1,86 @@ +# MIT License +# +# (C) Copyright [2021-2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# Tavern test cases for the CAPMC version API +# Author: Mitch Schooler, Andrew Nieuwsma, Michael Jendrysik +# Service: Cray Advanced Platform Monitoring and Control +--- +test_name: capmcAPIServiceAPIS +stages: + - name: capmcAPIHealthGET - Ensure that /health can be retrieved + request: + url: "{capmc_base_url}/capmc/v1/health" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + readiness: + type: str + required: True + vault: + type: str + required: True + hsm: + type: str + required: True + - name: capmcAPIHealthPOST - Ensure that /health cannot be posted to + request: + url: "{capmc_base_url}/capmc/v1/health" + method: POST + verify: !bool "{verify}" + response: + status_code: 405 + - name: capmcAPILivenessGET - Ensure that /liveness can be retrieved + request: + url: "{capmc_base_url}/capmc/v1/liveness" + method: GET + verify: !bool "{verify}" + response: + status_code: 204 + - name: capmcAPILivenessPOST - Ensure that /liveness cannot be posted to + request: + url: "{capmc_base_url}/capmc/v1/liveness" + method: POST + verify: !bool "{verify}" + response: + status_code: 405 + - name: capmcAPIReadinessGET - Ensure that /readiness can be retrieved + request: + url: "{capmc_base_url}/capmc/v1/readiness" + method: GET + verify: !bool "{verify}" + response: + status_code: 204 + - name: capmcAPIReadinessPOST - Ensure that /readiness cannot be posted to + request: + url: "{capmc_base_url}/capmc/v1/readiness" + method: POST + verify: !bool "{verify}" + response: + status_code: 405 + diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml new file mode 100644 index 0000000..e51a46f --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -0,0 +1,658 @@ +# MIT License +# +# (C) Copyright [2020-2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) get_xname_status API. +# Author: Mitch Schooler, Michael Jendrysik +# Service: Cray Advanced Platform Monitoring and Control + +# CAPMC get_xname_status test cases: 4 +# 1. POST /get_xname_status empty payload API response size (Redfish) +# 2. POST /get_xname_status empty payload API response body (Redfish) +# 3. POST /get_xname_status empty payload API response size (HSM) +# 4. POST /get_xname_status empty payload API response body (HSM) +--- +test_name: capmcAPIGetXnameStatus via Redfish +stages: + # 1. POST /get_xname_status empty payload API response size (Redfish) + # 2. POST /get_xname_status empty payload API response body (Redfish) + - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (Redfish) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "redfish"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status along with "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (Redfish) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "redfish"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True +--- +test_name: capmcAPIGetXnameStatus via Hardware State Manager +stages: + # 3. POST /get_xname_status empty payload API response size (HSM) + # 4. POST /get_xname_status empty payload API response body (HSM) + - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (HSM) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status along with "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (HSM) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "halt": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "standby": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "ready": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "disabled": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "empty": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "flags": + type: map + required: False + mapping: + key: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_all' filter + +stages: + # 3. POST /get_xname_status show_all filter API response code + # 4. POST /get_xname_status show_all filter API response body + - name: Get nodes in any state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_all", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "halt": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "standby": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "ready": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "disabled": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "empty": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "flags": + type: map + required: False + mapping: + key: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + # function: tavern.testutils.helpers:validate_content + # extra_kwargs: + # comparisons: + # # response body should have at least one node status and not only "e" and "err_msg" keys + # - jmespath: "length(keys(@))" + # operator: "gt" + # expected: 2 + +--- +test_name: capmcAPIGetXnameStatus with 'show_off' filter + +stages: + # 5. POST /get_xname_status show_off filter API response code + # 6. POST /get_xname_status show_off filter API response body + - name: Get all nodes in the 'off' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_off", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_on' filter + +stages: + # 7. POST /get_xname_status show_on filter API response code + # 8. POST /get_xname_status show_on filter API response body + - name: Get all nodes in the 'on' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_on", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_halt' filter + +stages: + # 9. POST /get_xname_status show_halt filter API response code + # 10. POST /get_xname_status show_halt filter API response body + - name: Get all nodes in the 'halt' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_halt", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_standby' filter + +stages: + # 11. POST /get_xname_status show_standby filter API response code + # 12. POST /get_xname_status show_standby filter API response body + - name: Get all nodes in the 'standby' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_standby", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_ready' filter + +stages: + # 13. POST /get_xname_status show_ready filter API response code + # 14. POST /get_xname_status show_ready filter API response body + - name: Get all nodes in the 'ready' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_ready", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_diag' filter + +stages: + # 15. POST /get_xname_status show_diag filter API response code + # 16. POST /get_xname_status show_diag filter API response body + - name: Get all nodes in the 'diag' state of which there should be none + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_diag", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "eq" + expected: 2 + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_disabled' filter + +stages: + # 17. POST /get_xname_status show_disabled filter API response code + # 18. POST /get_xname_status show_disabled filter API response body + - name: Get all nodes in the 'disabled' state of which there should be none + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_disabled", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with multiple filters + +stages: + # 19. POST /get_xname_status show_on show_off filters API response code + # 20. POST /get_xname_status show_on show_off filters API response body + - name: Get all nodes in the 'on' or 'off' states + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_on|show_off", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 5 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml new file mode 100644 index 0000000..a4431da --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml @@ -0,0 +1,168 @@ +# MIT License +# +# (C) Copyright [2020-2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) get_xname_status API. +# Author: Mitch Schooler, Michael Jendrysik +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 13 +# 1. POST /get_xname_status invalid filter API response code +# 2. POST /get_xname_status invalid filter API response body +# 3. POST /get_xname_status garbage filter API response code +# 4. POST /get_xname_status garbage filter API response body +# 5. GET /get_xname_status API response code +# 6. GET /get_xname_status API response body +# 7. HEAD /get_xname_status API response code +# 8. PUT /get_xname_status API response code +# 9. PUT /get_xname_status API response body +# 10. DELETE /get_xname_status API response code +# 11. DELETE /get_xname_status API response body +# 12. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response code +# 13. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response body +# 14. PATCH /get_xname_status API response code +# 15. PATCH /get_xname_status API response body +--- +test_name: capmcAPIGetXnameStatus invalid filter +stages: + # 1. POST /get_xname_status invalid filter API response code + # 2. POST /get_xname_status invalid filter API response body + - name: capmcAPIGetXnameStatus fails with invalid filter + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_fake"} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + json: + e: 400 + err_msg: "invalid filter string: show_fake" + +--- +test_name: capmcAPIGetXnameStatus garbage filter +stages: + # 3. POST /get_xname_status garbage filter API response code + # 4. POST /get_xname_status garbage filter API response body + - name: capmcAPIGetXnameStatus fails with garbage filter + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "~!@#$%^&*"} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + json: + e: 400 + err_msg: "invalid filter string: ~!@#$%^&*" + +--- +test_name: capmcAPIGetXnameStatus method fails GET +stages: + # 5. GET /get_xname_status API response code + # 6. GET /get_xname_status API response body + - name: capmcAPIGetXnameStatus fails with GET method + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + method: GET + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(GET) Not Allowed" + +--- +test_name: capmcAPIGetXnameStatus method fails HEAD +stages: + # 7. HEAD /get_xname_status API response code + - name: capmcAPIGetXnameStatus fails with HEAD method + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + method: HEAD + verify: !bool "{verify}" + response: + status_code: 405 + +--- +test_name: capmcAPIGetXnameStatus method fails PUT +stages: + # 8. PUT /get_xname_status API response code + # 9. PUT /get_xname_status API response body + - name: capmcAPIGetXnameStatus fails with PUT method + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + method: PUT + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PUT) Not Allowed" + +--- +test_name: capmcAPIGetXnameStatus method fails DELETE +stages: + # 10. DELETE /get_xname_status API response code + # 11. DELETE /get_xname_status API response body + - name: capmcAPIGetXnameStatus fails with DELETE method + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + method: DELETE + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(DELETE) Not Allowed" + +#--- +#test_name: capmcAPIGetXnameStatus method fails OPTIONS +#stages: +# # 12. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response code +# # 13. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response body +# - name: capmcAPIGetXnameStatus fails with OPTIONS method +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# method: OPTIONS +# verify: !bool "{verify}" +# response: +# status_code: 405 +# json: +# e: 405 +# err_msg: "(OPTIONS) Not Allowed" +# +--- +test_name: capmcAPIGetXnameStatus method fails PATCH +stages: + # 14. PATCH /get_xname_status API response code + # 15. PATCH /get_xname_status API response body + - name: capmcAPIGetXnameStatus fails with PATCH method + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + method: PATCH + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PATCH) Not Allowed" diff --git a/test/ct/functional/test_get_xname_status.tavern.yaml b/test/ct/functional/test_get_xname_status.tavern.yaml index e66dde8..32961f9 100644 --- a/test/ct/functional/test_get_xname_status.tavern.yaml +++ b/test/ct/functional/test_get_xname_status.tavern.yaml @@ -33,10 +33,10 @@ test_name: Verify get_xname_status POST method with empty payload stages: # 1. POST /get_xname_status empty payload API response code # 2. POST /get_xname_status empty payload API response body - - name: Get the status of all xnames + - name: Get the status of all xnames via Redfish request: url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "hsm"} + json: {"source": "redfish"} method: POST verify: !bool "{verify}" response: From e21591044612b7636a3305426fc37433c899753c Mon Sep 17 00:00:00 2001 From: Michael Jendrysik Date: Mon, 17 Oct 2022 10:08:11 -0700 Subject: [PATCH 02/48] Formatting changes --- .../test_capmc_health_apis.tavern.yaml | 9 +++ .../test_get_xname_status.tavern.yaml | 65 +++++++++---------- ...test_get_xname_status_negative.tavern.yaml | 52 +++++---------- 3 files changed, 55 insertions(+), 71 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml index 7111ae8..a8b5c21 100644 --- a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml @@ -19,9 +19,18 @@ # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. + # Tavern test cases for the CAPMC version API # Author: Mitch Schooler, Andrew Nieuwsma, Michael Jendrysik # Service: Cray Advanced Platform Monitoring and Control + +# CAPMC Heal APIs test cases: 6 +# Ensure that /health can be retrieved +# Ensure that /health cannot be posted to +# Ensure that /liveness can be retrieved +# Ensure that /liveness cannot be posted to +# Ensure that /readiness can be retrieved +# Ensure that /readiness cannot be posted to --- test_name: capmcAPIServiceAPIS stages: diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index e51a46f..42a8500 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -25,16 +25,24 @@ # Author: Mitch Schooler, Michael Jendrysik # Service: Cray Advanced Platform Monitoring and Control -# CAPMC get_xname_status test cases: 4 -# 1. POST /get_xname_status empty payload API response size (Redfish) -# 2. POST /get_xname_status empty payload API response body (Redfish) -# 3. POST /get_xname_status empty payload API response size (HSM) -# 4. POST /get_xname_status empty payload API response body (HSM) +# CAPMC get_xname_status test cases: 14 +# /get_xname_status - Validate proper number of json fields (Redfish) +# /get_xname_status - Validate response has valid fields (Redfish) +# /get_xname_status - Validate proper number of json fields (HSM) +# /get_xname_status - Validate response has valid fields (HSM) +# /get_xname_status nodes in any state - validate number of fields +# /get_xname_status nodes in any state +# /get_xname_status all nodes in the 'off' state +# /get_xname_status all nodes in the 'on' state +# /get_xname_status all nodes in the 'halt' state +# /get_xname_status all nodes in the 'standby' state +# /get_xname_status all nodes in the 'ready' state +# /get_xname_status all nodes in the 'diag' state of which there should be none +# /get_xname_status all nodes in the 'disabled' state of which there should be none +# /get_xname_status all nodes in the 'on' or 'off' states --- test_name: capmcAPIGetXnameStatus via Redfish stages: - # 1. POST /get_xname_status empty payload API response size (Redfish) - # 2. POST /get_xname_status empty payload API response body (Redfish) - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (Redfish) request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -100,8 +108,6 @@ stages: --- test_name: capmcAPIGetXnameStatus via Hardware State Manager stages: - # 3. POST /get_xname_status empty payload API response size (HSM) - # 4. POST /get_xname_status empty payload API response body (HSM) - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (HSM) request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -215,8 +221,22 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_all' filter stages: - # 3. POST /get_xname_status show_all filter API response code - # 4. POST /get_xname_status show_all filter API response body + - name: Get nodes in any state - validate number of fields + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_all", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status and not only "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 - name: Get nodes in any state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -302,20 +322,11 @@ stages: sequence: - type: str unique: True - # function: tavern.testutils.helpers:validate_content - # extra_kwargs: - # comparisons: - # # response body should have at least one node status and not only "e" and "err_msg" keys - # - jmespath: "length(keys(@))" - # operator: "gt" - # expected: 2 --- test_name: capmcAPIGetXnameStatus with 'show_off' filter stages: - # 5. POST /get_xname_status show_off filter API response code - # 6. POST /get_xname_status show_off filter API response body - name: Get all nodes in the 'off' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -360,8 +371,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_on' filter stages: - # 7. POST /get_xname_status show_on filter API response code - # 8. POST /get_xname_status show_on filter API response body - name: Get all nodes in the 'on' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -406,8 +415,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_halt' filter stages: - # 9. POST /get_xname_status show_halt filter API response code - # 10. POST /get_xname_status show_halt filter API response body - name: Get all nodes in the 'halt' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -452,8 +459,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_standby' filter stages: - # 11. POST /get_xname_status show_standby filter API response code - # 12. POST /get_xname_status show_standby filter API response body - name: Get all nodes in the 'standby' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -498,8 +503,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_ready' filter stages: - # 13. POST /get_xname_status show_ready filter API response code - # 14. POST /get_xname_status show_ready filter API response body - name: Get all nodes in the 'ready' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -544,8 +547,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_diag' filter stages: - # 15. POST /get_xname_status show_diag filter API response code - # 16. POST /get_xname_status show_diag filter API response body - name: Get all nodes in the 'diag' state of which there should be none request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -572,8 +573,6 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_disabled' filter stages: - # 17. POST /get_xname_status show_disabled filter API response code - # 18. POST /get_xname_status show_disabled filter API response body - name: Get all nodes in the 'disabled' state of which there should be none request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -618,8 +617,6 @@ stages: test_name: capmcAPIGetXnameStatus with multiple filters stages: - # 19. POST /get_xname_status show_on show_off filters API response code - # 20. POST /get_xname_status show_on show_off filters API response body - name: Get all nodes in the 'on' or 'off' states request: url: "{capmc_base_url}/capmc/v1/get_xname_status" diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml index a4431da..3bfa761 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml @@ -25,27 +25,18 @@ # Author: Mitch Schooler, Michael Jendrysik # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 13 -# 1. POST /get_xname_status invalid filter API response code -# 2. POST /get_xname_status invalid filter API response body -# 3. POST /get_xname_status garbage filter API response code -# 4. POST /get_xname_status garbage filter API response body -# 5. GET /get_xname_status API response code -# 6. GET /get_xname_status API response body -# 7. HEAD /get_xname_status API response code -# 8. PUT /get_xname_status API response code -# 9. PUT /get_xname_status API response body -# 10. DELETE /get_xname_status API response code -# 11. DELETE /get_xname_status API response body -# 12. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response code -# 13. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response body -# 14. PATCH /get_xname_status API response code -# 15. PATCH /get_xname_status API response body +# HMS test metrics test cases: 8 +# /get_xname_status fails with invalid filter +# /get_xname_status fails with garbage filter +# /get_xname_status fails with GET method +# /get_xname_status fails with HEAD method +# /get_xname_status fails with PUT method +# /get_xname_status fails with DELETE method +# /get_xname_status fails with OPTIONS method # disabled +# /get_xname_status fails with PATCH method --- test_name: capmcAPIGetXnameStatus invalid filter stages: - # 1. POST /get_xname_status invalid filter API response code - # 2. POST /get_xname_status invalid filter API response body - name: capmcAPIGetXnameStatus fails with invalid filter request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -61,8 +52,6 @@ stages: --- test_name: capmcAPIGetXnameStatus garbage filter stages: - # 3. POST /get_xname_status garbage filter API response code - # 4. POST /get_xname_status garbage filter API response body - name: capmcAPIGetXnameStatus fails with garbage filter request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -76,10 +65,8 @@ stages: err_msg: "invalid filter string: ~!@#$%^&*" --- -test_name: capmcAPIGetXnameStatus method fails GET +test_name: capmcAPIGetXnameStatus GET method fails stages: - # 5. GET /get_xname_status API response code - # 6. GET /get_xname_status API response body - name: capmcAPIGetXnameStatus fails with GET method request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -92,9 +79,8 @@ stages: err_msg: "(GET) Not Allowed" --- -test_name: capmcAPIGetXnameStatus method fails HEAD +test_name: capmcAPIGetXnameStatus HEAD method fails stages: - # 7. HEAD /get_xname_status API response code - name: capmcAPIGetXnameStatus fails with HEAD method request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -104,10 +90,8 @@ stages: status_code: 405 --- -test_name: capmcAPIGetXnameStatus method fails PUT +test_name: capmcAPIGetXnameStatus PUT method fails stages: - # 8. PUT /get_xname_status API response code - # 9. PUT /get_xname_status API response body - name: capmcAPIGetXnameStatus fails with PUT method request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -120,10 +104,8 @@ stages: err_msg: "(PUT) Not Allowed" --- -test_name: capmcAPIGetXnameStatus method fails DELETE +test_name: capmcAPIGetXnameStatus DELETE method fails stages: - # 10. DELETE /get_xname_status API response code - # 11. DELETE /get_xname_status API response body - name: capmcAPIGetXnameStatus fails with DELETE method request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -136,10 +118,8 @@ stages: err_msg: "(DELETE) Not Allowed" #--- -#test_name: capmcAPIGetXnameStatus method fails OPTIONS +#test_name: capmcAPIGetXnameStatus OPTIONS method fails #stages: -# # 12. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response code -# # 13. Disabled (CASMPET-1067) - OPTIONS /get_xname_status API response body # - name: capmcAPIGetXnameStatus fails with OPTIONS method # request: # url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -152,10 +132,8 @@ stages: # err_msg: "(OPTIONS) Not Allowed" # --- -test_name: capmcAPIGetXnameStatus method fails PATCH +test_name: capmcAPIGetXnameStatus PATCH method fails stages: - # 14. PATCH /get_xname_status API response code - # 15. PATCH /get_xname_status API response body - name: capmcAPIGetXnameStatus fails with PATCH method request: url: "{capmc_base_url}/capmc/v1/get_xname_status" From 862b0120d94adff61b3f0fae4a731eba3b82c377 Mon Sep 17 00:00:00 2001 From: Shane Unruh Date: Mon, 31 Oct 2022 17:57:18 -0600 Subject: [PATCH 03/48] Added get_power_cap test --- .../test_get_power_cap.tavern.yaml | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml diff --git a/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml new file mode 100644 index 0000000..3451b23 --- /dev/null +++ b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml @@ -0,0 +1,109 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) get_power_cap API. +# Author: Shane Unruh +# Service: Cray Advanced Platform Monitoring and Control + +# CAPMC get_power_cap test cases: 1 +# /get_power_cap - +--- +test_name: capmcAPIGetPowerCap +stages: + # get node to work with + - name: capmcAPIGetPowerCap - Get HSM Compute Node Component + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + xname: Components[0].ID + nid: Components[0].NID + original_state: Components[0].State + + # set state to off + - name: capmcAPIGetPowerCap - Set HSM Node to Off + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + # test get_power_cap for node that is Off (failure case) + - name: capmcAPIGetPowerCap - test get_power_cap when node is off + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap" + json: + nids: + - !int "{nid:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + + # set state to Ready + - name: capmcAPIGetPowerCap - Set HSM Node to Ready + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" + json: {"State":"Ready"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + # test get_power_cap for node that is Ready + - name: capmcAPIGetPowerCap - test get_power_cap when node is Ready + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap" + json: + nids: + - !int "{nid:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + + # Set state back to original state + # First set it to off (a node in the ready state can't go back to the on state) + - name: capmcAPIGetPowerCap - Set HSM Node to Ready + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + # set it to original state + - name: capmcAPIGetPowerCap - Set HSM Node to Ready + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" + json: + State: "{original_state}" + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + From 33eea3ca5675a29e6c3c3f5d662a7e2d27c13720 Mon Sep 17 00:00:00 2001 From: Shane Unruh Date: Mon, 31 Oct 2022 20:09:18 -0600 Subject: [PATCH 04/48] Fixed make ct --- docker-compose.test.ct.yaml | 4 ++-- runCT.sh | 37 +++++++++++-------------------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 7381abc..6b387c2 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -13,7 +13,7 @@ services: - cray-smd networks: - capmc - tavern-tests: + tavern: build: context: test/ct/ dockerfile: Dockerfile @@ -22,7 +22,7 @@ services: entrypoint: entrypoint.sh tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api networks: - capmc - smoke-tests: + smoke: build: context: test/ct/ dockerfile: Dockerfile diff --git a/runCT.sh b/runCT.sh index 8418506..5f80b84 100755 --- a/runCT.sh +++ b/runCT.sh @@ -25,25 +25,17 @@ # set -x -# Add .exe if running in a WSL environment -if $(uname -r | grep -q "Microsoft"); then - shopt -s expand_aliases - alias docker-compose=docker-compose.exe -fi # Configure docker compose export COMPOSE_PROJECT_NAME=$RANDOM export COMPOSE_FILE=docker-compose.test.ct.yaml -args="-f $COMPOSE_FILE -p $COMPOSE_PROJECT_NAME" - echo "COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME}" echo "COMPOSE_FILE: $COMPOSE_FILE" - function cleanup() { - docker-compose $args down - if ! [[ $? -eq 0 ]]; then + echo "Cleaning up containers..." + if ! docker compose down --remove-orphans; then echo "Failed to decompose environment!" exit 1 fi @@ -53,28 +45,21 @@ function cleanup() { # Get the base containers running echo "Starting containers..." -docker-compose $args build --no-cache -docker-compose $args up -d cray-capmc #this will stand up everything except for the integration test container - -docker-compose $args up -d ct-tests-functional-wait-for-smd -docker wait ${COMPOSE_PROJECT_NAME}_ct-tests-functional-wait-for-smd_1 -docker logs ${COMPOSE_PROJECT_NAME}_ct-tests-functional-wait-for-smd_1 +docker compose build --no-cache +docker compose up -d cray-capmc -docker-compose $args up --exit-code-from ct-tests-smoke ct-tests-smoke -test_result=$? -echo "Cleaning up containers..." -if [[ $test_result -ne 0 ]]; then +sleep 10 +if ! docker compose up --exit-code-from smoke smoke; then echo "CT smoke tests FAILED!" cleanup 1 fi +# wait for containers to stabilize and simulated HSM hardware discoveries to complete +docker compose up --exit-code-from wait-for-smd wait-for-smd -docker-compose $args up --exit-code-from ct-tests-functional ct-tests-functional -test_result=$? -# Clean up -echo "Cleaning up containers..." -if [[ $test_result -ne 0 ]]; then - echo "CT functional tests FAILED!" +# execute the CT functional tests +if ! docker compose up --exit-code-from tavern tavern; then + echo "CT tavern tests FAILED!" cleanup 1 fi From 0e077e1bdf6be5f03800498661288636aa6d8069 Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:39:50 -0500 Subject: [PATCH 05/48] try --- runCT.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runCT.sh b/runCT.sh index 5f80b84..2ef5ac6 100755 --- a/runCT.sh +++ b/runCT.sh @@ -50,10 +50,11 @@ docker compose up -d cray-capmc sleep 10 if ! docker compose up --exit-code-from smoke smoke; then + docker logs smoke echo "CT smoke tests FAILED!" cleanup 1 fi - +docker logs smoke # wait for containers to stabilize and simulated HSM hardware discoveries to complete docker compose up --exit-code-from wait-for-smd wait-for-smd From d660c66cd13092fad2656331b4d0ca0c04c1759d Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:46:16 -0500 Subject: [PATCH 06/48] try --- docker-compose.test.ct.yaml | 4 ---- runCT.sh | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 6b387c2..46cbb46 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -17,8 +17,6 @@ services: build: context: test/ct/ dockerfile: Dockerfile - depends_on: - - cray-capmc entrypoint: entrypoint.sh tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api networks: - capmc @@ -26,8 +24,6 @@ services: build: context: test/ct/ dockerfile: Dockerfile - depends_on: - - cray-capmc entrypoint: entrypoint.sh smoke -f smoke.json -u http://cray-capmc:27777 networks: - capmc diff --git a/runCT.sh b/runCT.sh index 2ef5ac6..a08e8c8 100755 --- a/runCT.sh +++ b/runCT.sh @@ -49,12 +49,14 @@ docker compose build --no-cache docker compose up -d cray-capmc sleep 10 + +docker compose logs cray-capmc if ! docker compose up --exit-code-from smoke smoke; then - docker logs smoke + docker compose logs smoke echo "CT smoke tests FAILED!" cleanup 1 fi -docker logs smoke +docker compose logs smoke # wait for containers to stabilize and simulated HSM hardware discoveries to complete docker compose up --exit-code-from wait-for-smd wait-for-smd From 91c3c1d7296aa3664f40e2b727d4d8c3b20a32fb Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:52:11 -0500 Subject: [PATCH 07/48] remove log prints --- runCT.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/runCT.sh b/runCT.sh index a08e8c8..4f1b683 100755 --- a/runCT.sh +++ b/runCT.sh @@ -52,11 +52,9 @@ sleep 10 docker compose logs cray-capmc if ! docker compose up --exit-code-from smoke smoke; then - docker compose logs smoke echo "CT smoke tests FAILED!" cleanup 1 fi -docker compose logs smoke # wait for containers to stabilize and simulated HSM hardware discoveries to complete docker compose up --exit-code-from wait-for-smd wait-for-smd From 31771cc99198d13cac9d007dc7a91a1850c7334f Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:56:30 -0500 Subject: [PATCH 08/48] delete depends on --- docker-compose.test.ct.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 46cbb46..a6544a4 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -8,9 +8,6 @@ services: build: context: test/ct/ dockerfile: Dockerfile.wait-for-smd.Dockerfile - depends_on: - - cray-capmc - - cray-smd networks: - capmc tavern: From 29c1276669818af5db28bfb88b9a3d5bdd466dd6 Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 11:21:17 -0500 Subject: [PATCH 09/48] fixed unit tests --- docker-compose.test.unit.yaml | 2 +- runUnitTest.sh | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/docker-compose.test.unit.yaml b/docker-compose.test.unit.yaml index ba9e965..4b3ee94 100644 --- a/docker-compose.test.unit.yaml +++ b/docker-compose.test.unit.yaml @@ -7,6 +7,6 @@ services: unit-tests: build: context: . - dockerfile: Dockerfile.testing.Dockerfile + dockerfile: Dockerfile.test.unit.Dockerfile networks: - capmc \ No newline at end of file diff --git a/runUnitTest.sh b/runUnitTest.sh index de53f73..ca3c9ab 100755 --- a/runUnitTest.sh +++ b/runUnitTest.sh @@ -25,24 +25,16 @@ set -x -# Add .exe if running in a WSL environment -if $(uname -r | grep -q "Microsoft"); then - shopt -s expand_aliases - alias docker-compose=docker-compose.exe -fi - # Configure docker compose export COMPOSE_PROJECT_NAME=$RANDOM export COMPOSE_FILE=docker-compose.test.unit.yaml -args="-f $COMPOSE_FILE -p $COMPOSE_PROJECT_NAME" - echo "COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME}" echo "COMPOSE_FILE: $COMPOSE_FILE" function cleanup() { - docker-compose $args down - if ! [[ $? -eq 0 ]]; then + echo "Cleaning up containers..." + if ! docker compose down --remove-orphans; then echo "Failed to decompose environment!" exit 1 fi @@ -52,11 +44,12 @@ function cleanup() { # Step 3) Get the base containers running echo "Starting containers..." -docker-compose $args build -docker-compose $args up --exit-code-from unit-tests unit-tests +docker compose build --no-cache +docker compose up --exit-code-from unit-tests unit-tests -test_result=$? +test_result=$? +docker compose logs unit-tests # Clean up echo "Cleaning up containers..." if [[ $test_result -ne 0 ]]; then From 48fccdbd3ec7b1cc202b249fbd5421826c774957 Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 13:13:51 -0500 Subject: [PATCH 10/48] use RIE instead of RTS --- docker-compose.test.ct.yaml | 109 ++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 31 deletions(-) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index a6544a4..045243f 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -48,7 +48,7 @@ services: - cray-smd - vault-kv-enabler - kafka - - redfish-simulator + - emulator-loader vault: hostname: vault @@ -154,41 +154,88 @@ services: - capmc depends_on: - kafka - redfish-simulator: - image: artifactory.algol60.net/csm-docker/stable/hms-redfish-translation-service:1.13.3 - environment: - - SCHEMA_VERSION=2019.1 - - LOG_LEVEL=TRACE - - PRIVILEGE_REGISTRY_VERSION=1.0.4 - - SCRIPT_DIR_PREFIX=/tmp/redfish - - VAULT_TOKEN=hms - - REDIS_HOSTNAME=redis - - REDIS_PORT=6379 - - VAULT_ADDR=http://vault:8200 - - CRAY_VAULT_JWT_FILE=configs/token - - CRAY_VAULT_ROLE_FILE=configs/namespace - - CRAY_VAULT_AUTH_PATH=auth/token/create - - HTTPS_CERT=configs/rts.crt - - HTTPS_KEY=configs/rts.key - - BACKEND_HELPER=RFSimulator - - PERIODIC_SLEEP=120 - - COLLECTOR_URL=http://cray-hms-hmcollector - - HSM_URL=http://cray-smd:27779 - - HMS_VAULT_KEYPATH=hms-creds - - RF_USERNAME=root - - RF_PASSWORD=testpassword - - RF_SIMULATOR_XNAMES=x0c0s1b0,x0c0s2b0 + emulator-loader: + image: artifactory.algol60.net/docker.io/library/golang:1.16-alpine + command: > + sh -c "apk add curl && sleep 10 && + curl -X POST -d '{\"RedfishEndpoints\":[{ + \"ID\":\"x0c0s1b0\", + \"FQDN\":\"x0c0s1b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s2b0\", + \"FQDN\":\"x0c0s2b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s3b0\", + \"FQDN\":\"x0c0s3b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s4b0\", + \"FQDN\":\"x0c0s4b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + }]}' http://cray-smd:27779/hsm/v2/Inventory/RedfishEndpoints" depends_on: - - redis - - vault - cray-smd + - rfemulator0 + - rfemulator1 + - rfemulator2 + - rfemulator3 + networks: + - capmc + rfemulator0: + hostname: x0c0s1b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s1b0 + - PORT=443 networks: capmc: aliases: - x0c0s1b0 + rfemulator1: + hostname: x0c0s2b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s2b0 + - PORT=443 + networks: + capmc: + aliases: - x0c0s2b0 - redis: - image: artifactory.algol60.net/docker.io/library/redis:5.0-alpine3.12 - hostname: hms-redfish-redis + rfemulator2: + hostname: x0c0s3b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s3b0 + - PORT=443 networks: - - capmc + capmc: + aliases: + - x0c0s3b0 + rfemulator3: + hostname: x0c0s4b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s4b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0s4b0 From 1a6fe64cd1b12328c374ac69574d93eb2c85d1a3 Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 14:09:26 -0500 Subject: [PATCH 11/48] runTavern --- Makefile | 3 +- runTavernTestsWithSimulator.sh | 4 + .../test_xname_on_off.tavern.yaml | 636 ++++++++++++++++++ 3 files changed, 642 insertions(+), 1 deletion(-) create mode 100755 runTavernTestsWithSimulator.sh create mode 100644 test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml diff --git a/Makefile b/Makefile index 396dd88..e054cc8 100644 --- a/Makefile +++ b/Makefile @@ -37,4 +37,5 @@ ct: ct_image: - docker build --no-cache -f test/ct/Dockerfile test/ct/ --tag cray-capmc-test:${VERSION} + docker build --no-cache -f test/ct/Dockerfile test/ct/ --tag cray-capmc-hmth-test:${VERSION} + diff --git a/runTavernTestsWithSimulator.sh b/runTavernTestsWithSimulator.sh new file mode 100755 index 0000000..a289a4f --- /dev/null +++ b/runTavernTestsWithSimulator.sh @@ -0,0 +1,4 @@ +#!/bin/bash +make ct_image +VERSION=$(cat .version) +docker run --rm -it --network hms-simulation-environment_simulation cray-capmc-hmth-test:${VERSION} tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api #/2-disruptive diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml new file mode 100644 index 0000000..cbad33c --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -0,0 +1,636 @@ +# MIT License +# +# (C) Copyright [2020-2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + + +--- +test_name: capmcAPIGetXnameStatus via Redfish +stages: + - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (Redfish) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "redfish"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status along with "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (Redfish) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "redfish"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True +--- +test_name: capmcAPIGetXnameStatus via Hardware State Manager +stages: + - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (HSM) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status along with "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (HSM) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "halt": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "standby": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "ready": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "disabled": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "empty": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "flags": + type: map + required: False + mapping: + key: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_all' filter + +stages: + - name: Get nodes in any state - validate number of fields + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_all", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status and not only "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + - name: Get nodes in any state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_all", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "halt": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "standby": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "ready": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "disabled": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "empty": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "flags": + type: map + required: False + mapping: + key: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_off' filter + +stages: + - name: Get all nodes in the 'off' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_off", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_on' filter + +stages: + - name: Get all nodes in the 'on' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_on", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_halt' filter + +stages: + - name: Get all nodes in the 'halt' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_halt", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_standby' filter + +stages: + - name: Get all nodes in the 'standby' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_standby", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_ready' filter + +stages: + - name: Get all nodes in the 'ready' state + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_ready", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_diag' filter + +stages: + - name: Get all nodes in the 'diag' state of which there should be none + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_diag", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "eq" + expected: 2 + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with 'show_disabled' filter + +stages: + - name: Get all nodes in the 'disabled' state of which there should be none + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_disabled", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True + +--- +test_name: capmcAPIGetXnameStatus with multiple filters + +stages: + - name: Get all nodes in the 'on' or 'off' states + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"filter": "show_on|show_off", "source": "hsm"} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(keys(@))" + operator: "lt" + expected: 5 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'disabled')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'e')" + operator: "eq" + expected: True + - jmespath: "contains(keys(@), 'err_msg')" + operator: "eq" + expected: True From bb1518b02ab2ee909669ed37fb67ee7ae2b83587 Mon Sep 17 00:00:00 2001 From: Andrew Nieuwsma <76961724+anieuwsma-hpe@users.noreply.github.com> Date: Tue, 1 Nov 2022 16:19:32 -0500 Subject: [PATCH 12/48] add tavern test --- .../test_xname_on_off.tavern.yaml | 667 ++++-------------- 1 file changed, 141 insertions(+), 526 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml index cbad33c..6877d77 100644 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -20,30 +20,24 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. - --- -test_name: capmcAPIGetXnameStatus via Redfish +test_name: capmcAPIXnameONForceOnFail - test that forcing a compute node on fails stages: - - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (Redfish) + - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "redfish"} - method: POST + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET verify: !bool "{verify}" response: status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - # response body should have at least one node status along with "e" and "err_msg" keys - - jmespath: "length(keys(@))" - operator: "gt" - expected: 2 - - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (Redfish) + save: + json: + xname: Components[0].ID + + - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields (Redfish) request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "redfish"} + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason": "ct tests", xnames: ["{xname}"], "force":true} method: POST verify: !bool "{verify}" response: @@ -59,56 +53,63 @@ stages: type: int required: True enum: - - 0 + - -1 "err_msg": required: True type: str enum: - - "" - "on": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "off": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "undefined": + - "Errors encountered with 1/1 Xnames issued ForceOn" + "xnames": type: seq + required: True matching: all - required: False sequence: - - type: str - unique: True + - type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "NodeBMC x1000c0s0b1: no supported ResetType for ForceOn operation" + "xname": + required: True + type: str + enum: + - "{xname}" + --- -test_name: capmcAPIGetXnameStatus via Hardware State Manager +test_name: capmcAPIXnameONHappyPath - test that an on works stages: - - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (HSM) + - name: capmcAPIXnameOFFContext - Get an xname from the HSM Components collection to use in the next stage request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "hsm"} + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + xname: Components[0].ID + + - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields (Redfish) + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true} method: POST verify: !bool "{verify}" response: status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - # response body should have at least one node status along with "e" and "err_msg" keys - - jmespath: "length(keys(@))" - operator: "gt" - expected: 2 - - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (HSM) + + - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields (Redfish) request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "hsm"} + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason": "ct tests", xnames: ["{xname}"]} method: POST verify: !bool "{verify}" response: @@ -130,98 +131,12 @@ stages: type: str enum: - "" - "on": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "off": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "undefined": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "halt": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "standby": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "ready": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "disabled": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "empty": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "flags": - type: map - required: False - mapping: - key: - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_all' filter - -stages: - - name: Get nodes in any state - validate number of fields - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_all", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - # response body should have at least one node status and not only "e" and "err_msg" keys - - jmespath: "length(keys(@))" - operator: "gt" - expected: 2 - - name: Get nodes in any state + - name: capmcAPIGetXnameOnValidation - Validate response has valid fields (Redfish) + max_retries: 30 #retry this because there are delays to cause the state change + delay_after: 10 request: url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_all", "source": "hsm"} + json: {"source": "redfish",xnames: ["{xname}"] } method: POST verify: !bool "{verify}" response: @@ -246,391 +161,91 @@ stages: "on": type: seq matching: all - required: False - sequence: - - type: str - unique: True - "off": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "halt": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "standby": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "ready": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "disabled": - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - "empty": - type: seq - matching: all - required: False + required: True sequence: - type: str unique: True - "flags": - type: map - required: False - mapping: - key: - type: seq - matching: all - required: False - sequence: - - type: str - unique: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_off' filter - -stages: - - name: Get all nodes in the 'off' state - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_off", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'on')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_on' filter - -stages: - - name: Get all nodes in the 'on' state - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_on", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'off')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True ---- -test_name: capmcAPIGetXnameStatus with 'show_halt' filter - -stages: - - name: Get all nodes in the 'halt' state - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_halt", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'on')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'off')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_standby' filter - -stages: - - name: Get all nodes in the 'standby' state - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_standby", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'on')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'off')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_ready' filter - -stages: - - name: Get all nodes in the 'ready' state - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_ready", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'on')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'off')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_diag' filter - -stages: - - name: Get all nodes in the 'diag' state of which there should be none - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_diag", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "eq" - expected: 2 - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with 'show_disabled' filter - -stages: - - name: Get all nodes in the 'disabled' state of which there should be none - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_disabled", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 4 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'on')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'off')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True - ---- -test_name: capmcAPIGetXnameStatus with multiple filters - -stages: - - name: Get all nodes in the 'on' or 'off' states - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"filter": "show_on|show_off", "source": "hsm"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - - jmespath: "length(keys(@))" - operator: "lt" - expected: 5 - - jmespath: "length(keys(@))" - operator: "gt" - expected: 1 - - jmespath: "contains(keys(@), 'halt')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'standby')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'ready')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'disabled')" - operator: "eq" - expected: False - - jmespath: "contains(keys(@), 'e')" - operator: "eq" - expected: True - - jmespath: "contains(keys(@), 'err_msg')" - operator: "eq" - expected: True +# # THIS TEST IS BROKEN, WIP +#--- +#test_name: capmcAPIXnameOFFSadPath - test that an off works +#stages: +# - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# xname: Components[0].ID +# +# - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields (Redfish) +# request: +# url: "{capmc_base_url}/capmc/v1/xname_on" +# json: {"reason": "ct tests", xnames: ["{xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields (Redfish) +# request: +# url: "{capmc_base_url}/capmc/v1/xname_off" +# json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true } +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# - name: capmcAPIGetXnameOffValidation - Validate response has valid fields (Redfish) +# max_retries: 30 #retry this because there are delays to cause the state change +# delay_after: 10 +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source": "redfish",xnames: ["{xname}"] } +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "off": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True From ddd90dea5a79780cfe3fcbfc47ac37c01b3359ce Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 8 Nov 2022 20:08:16 -0600 Subject: [PATCH 13/48] Add new get_xname_status tests from previous branch. --- .../test_capmc_health_apis.tavern.yaml | 14 ++- .../test_get_xname_status.tavern.yaml | 105 +++++++++++++++++- ...test_get_xname_status_negative.tavern.yaml | 47 ++++++++ 3 files changed, 163 insertions(+), 3 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml index a8b5c21..32f529a 100644 --- a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml @@ -32,7 +32,8 @@ # Ensure that /readiness can be retrieved # Ensure that /readiness cannot be posted to --- -test_name: capmcAPIServiceAPIS +test_name: capmcAPIServiceAPIs + stages: - name: capmcAPIHealthGET - Ensure that /health can be retrieved request: @@ -51,12 +52,18 @@ stages: readiness: type: str required: True + enum: + - "Ready" vault: type: str required: True + pattern: "Vault connection established with [0-9]+ credentials loaded" hsm: type: str required: True + enum: + - "HSM Ready" + - name: capmcAPIHealthPOST - Ensure that /health cannot be posted to request: url: "{capmc_base_url}/capmc/v1/health" @@ -64,6 +71,7 @@ stages: verify: !bool "{verify}" response: status_code: 405 + - name: capmcAPILivenessGET - Ensure that /liveness can be retrieved request: url: "{capmc_base_url}/capmc/v1/liveness" @@ -71,6 +79,7 @@ stages: verify: !bool "{verify}" response: status_code: 204 + - name: capmcAPILivenessPOST - Ensure that /liveness cannot be posted to request: url: "{capmc_base_url}/capmc/v1/liveness" @@ -78,6 +87,7 @@ stages: verify: !bool "{verify}" response: status_code: 405 + - name: capmcAPIReadinessGET - Ensure that /readiness can be retrieved request: url: "{capmc_base_url}/capmc/v1/readiness" @@ -85,6 +95,7 @@ stages: verify: !bool "{verify}" response: status_code: 204 + - name: capmcAPIReadinessPOST - Ensure that /readiness cannot be posted to request: url: "{capmc_base_url}/capmc/v1/readiness" @@ -92,4 +103,3 @@ stages: verify: !bool "{verify}" response: status_code: 405 - diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index 42a8500..f34c724 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -25,11 +25,12 @@ # Author: Mitch Schooler, Michael Jendrysik # Service: Cray Advanced Platform Monitoring and Control -# CAPMC get_xname_status test cases: 14 +# CAPMC get_xname_status test cases: 15 # /get_xname_status - Validate proper number of json fields (Redfish) # /get_xname_status - Validate response has valid fields (Redfish) # /get_xname_status - Validate proper number of json fields (HSM) # /get_xname_status - Validate response has valid fields (HSM) +# /get_xname_status - Validate response for request with Node (HSM) # /get_xname_status nodes in any state - validate number of fields # /get_xname_status nodes in any state # /get_xname_status all nodes in the 'off' state @@ -217,6 +218,108 @@ stages: - type: str unique: True +--- +#TODO +test_name: capmcAPIGetXnameStatusPOST via Hardware State Manager with Node Xname + +stages: + - name: Get Node Xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIGetXnameStatusPOSTnode - Validate response has proper number of json fields and valid fields (HSM) + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm", "xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "off": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "halt": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "standby": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "ready": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "disabled": + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + "flags": + type: map + required: False + mapping: + key: + type: seq + matching: all + required: False + sequence: + - type: int + unique: True + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have at least one node status and not only "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "gt" + expected: 2 + --- test_name: capmcAPIGetXnameStatus with 'show_all' filter diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml index 3bfa761..87392f1 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml @@ -26,6 +26,7 @@ # Service: Cray Advanced Platform Monitoring and Control # HMS test metrics test cases: 8 +# /get_xname_status fails with NodeBMC xname # /get_xname_status fails with invalid filter # /get_xname_status fails with garbage filter # /get_xname_status fails with GET method @@ -34,6 +35,52 @@ # /get_xname_status fails with DELETE method # /get_xname_status fails with OPTIONS method # disabled # /get_xname_status fails with PATCH method +--- +test_name: capmcAPIGetXnameStatus NodeBMC xname +stages: + - name: Get NodeBMC xname from HSM Components to use in upcoming stages + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + - name: capmcAPIGetXnameStatus fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source": "hsm", "xnames":["{bmc_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "xnames not found: [{bmc_xname}]" + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + # response body should have "e" and "err_msg" keys + - jmespath: "length(keys(@))" + operator: "eq" + expected: 2 + --- test_name: capmcAPIGetXnameStatus invalid filter stages: From c4eafa2cb83070c5536072baa2dbbcaaebec98f6 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 8 Nov 2022 20:23:27 -0600 Subject: [PATCH 14/48] Increase sleep time for CT environment spin-up to 15s. --- runCT.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runCT.sh b/runCT.sh index 4f1b683..d38990c 100755 --- a/runCT.sh +++ b/runCT.sh @@ -48,7 +48,7 @@ echo "Starting containers..." docker compose build --no-cache docker compose up -d cray-capmc -sleep 10 +sleep 15 docker compose logs cray-capmc if ! docker compose up --exit-code-from smoke smoke; then From 6c3c10d2c82b6b2a2102c2c081f8ee71331a7b0f Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 8 Nov 2022 20:41:30 -0600 Subject: [PATCH 15/48] Fixes for xname_on_off test. --- .../test_get_xname_status.tavern.yaml | 2 +- .../2-disruptive/test_xname_on_off.tavern.yaml | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index f34c724..dd01f2a 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -220,7 +220,7 @@ stages: --- #TODO -test_name: capmcAPIGetXnameStatusPOST via Hardware State Manager with Node Xname +test_name: capmcAPIGetXnameStatus via Hardware State Manager with Node Xname stages: - name: Get Node Xname from HSM Components to use in upcoming stage diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml index 6877d77..8274b7d 100644 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -34,9 +34,10 @@ stages: json: xname: Components[0].ID - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields (Redfish) + - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_on" + #TODO: this assumes that a random compute node in HSM doesn't support ForceOn, seems like a bad assumption json: {"reason": "ct tests", xnames: ["{xname}"], "force":true} method: POST verify: !bool "{verify}" @@ -76,7 +77,7 @@ stages: required: True type: str enum: - - "NodeBMC x1000c0s0b1: no supported ResetType for ForceOn operation" + - "NodeBMC {xname}: no supported ResetType for ForceOn operation" "xname": required: True type: str @@ -97,7 +98,7 @@ stages: json: xname: Components[0].ID - - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields (Redfish) + - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_off" json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true} @@ -106,7 +107,7 @@ stages: response: status_code: 200 - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields (Redfish) + - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_on" json: {"reason": "ct tests", xnames: ["{xname}"]} @@ -136,7 +137,7 @@ stages: delay_after: 10 request: url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "redfish",xnames: ["{xname}"] } + json: {"source": "redfish", xnames: ["{xname}"] } method: POST verify: !bool "{verify}" response: @@ -181,7 +182,7 @@ stages: # json: # xname: Components[0].ID # -# - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields (Redfish) +# - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields # request: # url: "{capmc_base_url}/capmc/v1/xname_on" # json: {"reason": "ct tests", xnames: ["{xname}"]} @@ -190,7 +191,7 @@ stages: # response: # status_code: 200 # -# - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields (Redfish) +# - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields # request: # url: "{capmc_base_url}/capmc/v1/xname_off" # json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true } @@ -220,7 +221,7 @@ stages: # delay_after: 10 # request: # url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source": "redfish",xnames: ["{xname}"] } +# json: {"source": "redfish", xnames: ["{xname}"] } # method: POST # verify: !bool "{verify}" # response: From 7019a339e5aba5206aa3ba4aed592d2222205910 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 8 Nov 2022 21:01:46 -0600 Subject: [PATCH 16/48] Another fix for xname_on_off test. --- test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml index 8274b7d..dabad82 100644 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -76,8 +76,7 @@ stages: "err_msg": required: True type: str - enum: - - "NodeBMC {xname}: no supported ResetType for ForceOn operation" + pattern: "NodeBMC [A-Za-z0-9]+: no supported ResetType for ForceOn operation" "xname": required: True type: str From f09e0769c996e8dded913d9e38da35041b206952 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Thu, 17 Nov 2022 11:24:46 -0600 Subject: [PATCH 17/48] Test cleanup. --- cmd/capmcd/capmcd_defs.go | 8 +-- .../test_capmc_health_apis.tavern.yaml | 4 +- .../test_get_xname_status.tavern.yaml | 1 - .../test_xname_on_off.tavern.yaml | 51 +++++++++++++++---- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/cmd/capmcd/capmcd_defs.go b/cmd/capmcd/capmcd_defs.go index 1657df6..a6b9694 100644 --- a/cmd/capmcd/capmcd_defs.go +++ b/cmd/capmcd/capmcd_defs.go @@ -126,10 +126,10 @@ var ( // // ResetType: // Default mapping for CAPMC `Off` operations to Redfish ResetType - // GracefulSutdown - requires no additional checks - // Off - requires no additional checks (DTMF is adding) - // PushPowerButton - requires additional checks (this is a toggle) - // ForceOff - requires no additional checks + // GracefulShutdown - requires no additional checks + // Off - requires no additional checks (DTMF is adding) + // PushPowerButton - requires additional checks (this is a toggle) + // ForceOff - requires no additional checks // // Default mapping for CAPMC `On` operations to Redfish ResetType // On - requires no additional checks diff --git a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml index 32f529a..9fee1e0 100644 --- a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml @@ -20,11 +20,11 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -# Tavern test cases for the CAPMC version API +# Tavern test cases for the CAPMC service APIs # Author: Mitch Schooler, Andrew Nieuwsma, Michael Jendrysik # Service: Cray Advanced Platform Monitoring and Control -# CAPMC Heal APIs test cases: 6 +# CAPMC service APIs test cases: 6 # Ensure that /health can be retrieved # Ensure that /health cannot be posted to # Ensure that /liveness can be retrieved diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index dd01f2a..d8ae827 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -219,7 +219,6 @@ stages: unique: True --- -#TODO test_name: capmcAPIGetXnameStatus via Hardware State Manager with Node Xname stages: diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml index dabad82..9edb5c7 100644 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -1,6 +1,6 @@ # MIT License # -# (C) Copyright [2020-2022] Hewlett Packard Enterprise Development LP +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -20,8 +20,22 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) xname_on and xname_off APIs. +# Author: Mitch Schooler, Andrew Nieuwsma +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: TODO +# POST /xname_on Compute Node Power On Force Fails API response code +# POST /xname_on Compute Node Power On Force Fails API response body +# POST /xname_off Compute Node Power Off Force API response code +# POST /xname_off Compute Node Power Off Force API response body +# POST /xname_on Compute Node Power On API response code +# POST /xname_on Compute Node Power On API response body +# POST /get_xname_status Compute Node Powered On API response code +# POST /get_xname_status Compute Node Powered On API response body --- -test_name: capmcAPIXnameONForceOnFail - test that forcing a compute node on fails +test_name: capmcAPIXnameONForceOnFail - Test that forcing a compute node on fails stages: - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage request: @@ -34,11 +48,13 @@ stages: json: xname: Components[0].ID + # POST /xname_on Compute Node Power On Force Fails API response code + # POST /xname_on Compute Node Power On Force Fails API response body - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_on" #TODO: this assumes that a random compute node in HSM doesn't support ForceOn, seems like a bad assumption - json: {"reason": "ct tests", xnames: ["{xname}"], "force":true} + json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"],"force":true} method: POST verify: !bool "{verify}" response: @@ -84,7 +100,7 @@ stages: - "{xname}" --- -test_name: capmcAPIXnameONHappyPath - test that an on works +test_name: capmcAPIXnameONHappyPath - Test that an on works stages: - name: capmcAPIXnameOFFContext - Get an xname from the HSM Components collection to use in the next stage request: @@ -97,19 +113,31 @@ stages: json: xname: Components[0].ID + # POST /xname_off Compute Node Power Off Force API response code + # POST /xname_off Compute Node Power Off Force API response body - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true} + json: {"reason":"CT test case: capmcAPIXnameOffPOSTPrep","xnames":["{xname}"],"force":true,"continue":true} method: POST verify: !bool "{verify}" response: status_code: 200 + #TODO + #verify_response_with: + # function: tavern.testutils.helpers:validate_pykwalify + # extra_kwargs: + # schema: + # type: map + # required: True + # mapping: + # POST /xname_on Compute Node Power On API response code + # POST /xname_on Compute Node Power On API response body - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields request: url: "{capmc_base_url}/capmc/v1/xname_on" - json: {"reason": "ct tests", xnames: ["{xname}"]} + json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"]} method: POST verify: !bool "{verify}" response: @@ -131,12 +159,15 @@ stages: type: str enum: - "" + + # POST /get_xname_status Compute Node Powered On API response code + # POST /get_xname_status Compute Node Powered On API response body - name: capmcAPIGetXnameOnValidation - Validate response has valid fields (Redfish) max_retries: 30 #retry this because there are delays to cause the state change delay_after: 10 request: url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "redfish", xnames: ["{xname}"] } + json: {"source":"redfish","xnames":["{xname}"]} method: POST verify: !bool "{verify}" response: @@ -184,7 +215,7 @@ stages: # - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields # request: # url: "{capmc_base_url}/capmc/v1/xname_on" -# json: {"reason": "ct tests", xnames: ["{xname}"]} +# json: {"reason": "ct tests", "xnames": ["{xname}"]} # method: POST # verify: !bool "{verify}" # response: @@ -193,7 +224,7 @@ stages: # - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields # request: # url: "{capmc_base_url}/capmc/v1/xname_off" -# json: {"reason": "ct tests", xnames: ["{xname}"], "force":true, "continue": true } +# json: {"reason": "ct tests", "xnames": ["{xname}"], "force":true, "continue": true } # method: POST # verify: !bool "{verify}" # response: @@ -220,7 +251,7 @@ stages: # delay_after: 10 # request: # url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source": "redfish", xnames: ["{xname}"] } +# json: {"source": "redfish", "xnames": ["{xname}"] } # method: POST # verify: !bool "{verify}" # response: From ce209348b6357837291406aebdd7a6dd9350febb Mon Sep 17 00:00:00 2001 From: Shane Unruh Date: Wed, 9 Nov 2022 15:13:18 -0700 Subject: [PATCH 18/48] Added tavern based power cap tests Added tests for: - POST get_power_cap - POST get_power_cap_capabilities - POST set_power_cap Jira: CASM-3568 --- runCT.sh | 2 +- ...est_get_power_cap_capabilities.tavern.yaml | 326 ++++++++++ .../test_xname_on_off.tavern.yaml | 2 +- .../test_get_power_cap.tavern.yaml | 121 +++- .../test_set_power_cap.tavern.yaml | 572 ++++++++++++++++++ 5 files changed, 1004 insertions(+), 19 deletions(-) create mode 100644 test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml create mode 100644 test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml diff --git a/runCT.sh b/runCT.sh index d38990c..6ddeb7d 100755 --- a/runCT.sh +++ b/runCT.sh @@ -51,7 +51,7 @@ docker compose up -d cray-capmc sleep 15 docker compose logs cray-capmc -if ! docker compose up --exit-code-from smoke smoke; then +if ! docker compose up --no-recreate --exit-code-from smoke smoke; then echo "CT smoke tests FAILED!" cleanup 1 fi diff --git a/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml new file mode 100644 index 0000000..c30b2a8 --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml @@ -0,0 +1,326 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) get_power_cap_capabilities API. +# Author: Shane Unruh +# Service: Cray Advanced Platform Monitoring and Control + +# CAPMC get_power_cap_capabilities test cases: 3 +# 1. setup1 - Get HSM Nodes +# 2. test1 - POST get_power_cap_capabilities - single nid +# 3. test2 - POST get_power_cap_capabilities - two nids +# 4. test3 - POST get_power_cap_capabilities - nonexistent nid - failure test +--- +test_name: capmcAPIGetPowerCapCapabilities +stages: + - name: capmcAPIGetPowerCapabilities - setup1 - Get HSM Nodes + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + xname0: Components[0].ID + nid0: Components[0].NID + xname1: Components[1].ID + nid1: Components[1].NID + + - name: capmcAPIGetPowerCapCapabilities - test1 - POST get_power_cap_capabilities - single nid + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap_capabilities" + json: + nids: + - !int "{nid0:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 0, + # "err_msg": "", + # "groups": [ + # { + # "name": "3_AuthenticAMD_64c_256GiB_3200MHz_NoAccel", + # "desc": "3_AuthenticAMD_64c_256GiB_3200MHz_NoAccel", + # "host_limit_max": 925, + # "host_limit_min": 350, + # "static": 0, + # "supply": 925, + # "powerup": 0, + # "nids": [ + # 1000 + # ], + # "controls": [ + # { + # "name": "Node Power Limit", + # "desc": "Node Power Limit", + # "max": 925, + # "min": 350 + # } + # ] + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + groups: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + name: + type: str + required: True + desc: + type: str + required: True + host_limit_max: + type: int + required: True + host_limit_min: + type: int + required: True + static: + type: int + required: True + supply: + type: int + required: True + powerup: + type: int + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: int + required: true + enum: + - !int "{nid0:d}" + controls: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + name: + type: str + required: True + desc: + type: str + required: True + max: + type: int + required: True + min: + type: int + required: True + + - name: capmcAPIGetPowerCapCapabilities - test2 - POST get_power_cap_capabilities - two nids + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap_capabilities" + json: + nids: + - !int "{nid0:d}" + - !int "{nid1:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 0, + # "err_msg": "", + # "groups": [ + # { + # "name": "3_AuthenticAMD_64c_256GiB_3200MHz_NoAccel", + # "desc": "3_AuthenticAMD_64c_256GiB_3200MHz_NoAccel", + # "host_limit_max": 925, + # "host_limit_min": 350, + # "static": 0, + # "supply": 925, + # "powerup": 0, + # "nids": [ + # 1001, + # 1000 + # ], + # "controls": [ + # { + # "name": "Node Power Limit", + # "desc": "Node Power Limit", + # "max": 925, + # "min": 350 + # } + # ] + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + groups: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + name: + type: str + required: True + desc: + type: str + required: True + host_limit_max: + type: int + required: True + host_limit_min: + type: int + required: True + static: + type: int + required: True + supply: + type: int + required: True + powerup: + type: int + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: int + required: true + enum: + - !int "{nid0:d}" + - !int "{nid1:d}" + controls: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + name: + type: str + required: True + desc: + type: str + required: True + max: + type: int + required: True + min: + type: int + required: True + + - name: capmcAPIGetPowerCapCapabilities - test3 - POST get_power_cap_capabilities - nonexistent nid - failure test + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap_capabilities" + json: + nids: + - 1300200100 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 22, + # "err_msg": "Invalid argument", + # "nids": [ + # { + # "nid": 1300200100, + # "e": 22, + # "err_msg": "Undefined NID" + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + pattern: "Invalid argument" + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: true + enum: + - 1300200100 + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + pattern: "Undefined NID" diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml index 9edb5c7..f80c84e 100644 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml @@ -92,7 +92,7 @@ stages: "err_msg": required: True type: str - pattern: "NodeBMC [A-Za-z0-9]+: no supported ResetType for ForceOn operation" + pattern: "NodeBMC (x[0-9]+c[0-9]+s[0-9]+b[0-9]+): no supported ResetType for ForceOn operation" "xname": required: True type: str diff --git a/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml index 3451b23..e3d759c 100644 --- a/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml @@ -25,13 +25,18 @@ # Author: Shane Unruh # Service: Cray Advanced Platform Monitoring and Control -# CAPMC get_power_cap test cases: 1 -# /get_power_cap - +# CAPMC get_power_cap test cases: 2 +# 1. setup1 - Get HSM Node +# 2. setup2 - Set HSM Node to Off +# 3. test1 - POST get_power_cap when node is off +# 4. setup3 - Set HSM Node to Ready +# 5. test2 - POST get_power_cap when node is Ready +# 6. setup4 - Set HSM Node to Off +# 7. setup5 - Set HSM Node to its original state --- test_name: capmcAPIGetPowerCap stages: - # get node to work with - - name: capmcAPIGetPowerCap - Get HSM Compute Node Component + - name: capmcAPIGetPowerCap - setup1 - Get HSM Node request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -44,8 +49,7 @@ stages: nid: Components[0].NID original_state: Components[0].State - # set state to off - - name: capmcAPIGetPowerCap - Set HSM Node to Off + - name: capmcAPIGetPowerCap - setup2 - Set HSM Node to Off request: url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" json: {"State":"Off"} @@ -53,8 +57,8 @@ stages: verify: !bool "{verify}" response: status_code: 204 - # test get_power_cap for node that is Off (failure case) - - name: capmcAPIGetPowerCap - test get_power_cap when node is off + + - name: capmcAPIGetPowerCap - test1 - POST get_power_cap when node is off request: url: "{capmc_base_url}/capmc/v1/get_power_cap" json: @@ -64,9 +68,43 @@ stages: verify: !bool "{verify}" response: status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: {'e': 22, 'err_msg': '', 'nids': [{'nid': 1000, 'e': 22, 'err_msg': ""}]} + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: True + enum: + - !int "{nid:d}" + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True - # set state to Ready - - name: capmcAPIGetPowerCap - Set HSM Node to Ready + - name: capmcAPIGetPowerCap - setup3 - Set HSM Node to Ready request: url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" json: {"State":"Ready"} @@ -74,8 +112,8 @@ stages: verify: !bool "{verify}" response: status_code: 204 - # test get_power_cap for node that is Ready - - name: capmcAPIGetPowerCap - test get_power_cap when node is Ready + + - name: capmcAPIGetPowerCap - test2 - POST get_power_cap when node is Ready request: url: "{capmc_base_url}/capmc/v1/get_power_cap" json: @@ -85,10 +123,59 @@ stages: verify: !bool "{verify}" response: status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # example: {'e': 0, 'err_msg': '', + # 'nids': + # [{'nid': 1000, + # 'controls': + # [{'name': 'Node Power Limit', 'val': 0}]}]} + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + enum: + - "" + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: True + enum: + - !int "{nid:d}" + controls: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + name: + type: str + required: True + val: + type: int + required: True - # Set state back to original state - # First set it to off (a node in the ready state can't go back to the on state) - - name: capmcAPIGetPowerCap - Set HSM Node to Ready + # The following steps put the nodes back to their original state + # For each node: + # - First set it to off, because a node in the ready state can't go directly back to the on state. + # - Then set it to the original state. + + - name: capmcAPIGetPowerCap - setup4 - Set HSM Node to Off request: url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" json: {"State":"Off"} @@ -96,8 +183,8 @@ stages: verify: !bool "{verify}" response: status_code: 204 - # set it to original state - - name: capmcAPIGetPowerCap - Set HSM Node to Ready + + - name: capmcAPIGetPowerCap - setup5 - Set HSM Node to its original state request: url: "{hsm_base_url}/hsm/v2/State/Components/{xname}/StateData" json: diff --git a/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml new file mode 100644 index 0000000..2d8d749 --- /dev/null +++ b/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml @@ -0,0 +1,572 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) set_power_cap API. +# Author: Shane Unruh +# Service: Cray Advanced Platform Monitoring and Control + +# CAPMC set_power_cap test cases: 7 +# 1. setup1 - Get HSM Nodes +# 2. setup2 - get_power_cap_capabilities for nodes +# 3. setup3 - Set HSM Node 0 to Off +# 4. setup4 - Set HSM Node 1 to Off +# 5. test1 - POST set_power_cap for powered off node - failure test +# 6. setup5 - Set HSM Node 0 to Ready +# 7. setup6 - Set HSM Node 1 to Ready +# 8. test2 - POST set_power_cap for two ready nodes +# 10. test3 - POST get_power_cap verify power cap values +# 11. test4 - POST set_power_cap value larger than max - failure test +# 12. test5 - POST set_power_cap value less than min - failure test +# 13. test6 - POST set_power_cap to zero +# 14. test7 - POST set_power_cap to zero second time - failure test +# 15. setup7 - Set HSM Node 0 to Off +# 16. setup8 - Set HSM Node 0 to its original state +# 17. setup9 - Set HSM Node 1 to Off +# 18. setup10 - Set HSM Node 1 to its original state +--- +test_name: capmcAPISetPowerCap +stages: + - name: capmcAPISetPowerCap - setup1 - Get HSM Nodes + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + xname0: Components[0].ID + nid0: Components[0].NID + original_state0: Components[0].State + xname1: Components[1].ID + nid1: Components[1].NID + original_state1: Components[1].State + + - name: capmcAPISetPowerCap - setup2 - get_power_cap_capabilities + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap_capabilities" + json: + nids: + - !int "{nid0:d}" + - !int "{nid1:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + min0: groups[0].host_limit_min + max0: groups[0].host_limit_max + min1: groups[0].host_limit_min + max1: groups[0].host_limit_max + + - name: capmcAPISetPowerCap - setup3 - Set HSM Node 0 to Off + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname0}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - setup4 - Set HSM Node 1 to Off + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname1}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - test1 - POST set_power_cap for powered off node - failure test + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: 410 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 22, + # "err_msg": "No supported power capping controls", + # "nids": [ + # { + # "nid": 1000, + # "e": 22, + # "err_msg": "Invalid state, NID is not 'ready'" + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: true + enum: + - !int "{nid0:d}" + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + pattern: "Invalid state, NID is not 'ready'" + + - name: capmcAPISetPowerCap - setup5 - Set HSM Node 0 to Ready + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname0}/StateData" + json: {"State":"Ready"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - setup6 - Set HSM Node 1 to Ready + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname1}/StateData" + json: {"State":"Ready"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - test2 - set_power_cap for two ready nodes + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: !int "{min0:d}" + - nid: !int "{nid1:d}" + controls: + - name: Node Power Limit + val: !int "{min1:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 0, + # "err_msg": "", + # "nids": null + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + nids: + type: none + required: False + + - name: capmcAPIGetPowerCap - test3 - POST get_power_cap verify power cap values + request: + url: "{capmc_base_url}/capmc/v1/get_power_cap" + json: + nids: + - !int "{nid0:d}" + - !int "{nid1:d}" + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # example: {'e': 0, 'err_msg': '', + # 'nids': + # [{'nid': 1000, + # 'controls': + # [{'name': 'Node Power Limit', 'val': 350}]}, + # [{'nid': 1001, + # 'controls': + # [{'name': 'Node Power Limit', 'val': 350}]}]} + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + enum: + - "" + nids: + type: seq + required: True + matching: any + sequence: + - type: map + mapping: + nid: + type: int + required: True + enum: + - !int "{nid0:d}" + controls: + type: seq + required: True + matching: "*" + sequence: + - type: map + mapping: + name: + type: str + required: True + val: + type: int + required: True + enum: + - !int "{min0:d}" + - type: map + mapping: + nid: + type: int + required: True + enum: + - !int "{nid1:d}" + controls: + type: seq + required: True + matching: "*" + sequence: + - type: map + mapping: + name: + type: str + required: True + val: + type: int + required: True + enum: + - !int "{min1:d}" + + - name: capmcAPISetPowerCap - test4 - POST set_power_cap value larger than max - failure test + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: 1234567 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 22, + # "err_msg": "No supported power capping controls", + # "nids": [ + # { + # "nid": 1000, + # "e": 22, + # "err_msg": "Control (Node Power Limit) value (400000) is greater than maximum (925)" + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: true + enum: + - !int "{nid0:d}" + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + enum: + - "Control (Node Power Limit) value (1234567) is greater than maximum ({max0})" + + - name: capmcAPISetPowerCap - test5 - POST set_power_cap value less than min - failure test + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: 1 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 22, + # "err_msg": "No supported power capping controls", + # "nids": [ + # { + # "nid": 1000, + # "e": 22, + # "err_msg": "Control (Node Power Limit) value (1) is less than minimum (350)" + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: true + enum: + - !int "{nid0:d}" + e: + type: int + required: True + enum: + - 22 + err_msg: + type: str + required: True + enum: + - "Control (Node Power Limit) value (1) is less than minimum ({min0})" + + - name: capmcAPISetPowerCap - test6 - POST set_power_cap to zero + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: 0 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 0, + # "err_msg": "", + # "nids": null + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 0 + err_msg: + type: str + required: True + nids: + type: none + required: False + + - name: capmcAPISetPowerCap - test7 - POST set_power_cap to zero second time - failure test + request: + url: "{capmc_base_url}/capmc/v1/set_power_cap" + json: + nids: + - nid: !int "{nid0:d}" + controls: + - name: Node Power Limit + val: 0 + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + # expected: + # { + # "e": 52, + # "err_msg": "Invalid exchange", + # "nids": [ + # { + # "nid": 1000, + # "e": 400, + # "err_msg": "Error setting power cap for NID" + # } + # ] + # } + schema: + type: map + mapping: + e: + type: int + required: True + enum: + - 52 + err_msg: + type: str + required: True + enum: + - "Invalid exchange" + nids: + type: seq + required: True + matching: all + sequence: + - type: map + mapping: + nid: + type: int + required: true + enum: + - !int "{nid0:d}" + e: + type: int + required: True + enum: + - 400 + err_msg: + type: str + required: True + enum: + - "Error setting power cap for NID" + + # The following steps put the nodes back to their original state + # For each node: + # - First set it to off, because a node in the ready state can't go directly back to the on state. + # - Then set it to the original state. + + - name: capmcAPISetPowerCap - setup7 - Set HSM Node 0 to Off + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname0}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - setup8 - Set HSM Node 0 to its original state + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname0}/StateData" + json: + State: "{original_state0}" + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - setup9 - Set HSM Node 1 to Off + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname1}/StateData" + json: {"State":"Off"} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 + + - name: capmcAPISetPowerCap - setup10 - Set HSM Node 1 to its original state + request: + url: "{hsm_base_url}/hsm/v2/State/Components/{xname1}/StateData" + json: + State: "{original_state1}" + method: PATCH + verify: !bool "{verify}" + response: + status_code: 204 From 9f0f5e3376be1ce5d03abc62a5025ffd4d83d642 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 22 Nov 2022 13:53:46 -0600 Subject: [PATCH 19/48] Add/fix xname_on and xname_reinit tests. --- .../capmc_node_xname_power_cycle_test.sh | 0 ...test_get_xname_status_negative.tavern.yaml | 14 - ...ern.yaml => test_service_apis.tavern.yaml} | 0 .../2-disruptive/test_xname_on.tavern.yaml | 326 +++++++++++++++++ .../test_xname_on_off.tavern.yaml | 282 --------------- .../test_xname_reinit.tavern.yaml | 336 ++++++++++++++++++ .../test_get_xname_status.tavern.yaml | 120 ------- 7 files changed, 662 insertions(+), 416 deletions(-) rename test/{ct/disruptive => bash}/capmc_node_xname_power_cycle_test.sh (100%) rename test/ct/api/1-non-disruptive/{test_capmc_health_apis.tavern.yaml => test_service_apis.tavern.yaml} (100%) create mode 100644 test/ct/api/2-disruptive/test_xname_on.tavern.yaml delete mode 100644 test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml create mode 100644 test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml delete mode 100644 test/ct/functional/test_get_xname_status.tavern.yaml diff --git a/test/ct/disruptive/capmc_node_xname_power_cycle_test.sh b/test/bash/capmc_node_xname_power_cycle_test.sh similarity index 100% rename from test/ct/disruptive/capmc_node_xname_power_cycle_test.sh rename to test/bash/capmc_node_xname_power_cycle_test.sh diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml index 87392f1..345032b 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml @@ -164,20 +164,6 @@ stages: e: 405 err_msg: "(DELETE) Not Allowed" -#--- -#test_name: capmcAPIGetXnameStatus OPTIONS method fails -#stages: -# - name: capmcAPIGetXnameStatus fails with OPTIONS method -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# method: OPTIONS -# verify: !bool "{verify}" -# response: -# status_code: 405 -# json: -# e: 405 -# err_msg: "(OPTIONS) Not Allowed" -# --- test_name: capmcAPIGetXnameStatus PATCH method fails stages: diff --git a/test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml b/test/ct/api/1-non-disruptive/test_service_apis.tavern.yaml similarity index 100% rename from test/ct/api/1-non-disruptive/test_capmc_health_apis.tavern.yaml rename to test/ct/api/1-non-disruptive/test_service_apis.tavern.yaml diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml new file mode 100644 index 0000000..526afde --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -0,0 +1,326 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_on API. +# Author: Mitch Schooler, Andrew Nieuwsma +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: TODO + +# POST /xname_off Power Off Compute Node +# POST /get_xname_status Verify Off Compute Node +# POST /xname_on Off Compute Node +# POST /get_xname_status Verify On Compute Node + +# POST /xname_on Power On Compute Node +# POST /get_xname_status Verify On Compute Node +# POST /xname_on On Compute Node +# POST /get_xname_status Verify On Compute Node +--- +test_name: capmcAPIxnameOnPOSToffComputeNode - TODO + +stages: + - name: capmcAPIxnameOnPOSToffComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameOnPOSToffComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + +--- +test_name: capmcAPIxnameOnPOSTonComputeNode - TODO + +stages: + - name: capmcAPIxnameOnPOSTonComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTonComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameOnPOSTonComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml deleted file mode 100644 index 9edb5c7..0000000 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ /dev/null @@ -1,282 +0,0 @@ -# MIT License -# -# (C) Copyright 2022 Hewlett Packard Enterprise Development LP -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -# Tavern test cases for the Cray Advanced Platform Monitoring and Control -# (CAPMC) xname_on and xname_off APIs. -# Author: Mitch Schooler, Andrew Nieuwsma -# Service: Cray Advanced Platform Monitoring and Control - -# HMS test metrics test cases: TODO -# POST /xname_on Compute Node Power On Force Fails API response code -# POST /xname_on Compute Node Power On Force Fails API response body -# POST /xname_off Compute Node Power Off Force API response code -# POST /xname_off Compute Node Power Off Force API response body -# POST /xname_on Compute Node Power On API response code -# POST /xname_on Compute Node Power On API response body -# POST /get_xname_status Compute Node Powered On API response code -# POST /get_xname_status Compute Node Powered On API response body ---- -test_name: capmcAPIXnameONForceOnFail - Test that forcing a compute node on fails -stages: - - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - xname: Components[0].ID - - # POST /xname_on Compute Node Power On Force Fails API response code - # POST /xname_on Compute Node Power On Force Fails API response body - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - #TODO: this assumes that a random compute node in HSM doesn't support ForceOn, seems like a bad assumption - json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"],"force":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1/1 Xnames issued ForceOn" - "xnames": - type: seq - required: True - matching: all - sequence: - - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - pattern: "NodeBMC [A-Za-z0-9]+: no supported ResetType for ForceOn operation" - "xname": - required: True - type: str - enum: - - "{xname}" - ---- -test_name: capmcAPIXnameONHappyPath - Test that an on works -stages: - - name: capmcAPIXnameOFFContext - Get an xname from the HSM Components collection to use in the next stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - xname: Components[0].ID - - # POST /xname_off Compute Node Power Off Force API response code - # POST /xname_off Compute Node Power Off Force API response body - - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason":"CT test case: capmcAPIXnameOffPOSTPrep","xnames":["{xname}"],"force":true,"continue":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - #TODO - #verify_response_with: - # function: tavern.testutils.helpers:validate_pykwalify - # extra_kwargs: - # schema: - # type: map - # required: True - # mapping: - - # POST /xname_on Compute Node Power On API response code - # POST /xname_on Compute Node Power On API response body - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"]} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" - - # POST /get_xname_status Compute Node Powered On API response code - # POST /get_xname_status Compute Node Powered On API response body - - name: capmcAPIGetXnameOnValidation - Validate response has valid fields (Redfish) - max_retries: 30 #retry this because there are delays to cause the state change - delay_after: 10 - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source":"redfish","xnames":["{xname}"]} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" - "on": - type: seq - matching: all - required: True - sequence: - - type: str - unique: True - -# # THIS TEST IS BROKEN, WIP -#--- -#test_name: capmcAPIXnameOFFSadPath - test that an off works -#stages: -# - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# xname: Components[0].ID -# -# - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields -# request: -# url: "{capmc_base_url}/capmc/v1/xname_on" -# json: {"reason": "ct tests", "xnames": ["{xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# -# - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields -# request: -# url: "{capmc_base_url}/capmc/v1/xname_off" -# json: {"reason": "ct tests", "xnames": ["{xname}"], "force":true, "continue": true } -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# - name: capmcAPIGetXnameOffValidation - Validate response has valid fields (Redfish) -# max_retries: 30 #retry this because there are delays to cause the state change -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source": "redfish", "xnames": ["{xname}"] } -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "off": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml new file mode 100644 index 0000000..e20b477 --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -0,0 +1,336 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control +# (CAPMC) xname_reinit API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: TODO + +# POST /xname_on Power On Compute Node +# POST /get_xname_status Verify On Compute Node +# POST /xname_reinit On Compute Node +# POST /get_xname_status Verify On Compute Node + +# POST /xname_off Power Off Compute Node +# POST /get_xname_status Verify Off Compute Node +# POST /xname_reinit Off Compute Node +# POST /get_xname_status Verify On Compute Node +--- +test_name: capmcAPIxnameReinitPOSTonComputeNode - TODO + +stages: + - name: capmcAPIxnameReinitPOSTonComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTonComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameReinitPOSTonComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + # Cray Mountain compute node + # TODO: xname_reinit w/ force=true turns the node off but then errors out saying ForceOn is not supported leaving it off + # TODO: xname_reinit w/ force=false works, but there's no way to confirm that the node was reinitialized since the state doesn't change from "On", it also powers on an initially "Off" node successfully + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false} + # Intel compute node + # Same behavior as Cray Mountain compute w/ force=false + # Different behavior w/ force=on: you actually see the state flip from "On" to "Off" and back to "On" since Intel supports ForceOff and ForceOn + # Gigabyte compute node + # Couldn't get the node to change power states at all with node_off, node_on, or node_reinit with force=true or force=false + # HPE compute node + # Couldn't get the node to change power states at all with node_off, node_on, or node_reinit with force=true or force=false + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + # Not checking that the node powers "Off" before powering back "On" again, could only get that to work on Intel compute node w/ force=true + + - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" +--- +test_name: capmcAPIxnameReinitPOSToffComputeNode - TODO + +stages: + - name: capmcAPIxnameReinitPOSToffComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSToffComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameReinitPOSToffComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" diff --git a/test/ct/functional/test_get_xname_status.tavern.yaml b/test/ct/functional/test_get_xname_status.tavern.yaml deleted file mode 100644 index 32961f9..0000000 --- a/test/ct/functional/test_get_xname_status.tavern.yaml +++ /dev/null @@ -1,120 +0,0 @@ -# MIT License -# -# (C) Copyright [2020-2022] Hewlett Packard Enterprise Development LP -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -# Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) get_xname_status API. -# Author: Mitch Schooler -# Service: Cray Advanced Platform Monitoring and Control - -# HMS test metrics test cases: 2 -# 1. POST /get_xname_status empty payload API response code -# 2. POST /get_xname_status empty payload API response body ---- -test_name: Verify get_xname_status POST method with empty payload - -stages: - # 1. POST /get_xname_status empty payload API response code - # 2. POST /get_xname_status empty payload API response body - - name: Get the status of all xnames via Redfish - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source": "redfish"} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" - "on": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "off": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "halt": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "standby": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "ready": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "disabled": - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - "flags": - type: map - required: False - mapping: - key: - type: seq - matching: all - required: False - sequence: - - type: int - unique: True - function: tavern.testutils.helpers:validate_content - extra_kwargs: - comparisons: - # response body should have at least one node status and not only "e" and "err_msg" keys - - jmespath: "length(keys(@))" - operator: "gt" - expected: 2 From 00c00ea8aab92b1a948f71bf36892a1f65ac87d8 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 22 Nov 2022 13:56:52 -0600 Subject: [PATCH 20/48] Remove duplicate test file. --- .../test_xname_on_off.tavern.yaml | 282 ------------------ 1 file changed, 282 deletions(-) delete mode 100644 test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml diff --git a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml deleted file mode 100644 index f80c84e..0000000 --- a/test/ct/api/2-disruptive/test_xname_on_off.tavern.yaml +++ /dev/null @@ -1,282 +0,0 @@ -# MIT License -# -# (C) Copyright 2022 Hewlett Packard Enterprise Development LP -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -# Tavern test cases for the Cray Advanced Platform Monitoring and Control -# (CAPMC) xname_on and xname_off APIs. -# Author: Mitch Schooler, Andrew Nieuwsma -# Service: Cray Advanced Platform Monitoring and Control - -# HMS test metrics test cases: TODO -# POST /xname_on Compute Node Power On Force Fails API response code -# POST /xname_on Compute Node Power On Force Fails API response body -# POST /xname_off Compute Node Power Off Force API response code -# POST /xname_off Compute Node Power Off Force API response body -# POST /xname_on Compute Node Power On API response code -# POST /xname_on Compute Node Power On API response body -# POST /get_xname_status Compute Node Powered On API response code -# POST /get_xname_status Compute Node Powered On API response body ---- -test_name: capmcAPIXnameONForceOnFail - Test that forcing a compute node on fails -stages: - - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - xname: Components[0].ID - - # POST /xname_on Compute Node Power On Force Fails API response code - # POST /xname_on Compute Node Power On Force Fails API response body - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - #TODO: this assumes that a random compute node in HSM doesn't support ForceOn, seems like a bad assumption - json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"],"force":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1/1 Xnames issued ForceOn" - "xnames": - type: seq - required: True - matching: all - sequence: - - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - pattern: "NodeBMC (x[0-9]+c[0-9]+s[0-9]+b[0-9]+): no supported ResetType for ForceOn operation" - "xname": - required: True - type: str - enum: - - "{xname}" - ---- -test_name: capmcAPIXnameONHappyPath - Test that an on works -stages: - - name: capmcAPIXnameOFFContext - Get an xname from the HSM Components collection to use in the next stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - xname: Components[0].ID - - # POST /xname_off Compute Node Power Off Force API response code - # POST /xname_off Compute Node Power Off Force API response body - - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason":"CT test case: capmcAPIXnameOffPOSTPrep","xnames":["{xname}"],"force":true,"continue":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - #TODO - #verify_response_with: - # function: tavern.testutils.helpers:validate_pykwalify - # extra_kwargs: - # schema: - # type: map - # required: True - # mapping: - - # POST /xname_on Compute Node Power On API response code - # POST /xname_on Compute Node Power On API response body - - name: capmcAPIXnameOnPOSTActual - Validate proper number of json fields - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - json: {"reason":"CT test case: capmcAPIXnameOnPOSTActual","xnames":["{xname}"]} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" - - # POST /get_xname_status Compute Node Powered On API response code - # POST /get_xname_status Compute Node Powered On API response body - - name: capmcAPIGetXnameOnValidation - Validate response has valid fields (Redfish) - max_retries: 30 #retry this because there are delays to cause the state change - delay_after: 10 - request: - url: "{capmc_base_url}/capmc/v1/get_xname_status" - json: {"source":"redfish","xnames":["{xname}"]} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" - "on": - type: seq - matching: all - required: True - sequence: - - type: str - unique: True - -# # THIS TEST IS BROKEN, WIP -#--- -#test_name: capmcAPIXnameOFFSadPath - test that an off works -#stages: -# - name: capmcAPIXnameContext - Get an xname from the HSM Components collection to use in the next stage -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# xname: Components[0].ID -# -# - name: capmcAPIXnameOffPOSTPrep - Validate proper number of json fields -# request: -# url: "{capmc_base_url}/capmc/v1/xname_on" -# json: {"reason": "ct tests", "xnames": ["{xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# -# - name: capmcAPIXnameOffPOSTActual - Validate proper number of json fields -# request: -# url: "{capmc_base_url}/capmc/v1/xname_off" -# json: {"reason": "ct tests", "xnames": ["{xname}"], "force":true, "continue": true } -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# - name: capmcAPIGetXnameOffValidation - Validate response has valid fields (Redfish) -# max_retries: 30 #retry this because there are delays to cause the state change -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source": "redfish", "xnames": ["{xname}"] } -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "off": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True From b359cef9dd446b7857791ba782f7e26176b92f80 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 22 Nov 2022 14:10:05 -0600 Subject: [PATCH 21/48] Reorganize docker-compose file for CT environment. --- Makefile | 2 - docker-compose.test.ct.yaml | 118 ++++++++++++++++++++++-------------- 2 files changed, 72 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index e054cc8..4e89e3f 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,5 @@ unittest: ct: ./runCT.sh - ct_image: docker build --no-cache -f test/ct/Dockerfile test/ct/ --tag cray-capmc-hmth-test:${VERSION} - diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 045243f..62c91b4 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -4,52 +4,10 @@ networks: capmc: services: - wait-for-smd: - build: - context: test/ct/ - dockerfile: Dockerfile.wait-for-smd.Dockerfile - networks: - - capmc - tavern: - build: - context: test/ct/ - dockerfile: Dockerfile - entrypoint: entrypoint.sh tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api - networks: - - capmc - smoke: - build: - context: test/ct/ - dockerfile: Dockerfile - entrypoint: entrypoint.sh smoke -f smoke.json -u http://cray-capmc:27777 - networks: - - capmc - cray-capmc: - build: - context: . - dockerfile: Dockerfile - environment: - - HSM_URL=http://cray-smd:27779 - - CRAY_VAULT_AUTH_PATH=auth/token/create - - CRAY_VAULT_ROLE_FILE=configs/namespace - - CRAY_VAULT_JWT_FILE=configs/token - - VAULT_ADDR=http://vault:8200 - - VAULT_TOKEN=hms - - VAULT_KEYPATH=hms-creds - - VAULT_SKIP_VERIFY=true - - VAULT_ENABLED=true - - LOG_LEVEL=DEBUG - - TRS_IMPLEMENTATION=LOCAL - - HSMLOCK_ENABLED=true - - networks: - - capmc - depends_on: - - cray-smd - - vault-kv-enabler - - kafka - - emulator-loader + # + # Required services + # vault: hostname: vault image: artifactory.algol60.net/docker.io/library/vault:1.5.5 @@ -61,6 +19,7 @@ services: - IPC_LOCK networks: - capmc + vault-kv-enabler: image: artifactory.algol60.net/csm-docker/stable/vault-kv-enabler:1.13.4 environment: @@ -71,7 +30,7 @@ services: - vault networks: - capmc -# + hmsds-postgres: hostname: hmsds-postgres image: artifactory.algol60.net/docker.io/library/postgres:11-alpine @@ -81,6 +40,7 @@ services: - POSTGRES_DB=hmsds networks: - capmc + cray-smd-init: image: artifactory.algol60.net/csm-docker/stable/cray-smd:1.48.0 environment: @@ -91,6 +51,7 @@ services: networks: - capmc command: /entrypoint.sh smd-init + cray-smd: image: artifactory.algol60.net/csm-docker/stable/cray-smd:1.48.0 environment: @@ -111,6 +72,7 @@ services: - vault networks: - capmc + zookeeper: image: artifactory.algol60.net/docker.io/confluentinc/cp-zookeeper:6.1.1 hostname: zookeeper @@ -119,6 +81,7 @@ services: ZOOKEEPER_TICK_TIME: 2000 networks: - capmc + kafka: image: artifactory.algol60.net/docker.io/confluentinc/cp-kafka:6.1.1 hostname: kafka @@ -133,6 +96,7 @@ services: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 networks: - capmc + cray-hms-hmcollector: image: artifactory.algol60.net/csm-docker/stable/hms-hmcollector:2.12.4 environment: @@ -154,6 +118,10 @@ services: - capmc depends_on: - kafka + + # + # Emulated hardware + # emulator-loader: image: artifactory.algol60.net/docker.io/library/golang:1.16-alpine command: > @@ -191,6 +159,7 @@ services: - rfemulator3 networks: - capmc + rfemulator0: hostname: x0c0s1b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 @@ -203,6 +172,7 @@ services: capmc: aliases: - x0c0s1b0 + rfemulator1: hostname: x0c0s2b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 @@ -215,6 +185,7 @@ services: capmc: aliases: - x0c0s2b0 + rfemulator2: hostname: x0c0s3b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 @@ -227,6 +198,7 @@ services: capmc: aliases: - x0c0s3b0 + rfemulator3: hostname: x0c0s4b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 @@ -239,3 +211,57 @@ services: capmc: aliases: - x0c0s4b0 + + # + # Service under test + # + cray-capmc: + build: + context: . + dockerfile: Dockerfile + environment: + - HSM_URL=http://cray-smd:27779 + - CRAY_VAULT_AUTH_PATH=auth/token/create + - CRAY_VAULT_ROLE_FILE=configs/namespace + - CRAY_VAULT_JWT_FILE=configs/token + - VAULT_ADDR=http://vault:8200 + - VAULT_TOKEN=hms + - VAULT_KEYPATH=hms-creds + - VAULT_SKIP_VERIFY=true + - VAULT_ENABLED=true + - LOG_LEVEL=DEBUG + - TRS_IMPLEMENTATION=LOCAL + - HSMLOCK_ENABLED=true + networks: + - capmc + depends_on: + - cray-smd + - vault-kv-enabler + - kafka + - emulator-loader + + # + # Tests + # + wait-for-smd: + build: + context: test/ct/ + dockerfile: Dockerfile.wait-for-smd.Dockerfile + networks: + - capmc + + tavern: + build: + context: test/ct/ + dockerfile: Dockerfile + entrypoint: entrypoint.sh tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api + networks: + - capmc + + smoke: + build: + context: test/ct/ + dockerfile: Dockerfile + entrypoint: entrypoint.sh smoke -f smoke.json -u http://cray-capmc:27777 + networks: + - capmc From 553d37f5c918092e2e9fb170ea4dba1f276abd5c Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 22 Nov 2022 17:02:08 -0600 Subject: [PATCH 22/48] Add xname_off tests. --- .../2-disruptive/test_xname_off.tavern.yaml | 326 ++++++++++++++++++ .../2-disruptive/test_xname_on.tavern.yaml | 2 +- .../test_xname_reinit.tavern.yaml | 2 +- 3 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 test/ct/api/2-disruptive/test_xname_off.tavern.yaml diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml new file mode 100644 index 0000000..e51fc2b --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -0,0 +1,326 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_off API. +# Author: Mitch Schooler, Andrew Nieuwsma +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 8 + +# POST /xname_on Power On Compute Node +# POST /get_xname_status Verify On Compute Node +# POST /xname_off On Compute Node +# POST /get_xname_status Verify Off Compute Node + +# POST /xname_off Power Off Compute Node +# POST /get_xname_status Verify Off Compute Node +# POST /xname_off Off Compute Node +# POST /get_xname_status Verify Off Compute Node +--- +test_name: capmcAPIxnameOffPOSTonComputeNode - TODO + +stages: + - name: capmcAPIxnameOffPOSTonComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTonComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameOffPOSTonComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + +--- +test_name: capmcAPIxnameOffPOSToffComputeNode - TODO + +stages: + - name: capmcAPIxnameOffPOSToffComputeNodeTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSToffComputeNodePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" + + - name: capmcAPIxnameOffPOSToffComputeNodeActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_xname}" diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index 526afde..f7a72bd 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler, Andrew Nieuwsma # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: TODO +# HMS test metrics test cases: 8 # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index e20b477..4d40fda 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -25,7 +25,7 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: TODO +# HMS test metrics test cases: 8 # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node From fe8a690b630780c5971be685339220e90f511d91 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 22 Nov 2022 17:14:36 -0600 Subject: [PATCH 23/48] Consistent formatting. --- .../test_get_power_cap_capabilities.tavern.yaml | 1 + .../1-non-disruptive/test_get_xname_status.tavern.yaml | 6 ++++++ .../test_get_xname_status_negative.tavern.yaml | 10 +++++++++- .../test_get_power_cap.tavern.yaml | 2 +- .../test_set_power_cap.tavern.yaml | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml index c30b2a8..e5425e6 100644 --- a/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_power_cap_capabilities.tavern.yaml @@ -32,6 +32,7 @@ # 4. test3 - POST get_power_cap_capabilities - nonexistent nid - failure test --- test_name: capmcAPIGetPowerCapCapabilities + stages: - name: capmcAPIGetPowerCapabilities - setup1 - Get HSM Nodes request: diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index d8ae827..27a6f94 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -43,6 +43,7 @@ # /get_xname_status all nodes in the 'on' or 'off' states --- test_name: capmcAPIGetXnameStatus via Redfish + stages: - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (Redfish) request: @@ -60,6 +61,7 @@ stages: - jmespath: "length(keys(@))" operator: "gt" expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (Redfish) request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -106,8 +108,10 @@ stages: sequence: - type: str unique: True + --- test_name: capmcAPIGetXnameStatus via Hardware State Manager + stages: - name: capmcAPIGetXnameStatusPOST - Validate proper number of json fields (HSM) request: @@ -125,6 +129,7 @@ stages: - jmespath: "length(keys(@))" operator: "gt" expected: 2 + - name: capmcAPIGetXnameStatusPOST - Validate response has valid fields (HSM) request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -339,6 +344,7 @@ stages: - jmespath: "length(keys(@))" operator: "gt" expected: 2 + - name: Get nodes in any state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml index 345032b..e367b26 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status_negative.tavern.yaml @@ -33,10 +33,10 @@ # /get_xname_status fails with HEAD method # /get_xname_status fails with PUT method # /get_xname_status fails with DELETE method -# /get_xname_status fails with OPTIONS method # disabled # /get_xname_status fails with PATCH method --- test_name: capmcAPIGetXnameStatus NodeBMC xname + stages: - name: Get NodeBMC xname from HSM Components to use in upcoming stages request: @@ -48,6 +48,7 @@ stages: save: json: bmc_xname: Components[0].ID + - name: capmcAPIGetXnameStatus fails with NodeBMC xname request: url: "{capmc_base_url}/capmc/v1/get_xname_status" @@ -83,6 +84,7 @@ stages: --- test_name: capmcAPIGetXnameStatus invalid filter + stages: - name: capmcAPIGetXnameStatus fails with invalid filter request: @@ -98,6 +100,7 @@ stages: --- test_name: capmcAPIGetXnameStatus garbage filter + stages: - name: capmcAPIGetXnameStatus fails with garbage filter request: @@ -113,6 +116,7 @@ stages: --- test_name: capmcAPIGetXnameStatus GET method fails + stages: - name: capmcAPIGetXnameStatus fails with GET method request: @@ -127,6 +131,7 @@ stages: --- test_name: capmcAPIGetXnameStatus HEAD method fails + stages: - name: capmcAPIGetXnameStatus fails with HEAD method request: @@ -138,6 +143,7 @@ stages: --- test_name: capmcAPIGetXnameStatus PUT method fails + stages: - name: capmcAPIGetXnameStatus fails with PUT method request: @@ -152,6 +158,7 @@ stages: --- test_name: capmcAPIGetXnameStatus DELETE method fails + stages: - name: capmcAPIGetXnameStatus fails with DELETE method request: @@ -166,6 +173,7 @@ stages: --- test_name: capmcAPIGetXnameStatus PATCH method fails + stages: - name: capmcAPIGetXnameStatus fails with PATCH method request: diff --git a/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml index e3d759c..18ab07e 100644 --- a/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_get_power_cap.tavern.yaml @@ -35,6 +35,7 @@ # 7. setup5 - Set HSM Node to its original state --- test_name: capmcAPIGetPowerCap + stages: - name: capmcAPIGetPowerCap - setup1 - Get HSM Node request: @@ -193,4 +194,3 @@ stages: verify: !bool "{verify}" response: status_code: 204 - diff --git a/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml index 2d8d749..70bea71 100644 --- a/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_set_power_cap.tavern.yaml @@ -45,6 +45,7 @@ # 18. setup10 - Set HSM Node 1 to its original state --- test_name: capmcAPISetPowerCap + stages: - name: capmcAPISetPowerCap - setup1 - Get HSM Nodes request: From a63b1b2ca289f09aaf9ce144fbc559fe7e332023 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Mon, 28 Nov 2022 17:58:21 -0600 Subject: [PATCH 24/48] Add CAPMC power control negative tests. --- .../test_xname_off_negative.tavern.yaml | 375 ++++++++++++++++++ .../test_xname_on_negative.tavern.yaml | 375 ++++++++++++++++++ .../test_xname_reinit_negative.tavern.yaml | 375 ++++++++++++++++++ 3 files changed, 1125 insertions(+) create mode 100644 test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml create mode 100644 test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml create mode 100644 test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml diff --git a/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml new file mode 100644 index 0000000..7523054 --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml @@ -0,0 +1,375 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_off API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 10 +# POST /xname_off fails with missing xnames +# POST /xname_off fails with empty xname +# POST /xname_off fails with garbage xname +# POST /xname_off fails with NodeBMC xname +# POST /xname_off fails with NodeEnclosure xname +# GET /xname_off fails +# DELETE /xname_off fails +# PATCH /xname_off fails +# PUT /xname_off fails +# HEAD /xname_off fails +--- +test_name: capmcAPIxnameOffPOSTmissingXnames + +stages: + - name: capmcAPIxnameOffPOSTmissingXnames - Verify xname_off fails with missing xnames list + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTmissingXnames","force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: Missing required xnames parameter" + +--- +test_name: capmcAPIxnameOffPOSTemptyXname + +stages: + - name: capmcAPIxnameOffPOSTemptyXname - Verify xname_off fails with empty xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTemptyXname","xnames":[""],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameOffPOSTgarbageXname + +stages: + - name: capmcAPIxnameOffPOSTgarbageXname - Verify xname_off fails with garbage xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTgarbageXname","xnames":[".*&^%$#$%$^"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - ".*&^%$#$%$^" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameOffPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameOffPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTnodeBMCxnameActual - Verify xname_off fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for Off" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Off'" + +--- +test_name: capmcAPIxnameOffPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameOffPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTnodeEnclosureXnameActual - Verify xname_off fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceOff" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOff'" + +--- +test_name: capmcAPIxnameOffGET - Verify xname_off GET method fails + +stages: + - name: capmcAPIxnameOffGET - Verify xname_off fails with GET method + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + method: GET + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(GET) Not Allowed" + +--- +test_name: capmcAPIxnameOffDELETE - Verify xname_off DELETE method fails + +stages: + - name: capmcAPIxnameOffDELETE - Verify xname_off fails with DELETE method + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + method: DELETE + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(DELETE) Not Allowed" + +--- +test_name: capmcAPIxnameOffPATCH - Verify xname_off PATCH method fails + +stages: + - name: capmcAPIxnameOffPATCH - Verify xname_off fails with PATCH method + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPATCH","xnames":["FAKE"]} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PATCH) Not Allowed" + +--- +test_name: capmcAPIxnameOffPUT - Verify xname_off PUT method fails + +stages: + - name: capmcAPIxnameOffPUT - Verify xname_off fails with PUT method + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPUT","xnames":["FAKE"]} + method: PUT + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PUT) Not Allowed" + +--- +test_name: capmcAPIxnameOffHEAD - Verify xname_off HEAD method fails + +stages: + - name: capmcAPIxnameOffHEAD - Verify xname_off fails with HEAD method + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + method: HEAD + verify: !bool "{verify}" + response: + status_code: 405 diff --git a/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml new file mode 100644 index 0000000..9f6264b --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml @@ -0,0 +1,375 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_on API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 10 +# POST /xname_on fails with missing xnames +# POST /xname_on fails with empty xname +# POST /xname_on fails with garbage xname +# POST /xname_on fails with NodeBMC xname +# POST /xname_on fails with NodeEnclosure xname +# GET /xname_on fails +# DELETE /xname_on fails +# PATCH /xname_on fails +# PUT /xname_on fails +# HEAD /xname_on fails +--- +test_name: capmcAPIxnameOnPOSTmissingXnames + +stages: + - name: capmcAPIxnameOnPOSTmissingXnames - Verify xname_on fails with missing xnames list + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTmissingXnames","force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: Missing required xnames parameter" + +--- +test_name: capmcAPIxnameOnPOSTemptyXname + +stages: + - name: capmcAPIxnameOnPOSTemptyXname - Verify xname_on fails with empty xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTemptyXname","xnames":[""],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameOnPOSTgarbageXname + +stages: + - name: capmcAPIxnameOnPOSTgarbageXname - Verify xname_on fails with garbage xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTgarbageXname","xnames":[".*&^%$#$%$^"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - ".*&^%$#$%$^" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameOnPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameOnPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTnodeBMCxnameActual - Verify xname_on fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for On" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'On'" + +--- +test_name: capmcAPIxnameOnPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameOnPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTnodeEnclosureXnameActual - Verify xname_on fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceOn" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOn'" + +--- +test_name: capmcAPIxnameOnGET - Verify xname_on GET method fails + +stages: + - name: capmcAPIxnameOnGET - Verify xname_on fails with GET method + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + method: GET + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(GET) Not Allowed" + +--- +test_name: capmcAPIxnameOnDELETE - Verify xname_on DELETE method fails + +stages: + - name: capmcAPIxnameOnDELETE - Verify xname_on fails with DELETE method + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + method: DELETE + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(DELETE) Not Allowed" + +--- +test_name: capmcAPIxnameOnPATCH - Verify xname_on PATCH method fails + +stages: + - name: capmcAPIxnameOnPATCH - Verify xname_on fails with PATCH method + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPATCH","xnames":["FAKE"]} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PATCH) Not Allowed" + +--- +test_name: capmcAPIxnameOnPUT - Verify xname_on PUT method fails + +stages: + - name: capmcAPIxnameOnPUT - Verify xname_on fails with PUT method + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPUT","xnames":["FAKE"]} + method: PUT + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PUT) Not Allowed" + +--- +test_name: capmcAPIxnameOnHEAD - Verify xname_on HEAD method fails + +stages: + - name: capmcAPIxnameOnHEAD - Verify xname_on fails with HEAD method + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + method: HEAD + verify: !bool "{verify}" + response: + status_code: 405 diff --git a/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml new file mode 100644 index 0000000..5e411a4 --- /dev/null +++ b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml @@ -0,0 +1,375 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_reinit API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 10 +# POST /xname_reinit fails with missing xnames +# POST /xname_reinit fails with empty xname +# POST /xname_reinit fails with garbage xname +# POST /xname_reinit fails with NodeBMC xname +# POST /xname_reinit fails with NodeEnclosure xname +# GET /xname_reinit fails +# DELETE /xname_reinit fails +# PATCH /xname_reinit fails +# PUT /xname_reinit fails +# HEAD /xname_reinit fails +--- +test_name: capmcAPIxnameReinitPOSTmissingXnames + +stages: + - name: capmcAPIxnameReinitPOSTmissingXnames - Verify xname_reinit fails with missing xnames list + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTmissingXnames","force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: Missing required xnames parameter" + +--- +test_name: capmcAPIxnameReinitPOSTemptyXname + +stages: + - name: capmcAPIxnameReinitPOSTemptyXname - Verify xname_reinit fails with empty xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTemptyXname","xnames":[""],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameReinitPOSTgarbageXname + +stages: + - name: capmcAPIxnameReinitPOSTgarbageXname - Verify xname_reinit fails with garbage xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTgarbageXname","xnames":[".*&^%$#$%$^"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 22 + "err_msg": + required: True + type: str + enum: + - "invalid argument" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - ".*&^%$#$%$^" + "e": + type: int + required: True + enum: + - 22 + "err_msg": + type: str + required: True + enum: + - "invalid/duplicate xname" + +--- +test_name: capmcAPIxnameReinitPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameReinitPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTnodeBMCxnameActual - Verify xname_reinit fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for Restart" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Restart'" + +--- +test_name: capmcAPIxnameReinitPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameReinitPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual - Verify xname_reinit fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceRestart" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceRestart'" + +--- +test_name: capmcAPIxnameReinitGET - Verify xname_reinit GET method fails + +stages: + - name: capmcAPIxnameReinitGET - Verify xname_reinit fails with GET method + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + method: GET + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(GET) Not Allowed" + +--- +test_name: capmcAPIxnameReinitDELETE - Verify xname_reinit DELETE method fails + +stages: + - name: capmcAPIxnameReinitDELETE - Verify xname_reinit fails with DELETE method + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + method: DELETE + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(DELETE) Not Allowed" + +--- +test_name: capmcAPIxnameReinitPATCH - Verify xname_reinit PATCH method fails + +stages: + - name: capmcAPIxnameReinitPATCH - Verify xname_reinit fails with PATCH method + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPATCH","xnames":["FAKE"]} + method: PATCH + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PATCH) Not Allowed" + +--- +test_name: capmcAPIxnameReinitPUT - Verify xname_reinit PUT method fails + +stages: + - name: capmcAPIxnameReinitPUT - Verify xname_reinit fails with PUT method + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPUT","xnames":["FAKE"]} + method: PUT + verify: !bool "{verify}" + response: + status_code: 405 + json: + e: 405 + err_msg: "(PUT) Not Allowed" + +--- +test_name: capmcAPIxnameReinitHEAD - Verify xname_reinit HEAD method fails + +stages: + - name: capmcAPIxnameReinitHEAD - Verify xname_reinit fails with HEAD method + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + method: HEAD + verify: !bool "{verify}" + response: + status_code: 405 From 3ddd576e378568b4a31540c577666492634b429c Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 29 Nov 2022 20:55:54 -0600 Subject: [PATCH 25/48] Add xname_on tests for more component types. --- .../2-disruptive/test_xname_on.tavern.yaml | 584 +++++++++++++++++- 1 file changed, 579 insertions(+), 5 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index f7a72bd..e42d102 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler, Andrew Nieuwsma # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 8 +# HMS test metrics test cases: 16 # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node @@ -35,6 +35,26 @@ # POST /get_xname_status Verify On Compute Node # POST /xname_on On Compute Node # POST /get_xname_status Verify On Compute Node + +# POST /xname_off Power Off Chassis +# POST /get_xname_status Verify Off Chassis +# POST /xname_on Off Chassis +# POST /get_xname_status Verify On Chassis + +# POST /xname_off Power Off ComputeModule +# POST /get_xname_status Verify Off ComputeModule +# POST /xname_on Off ComputeModule +# POST /get_xname_status Verify On ComputeModule + +#TODO: Need to create these components to ensure an HSNBoard exists under RouterModule +# POST /xname_off Power Off RouterModule and HSNBoard +# POST /get_xname_status Verify Off RouterModule and HSNBoard +# POST /xname_on Off RouterModule and HSNBoard +# POST /get_xname_status Verify On RouterModule and HSNBoard + +#TODO: Need to create these components, they aren't created by simulation environment +# CabinetPDUOutlet +# CabinetPDUPowerConnector --- test_name: capmcAPIxnameOnPOSToffComputeNode - TODO @@ -54,7 +74,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_off" # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here - json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -119,7 +139,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_on" # Not all compute node types support ForceOn (only Intel does), can't use force=true here - json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false} + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -199,7 +219,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_on" # Not all compute node types support ForceOn (only Intel does), can't use force=true here - json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} + json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -264,7 +284,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_on" # Not all compute node types support ForceOn (only Intel does), can't use force=true here - json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false} + json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -324,3 +344,557 @@ stages: unique: True enum: - "{node_xname}" + +--- +test_name: capmcAPIxnameOnPOSToffChassis - TODO + +stages: + - name: capmcAPIxnameOnPOSToffChassisTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Chassis" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + chassis_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffChassisPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffChassisPrep","xnames":["{chassis_xname}"],"force":true,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffChassisStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{chassis_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{chassis_xname}" + + - name: capmcAPIxnameOnPOSToffChassisActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffChassisActual","xnames":["{chassis_xname}"],"force":false,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffChassisStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{chassis_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{chassis_xname}" + +--- +test_name: capmcAPIxnameOnPOSToffComputeModule - TODO + +stages: + - name: capmcAPIxnameOnPOSToffComputeModuleTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffComputeModulePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModulePrep","xnames":["{compute_module_xname}"],"force":true,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOnPOSToffComputeModuleActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleActual","xnames":["{compute_module_xname}"],"force":false,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + +#--- +##TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way by simulation environment +##TODO: Check if this is expected for recursive:false, could be a bug since I don't see this behavior with other hierarchal components +#test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO +# +#stages: +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# router_module_xname: Components[0].ID +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# hsn_board_xname: Components[0].ID +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO +# request: +# url: "{capmc_base_url}/capmc/v1/xname_off" +# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO +# # retry here if needed since there can be delays to the state change +# max_retries: 30 +# delay_after: 10 +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source":"redfish","xnames":["{router_module_xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "off": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True +# enum: +# - "{router_module_xname}" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckHSNBoard - TODO +# # retry here if needed since there can be delays to the state change +# max_retries: 30 +# delay_after: 10 +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source":"redfish","xnames":["{hsn_board_xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "off": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True +# enum: +# - "{hsn_board_xname}" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardActual - TODO +# request: +# url: "{capmc_base_url}/capmc/v1/xname_on" +# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardActual","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":false,"recursive":false} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO +# # retry here if needed since there can be delays to the state change +# max_retries: 30 +# delay_after: 10 +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source":"redfish","xnames":["{router_module_xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "on": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True +# enum: +# - "{router_module_xname}" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckHSNBoard - TODO +# # retry here if needed since there can be delays to the state change +# max_retries: 30 +# delay_after: 10 +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source":"redfish","xnames":["{hsn_board_xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "on": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True +# enum: +# - "{hsn_board_xname}" +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModuleAndHSNBoard - TODO +# request: +# url: "{capmc_base_url}/capmc/v1/get_xname_status" +# json: {"source":"redfish","xnames":["{router_module_xname}","{hsn_board_xname}"]} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" +# "on": +# type: seq +# matching: all +# required: True +# sequence: +# - type: str +# unique: True +# enum: +# - "{hsn_board_xname}" +# - "{router_module_xname}" From 9167d2da153dbcf9d1ec1815b952e4dfee1a99e3 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 30 Nov 2022 11:49:21 -0600 Subject: [PATCH 26/48] Attempt to add emulated CMM to test environment. --- docker-compose.test.ct.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 62c91b4..6e343ff 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -150,6 +150,12 @@ services: \"RediscoverOnUpdate\":true, \"User\":\"root\", \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0b0\", + \"FQDN\":\"x0c0b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" }]}' http://cray-smd:27779/hsm/v2/Inventory/RedfishEndpoints" depends_on: - cray-smd @@ -157,6 +163,7 @@ services: - rfemulator1 - rfemulator2 - rfemulator3 + - rfemulator4 networks: - capmc @@ -212,6 +219,18 @@ services: aliases: - x0c0s4b0 + rfemulator4: + hostname: x0c0b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=CMM + - XNAME=x0c0b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0b0 + # # Service under test # From bf8e26daa19ed4904f907e7b297870be34ab0342 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 30 Nov 2022 12:09:59 -0600 Subject: [PATCH 27/48] Wait for Nodes to discover. --- test/ct/wait-for.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ct/wait-for.sh b/test/ct/wait-for.sh index 24bbddd..618491c 100755 --- a/test/ct/wait-for.sh +++ b/test/ct/wait-for.sh @@ -24,7 +24,9 @@ # wait-for.sh; used by runCT.sh to make sure HSM has been populated with data before running. echo "Initiating..." -URL="http://cray-smd:27779/hsm/v2/State/Components" +#TODO +#URL="http://cray-smd:27779/hsm/v2/State/Components" +URL="http://cray-smd:27779/hsm/v2/State/Components?type=Node" sentry=1 limit=200 while :; do From 8c2c5b136556be5ead286d7c6b58fc7744f71509 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 30 Nov 2022 14:21:38 -0600 Subject: [PATCH 28/48] Check for RouterModule and HSNBoard. --- .../2-disruptive/test_xname_on.tavern.yaml | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index e42d102..f71ff43 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -631,59 +631,59 @@ stages: enum: - "{compute_module_xname}" -#--- -##TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way by simulation environment -##TODO: Check if this is expected for recursive:false, could be a bug since I don't see this behavior with other hierarchal components -#test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO -# -#stages: -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# router_module_xname: Components[0].ID -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# hsn_board_xname: Components[0].ID -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO -# request: -# url: "{capmc_base_url}/capmc/v1/xname_off" -# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" +--- +#TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way by simulation environment +#TODO: Check if this is expected for recursive:false, could be a bug since I don't see this behavior with other hierarchal components +test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO + +stages: + - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + router_module_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + hsn_board_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" # # - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO # # retry here if needed since there can be delays to the state change From 2dbfd867529bd83a691bce799f09617cdd0f5f1b Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 30 Nov 2022 18:53:37 -0600 Subject: [PATCH 29/48] Clean up Chassis and ComputeModule test cases. --- .../2-disruptive/test_xname_off.tavern.yaml | 318 +++++++++++++++++- .../2-disruptive/test_xname_on.tavern.yaml | 113 +++---- 2 files changed, 368 insertions(+), 63 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index e51fc2b..5a8845c 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -21,10 +21,10 @@ # OTHER DEALINGS IN THE SOFTWARE. # Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_off API. -# Author: Mitch Schooler, Andrew Nieuwsma +# Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 8 +# HMS test metrics test cases: TODO # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node @@ -35,6 +35,26 @@ # POST /get_xname_status Verify Off Compute Node # POST /xname_off Off Compute Node # POST /get_xname_status Verify Off Compute Node + +# POST /xname_on Power On Chassis +# POST /get_xname_status Verify On Chassis +# POST /xname_off On Chassis +# POST /get_xname_status Verify Off Chassis + +# POST /xname_on Power On ComputeModule +# POST /get_xname_status Verify On ComputeModule +# POST /xname_off On ComputeModule +# POST /get_xname_status Verify Off ComputeModule + +#TODO: Need to create these components using simulator/RIE to ensure an HSNBoard exists under RouterModule +# POST /xname_on Power On RouterModule and HSNBoard +# POST /get_xname_status Verify On RouterModule and HSNBoard +# POST /xname_off On RouterModule and HSNBoard +# POST /get_xname_status Verify Off RouterModule and HSNBoard + +#TODO: Need to create these components using simulator/RIE +# CabinetPDUOutlet +# CabinetPDUPowerConnector --- test_name: capmcAPIxnameOffPOSTonComputeNode - TODO @@ -54,7 +74,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_on" # Not all compute node types support ForceOn (only Intel does), can't use force=true here - json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -119,7 +139,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_off" # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here - json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":true} + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -199,7 +219,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_off" # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here - json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} + json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -264,7 +284,7 @@ stages: request: url: "{capmc_base_url}/capmc/v1/xname_off" # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here - json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":true} + json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" response: @@ -324,3 +344,289 @@ stages: unique: True enum: - "{node_xname}" + +--- +test_name: capmcAPIxnameOffPOSTonChassis - TODO + +stages: + - name: capmcAPIxnameOffPOSTonChassisTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Chassis" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + chassis_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTonChassisPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonChassisPrep","xnames":["{chassis_xname}"],"force":false,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonChassisStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{chassis_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{chassis_xname}" + + - name: capmcAPIxnameOffPOSTonChassisActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonChassisActual","xnames":["{chassis_xname}"],"force":true,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonChassisStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{chassis_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{chassis_xname}" + +--- +test_name: capmcAPIxnameOffPOSTonComputeModule - TODO + +stages: + - name: capmcAPIxnameOffPOSTonComputeModuleTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTonComputeModulePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModulePrep","xnames":["{compute_module_xname}"],"force":false,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOffPOSTonComputeModuleActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleActual","xnames":["{compute_module_xname}"],"force":true,"recursive":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index f71ff43..fe76d6b 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -21,10 +21,10 @@ # OTHER DEALINGS IN THE SOFTWARE. # Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_on API. -# Author: Mitch Schooler, Andrew Nieuwsma +# Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 16 +# HMS test metrics test cases: TODO # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node @@ -46,13 +46,13 @@ # POST /xname_on Off ComputeModule # POST /get_xname_status Verify On ComputeModule -#TODO: Need to create these components to ensure an HSNBoard exists under RouterModule +#TODO: Need to create these components using simulator/RIE to ensure an HSNBoard exists under RouterModule # POST /xname_off Power Off RouterModule and HSNBoard # POST /get_xname_status Verify Off RouterModule and HSNBoard # POST /xname_on Off RouterModule and HSNBoard # POST /get_xname_status Verify On RouterModule and HSNBoard -#TODO: Need to create these components, they aren't created by simulation environment +#TODO: Need to create these components using simulator/RIE # CabinetPDUOutlet # CabinetPDUPowerConnector --- @@ -631,59 +631,58 @@ stages: enum: - "{compute_module_xname}" ---- -#TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way by simulation environment -#TODO: Check if this is expected for recursive:false, could be a bug since I don't see this behavior with other hierarchal components -test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO - -stages: - - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - router_module_xname: Components[0].ID - - - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - hsn_board_xname: Components[0].ID - - - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO - request: - url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - 0 - "err_msg": - required: True - type: str - enum: - - "" +#--- +##TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way in simulation environment +#test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO +# +#stages: +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# router_module_xname: Components[0].ID +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# hsn_board_xname: Components[0].ID +# +# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO +# request: +# url: "{capmc_base_url}/capmc/v1/xname_off" +# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} +# method: POST +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# required: True +# mapping: +# "e": +# type: int +# required: True +# enum: +# - 0 +# "err_msg": +# required: True +# type: str +# enum: +# - "" # # - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO # # retry here if needed since there can be delays to the state change From ec05da81c5a5d9e957bc19502bde97934f273d19 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 30 Nov 2022 19:54:36 -0600 Subject: [PATCH 30/48] Add comments for Chassis and ComputeModule restart operations. --- test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml | 3 +++ test/ct/wait-for.sh | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index 4d40fda..59ad923 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -36,6 +36,9 @@ # POST /get_xname_status Verify Off Compute Node # POST /xname_reinit Off Compute Node # POST /get_xname_status Verify On Compute Node + +#TODO: Chassis type doesn't support 'Restart' or 'ForceRestart' operations +#TODO: ComputeModule type doesn't support 'Restart' or 'ForceRestart' operations --- test_name: capmcAPIxnameReinitPOSTonComputeNode - TODO diff --git a/test/ct/wait-for.sh b/test/ct/wait-for.sh index 618491c..1ad07a8 100755 --- a/test/ct/wait-for.sh +++ b/test/ct/wait-for.sh @@ -24,8 +24,7 @@ # wait-for.sh; used by runCT.sh to make sure HSM has been populated with data before running. echo "Initiating..." -#TODO -#URL="http://cray-smd:27779/hsm/v2/State/Components" +# wait for the emulated Nodes to be discovered which take longer than the CMM URL="http://cray-smd:27779/hsm/v2/State/Components?type=Node" sentry=1 limit=200 From 982bdda0339286e5d51fd8a6e7663f1d64607f92 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 2 Dec 2022 01:20:50 -0600 Subject: [PATCH 31/48] Add test for xname_off recursive option. --- .../test_xname_off.tavern.yaml | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml new file mode 100644 index 0000000..b2fb7ce --- /dev/null +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -0,0 +1,256 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_off API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 6 + +# POST /xname_on Power On ComputeModule Recursive +# POST /get_xname_status Verify On ComputeModule +# POST /get_xname_status Verify On Compute Node +# POST /xname_off On ComputeModule Recursive +# POST /get_xname_status Verify Off ComputeModule +# POST /get_xname_status Verify Off Compute Node +--- +test_name: capmcAPIxnameOffPOSTonComputeModuleRecursive - TODO + +stages: + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + #TODO + #url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule&id=x1000c0s0" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep","xnames":["{compute_module_xname}"],"force":false,"recursive":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual","xnames":["{compute_module_xname}"],"force":true,"recursive":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" From 235238965a7f7f15026f825d99fc9d6e19f953ad Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 2 Dec 2022 10:43:35 -0600 Subject: [PATCH 32/48] Troubleshooting. --- .../test_xname_off.tavern.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index b2fb7ce..24cd448 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -49,6 +49,49 @@ stages: json: compute_module_xname: Components[0].ID + #TODO: Want to check /State/Components + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Components: + type: seq + matching: all + required: True + sequence: + - type: map + required: True + allowempty: True + mapping: + ID: + type: str + required: True + #TODO: this causes the failure + enum: + - "x9999c7s9b9n9" + Type: + type: str + required: True + State: + type: str + required: True + Flag: + type: str + required: True + Enabled: + type: bool + required: True + - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" From 349fba02939eac1220d9c78f97dd2a18e683ab6e Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 2 Dec 2022 17:13:21 -0600 Subject: [PATCH 33/48] Fully populate chassis. --- docker-compose.test.ct.yaml | 92 ++++++++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 6e343ff..4445d4a 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -127,6 +127,18 @@ services: command: > sh -c "apk add curl && sleep 10 && curl -X POST -d '{\"RedfishEndpoints\":[{ + \"ID\":\"x0c0b0\", + \"FQDN\":\"x0c0b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s0b0\", + \"FQDN\":\"x0c0s0b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ \"ID\":\"x0c0s1b0\", \"FQDN\":\"x0c0s1b0\", \"RediscoverOnUpdate\":true, @@ -151,8 +163,20 @@ services: \"User\":\"root\", \"Password\":\"root_password\" },{ - \"ID\":\"x0c0b0\", - \"FQDN\":\"x0c0b0\", + \"ID\":\"x0c0s5b0\", + \"FQDN\":\"x0c0s5b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s6b0\", + \"FQDN\":\"x0c0s6b0\", + \"RediscoverOnUpdate\":true, + \"User\":\"root\", + \"Password\":\"root_password\" + },{ + \"ID\":\"x0c0s7b0\", + \"FQDN\":\"x0c0s7b0\", \"RediscoverOnUpdate\":true, \"User\":\"root\", \"Password\":\"root_password\" @@ -164,10 +188,27 @@ services: - rfemulator2 - rfemulator3 - rfemulator4 + - rfemulator5 + - rfemulator6 + - rfemulator7 + - rfemulator8 networks: - capmc rfemulator0: + hostname: x0c0s0b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s0b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0s0b0 + + rfemulator1: hostname: x0c0s1b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 environment: @@ -180,7 +221,7 @@ services: aliases: - x0c0s1b0 - rfemulator1: + rfemulator2: hostname: x0c0s2b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 environment: @@ -193,7 +234,7 @@ services: aliases: - x0c0s2b0 - rfemulator2: + rfemulator3: hostname: x0c0s3b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 environment: @@ -206,7 +247,7 @@ services: aliases: - x0c0s3b0 - rfemulator3: + rfemulator4: hostname: x0c0s4b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 environment: @@ -219,7 +260,46 @@ services: aliases: - x0c0s4b0 - rfemulator4: + rfemulator5: + hostname: x0c0s5b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s5b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0s5b0 + + rfemulator6: + hostname: x0c0s6b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s6b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0s6b0 + + rfemulator7: + hostname: x0c0s7b0 + image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s7b0 + - PORT=443 + networks: + capmc: + aliases: + - x0c0s7b0 + + rfemulator8: hostname: x0c0b0 image: artifactory.algol60.net/csm-docker/stable/csm-rie:1.3.0 environment: From 64e3505a742b74b391c2e53fdf3d582d0783d717 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 2 Dec 2022 17:39:18 -0600 Subject: [PATCH 34/48] Remove test code. --- .../test_xname_off.tavern.yaml | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index 24cd448..b2fb7ce 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -49,49 +49,6 @@ stages: json: compute_module_xname: Components[0].ID - #TODO: Want to check /State/Components - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - TODO - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - Components: - type: seq - matching: all - required: True - sequence: - - type: map - required: True - allowempty: True - mapping: - ID: - type: str - required: True - #TODO: this causes the failure - enum: - - "x9999c7s9b9n9" - Type: - type: str - required: True - State: - type: str - required: True - Flag: - type: str - required: True - Enabled: - type: bool - required: True - - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" From fdaeaa31956db37fe254f594f107de23eee0f747 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Mon, 5 Dec 2022 18:04:21 -0600 Subject: [PATCH 35/48] Add xname_on recursive test. --- .../test_xname_off.tavern.yaml | 4 +- .../test_xname_on.tavern.yaml | 256 ++++++++++++++++++ 2 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index b2fb7ce..8000a1e 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -39,8 +39,6 @@ stages: - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - TODO request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" - #TODO - #url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule&id=x1000c0s0" method: GET verify: !bool "{verify}" response: @@ -120,6 +118,7 @@ stages: delay_after: 10 request: url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} method: POST verify: !bool "{verify}" @@ -223,6 +222,7 @@ stages: delay_after: 10 request: url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} method: POST verify: !bool "{verify}" diff --git a/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml new file mode 100644 index 0000000..9347002 --- /dev/null +++ b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml @@ -0,0 +1,256 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Tavern test cases for the Cray Advanced Platform Monitoring and Control (CAPMC) xname_on API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 6 + +# POST /xname_off Power Off ComputeModule Recursive +# POST /get_xname_status Verify Off ComputeModule +# POST /get_xname_status Verify Off Compute Node +# POST /xname_on Off ComputeModule Recursive +# POST /get_xname_status Verify On ComputeModule +# POST /get_xname_status Verify On Compute Node +--- +test_name: capmcAPIxnameOnPOSToffComputeModuleRecursive - TODO + +stages: + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep","xnames":["{compute_module_xname}"],"force":true,"recursive":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual","xnames":["{compute_module_xname}"],"force":false,"recursive":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" From da02b30399f0e409b4f8cd4a00eb451575dbf939 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Mon, 5 Dec 2022 19:00:51 -0600 Subject: [PATCH 36/48] Add negative tests for recursive and prereq options. --- .../test_get_xname_status.tavern.yaml | 14 ++++++ .../test_xname_off_negative.tavern.yaml | 44 ++++++++++++++++++- .../test_xname_on_negative.tavern.yaml | 44 ++++++++++++++++++- .../test_xname_reinit_negative.tavern.yaml | 44 ++++++++++++++++++- 4 files changed, 143 insertions(+), 3 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index 27a6f94..190ba7f 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -222,6 +222,13 @@ stages: sequence: - type: str unique: True + warning: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True --- test_name: capmcAPIGetXnameStatus via Hardware State Manager with Node Xname @@ -430,6 +437,13 @@ stages: sequence: - type: str unique: True + warning: + type: seq + matching: all + required: False + sequence: + - type: str + unique: True --- test_name: capmcAPIGetXnameStatus with 'show_off' filter diff --git a/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml index 7523054..0d176a3 100644 --- a/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml @@ -25,12 +25,13 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 10 +# HMS test metrics test cases: 11 # POST /xname_off fails with missing xnames # POST /xname_off fails with empty xname # POST /xname_off fails with garbage xname # POST /xname_off fails with NodeBMC xname # POST /xname_off fails with NodeEnclosure xname +# POST /xname_off fails with recursive and prereq options # GET /xname_off fails # DELETE /xname_off fails # PATCH /xname_off fails @@ -300,6 +301,47 @@ stages: enum: - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOff'" +--- +test_name: capmcAPIxnameOffPOSTnodeXnameRecursiveAndPrereq + +stages: + - name: capmcAPIxnameOffPOSTnodeXnameRecursiveAndPrereqPrep - Get compute Node xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTnodeXnameRecursiveAndPrereqActual - Verify xname_off fails with recursive and prereq options + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeXnameRecursiveAndPrereqActual","xnames":["{node_xname}"],"force":false,"recursive":true,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: recursive and prereq options are mutually exclusive" + --- test_name: capmcAPIxnameOffGET - Verify xname_off GET method fails diff --git a/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml index 9f6264b..0f66c3a 100644 --- a/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml @@ -25,12 +25,13 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 10 +# HMS test metrics test cases: 11 # POST /xname_on fails with missing xnames # POST /xname_on fails with empty xname # POST /xname_on fails with garbage xname # POST /xname_on fails with NodeBMC xname # POST /xname_on fails with NodeEnclosure xname +# POST /xname_on fails with recursive and prereq options # GET /xname_on fails # DELETE /xname_on fails # PATCH /xname_on fails @@ -300,6 +301,47 @@ stages: enum: - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOn'" +--- +test_name: capmcAPIxnameOnPOSTnodeXnameRecursiveAndPrereq + +stages: + - name: capmcAPIxnameOnPOSTnodeXnameRecursiveAndPrereqPrep - Get compute Node xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTnodeXnameRecursiveAndPrereqActual - Verify xname_on fails with recursive and prereq options + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeXnameRecursiveAndPrereqActual","xnames":["{node_xname}"],"force":false,"recursive":true,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: recursive and prereq options are mutually exclusive" + --- test_name: capmcAPIxnameOnGET - Verify xname_on GET method fails diff --git a/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml index 5e411a4..ad101f5 100644 --- a/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml @@ -25,12 +25,13 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 10 +# HMS test metrics test cases: 11 # POST /xname_reinit fails with missing xnames # POST /xname_reinit fails with empty xname # POST /xname_reinit fails with garbage xname # POST /xname_reinit fails with NodeBMC xname # POST /xname_reinit fails with NodeEnclosure xname +# POST /xname_reinit fails with recursive and prereq options # GET /xname_reinit fails # DELETE /xname_reinit fails # PATCH /xname_reinit fails @@ -300,6 +301,47 @@ stages: enum: - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceRestart'" +--- +test_name: capmcAPIxnameReinitPOSTnodeXnameRecursiveAndPrereq + +stages: + - name: capmcAPIxnameReinitPOSTnodeXnameRecursiveAndPrereqPrep - Get compute Node xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTnodeXnameRecursiveAndPrereqActual - Verify xname_reinit fails with recursive and prereq options + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeXnameRecursiveAndPrereqActual","xnames":["{node_xname}"],"force":false,"recursive":true,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 400 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 400 + "err_msg": + required: True + type: str + enum: + - "Bad Request: recursive and prereq options are mutually exclusive" + --- test_name: capmcAPIxnameReinitGET - Verify xname_reinit GET method fails From 617ad300b5e040109a13536261e54ec18a9b8c1e Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 6 Dec 2022 16:25:33 -0600 Subject: [PATCH 37/48] Add xname_off prereq test. --- .../test_xname_off.tavern.yaml | 233 +++++++++++++++++- 1 file changed, 232 insertions(+), 1 deletion(-) diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index 8000a1e..d489fbd 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 6 +# HMS test metrics test cases: 12 # POST /xname_on Power On ComputeModule Recursive # POST /get_xname_status Verify On ComputeModule @@ -32,6 +32,13 @@ # POST /xname_off On ComputeModule Recursive # POST /get_xname_status Verify Off ComputeModule # POST /get_xname_status Verify Off Compute Node + +# POST /xname_on Power On Compute Node Prereq +# POST /get_xname_status Verify On Compute Node +# POST /get_xname_status Verify On ComputeModule +# POST /xname_off On Compute Node Prereq +# POST /get_xname_status Verify Off Compute Node +# POST /get_xname_status Verify Off ComputeModule --- test_name: capmcAPIxnameOffPOSTonComputeModuleRecursive - TODO @@ -254,3 +261,227 @@ stages: unique: True enum: - "{compute_module_xname}b0n0" + +--- +test_name: capmcAPIxnameOffPOSTonComputeNodePrereq - TODO + +stages: + - name: capmcAPIxnameOffPOSTonComputeNodePrereqTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrereqPrep","xnames":["{compute_module_xname}b0n0"],"force":false,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrereqActual","xnames":["{compute_module_xname}b0n0"],"force":true,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" From 1d1a0d15a0d8aa49b925b809ff94aabfebe616d4 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 6 Dec 2022 17:44:35 -0600 Subject: [PATCH 38/48] Add xname_on prereq test. --- .../2-disruptive/test_xname_off.tavern.yaml | 8 +- .../2-disruptive/test_xname_on.tavern.yaml | 8 +- .../test_xname_reinit.tavern.yaml | 6 +- .../test_xname_off.tavern.yaml | 9 +- .../test_xname_on.tavern.yaml | 238 +++++++++++++++++- 5 files changed, 251 insertions(+), 18 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index 5a8845c..724e887 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -73,7 +73,7 @@ stages: - name: capmcAPIxnameOffPOSTonComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" @@ -138,7 +138,7 @@ stages: - name: capmcAPIxnameOffPOSTonComputeNodeActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" @@ -218,7 +218,7 @@ stages: - name: capmcAPIxnameOffPOSToffComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" @@ -283,7 +283,7 @@ stages: - name: capmcAPIxnameOffPOSToffComputeNodeActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index fe76d6b..bfeb45e 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -73,7 +73,7 @@ stages: - name: capmcAPIxnameOnPOSToffComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true,"recursive":false} method: POST verify: !bool "{verify}" @@ -138,7 +138,7 @@ stages: - name: capmcAPIxnameOnPOSToffComputeNodeActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" @@ -218,7 +218,7 @@ stages: - name: capmcAPIxnameOnPOSTonComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" @@ -283,7 +283,7 @@ stages: - name: capmcAPIxnameOnPOSTonComputeNodeActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false,"recursive":false} method: POST verify: !bool "{verify}" diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index 59ad923..be0ce20 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -57,7 +57,7 @@ stages: - name: capmcAPIxnameReinitPOSTonComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameReinitPOSTonComputeNodePrep","xnames":["{node_xname}"],"force":false} method: POST verify: !bool "{verify}" @@ -155,7 +155,7 @@ stages: enum: - "" - # Not checking that the node powers "Off" before powering back "On" again, could only get that to work on Intel compute node w/ force=true + # not checking that the node powers "Off" before powering back "On" again, could only get that to work on Intel compute node w/ force=true - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - TODO # retry here if needed since there can be delays to the state change @@ -212,7 +212,7 @@ stages: - name: capmcAPIxnameReinitPOSToffComputeNodePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSToffComputeNodePrep","xnames":["{node_xname}"],"force":true} method: POST verify: !bool "{verify}" diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index d489fbd..2cd3eca 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -57,7 +57,7 @@ stages: - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep","xnames":["{compute_module_xname}"],"force":false,"recursive":true} method: POST verify: !bool "{verify}" @@ -161,7 +161,7 @@ stages: - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual","xnames":["{compute_module_xname}"],"force":true,"recursive":true} method: POST verify: !bool "{verify}" @@ -280,7 +280,7 @@ stages: - name: capmcAPIxnameOffPOSTonComputeNodePrereqPrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrereqPrep","xnames":["{compute_module_xname}b0n0"],"force":false,"prereq":true} method: POST @@ -385,7 +385,8 @@ stages: - name: capmcAPIxnameOffPOSTonComputeNodePrereqActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeNodePrereqActual","xnames":["{compute_module_xname}b0n0"],"force":true,"prereq":true} method: POST verify: !bool "{verify}" diff --git a/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml index 9347002..f2a6135 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 6 +# HMS test metrics test cases: 12 # POST /xname_off Power Off ComputeModule Recursive # POST /get_xname_status Verify Off ComputeModule @@ -32,6 +32,13 @@ # POST /xname_on Off ComputeModule Recursive # POST /get_xname_status Verify On ComputeModule # POST /get_xname_status Verify On Compute Node + +# POST /xname_off Power Off Compute Node Prereq +# POST /get_xname_status Verify Off Compute Node +# POST /get_xname_status Verify Off ComputeModule +# POST /xname_on Off Compute Node Prereq +# POST /get_xname_status Verify On Compute Node +# POST /get_xname_status Verify On ComputeModule --- test_name: capmcAPIxnameOnPOSToffComputeModuleRecursive - TODO @@ -50,7 +57,7 @@ stages: - name: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep - TODO request: url: "{capmc_base_url}/capmc/v1/xname_off" - # All compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep","xnames":["{compute_module_xname}"],"force":true,"recursive":true} method: POST verify: !bool "{verify}" @@ -154,7 +161,7 @@ stages: - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_on" - # Not all compute node types support ForceOn (only Intel does), can't use force=true here + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual","xnames":["{compute_module_xname}"],"force":false,"recursive":true} method: POST verify: !bool "{verify}" @@ -254,3 +261,228 @@ stages: unique: True enum: - "{compute_module_xname}b0n0" + +--- +test_name: capmcAPIxnameOnPOSToffComputeNodePrereq - TODO + +stages: + - name: capmcAPIxnameOnPOSToffComputeNodePrereqTarget - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + compute_module_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrereqPrep","xnames":["{compute_module_xname}b0n0"],"force":true,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # not all compute node types support ForceOn (only Intel does), can't use force=true here + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeNodePrereqActual","xnames":["{compute_module_xname}b0n0"],"force":false,"prereq":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + # this assumes a fully populated Chassis with NodeBMC 0 and Node 0 under all ComputeModules + json: {"source":"redfish","xnames":["{compute_module_xname}b0n0"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}b0n0" + + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{compute_module_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{compute_module_xname}" From 6334a1d7e08984957a72ece28a08d4ba7e4d254c Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 6 Dec 2022 18:36:33 -0600 Subject: [PATCH 39/48] Add power control negative tests for locking. --- .../test_xname_off_negative.tavern.yaml | 201 ++++++++++++++++++ .../test_xname_on_negative.tavern.yaml | 201 ++++++++++++++++++ .../test_xname_reinit_negative.tavern.yaml | 201 ++++++++++++++++++ 3 files changed, 603 insertions(+) create mode 100644 test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml create mode 100644 test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml create mode 100644 test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml diff --git a/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml new file mode 100644 index 0000000..9ccb35c --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml @@ -0,0 +1,201 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_off API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 1 +# POST /xname_off fails for Node that is already locked +--- +test_name: capmcAPIxnameOffPOSTlockedNode + +stages: + - name: capmcAPIxnameOffPOSTlockedNodeTarget - Retrieve an unlocked compute Node target from HSM to use in later stages + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute&locked=False" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTlockedNodeLock - Lock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/lock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 + + - name: capmcAPIxnameOffPOSTlockedNodeActual - Verify xname_off fails for Node that is already locked + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTlockedNodeActual","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 37 + "err_msg": + required: True + type: str + enum: + - "Error: Failed to reserve components while performing a ForceOff." + + - name: capmcAPIxnameOffPOSTlockedNodeUnlock - Unlock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/unlock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 diff --git a/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml new file mode 100644 index 0000000..ddf98df --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml @@ -0,0 +1,201 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_on API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 1 +# POST /xname_on fails for Node that is already locked +--- +test_name: capmcAPIxnameOnPOSTlockedNode + +stages: + - name: capmcAPIxnameOnPOSTlockedNodeTarget - Retrieve an unlocked compute Node target from HSM to use in later stages + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute&locked=False" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTlockedNodeLock - Lock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/lock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 + + - name: capmcAPIxnameOnPOSTlockedNodeActual - Verify xname_on fails for Node that is already locked + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTlockedNodeActual","xnames":["{node_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 37 + "err_msg": + required: True + type: str + enum: + - "Error: Failed to reserve components while performing a On." + + - name: capmcAPIxnameOnPOSTlockedNodeUnlock - Unlock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/unlock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 diff --git a/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml new file mode 100644 index 0000000..9b294e7 --- /dev/null +++ b/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml @@ -0,0 +1,201 @@ +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Negative Tavern test cases for the Cray Advanced Platform Monitoring and +# Control (CAPMC) xname_reinit API. +# Author: Mitch Schooler +# Service: Cray Advanced Platform Monitoring and Control + +# HMS test metrics test cases: 1 +# POST /xname_reinit fails for Node that is already locked +--- +test_name: capmcAPIxnameReinitPOSTlockedNode + +stages: + - name: capmcAPIxnameReinitPOSTlockedNodeTarget - Retrieve an unlocked compute Node target from HSM to use in later stages + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute&locked=False" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTlockedNodeLock - Lock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/lock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 + + - name: capmcAPIxnameReinitPOSTlockedNodeActual - Verify xname_reinit fails for Node that is already locked + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTlockedNodeActual","xnames":["{node_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 37 + "err_msg": + required: True + type: str + enum: + - "Error: Failed to reserve components while performing a ForceRestart." + + - name: capmcAPIxnameReinitPOSTlockedNodeUnlock - Unlock the target Node + request: + url: "{hsm_base_url}/hsm/v2/locks/unlock" + json: {"ComponentIDs":["{node_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + Counts: + type: map + required: True + mapping: + Total: + type: int + required: True + enum: + - 1 + Success: + type: int + required: True + enum: + - 1 + Failure: + type: int + required: True + enum: + - 0 + Success: + type: map + required: True + mapping: + ComponentIDs: + type: seq + required: True + sequence: + - type: str + required: True + enum: + - "{node_xname}" + Failure: + type: seq + required: True + sequence: + - type: map + required: False + mapping: + ID: + type: str + required: False + Reason: + type: str + required: False + function: tavern.testutils.helpers:validate_content + extra_kwargs: + comparisons: + - jmespath: "length(@.Success.ComponentIDs)" + operator: "eq" + expected: 1 From 61aea217ce75a78c77e11ba14336a88877c63c7c Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Tue, 6 Dec 2022 18:51:14 -0600 Subject: [PATCH 40/48] Cleanup test code. --- .../2-disruptive/test_xname_off.tavern.yaml | 12 +- .../2-disruptive/test_xname_on.tavern.yaml | 279 +----------------- .../test_xname_reinit.tavern.yaml | 13 - 3 files changed, 2 insertions(+), 302 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index 724e887..12e6f7a 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: TODO +# HMS test metrics test cases: 16 # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node @@ -45,16 +45,6 @@ # POST /get_xname_status Verify On ComputeModule # POST /xname_off On ComputeModule # POST /get_xname_status Verify Off ComputeModule - -#TODO: Need to create these components using simulator/RIE to ensure an HSNBoard exists under RouterModule -# POST /xname_on Power On RouterModule and HSNBoard -# POST /get_xname_status Verify On RouterModule and HSNBoard -# POST /xname_off On RouterModule and HSNBoard -# POST /get_xname_status Verify Off RouterModule and HSNBoard - -#TODO: Need to create these components using simulator/RIE -# CabinetPDUOutlet -# CabinetPDUPowerConnector --- test_name: capmcAPIxnameOffPOSTonComputeNode - TODO diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index bfeb45e..49b7000 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -24,7 +24,7 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: TODO +# HMS test metrics test cases: 16 # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node @@ -45,16 +45,6 @@ # POST /get_xname_status Verify Off ComputeModule # POST /xname_on Off ComputeModule # POST /get_xname_status Verify On ComputeModule - -#TODO: Need to create these components using simulator/RIE to ensure an HSNBoard exists under RouterModule -# POST /xname_off Power Off RouterModule and HSNBoard -# POST /get_xname_status Verify Off RouterModule and HSNBoard -# POST /xname_on Off RouterModule and HSNBoard -# POST /get_xname_status Verify On RouterModule and HSNBoard - -#TODO: Need to create these components using simulator/RIE -# CabinetPDUOutlet -# CabinetPDUPowerConnector --- test_name: capmcAPIxnameOnPOSToffComputeNode - TODO @@ -630,270 +620,3 @@ stages: unique: True enum: - "{compute_module_xname}" - -#--- -##TODO: Need create these components since CAPMC expects RouterModule w/ HSNBoard under it, not all RouterMoodules are set up this way in simulation environment -#test_name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoard - TODO -# -#stages: -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetRouterModule - TODO -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# router_module_xname: Components[0].ID -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardTargetHSNBoard - TODO -# request: -# url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" -# method: GET -# verify: !bool "{verify}" -# response: -# status_code: 200 -# save: -# json: -# hsn_board_xname: Components[0].ID -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep - TODO -# request: -# url: "{capmc_base_url}/capmc/v1/xname_off" -# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardPrep","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":true,"recursive":false} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO -# # retry here if needed since there can be delays to the state change -# max_retries: 30 -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source":"redfish","xnames":["{router_module_xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "off": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True -# enum: -# - "{router_module_xname}" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckHSNBoard - TODO -# # retry here if needed since there can be delays to the state change -# max_retries: 30 -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source":"redfish","xnames":["{hsn_board_xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "off": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True -# enum: -# - "{hsn_board_xname}" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardActual - TODO -# request: -# url: "{capmc_base_url}/capmc/v1/xname_on" -# json: {"reason":"CT test case: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardActual","xnames":["{router_module_xname}","{hsn_board_xname}"],"force":false,"recursive":false} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModule - TODO -# # retry here if needed since there can be delays to the state change -# max_retries: 30 -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source":"redfish","xnames":["{router_module_xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "on": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True -# enum: -# - "{router_module_xname}" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckHSNBoard - TODO -# # retry here if needed since there can be delays to the state change -# max_retries: 30 -# delay_after: 10 -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source":"redfish","xnames":["{hsn_board_xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "on": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True -# enum: -# - "{hsn_board_xname}" -# -# - name: capmcAPIxnameOnPOSToffRouterModuleAndHSNBoardStatusCheckRouterModuleAndHSNBoard - TODO -# request: -# url: "{capmc_base_url}/capmc/v1/get_xname_status" -# json: {"source":"redfish","xnames":["{router_module_xname}","{hsn_board_xname}"]} -# method: POST -# verify: !bool "{verify}" -# response: -# status_code: 200 -# verify_response_with: -# function: tavern.testutils.helpers:validate_pykwalify -# extra_kwargs: -# schema: -# type: map -# required: True -# mapping: -# "e": -# type: int -# required: True -# enum: -# - 0 -# "err_msg": -# required: True -# type: str -# enum: -# - "" -# "on": -# type: seq -# matching: all -# required: True -# sequence: -# - type: str -# unique: True -# enum: -# - "{hsn_board_xname}" -# - "{router_module_xname}" diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index be0ce20..15e07b4 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -36,9 +36,6 @@ # POST /get_xname_status Verify Off Compute Node # POST /xname_reinit Off Compute Node # POST /get_xname_status Verify On Compute Node - -#TODO: Chassis type doesn't support 'Restart' or 'ForceRestart' operations -#TODO: ComputeModule type doesn't support 'Restart' or 'ForceRestart' operations --- test_name: capmcAPIxnameReinitPOSTonComputeNode - TODO @@ -122,17 +119,7 @@ stages: - name: capmcAPIxnameReinitPOSTonComputeNodeActual - TODO request: url: "{capmc_base_url}/capmc/v1/xname_reinit" - # Cray Mountain compute node - # TODO: xname_reinit w/ force=true turns the node off but then errors out saying ForceOn is not supported leaving it off - # TODO: xname_reinit w/ force=false works, but there's no way to confirm that the node was reinitialized since the state doesn't change from "On", it also powers on an initially "Off" node successfully json: {"reason":"CT test case: capmcAPIxnameReinitPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false} - # Intel compute node - # Same behavior as Cray Mountain compute w/ force=false - # Different behavior w/ force=on: you actually see the state flip from "On" to "Off" and back to "On" since Intel supports ForceOff and ForceOn - # Gigabyte compute node - # Couldn't get the node to change power states at all with node_off, node_on, or node_reinit with force=true or force=false - # HPE compute node - # Couldn't get the node to change power states at all with node_off, node_on, or node_reinit with force=true or force=false method: POST verify: !bool "{verify}" response: From 1c70cefd33e8eabc0cd1565641f7d78093116da3 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 7 Dec 2022 11:04:13 -0600 Subject: [PATCH 41/48] Update CT docker compose file for HSM discovery performance improvement. --- docker-compose.test.ct.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.test.ct.yaml b/docker-compose.test.ct.yaml index 4445d4a..44f0440 100644 --- a/docker-compose.test.ct.yaml +++ b/docker-compose.test.ct.yaml @@ -66,6 +66,8 @@ services: - VAULT_KEYPATH=hms-creds - SMD_WVAULT=true - SMD_RVAULT=true + - SMD_SLS_HOST= + - SMD_HBTD_HOST= hostname: cray-smd depends_on: - cray-smd-init From b9789e4f3b6eb5ee6a67383e2a2f79a56a97b1fb Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 7 Dec 2022 12:15:47 -0600 Subject: [PATCH 42/48] Add xname_off test case for multiple nodes. --- .../2-disruptive/test_xname_off.tavern.yaml | 158 +++++++++++++++++- 1 file changed, 157 insertions(+), 1 deletion(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index 12e6f7a..5d2fab0 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -24,13 +24,19 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 16 +# HMS test metrics test cases: 20 # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node # POST /xname_off On Compute Node # POST /get_xname_status Verify Off Compute Node +#TODO +# POST /xname_on Power On Multiple Compute Nodes +# POST /get_xname_status Verify On Compute Nodes +# POST /xname_off Multiple On Compute Nodes +# POST /get_xname_status Verify Off Compute Nodes + # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node # POST /xname_off Off Compute Node @@ -190,6 +196,156 @@ stages: enum: - "{node_xname}" +#TODO vvv +--- +test_name: capmcAPIxnameOffPOSTmultipleOnComputeNodes - TODO + +stages: + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesTargets - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_1_xname: Components[0].ID + node_2_xname: Components[1].ID + + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTmultipleOnComputeNodesPrep","xnames":["{node_1_xname}","{node_2_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOffPOSTmultipleOnComputeNodesActual","xnames":["{node_1_xname}","{node_2_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + +#TODO ^^^ --- test_name: capmcAPIxnameOffPOSToffComputeNode - TODO From ff7662d5995ebf024f2535cdab29e711b63b0fb8 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 7 Dec 2022 13:14:47 -0600 Subject: [PATCH 43/48] Add xname_[on,reinit] test cases for multiple nodes. --- .../2-disruptive/test_xname_off.tavern.yaml | 3 - .../2-disruptive/test_xname_on.tavern.yaml | 155 ++++++++++++++++- .../test_xname_reinit.tavern.yaml | 156 +++++++++++++++++- 3 files changed, 309 insertions(+), 5 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index 5d2fab0..4d15e82 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -31,7 +31,6 @@ # POST /xname_off On Compute Node # POST /get_xname_status Verify Off Compute Node -#TODO # POST /xname_on Power On Multiple Compute Nodes # POST /get_xname_status Verify On Compute Nodes # POST /xname_off Multiple On Compute Nodes @@ -196,7 +195,6 @@ stages: enum: - "{node_xname}" -#TODO vvv --- test_name: capmcAPIxnameOffPOSTmultipleOnComputeNodes - TODO @@ -345,7 +343,6 @@ stages: - "{node_1_xname}" - "{node_2_xname}" -#TODO ^^^ --- test_name: capmcAPIxnameOffPOSToffComputeNode - TODO diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index 49b7000..dc5540a 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -24,13 +24,18 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 16 +# HMS test metrics test cases: 20 # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node # POST /xname_on Off Compute Node # POST /get_xname_status Verify On Compute Node +# POST /xname_off Power Off Multiple Compute Nodes +# POST /get_xname_status Verify Off Compute Nodes +# POST /xname_on Multiple Off Compute Nodes +# POST /get_xname_status Verify On Compute Nodes + # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node # POST /xname_on On Compute Node @@ -190,6 +195,154 @@ stages: enum: - "{node_xname}" +--- +test_name: capmcAPIxnameOnPOSTmultipleOffComputeNodes - TODO + +stages: + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesTargets - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_1_xname: Components[0].ID + node_2_xname: Components[1].ID + + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSTmultipleOffComputeNodesPrep","xnames":["{node_1_xname}","{node_2_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "off": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameOnPOSTmultipleOffComputeNodesActual","xnames":["{node_1_xname}","{node_2_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + --- test_name: capmcAPIxnameOnPOSTonComputeNode - TODO diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index 15e07b4..a751e46 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -25,13 +25,18 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 8 +# HMS test metrics test cases: 12 # POST /xname_on Power On Compute Node # POST /get_xname_status Verify On Compute Node # POST /xname_reinit On Compute Node # POST /get_xname_status Verify On Compute Node +# POST /xname_on Power On Multiple Compute Nodes +# POST /get_xname_status Verify On Compute Nodes +# POST /xname_reinit Multiple On Compute Nodes +# POST /get_xname_status Verify On Compute Nodes + # POST /xname_off Power Off Compute Node # POST /get_xname_status Verify Off Compute Node # POST /xname_reinit Off Compute Node @@ -181,6 +186,155 @@ stages: unique: True enum: - "{node_xname}" + +--- +test_name: capmcAPIxnameReinitPOSTmultipleOnComputeNodes - TODO + +stages: + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesTargets - TODO + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + node_1_xname: Components[0].ID + node_2_xname: Components[1].ID + + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesPrep - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + # not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTmultipleOnComputeNodesPrep","xnames":["{node_1_xname}","{node_2_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesActual - TODO + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + # not all compute node types support ForceOn (only Intel does), can't use force=true here + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTmultipleOnComputeNodesActual","xnames":["{node_1_xname}","{node_2_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - TODO + # retry here if needed since there can be delays to the state change + max_retries: 30 + delay_after: 10 + request: + url: "{capmc_base_url}/capmc/v1/get_xname_status" + json: {"source":"redfish","xnames":["{node_1_xname}","{node_2_xname}"]} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - 0 + "err_msg": + required: True + type: str + enum: + - "" + "on": + type: seq + matching: all + required: True + sequence: + - type: str + unique: True + enum: + - "{node_1_xname}" + - "{node_2_xname}" + --- test_name: capmcAPIxnameReinitPOSToffComputeNode - TODO From 6843cc0a928ab045c85dd4b50eb9bb046075313c Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 7 Dec 2022 17:30:28 -0600 Subject: [PATCH 44/48] Add test case descriptions. --- .../2-disruptive/test_xname_off.tavern.yaml | 60 +++++++++---------- .../2-disruptive/test_xname_on.tavern.yaml | 60 +++++++++---------- .../test_xname_reinit.tavern.yaml | 38 ++++++------ .../test_xname_off.tavern.yaml | 32 +++++----- .../test_xname_on.tavern.yaml | 32 +++++----- 5 files changed, 112 insertions(+), 110 deletions(-) diff --git a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml index 4d15e82..181b3a5 100644 --- a/test/ct/api/2-disruptive/test_xname_off.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off.tavern.yaml @@ -51,10 +51,10 @@ # POST /xname_off On ComputeModule # POST /get_xname_status Verify Off ComputeModule --- -test_name: capmcAPIxnameOffPOSTonComputeNode - TODO +test_name: capmcAPIxnameOffPOSTonComputeNode - Verify xname_off powers off a compute node that is powered on stages: - - name: capmcAPIxnameOffPOSTonComputeNodeTarget - TODO + - name: capmcAPIxnameOffPOSTonComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -65,7 +65,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameOffPOSTonComputeNodePrep - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrep - Power the target node on to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -92,7 +92,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -130,7 +130,7 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameOffPOSTonComputeNodeActual - TODO + - name: capmcAPIxnameOffPOSTonComputeNodeActual - Power the target node off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -157,7 +157,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonComputeNodeStatusCheck - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -196,10 +196,10 @@ stages: - "{node_xname}" --- -test_name: capmcAPIxnameOffPOSTmultipleOnComputeNodes - TODO +test_name: capmcAPIxnameOffPOSTmultipleOnComputeNodes - Verify xname_off powers off multiple compute nodes that are powered on stages: - - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesTargets - TODO + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesTargets - Retrieve two compute nodes from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -211,7 +211,7 @@ stages: node_1_xname: Components[0].ID node_2_xname: Components[1].ID - - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesPrep - TODO + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesPrep - Power the target nodes on to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -238,7 +238,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - TODO + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - Verify that the target nodes are powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -277,7 +277,7 @@ stages: - "{node_1_xname}" - "{node_2_xname}" - - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesActual - TODO + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesActual - Power the target nodes off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -304,7 +304,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - TODO + - name: capmcAPIxnameOffPOSTmultipleOnComputeNodesStatusCheck - Verify that the target nodes are powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -344,10 +344,10 @@ stages: - "{node_2_xname}" --- -test_name: capmcAPIxnameOffPOSToffComputeNode - TODO +test_name: capmcAPIxnameOffPOSToffComputeNode - Verify xname_off keeps power off for a compute node that is already powered off stages: - - name: capmcAPIxnameOffPOSToffComputeNodeTarget - TODO + - name: capmcAPIxnameOffPOSToffComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -358,7 +358,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameOffPOSToffComputeNodePrep - TODO + - name: capmcAPIxnameOffPOSToffComputeNodePrep - Power the target node off to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -385,7 +385,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -423,7 +423,7 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameOffPOSToffComputeNodeActual - TODO + - name: capmcAPIxnameOffPOSToffComputeNodeActual - Power the target node off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -450,7 +450,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOffPOSToffComputeNodeStatusCheck - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -489,10 +489,10 @@ stages: - "{node_xname}" --- -test_name: capmcAPIxnameOffPOSTonChassis - TODO +test_name: capmcAPIxnameOffPOSTonChassis - Verify xname_off powers off a chassis that is powered on stages: - - name: capmcAPIxnameOffPOSTonChassisTarget - TODO + - name: capmcAPIxnameOffPOSTonChassisTarget - Retrieve a chassis from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Chassis" method: GET @@ -503,7 +503,7 @@ stages: json: chassis_xname: Components[0].ID - - name: capmcAPIxnameOffPOSTonChassisPrep - TODO + - name: capmcAPIxnameOffPOSTonChassisPrep - Power the target chassis on to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" json: {"reason":"CT test case: capmcAPIxnameOffPOSTonChassisPrep","xnames":["{chassis_xname}"],"force":false,"recursive":false} @@ -529,7 +529,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonChassisStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonChassisStatusCheck - Verify that the target chassis is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -567,7 +567,7 @@ stages: enum: - "{chassis_xname}" - - name: capmcAPIxnameOffPOSTonChassisActual - TODO + - name: capmcAPIxnameOffPOSTonChassisActual - Power the target chassis off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" json: {"reason":"CT test case: capmcAPIxnameOffPOSTonChassisActual","xnames":["{chassis_xname}"],"force":true,"recursive":false} @@ -593,7 +593,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonChassisStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonChassisStatusCheck - Verify that the target chassis is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -632,10 +632,10 @@ stages: - "{chassis_xname}" --- -test_name: capmcAPIxnameOffPOSTonComputeModule - TODO +test_name: capmcAPIxnameOffPOSTonComputeModule - Verify xname_off powers off a compute module that is powered on stages: - - name: capmcAPIxnameOffPOSTonComputeModuleTarget - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -646,7 +646,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOffPOSTonComputeModulePrep - TODO + - name: capmcAPIxnameOffPOSTonComputeModulePrep - Power the target compute module on to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModulePrep","xnames":["{compute_module_xname}"],"force":false,"recursive":false} @@ -672,7 +672,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -710,7 +710,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOffPOSTonComputeModuleActual - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleActual - Power the target compute module off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" json: {"reason":"CT test case: capmcAPIxnameOffPOSTonComputeModuleActual","xnames":["{compute_module_xname}"],"force":true,"recursive":false} @@ -736,7 +736,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleStatusCheck - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 diff --git a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml index dc5540a..68269e0 100644 --- a/test/ct/api/2-disruptive/test_xname_on.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on.tavern.yaml @@ -51,10 +51,10 @@ # POST /xname_on Off ComputeModule # POST /get_xname_status Verify On ComputeModule --- -test_name: capmcAPIxnameOnPOSToffComputeNode - TODO +test_name: capmcAPIxnameOnPOSToffComputeNode - Verify xname_on powers on a compute node that is powered off stages: - - name: capmcAPIxnameOnPOSToffComputeNodeTarget - TODO + - name: capmcAPIxnameOnPOSToffComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -65,7 +65,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameOnPOSToffComputeNodePrep - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrep - Power the target node off to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -92,7 +92,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -130,7 +130,7 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameOnPOSToffComputeNodeActual - TODO + - name: capmcAPIxnameOnPOSToffComputeNodeActual - Power the target node on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -157,7 +157,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -196,10 +196,10 @@ stages: - "{node_xname}" --- -test_name: capmcAPIxnameOnPOSTmultipleOffComputeNodes - TODO +test_name: capmcAPIxnameOnPOSTmultipleOffComputeNodes - Verify xname_on powers on multiple compute nodes that are powered off stages: - - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesTargets - TODO + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesTargets - Retrieve two compute nodes from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -211,7 +211,7 @@ stages: node_1_xname: Components[0].ID node_2_xname: Components[1].ID - - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesPrep - TODO + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesPrep - Power the target nodes off to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -238,7 +238,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - TODO + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - Verify that the target nodes are powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -277,7 +277,7 @@ stages: - "{node_1_xname}" - "{node_2_xname}" - - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesActual - TODO + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesActual - Power the target nodes on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -304,7 +304,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - TODO + - name: capmcAPIxnameOnPOSTmultipleOffComputeNodesStatusCheck - Verify that the target nodes are powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -344,10 +344,10 @@ stages: - "{node_2_xname}" --- -test_name: capmcAPIxnameOnPOSTonComputeNode - TODO +test_name: capmcAPIxnameOnPOSTonComputeNode - Verify xname_on keeps power on for a compute node that is already powered on stages: - - name: capmcAPIxnameOnPOSTonComputeNodeTarget - TODO + - name: capmcAPIxnameOnPOSTonComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -358,7 +358,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameOnPOSTonComputeNodePrep - TODO + - name: capmcAPIxnameOnPOSTonComputeNodePrep - Power the target node on to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -385,7 +385,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -423,7 +423,7 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameOnPOSTonComputeNodeActual - TODO + - name: capmcAPIxnameOnPOSTonComputeNodeActual - Power the target node on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -450,7 +450,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameOnPOSTonComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -489,10 +489,10 @@ stages: - "{node_xname}" --- -test_name: capmcAPIxnameOnPOSToffChassis - TODO +test_name: capmcAPIxnameOnPOSToffChassis - Verify xname_on powers on a chassis that is powered off stages: - - name: capmcAPIxnameOnPOSToffChassisTarget - TODO + - name: capmcAPIxnameOnPOSToffChassisTarget - Retrieve a chassis from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Chassis" method: GET @@ -503,7 +503,7 @@ stages: json: chassis_xname: Components[0].ID - - name: capmcAPIxnameOnPOSToffChassisPrep - TODO + - name: capmcAPIxnameOnPOSToffChassisPrep - Power the target chassis off to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" json: {"reason":"CT test case: capmcAPIxnameOnPOSToffChassisPrep","xnames":["{chassis_xname}"],"force":true,"recursive":false} @@ -529,7 +529,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffChassisStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffChassisStatusCheck - Verify that the target chassis is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -567,7 +567,7 @@ stages: enum: - "{chassis_xname}" - - name: capmcAPIxnameOnPOSToffChassisActual - TODO + - name: capmcAPIxnameOnPOSToffChassisActual - Power the target chassis on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" json: {"reason":"CT test case: capmcAPIxnameOnPOSToffChassisActual","xnames":["{chassis_xname}"],"force":false,"recursive":false} @@ -593,7 +593,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffChassisStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffChassisStatusCheck - Verify that the target chassis is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -632,10 +632,10 @@ stages: - "{chassis_xname}" --- -test_name: capmcAPIxnameOnPOSToffComputeModule - TODO +test_name: capmcAPIxnameOnPOSToffComputeModule - Verify xname_on powers on a compute module that is powered off stages: - - name: capmcAPIxnameOnPOSToffComputeModuleTarget - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -646,7 +646,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOnPOSToffComputeModulePrep - TODO + - name: capmcAPIxnameOnPOSToffComputeModulePrep - Power the target compute module off to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModulePrep","xnames":["{compute_module_xname}"],"force":true,"recursive":false} @@ -672,7 +672,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -710,7 +710,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOnPOSToffComputeModuleActual - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleActual - Power the target compute module on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" json: {"reason":"CT test case: capmcAPIxnameOnPOSToffComputeModuleActual","xnames":["{compute_module_xname}"],"force":false,"recursive":false} @@ -736,7 +736,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleStatusCheck - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 diff --git a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml index a751e46..caf9c8e 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit.tavern.yaml @@ -42,10 +42,10 @@ # POST /xname_reinit Off Compute Node # POST /get_xname_status Verify On Compute Node --- -test_name: capmcAPIxnameReinitPOSTonComputeNode - TODO +test_name: capmcAPIxnameReinitPOSTonComputeNode - Verify xname_reinit restarts a compute node that is powered on stages: - - name: capmcAPIxnameReinitPOSTonComputeNodeTarget - TODO + - name: capmcAPIxnameReinitPOSTonComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -56,7 +56,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameReinitPOSTonComputeNodePrep - TODO + - name: capmcAPIxnameReinitPOSTonComputeNodePrep - Power the target node on to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -83,7 +83,7 @@ stages: enum: - "" - - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -121,9 +121,10 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameReinitPOSTonComputeNodeActual - TODO + - name: capmcAPIxnameReinitPOSTonComputeNodeActual - Restart the target node using xname_reinit request: url: "{capmc_base_url}/capmc/v1/xname_reinit" + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameReinitPOSTonComputeNodeActual","xnames":["{node_xname}"],"force":false} method: POST verify: !bool "{verify}" @@ -149,7 +150,7 @@ stages: # not checking that the node powers "Off" before powering back "On" again, could only get that to work on Intel compute node w/ force=true - - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - TODO + - name: capmcAPIxnameReinitPOSTonComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -188,10 +189,10 @@ stages: - "{node_xname}" --- -test_name: capmcAPIxnameReinitPOSTmultipleOnComputeNodes - TODO +test_name: capmcAPIxnameReinitPOSTmultipleOnComputeNodes - Verify xname_reinit restarts multiple compute nodes that are powered on stages: - - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesTargets - TODO + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesTargets - Retrieve two compute nodes from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -203,7 +204,7 @@ stages: node_1_xname: Components[0].ID node_2_xname: Components[1].ID - - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesPrep - TODO + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesPrep - Power the target nodes on to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -230,7 +231,7 @@ stages: enum: - "" - - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - TODO + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - Verify that the target nodes are powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -269,7 +270,7 @@ stages: - "{node_1_xname}" - "{node_2_xname}" - - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesActual - TODO + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesActual - Restart the target nodes using xname_reinit request: url: "{capmc_base_url}/capmc/v1/xname_reinit" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -296,7 +297,7 @@ stages: enum: - "" - - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - TODO + - name: capmcAPIxnameReinitPOSTmultipleOnComputeNodesStatusCheck - Verify that the target nodes are powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -336,10 +337,10 @@ stages: - "{node_2_xname}" --- -test_name: capmcAPIxnameReinitPOSToffComputeNode - TODO +test_name: capmcAPIxnameReinitPOSToffComputeNode - Verify xname_reinit restarts a compute node that is powered off stages: - - name: capmcAPIxnameReinitPOSToffComputeNodeTarget - TODO + - name: capmcAPIxnameReinitPOSToffComputeNodeTarget - Retrieve a compute node from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET @@ -350,7 +351,7 @@ stages: json: node_xname: Components[0].ID - - name: capmcAPIxnameReinitPOSToffComputeNodePrep - TODO + - name: capmcAPIxnameReinitPOSToffComputeNodePrep - Power the target node off to prepare it for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -377,7 +378,7 @@ stages: enum: - "" - - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -415,9 +416,10 @@ stages: enum: - "{node_xname}" - - name: capmcAPIxnameReinitPOSToffComputeNodeActual - TODO + - name: capmcAPIxnameReinitPOSToffComputeNodeActual - Restart the target node using xname_reinit request: url: "{capmc_base_url}/capmc/v1/xname_reinit" + # not all compute node types support ForceOn (only Intel does), can't use force=true here json: {"reason":"CT test case: capmcAPIxnameReinitPOSToffComputeNodeActual","xnames":["{node_xname}"],"force":false} method: POST verify: !bool "{verify}" @@ -441,7 +443,7 @@ stages: enum: - "" - - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - TODO + - name: capmcAPIxnameReinitPOSToffComputeNodeStatusCheck - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 diff --git a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml index 2cd3eca..6da360f 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_off.tavern.yaml @@ -40,10 +40,10 @@ # POST /get_xname_status Verify Off Compute Node # POST /get_xname_status Verify Off ComputeModule --- -test_name: capmcAPIxnameOffPOSTonComputeModuleRecursive - TODO +test_name: capmcAPIxnameOffPOSTonComputeModuleRecursive - Verify xname_off with the recursive option powers off a compute module and its children that are powered on stages: - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -54,7 +54,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursivePrep - Power the target compute module and its children on to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -81,7 +81,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -119,7 +119,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -158,7 +158,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveActual - Power the target compute module and its children off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -185,7 +185,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckComputeModule - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -223,7 +223,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - TODO + - name: capmcAPIxnameOffPOSTonComputeModuleRecursiveStatusCheckNode - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -263,10 +263,10 @@ stages: - "{compute_module_xname}b0n0" --- -test_name: capmcAPIxnameOffPOSTonComputeNodePrereq - TODO +test_name: capmcAPIxnameOffPOSTonComputeNodePrereq - Verify xname_off with the prereq option powers off a compute node and its parents that are powered on stages: - - name: capmcAPIxnameOffPOSTonComputeNodePrereqTarget - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -277,7 +277,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOffPOSTonComputeNodePrereqPrep - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqPrep - Power the target compute node and its parents on to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -305,7 +305,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -344,7 +344,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -382,7 +382,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOffPOSTonComputeNodePrereqActual - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqActual - Power the target node and its parents off using xname_off request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -410,7 +410,7 @@ stages: enum: - "" - - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckNode - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -449,7 +449,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - TODO + - name: capmcAPIxnameOffPOSTonComputeNodePrereqStatusCheckComputeModule - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 diff --git a/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml index f2a6135..d5c0a5e 100644 --- a/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml +++ b/test/ct/api/4-build-pipeline-only/test_xname_on.tavern.yaml @@ -40,10 +40,10 @@ # POST /get_xname_status Verify On Compute Node # POST /get_xname_status Verify On ComputeModule --- -test_name: capmcAPIxnameOnPOSToffComputeModuleRecursive - TODO +test_name: capmcAPIxnameOnPOSToffComputeModuleRecursive - Verify xname_on with the recursive option powers on a compute module and its children that are powered off stages: - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveTarget - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -54,7 +54,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursivePrep - Power the target compute module and its children off to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -81,7 +81,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -119,7 +119,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -158,7 +158,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveActual - Power the target compute module and its children on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -185,7 +185,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckComputeModule - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -223,7 +223,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - TODO + - name: capmcAPIxnameOnPOSToffComputeModuleRecursiveStatusCheckNode - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -263,10 +263,10 @@ stages: - "{compute_module_xname}b0n0" --- -test_name: capmcAPIxnameOnPOSToffComputeNodePrereq - TODO +test_name: capmcAPIxnameOnPOSToffComputeNodePrereq - Verify xname_on with the prereq option powers on a compute node and its parents that are powered off stages: - - name: capmcAPIxnameOnPOSToffComputeNodePrereqTarget - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqTarget - Retrieve a compute module from HSM to be used in later stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=ComputeModule" method: GET @@ -277,7 +277,7 @@ stages: json: compute_module_xname: Components[0].ID - - name: capmcAPIxnameOnPOSToffComputeNodePrereqPrep - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqPrep - Power the target compute node and its parents off to prepare them for the test case request: url: "{capmc_base_url}/capmc/v1/xname_off" # all compute node types support ForceOff (Cray, Intel, Gigabyte, HPE), can use force=true here @@ -305,7 +305,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - Verify that the target node is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -344,7 +344,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - Verify that the target compute module is powered off using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -382,7 +382,7 @@ stages: enum: - "{compute_module_xname}" - - name: capmcAPIxnameOnPOSToffComputeNodePrereqActual - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqActual - Power the target node and its parents on using xname_on request: url: "{capmc_base_url}/capmc/v1/xname_on" # not all compute node types support ForceOn (only Intel does), can't use force=true here @@ -410,7 +410,7 @@ stages: enum: - "" - - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckNode - Verify that the target node is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 @@ -449,7 +449,7 @@ stages: enum: - "{compute_module_xname}b0n0" - - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - TODO + - name: capmcAPIxnameOnPOSToffComputeNodePrereqStatusCheckComputeModule - Verify that the target compute module is powered on using get_xname_status # retry here if needed since there can be delays to the state change max_retries: 30 delay_after: 10 From 2d2d848b33ecde9fe6cba9ee8ffae167b2e421d5 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Wed, 7 Dec 2022 17:37:52 -0600 Subject: [PATCH 45/48] Bump version. --- .version | 2 +- CHANGELOG.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 437459c..e70b452 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.5.0 +2.6.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 87c6bd4..7a06f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,15 @@ Fixed - for any bug fixes Security - in case of vulnerabilities --> +## [2.6.0] - 2022-12-07 + +### Changed + +CASMHMS-5468 - Refactored CAPMC CT tests for HMTH, including: +- Update CAPMC CT tests to use latest hms-test:4.0.0 image +- Break out CAPMC CT tests into non-disruptive, disruptive, destructive, and build-pipeline-only test buckets +- Add many new API tests that execute in the runCT environment in the build pipeline + ## [2.5.0] - 2022-07-26 ### Changed From b8057868f19762af56210c4dcbb2a1655488d43d Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Thu, 8 Dec 2022 16:42:38 -0600 Subject: [PATCH 46/48] Harden get_xname_status test to handle hardware in bad states. --- .../test_get_xname_status.tavern.yaml | 103 +++++++++++++++--- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml index 190ba7f..8fdf67d 100644 --- a/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_get_xname_status.tavern.yaml @@ -38,8 +38,8 @@ # /get_xname_status all nodes in the 'halt' state # /get_xname_status all nodes in the 'standby' state # /get_xname_status all nodes in the 'ready' state -# /get_xname_status all nodes in the 'diag' state of which there should be none -# /get_xname_status all nodes in the 'disabled' state of which there should be none +# /get_xname_status all nodes in the 'diag' state +# /get_xname_status all nodes in the 'disabled' state # /get_xname_status all nodes in the 'on' or 'off' states --- test_name: capmcAPIGetXnameStatus via Redfish @@ -80,13 +80,11 @@ stages: "e": type: int required: True - enum: - - 0 + # don't want test to fail on this "e" code if Redfish/hardware is in a bad state "err_msg": required: True type: str - enum: - - "" + # don't want test to fail on this "err_msg" code if Redfish/hardware is in a bad state "on": type: seq matching: all @@ -144,6 +142,7 @@ stages: schema: type: map required: True + allowempty: True mapping: "e": type: int @@ -211,9 +210,17 @@ stages: sequence: - type: str unique: True + "populated": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True "flags": type: map required: False + allowempty: True mapping: key: type: seq @@ -259,6 +266,7 @@ stages: schema: type: map required: True + allowempty: True mapping: "e": type: int @@ -275,53 +283,82 @@ stages: matching: all required: False sequence: - - type: int + - type: str unique: True "off": type: seq matching: all required: False sequence: - - type: int + - type: str + unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str unique: True "halt": type: seq matching: all required: False sequence: - - type: int + - type: str unique: True "standby": type: seq matching: all required: False sequence: - - type: int + - type: str unique: True "ready": type: seq matching: all required: False sequence: - - type: int + - type: str unique: True "disabled": type: seq matching: all required: False sequence: - - type: int + - type: str + unique: True + "empty": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True + "populated": + type: seq + matching: all + required: False + sequence: + - type: str unique: True "flags": type: map required: False + allowempty: True mapping: key: type: seq matching: all required: False sequence: - - type: int + - type: str + unique: True + warning: + type: seq + matching: all + required: False + sequence: + - type: str unique: True function: tavern.testutils.helpers:validate_content extra_kwargs: @@ -366,6 +403,7 @@ stages: schema: type: map required: True + allowempty: True mapping: "e": type: int @@ -391,6 +429,13 @@ stages: sequence: - type: str unique: True + "undefined": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True "halt": type: seq matching: all @@ -426,9 +471,17 @@ stages: sequence: - type: str unique: True + "populated": + type: seq + matching: all + required: False + sequence: + - type: str + unique: True "flags": type: map required: False + allowempty: True mapping: key: type: seq @@ -669,7 +722,7 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_diag' filter stages: - - name: Get all nodes in the 'diag' state of which there should be none + - name: Get all nodes in the 'diag' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" json: {"filter": "show_diag", "source": "hsm"} @@ -682,8 +735,26 @@ stages: extra_kwargs: comparisons: - jmespath: "length(keys(@))" + operator: "lt" + expected: 4 + - jmespath: "length(keys(@))" + operator: "gt" + expected: 1 + - jmespath: "contains(keys(@), 'on')" operator: "eq" - expected: 2 + expected: False + - jmespath: "contains(keys(@), 'off')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'halt')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'standby')" + operator: "eq" + expected: False + - jmespath: "contains(keys(@), 'ready')" + operator: "eq" + expected: False - jmespath: "contains(keys(@), 'e')" operator: "eq" expected: True @@ -695,7 +766,7 @@ stages: test_name: capmcAPIGetXnameStatus with 'show_disabled' filter stages: - - name: Get all nodes in the 'disabled' state of which there should be none + - name: Get all nodes in the 'disabled' state request: url: "{capmc_base_url}/capmc/v1/get_xname_status" json: {"filter": "show_disabled", "source": "hsm"} From c7076492bf7185d7d760f9e2d1a751f593655fd0 Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 9 Dec 2022 11:32:25 -0600 Subject: [PATCH 47/48] Add missing MIT license header. --- runTavernTestsWithSimulator.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/runTavernTestsWithSimulator.sh b/runTavernTestsWithSimulator.sh index a289a4f..07e7196 100755 --- a/runTavernTestsWithSimulator.sh +++ b/runTavernTestsWithSimulator.sh @@ -1,4 +1,27 @@ #!/bin/bash -make ct_image + +# MIT License +# +# (C) Copyright [2022] Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + VERSION=$(cat .version) +make ct_image docker run --rm -it --network hms-simulation-environment_simulation cray-capmc-hmth-test:${VERSION} tavern -c /src/app/tavern_global_config_ct_test.yaml -p /src/app/api #/2-disruptive From ecd7d51634517d67a39ae0afacf2098f86e58c2f Mon Sep 17 00:00:00 2001 From: Mitchell Schooler Date: Fri, 9 Dec 2022 12:02:26 -0600 Subject: [PATCH 48/48] Move some negative tests to disruptive directory for future-proofing. --- .../test_xname_off_negative.tavern.yaml | 132 +----------------- .../test_xname_on_negative.tavern.yaml | 132 +----------------- .../test_xname_reinit_negative.tavern.yaml | 132 +----------------- .../test_xname_off_negative.tavern.yaml | 132 +++++++++++++++++- .../test_xname_on_negative.tavern.yaml | 132 +++++++++++++++++- .../test_xname_reinit_negative.tavern.yaml | 132 +++++++++++++++++- 6 files changed, 396 insertions(+), 396 deletions(-) diff --git a/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml index 0d176a3..9ccb200 100644 --- a/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_off_negative.tavern.yaml @@ -25,12 +25,10 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 11 +# HMS test metrics test cases: 9 # POST /xname_off fails with missing xnames # POST /xname_off fails with empty xname # POST /xname_off fails with garbage xname -# POST /xname_off fails with NodeBMC xname -# POST /xname_off fails with NodeEnclosure xname # POST /xname_off fails with recursive and prereq options # GET /xname_off fails # DELETE /xname_off fails @@ -173,134 +171,6 @@ stages: enum: - "invalid/duplicate xname" ---- -test_name: capmcAPIxnameOffPOSTnodeBMCxname - -stages: - - name: capmcAPIxnameOffPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - bmc_xname: Components[0].ID - - - name: capmcAPIxnameOffPOSTnodeBMCxnameActual - Verify xname_off fails with NodeBMC xname - request: - url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for Off" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{bmc_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Off'" - ---- -test_name: capmcAPIxnameOffPOSTnodeEnclosureXname - -stages: - - name: capmcAPIxnameOffPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - enclosure_xname: Components[0].ID - - - name: capmcAPIxnameOffPOSTnodeEnclosureXnameActual - Verify xname_off fails with NodeEnclosure xname - request: - url: "{capmc_base_url}/capmc/v1/xname_off" - json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for ForceOff" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{enclosure_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOff'" - --- test_name: capmcAPIxnameOffPOSTnodeXnameRecursiveAndPrereq diff --git a/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml index 0f66c3a..f4a4c9e 100644 --- a/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_on_negative.tavern.yaml @@ -25,12 +25,10 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 11 +# HMS test metrics test cases: 9 # POST /xname_on fails with missing xnames # POST /xname_on fails with empty xname # POST /xname_on fails with garbage xname -# POST /xname_on fails with NodeBMC xname -# POST /xname_on fails with NodeEnclosure xname # POST /xname_on fails with recursive and prereq options # GET /xname_on fails # DELETE /xname_on fails @@ -173,134 +171,6 @@ stages: enum: - "invalid/duplicate xname" ---- -test_name: capmcAPIxnameOnPOSTnodeBMCxname - -stages: - - name: capmcAPIxnameOnPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - bmc_xname: Components[0].ID - - - name: capmcAPIxnameOnPOSTnodeBMCxnameActual - Verify xname_on fails with NodeBMC xname - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for On" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{bmc_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'On'" - ---- -test_name: capmcAPIxnameOnPOSTnodeEnclosureXname - -stages: - - name: capmcAPIxnameOnPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - enclosure_xname: Components[0].ID - - - name: capmcAPIxnameOnPOSTnodeEnclosureXnameActual - Verify xname_on fails with NodeEnclosure xname - request: - url: "{capmc_base_url}/capmc/v1/xname_on" - json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for ForceOn" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{enclosure_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOn'" - --- test_name: capmcAPIxnameOnPOSTnodeXnameRecursiveAndPrereq diff --git a/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml index ad101f5..d48c22a 100644 --- a/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml +++ b/test/ct/api/1-non-disruptive/test_xname_reinit_negative.tavern.yaml @@ -25,12 +25,10 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 11 +# HMS test metrics test cases: 9 # POST /xname_reinit fails with missing xnames # POST /xname_reinit fails with empty xname # POST /xname_reinit fails with garbage xname -# POST /xname_reinit fails with NodeBMC xname -# POST /xname_reinit fails with NodeEnclosure xname # POST /xname_reinit fails with recursive and prereq options # GET /xname_reinit fails # DELETE /xname_reinit fails @@ -173,134 +171,6 @@ stages: enum: - "invalid/duplicate xname" ---- -test_name: capmcAPIxnameReinitPOSTnodeBMCxname - -stages: - - name: capmcAPIxnameReinitPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - bmc_xname: Components[0].ID - - - name: capmcAPIxnameReinitPOSTnodeBMCxnameActual - Verify xname_reinit fails with NodeBMC xname - request: - url: "{capmc_base_url}/capmc/v1/xname_reinit" - json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for Restart" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{bmc_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Restart'" - ---- -test_name: capmcAPIxnameReinitPOSTnodeEnclosureXname - -stages: - - name: capmcAPIxnameReinitPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage - request: - url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - json: - enclosure_xname: Components[0].ID - - - name: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual - Verify xname_reinit fails with NodeEnclosure xname - request: - url: "{capmc_base_url}/capmc/v1/xname_reinit" - json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} - method: POST - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - "e": - type: int - required: True - enum: - - -1 - "err_msg": - required: True - type: str - enum: - - "Errors encountered with 1 components for ForceRestart" - "xnames": - type: seq - matching: all - required: True - sequence: - - type: map - required: True - mapping: - "xname": - type: str - required: True - enum: - - "{enclosure_xname}" - "e": - type: int - required: True - enum: - - -1 - "err_msg": - type: str - required: True - enum: - - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceRestart'" - --- test_name: capmcAPIxnameReinitPOSTnodeXnameRecursiveAndPrereq diff --git a/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml index 9ccb35c..3e9f44f 100644 --- a/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_off_negative.tavern.yaml @@ -25,8 +25,138 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 1 +# HMS test metrics test cases: 3 +# POST /xname_off fails with NodeBMC xname +# POST /xname_off fails with NodeEnclosure xname # POST /xname_off fails for Node that is already locked +--- +test_name: capmcAPIxnameOffPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameOffPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTnodeBMCxnameActual - Verify xname_off fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for Off" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Off'" + +--- +test_name: capmcAPIxnameOffPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameOffPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameOffPOSTnodeEnclosureXnameActual - Verify xname_off fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_off" + json: {"reason":"CT test case: capmcAPIxnameOffPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceOff" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOff'" + --- test_name: capmcAPIxnameOffPOSTlockedNode diff --git a/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml index ddf98df..51110e2 100644 --- a/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_on_negative.tavern.yaml @@ -25,8 +25,138 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 1 +# HMS test metrics test cases: 3 +# POST /xname_on fails with NodeBMC xname +# POST /xname_on fails with NodeEnclosure xname # POST /xname_on fails for Node that is already locked +--- +test_name: capmcAPIxnameOnPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameOnPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTnodeBMCxnameActual - Verify xname_on fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for On" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'On'" + +--- +test_name: capmcAPIxnameOnPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameOnPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameOnPOSTnodeEnclosureXnameActual - Verify xname_on fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_on" + json: {"reason":"CT test case: capmcAPIxnameOnPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceOn" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceOn'" + --- test_name: capmcAPIxnameOnPOSTlockedNode diff --git a/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml b/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml index 9b294e7..f360b31 100644 --- a/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml +++ b/test/ct/api/2-disruptive/test_xname_reinit_negative.tavern.yaml @@ -25,8 +25,138 @@ # Author: Mitch Schooler # Service: Cray Advanced Platform Monitoring and Control -# HMS test metrics test cases: 1 +# HMS test metrics test cases: 3 +# POST /xname_reinit fails with NodeBMC xname +# POST /xname_reinit fails with NodeEnclosure xname # POST /xname_reinit fails for Node that is already locked +--- +test_name: capmcAPIxnameReinitPOSTnodeBMCxname + +stages: + - name: capmcAPIxnameReinitPOSTnodeBMCxnamePrep - Get NodeBMC xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + bmc_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTnodeBMCxnameActual - Verify xname_reinit fails with NodeBMC xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeBMCxnameActual","xnames":["{bmc_xname}"],"force":false} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for Restart" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{bmc_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {bmc_xname}: Type, 'NodeBMC', not defined in power sequence for 'Restart'" + +--- +test_name: capmcAPIxnameReinitPOSTnodeEnclosureXname + +stages: + - name: capmcAPIxnameReinitPOSTnodeEnclosureXnamePrep - Get NodeEnclosure xname from HSM Components to use in upcoming stage + request: + url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + enclosure_xname: Components[0].ID + + - name: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual - Verify xname_reinit fails with NodeEnclosure xname + request: + url: "{capmc_base_url}/capmc/v1/xname_reinit" + json: {"reason":"CT test case: capmcAPIxnameReinitPOSTnodeEnclosureXnameActual","xnames":["{enclosure_xname}"],"force":true} + method: POST + verify: !bool "{verify}" + response: + status_code: 200 + verify_response_with: + function: tavern.testutils.helpers:validate_pykwalify + extra_kwargs: + schema: + type: map + required: True + mapping: + "e": + type: int + required: True + enum: + - -1 + "err_msg": + required: True + type: str + enum: + - "Errors encountered with 1 components for ForceRestart" + "xnames": + type: seq + matching: all + required: True + sequence: + - type: map + required: True + mapping: + "xname": + type: str + required: True + enum: + - "{enclosure_xname}" + "e": + type: int + required: True + enum: + - -1 + "err_msg": + type: str + required: True + enum: + - "Skipping {enclosure_xname}: Type, 'NodeEnclosure', not defined in power sequence for 'ForceRestart'" + --- test_name: capmcAPIxnameReinitPOSTlockedNode