diff --git a/Makefile b/Makefile index d4c1842d..213bda30 100644 --- a/Makefile +++ b/Makefile @@ -51,14 +51,8 @@ image: unittest: go test -cover -v -tags musl ./... -snyk: - ./runSnyk.sh - -ct: - ./runCT.sh - -ct_image: - docker build --no-cache -f test/ct/Dockerfile test/ct/ --tag smd-test:$(VERSION}) +ct-image: + docker build --no-cache -f test/Dockerfile test/ --tag smd-test:$(VERSION) binaries: smd smd-init smd-loader native diff --git a/README.md b/README.md index f49d3943..4eb5a93d 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,76 @@ goreleaser release --snapshot --clean Built binaries will be located in the `dist/` directory. ## Testing -SMD includes continuous test (CT) verification for live HPC systems. The test image is invoked via `helm test`. -In addition to the service itself, this repository builds and publishes cray-smd-test images containing tests that verify HSM on live Shasta systems. The tests are invoked via helm test as part of the Continuous Test (CT) framework during CSM installs and upgrades. The version of the cray-smd-test image (vX.Y.Z) should match the version of the cray-smd image being tested, both of which are specified in the helm chart for the service. +### Running the CT Tests in a Docker Compose Environment + +1. Start services using the quick start guide + + Use the quick start guide to start the services. See [README](https://github.com/OpenCHAMI/deployment-recipes/tree/main/quickstart) + + Edit `openchami-svcs.yml` and add `ENABLE_DISCOVERY=true` to the SMD container's environment variable list. + + Create a docker compose file to start the Redfish Emulator. For an example see [computes.yml](test/docker-compose/computes.yml) + + Start the docker compose containers. Use the directions in the quick start, but also add `-d computes.yml` to start the simulator containers. + + For example: + ``` + docker compose -f base.yml -f postgres.yml -f jwt-security.yml -f haproxy-api-gateway.yml -f openchami-svcs.yml -f autocert.yml -f coredhcp.yml -f configurator.yml -f computes.yml up -d + ``` + +2. Build the SMD test image + + ``` + make ct-image + ``` + +3. Set environment variables + + ``` + export COMPOSE_NAME=quickstart + export SMD_VERSION=v2.18.0 + ``` + Note: `SMD_VERSION` is the version of the test image. The version of the running SMD container is in `openchami-svcs.yml` + +4. Add nodes to SMD + + This discovers hardware using the redfish interfaces simulated by the Redfish Interface Emulator ([RIE](https://github.com/OpenCHAMI/csm-redfish-interface-emulator)). + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal smd-test:${SMD_VERSION} smd-test smd-discover -n x0c0s1b0 -n x0c0s2b0 -n x0c0s3b0 -n x0c0s4b0 + ``` + +5. Run non-destructive tests + + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal smd-test:${SMD_VERSION} smd-test test -t smoke -t 1-hardware-checks -t 2-non-disruptive -t 3-disruptive + ``` + +6. Run destructive tests (Optional) + + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal smd-test:${SMD_VERSION} smd-test test -t 4-destructive-initial -t 5-destructive-final + ``` + + These tests will destore some of SMD's data, which will not be easily recovered. + +### Miscellaneous Test Options +#### List the available tests + + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal smd-test:${SMD_VERSION} smd-test list + ``` + +#### Run the tests with tavern files from a local directory + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal -v $(pwd)/test/ct:/tests/ct smd-test:${SMD_VERSION} smd-test test -t smoke -t 1-hardware-checks -t 2-non-disruptive -t 3-disruptive + ``` + Note: This example can be run from the root directory of a clone of the SMD git repository. + +#### Run the tavern tests directly with pytest + ``` + docker run -it --rm --network ${COMPOSE_NAME}_internal smd-test:${SMD_VERSION} pytest -vvvv /tests/api/1-hardware-checks --rootdir=/ --tavern-global-cfg /opt/smd-test/libs/tavern_global_config_ct_test.yaml + ``` ## Running diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 00000000..c288cfb8 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright © 2025 OpenCHAMI a Series of LF Projects, LLC +# +# SPDX-License-Identifier: MIT + +FROM docker.io/library/alpine:3.15 + +STOPSIGNAL SIGTERM + +# Install the necessary packages +RUN set -ex \ + && apk -U upgrade \ + && apk add --no-cache \ + python3 \ + python3-dev \ + py3-pip \ + bash \ + curl \ + tar \ + gcc \ + musl-dev \ + && pip3 install --upgrade \ + pip \ + pytest==7.1.2 \ + tavern==1.23.1 \ + allure-pytest==2.12.0 \ + && apk del \ + python3-dev \ + tar \ + gcc \ + musl-dev + +RUN mkdir -p /opt/smd-test && \ + mkdir -p /var/logs/smd-test && \ + mkdir -p /tests && \ + mkdir -p /.pytest_cache && \ + chown -R 65534:65534 /.pytest_cache && \ + chmod 755 /.pytest_cache && \ + chown -R 65534:65534 /opt/smd-test && \ + chown -R 65534:65534 /tests && \ + chown -R 65534:65534 /var/logs/smd-test && \ + chmod 755 /var/logs/smd-test +COPY bin /opt/smd-test/bin +COPY libs /opt/smd-test/libs +COPY ct /tests/ct +COPY smoke_pytest /opt/smd-test/smoke_pytest + + + +# Run as nobody +USER 65534:65534 +ENV PATH="$PATH:/opt/smd-test/bin" + +WORKDIR / +CMD [ "/opt/smd-test/bin/smd-test" ] diff --git a/test/bin/smd-test b/test/bin/smd-test new file mode 100755 index 00000000..0fb03151 --- /dev/null +++ b/test/bin/smd-test @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright © 2025 OpenCHAMI a Series of LF Projects, LLC +# +# SPDX-License-Identifier: MIT + +import argparse +import logging +import signal +import subprocess +import sys +import requests +import json +import pytest +import traceback +import os +from glob import glob + + +OPAAL_URL= "http://opaal:3333" +SMD_URL = "http://smd:27779" +TEST_DIR = "/tests" + + +def get_access_token(opaal_url): + url = f"{opaal_url}/token" + r = requests.get(url=url, verify=False, timeout=30) + if r.status_code != 200: + raise Exception(f"request to {url} failed with {r.status_code}") + body = json.loads(r.text) + return body.get("access_token") + + +def discover_node(smd_url, token, node_hostname): + url = f"{smd_url}/hsm/v2/Inventory/RedfishEndpoints" + req_headers = { + 'Authorization': f'Bearer {token}', + 'cache-control': 'no-cache', + 'Content-Type': 'application/json', + } + + req_body = { + "RedfishEndpoints": [ + { + "ID": node_hostname, + "FQDN": node_hostname, + "RediscoverOnUpdate":True, + "User": "root", + "Password": "root_password", + } + ] + } + req_body_str = json.dumps(req_body) + + resp = requests.post(url, headers=req_headers, data=req_body_str, verify=False) + + print() + print(f"node: {node_hostname}") + print(f"code: {resp.status_code}") + print(f"body: {resp.text}") + + +def list_tests(test_dir): + tests = [] + if os.path.exists(f'{test_dir}/ct/smoke/smoke.json'): + tests.append("smoke") + + api_test_dir = f"{test_dir}/ct/api" + for item in os.listdir(api_test_dir): + item_path = os.path.join(api_test_dir, item) + if os.path.isdir(item_path): + tests.append(item) + + for test in tests: + print(test) + + + +def smoke_test(test_dir): + result = pytest.main(["-vvvv", "/opt/smd-test/smoke_pytest", "--smoke-json", f"{test_dir}/ct/smoke/smoke.json"]) + if result != 0: + sys.exit(result) + + +def tavern_test(test_dir, test_name): + if test_name == "smoke": + smoke_test(test_dir) + return + test_path = os.path.join(test_dir, "ct", "api", test_name) + config_file = "/opt/smd-test/libs/tavern_global_config_ct_test.yaml" + result = pytest.main(["-vvvv", str(test_path), "--rootdir=/", "--tavern-global-cfg", config_file]) + if result != 0: + sys.exit(result) + + +def main(argv): + command_choices = [ + "help", + "smd-discover", + "list", + "test", + "smoke", + ] + parser = argparse.ArgumentParser() + parser.add_argument("command", type=str, help="command", choices=command_choices) + parser.add_argument("-n", "--node", type=str, action="append", help="Node Hostname or IP. Used in the smd-discover command.") + parser.add_argument("-t", "--test", type=str, action="append", help="Test name. Used in the smd-discover command.") + + if len(sys.argv) == 1: + parser.print_help(sys.stderr) + sys.exit(1) + + args = parser.parse_args() + + try: + if args.command == "help": + parser.print_help() + elif args.command == "smd-discover": + token = get_access_token(OPAAL_URL) + for node in args.node: + discover_node(SMD_URL, token, node) + elif args.command == "list": + list_tests(TEST_DIR) + elif args.command == "smoke": + smoke_test(TEST_DIR) + elif args.command == "test": + for test in args.test: + tavern_test(TEST_DIR, test) + except Exception as e: + print(e) + print(traceback.format_exc()) + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/test/ct/api/2-non-disruptive/test_component_endpoints.tavern.yaml b/test/ct/api/2-non-disruptive/test_component_endpoints.tavern.yaml index 2bf0910d..a2d4e77b 100644 --- a/test/ct/api/2-non-disruptive/test_component_endpoints.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_component_endpoints.tavern.yaml @@ -46,6 +46,16 @@ test_name: Query the ComponentEndpoints collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints API response code # GET /ComponentEndpoints API response body - name: Ensure that we can conduct a query on the ComponentEndpoints collection @@ -53,6 +63,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -394,6 +406,16 @@ Accelerator[0-9]+" test_name: Query the ComponentEndpoints collection and get Node Information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints?type=Node API response code # GET /ComponentEndpoints?type=Node API response body - name: Ensure that we can conduct a query on the ComponentEndpoints collection for a particular node @@ -401,6 +423,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -445,6 +469,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -472,6 +498,16 @@ stages: test_name: Query the ComponentEndpoints collection and get NodeBMC Information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints?type=NodeBMC API response code # GET /ComponentEndpoints?type=NodeBMC API response body - name: Ensure that we can conduct a query on the ComponentEndpoints collection for a particular BMC @@ -479,6 +515,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -523,6 +561,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -550,6 +590,16 @@ stages: test_name: Query the ComponentEndpoints collection and get Node Enclosure Information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints?type=NodeEnclosure API response code # GET /ComponentEndpoints?type=NodeEnclosure API response body - name: Ensure that we can conduct a query on the ComponentEndpoints collection for a particular node enclosure @@ -557,6 +607,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints?type=NodeEnclosure" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -601,6 +653,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -628,12 +682,24 @@ stages: test_name: Attempt to query the ComponentEndpoints collection with a valid but nonexistent xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints/{nodeBMC} valid nonexistent API response code - name: Verify failure when providing a valid but nonexistent BMC xname in the ComponentEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/x9999c7s9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -641,12 +707,24 @@ stages: test_name: Attempt to query the ComponentEndpoints collection with an invalid xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints/{nodeBMC} invalid API response code - name: Verify failure when providing an invalid BMC xname in the ComponentEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/x9999999c7s9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 @@ -654,11 +732,23 @@ stages: test_name: Attempt to query the ComponentEndpoints collection with a nid instead of an xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ComponentEndpoints/{nid} unsupported id API response code - name: Verify failure when providing a nid name instead of a valid BMC xname in the ComponentEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 diff --git a/test/ct/api/2-non-disruptive/test_components.tavern.yaml b/test/ct/api/2-non-disruptive/test_components.tavern.yaml index 0c2b8042..e017c9fc 100644 --- a/test/ct/api/2-non-disruptive/test_components.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_components.tavern.yaml @@ -276,6 +276,16 @@ stages: test_name: Verify that we can query for NodeBMCs in the Components collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /Components?type=NodeBMC API response code # GET /Components?type=NodeBMC API response body - name: Retrieve a NodeBMC from the Components collection to use in upcoming stages @@ -283,6 +293,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -298,6 +310,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -355,6 +369,16 @@ strict: - json:off stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /Components?type=Node API response code # GET /Components?type=Node API response code - name: Verify that we can query for compute Nodes in the Components collection @@ -364,6 +388,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -388,6 +414,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/{node_xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -409,6 +437,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/{NID}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -469,6 +499,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/{node_xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -531,6 +563,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -602,6 +636,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute&Flag={Flag}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -675,6 +711,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute&Arch=X86" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -746,6 +784,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&nid={NID}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -822,6 +862,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Compute" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -891,6 +933,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Booster" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 json: @@ -906,6 +950,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Ready" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -921,6 +967,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?stateonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -955,6 +1003,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?flagonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -986,6 +1036,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?roleonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1020,6 +1072,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?nidonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1048,6 +1102,16 @@ stages: test_name: Verify the Component Query API with Node xnames stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /Components?type=Node API response code # GET /Components?type=Node API response body - name: Retrieve a Node from the Components collection to use in upcoming stages @@ -1055,6 +1119,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -1070,6 +1136,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1139,6 +1207,16 @@ stages: test_name: Verify that we can call the Component Query API with NodeBMC xnames stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /Components?type=NodeBMC API response code # GET /Components?type=NodeBMC API response body - name: Retrieve a NodeBMC from the Components collection to use in upcoming stages @@ -1146,6 +1224,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -1161,6 +1241,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/2-non-disruptive/test_discovery_status.tavern.yaml b/test/ct/api/2-non-disruptive/test_discovery_status.tavern.yaml index 87336a93..1c602675 100644 --- a/test/ct/api/2-non-disruptive/test_discovery_status.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_discovery_status.tavern.yaml @@ -33,12 +33,24 @@ test_name: Ensure that we can gather the system discovery status information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /DiscoveryStatus all - name: Ensure that we can conduct a discovery status query request: url: "{hsm_base_url}/hsm/v2/Inventory/DiscoveryStatus" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -79,6 +91,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/DiscoveryStatus/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -114,6 +128,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/DiscoveryStatus/999999999" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -145,6 +161,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/DiscoveryStatus/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: diff --git a/test/ct/api/2-non-disruptive/test_hardware.tavern.yaml b/test/ct/api/2-non-disruptive/test_hardware.tavern.yaml index 4a31fc19..1c497c8c 100644 --- a/test/ct/api/2-non-disruptive/test_hardware.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_hardware.tavern.yaml @@ -49,12 +49,24 @@ test_name: Query the Hardware collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /Hardware API response code - name: Retrieve the hardware information from the Hardware collection request: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -62,12 +74,24 @@ stages: test_name: Query the HardwareByFRU collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /HardwareByFRU API response code - name: Retrieve the hardware information from the HardwareByFRU collection request: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -75,6 +99,16 @@ stages: test_name: Query the Hardware collection for Node information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Retrieve a node xname from the Components collection to use in the next stage request: # also query with role=Compute since not all of the same node data is expected @@ -82,6 +116,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node&role=Compute" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -95,6 +131,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/{node_xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -139,6 +177,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{FRUID}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -161,11 +201,23 @@ stages: test_name: Query the Hardware collection for Node Enclosure information stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Retrieve a node enclosure xname from the Components collection to use in the next stage request: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -179,6 +231,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/{node_enclosure_xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -216,6 +270,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{FRUID}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -239,13 +295,23 @@ stages: #test_name: Query the Hardware collection for Node Processor information # #stages: +# - name: Get access token +# request: +# url: "{opaal_base_url}/token" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# access_token: access_token # - name: Retrieve a node xname from the Components collection to use in the next stage # request: # url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # save: @@ -258,9 +324,9 @@ stages: # request: # url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/{node_xname}p0" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # json: @@ -305,9 +371,9 @@ stages: # request: # url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{FRUID}" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # json: @@ -339,13 +405,23 @@ stages: #test_name: Query the Hardware collection for Node Memory information # #stages: +# - name: Get access token +# request: +# url: "{opaal_base_url}/token" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# save: +# json: +# access_token: access_token # - name: Retrieve a node xname from the Components collection to use in the next stage # request: # url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # save: @@ -358,9 +434,9 @@ stages: # request: # url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/{node_xname}d0" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # json: @@ -406,9 +482,9 @@ stages: # request: # url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{FRUID}" # method: GET +# verify: !bool "{verify}" # headers: # Authorization: "Bearer {access_token}" -# verify: !bool "{verify}" # response: # status_code: 200 # json: @@ -434,11 +510,23 @@ stages: test_name: Call the Hardware Inventory Query API with a Node xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Retrieve a node xname from the Components collection to use in the next stage request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -452,6 +540,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/{node_xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/2-non-disruptive/test_memberships.tavern.yaml b/test/ct/api/2-non-disruptive/test_memberships.tavern.yaml index 71113bdd..8823f0ae 100644 --- a/test/ct/api/2-non-disruptive/test_memberships.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_memberships.tavern.yaml @@ -49,6 +49,16 @@ test_name: Ensure that we can gather information from the memberships collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /memberships API response code # GET /memberships API response body - name: Ensure that we can conduct a query on the memberships collection @@ -56,6 +66,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -83,6 +95,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -96,6 +110,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships/{bmc_id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -119,6 +135,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -138,6 +156,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships/{node_id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -163,6 +183,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?arch={arch}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -191,6 +213,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?flag={flag}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -219,6 +243,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?id={node_id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -247,6 +273,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?nid={nid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -275,6 +303,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?role={role}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -303,6 +333,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?state={state}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -331,6 +363,8 @@ stages: url: "{hsm_base_url}/hsm/v2/memberships?type={type}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/2-non-disruptive/test_redfish_endpoints.tavern.yaml b/test/ct/api/2-non-disruptive/test_redfish_endpoints.tavern.yaml index 96426315..502c864a 100644 --- a/test/ct/api/2-non-disruptive/test_redfish_endpoints.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_redfish_endpoints.tavern.yaml @@ -45,6 +45,16 @@ test_name: Ensure that we can gather information from the RedfishEndpoints collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /RedfishEndpoints API response code # GET /RedfishEndpoints API response body - name: Ensure that we can conduct a query on the RedfishEndpoints collection @@ -52,6 +62,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -81,6 +93,7 @@ stages: - "DiscoveryStarted" # expected for ncn-m001 which is not connected to the site network - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -138,6 +151,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -167,6 +182,7 @@ stages: - "DiscoveryStarted" # expected for ncn-m001 which is not connected to the site network - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -216,6 +232,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -229,6 +247,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -251,6 +271,7 @@ stages: - "DiscoveryStarted" # expected for ncn-m001 which is not connected to the site network - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -307,6 +328,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?id={xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -336,6 +359,7 @@ stages: - "DiscoveryStarted" # expected for ncn-m001 which is not connected to the site network - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -389,6 +413,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?fqdn={fqdn}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -418,6 +444,7 @@ stages: - "DiscoveryStarted" # expected for ncn-m001 which is not connected to the site network - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -473,6 +500,8 @@ stages: # headers: # Authorization: "Bearer {access_token}" # verify: !bool "{verify}" + # headers: + # Authorization: "Bearer {access_token}" # response: # status_code: 200 # verify_response_with: @@ -502,6 +531,7 @@ stages: # - "DiscoveryStarted" # # expected for ncn-m001 which is not connected to the site network # - "HTTPsGetFailed" + # - "NotYetQueried" # RedfishVersion: # type: str # required: False @@ -555,6 +585,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/Query/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 json: @@ -570,6 +602,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/Query/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 json: diff --git a/test/ct/api/2-non-disruptive/test_service_endpoints.tavern.yaml b/test/ct/api/2-non-disruptive/test_service_endpoints.tavern.yaml index 8c5db7ee..828afb58 100644 --- a/test/ct/api/2-non-disruptive/test_service_endpoints.tavern.yaml +++ b/test/ct/api/2-non-disruptive/test_service_endpoints.tavern.yaml @@ -55,6 +55,16 @@ test_name: Query the ServiceEndpoints collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints API response code # GET /ServiceEndpoints API response body - name: Ensure that we can conduct a query on the ServiceEndpoints collection @@ -62,6 +72,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -74,6 +86,16 @@ stages: test_name: Query the ServiceEndpoints collection for the AccountService stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/AccountService API response code # GET /ServiceEndpoints/AccountService API response body - name: Ensure that we can conduct a query on the ServiceEndpoints collection for the AccountService @@ -81,6 +103,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/AccountService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -93,6 +117,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints?service=AccountService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -102,6 +128,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/AccountService/RedfishEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -109,6 +137,16 @@ stages: test_name: Query the ServiceEndpoints collection for the EventService stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/EventService API response code # GET /ServiceEndpoints/EventService API response body - name: Ensure that we can conduct a query on the ServiceEndpoints collection for the EventService @@ -116,6 +154,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/EventService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -128,6 +168,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints?service=EventService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -137,6 +179,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/EventService/RedfishEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -144,6 +188,16 @@ stages: test_name: Query the ServiceEndpoints collection for the SessionService stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/SessionService API response code # GET /ServiceEndpoints/SessionService API response body - name: Ensure that we can conduct a query on the ServiceEndpoints collection for the SessionService @@ -151,6 +205,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/SessionService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -163,6 +219,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints?service=SessionService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -172,6 +230,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/SessionService/RedfishEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -179,6 +239,16 @@ stages: test_name: Query the ServiceEndpoints collection for the UpdateService stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/UpdateService API response code # GET /ServiceEndpoints/UpdateService API response body - name: Ensure that we can conduct a query on the ServiceEndpoints collection for the UpdateService @@ -186,6 +256,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/UpdateService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -198,6 +270,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints?service=UpdateService" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -207,6 +281,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/UpdateService/RedfishEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -214,12 +290,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the AccountService with a valid but nonexistent xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/AccountService/RedfishEndpoints/{xname} valid nonexistent nodeBMC API response code - name: Verify failure when providing a valid but nonexistent xname for the AccountService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/AccountService/RedfishEndpoints/x1025c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -227,12 +315,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the EventService with a valid but nonexistent xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/EventService/RedfishEndpoints/{xname} valid nonexistent nodeBMC API response code - name: Verify failure when providing a valid but nonexistent xname for the EventService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/EventService/RedfishEndpoints/x1025c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -240,12 +340,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the SessionService with a valid but nonexistent xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/SessionService/RedfishEndpoints/{xname} valid nonexistent nodeBMC API response code - name: Verify failure when providing a valid but nonexistent xname for the SessionService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/SessionService/RedfishEndpoints/x1025c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -253,12 +365,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the UpdateService with a valid but nonexistent xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/UpdateService/RedfishEndpoints/{xname} valid nonexistent nodeBMC API response code - name: Verify failure when providing a valid but nonexistent xname for the UpdateService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/UpdateService/RedfishEndpoints/x1025c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -266,12 +390,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the AccountService with an invalid xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/AccountService/RedfishEndpoints/{xname} invalid nodeBMC API response code - name: Verify failure when providing an invalid xname for the AccountService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/AccountService/RedfishEndpoints/x1025000c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 @@ -279,12 +415,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the EventService with an invalid xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/EventService/RedfishEndpoints/{xname} invalid nodeBMC API response code - name: Verify failure when providing an invalid xname for the EventService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/EventService/RedfishEndpoints/x1025000c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 @@ -292,12 +440,24 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the SessionService with an invalid xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/SessionService/RedfishEndpoints/{xname} invalid nodeBMC API response code - name: Verify failure when providing an invalid xname for the SessionService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/SessionService/RedfishEndpoints/x1025000c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 @@ -305,11 +465,23 @@ stages: test_name: Attempt to query the ServiceEndpoints collection for the UpdateService with an invalid xname stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # GET /ServiceEndpoints/UpdateService/RedfishEndpoints/{xname} invalid nodeBMC API response code - name: Verify failure when providing an invalid xname for the UpdateService in the ServiceEndpoints collection request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/UpdateService/RedfishEndpoints/x1025000c7s4b4" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 diff --git a/test/ct/api/2-non-disruptive/test_state_change_notifications.tavern.yaml b/test/ct/api/2-non-disruptive/test_state_change_notifications.tavern.yaml deleted file mode 100644 index 9e69a031..00000000 --- a/test/ct/api/2-non-disruptive/test_state_change_notifications.tavern.yaml +++ /dev/null @@ -1,169 +0,0 @@ -# MIT License -# -# (C) Copyright [2019-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 Hardware State Manager (HSM) State Change Notifications (SCN) API. -# Author: Mitch Schooler -# Service: Hardware State Manager - -# HMS test metrics test cases: 4 -# GET /Subscriptions/SCN API response code -# GET /Subscriptions/SCN API response body -# GET /Subscriptions/SCN/{id} API response code -# GET /Subscriptions/SCN/{id} API response body ---- -test_name: Ensure that we can gather information from the State Change Notifications collection - -stages: - # GET /Subscriptions/SCN API response code - # GET /Subscriptions/SCN API response body - - name: Ensure that we can conduct a query on the State Change Notifications collection - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - SubscriptionList: - type: seq - matching: all - sequence: - - type: map - mapping: - ID: - type: int - required: True - Subscriber: - type: str - required: True - Enabled: - type: bool - required: False - Roles: - type: seq - required: False - matching: all - sequence: - - type: str - SoftwareStatus: - type: seq - required: False - matching: all - sequence: - - type: str - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "empty" - - "Unknown" - - "unknown" - - "Populated" - - "populated" - - "Off" - - "off" - - "On" - - "on" - - "Standby" - - "standby" - - "Halt" - - "halt" - - "Ready" - - "ready" - Url: - type: str - required: True - save: - json: - ID: SubscriptionList[0].ID - - # GET /Subscriptions/SCN/{id} API response code - # GET /Subscriptions/SCN/{id} API response body - - name: Ensure that we can conduct a query for a specific ID from the State Change Notifications collection - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{ID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - Subscriber: - type: str - required: True - Enabled: - type: bool - required: False - Roles: - type: seq - required: False - matching: all - sequence: - - type: str - SoftwareStatus: - type: seq - required: False - matching: all - sequence: - - type: str - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "empty" - - "Unknown" - - "unknown" - - "Populated" - - "populated" - - "Off" - - "off" - - "On" - - "on" - - "Standby" - - "standby" - - "Halt" - - "halt" - - "Ready" - - "ready" - Url: - type: str - required: True diff --git a/test/ct/api/3-disruptive/test_components_negative.tavern.yaml b/test/ct/api/3-disruptive/test_components_negative.tavern.yaml index c7d0ff18..e51710ca 100644 --- a/test/ct/api/3-disruptive/test_components_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_components_negative.tavern.yaml @@ -204,6 +204,16 @@ stages: test_name: hsmAPIstateComponentsNegative stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # POST /State/Components Invalid CabinetPDUController API response code # POST /State/Components Invalid CabinetPDUController API response body - name: hsmAPIstateComponentsPOSTinvalidCabinetPDUController - Attempt to create a CabinetPDUController Component with an invalid payload using POST. @@ -211,6 +221,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9998m3","Type":"CabinetPDUController","State":"FAKE","Flag":"OK","Enabled":true,"NetType":"Infiniband","Arch":"X86"}],"Force":false} response: status_code: 400 @@ -249,6 +261,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9998c7","Type":"Chassis","State":"Off","Flag":"FAKE","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 400 @@ -287,6 +301,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7b0","Type":"ChassisBMC","State":"Ready","Flag":"OK","Enabled":"fake","NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 500 @@ -325,6 +341,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7r9e9","Type":"HSNBoard","State":"On","Flag":"Warning","Enabled":false,"NetType":"FAKE","Arch":"X86","Class":"River"}],"Force":false} response: status_code: 400 @@ -363,6 +381,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9n9","Type":"Node","State":"On","Flag":"OK","Enabled":true,"SoftwareStatus":"AdminStatus","Role":"Compute","NID":9999999999,"NetType":"Sling","Arch":"FAKE","Class":"River"}],"Force":false} response: status_code: 400 @@ -401,6 +421,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9","Type":"NodeBMC","State":"Ready","Flag":"OK","Enabled":true,"Role":"Management","NetType":"Sling","Arch":"X86","Class":"FAKE","Locked":false}],"Force":false} response: status_code: 400 @@ -439,6 +461,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9e9","Type":"NodeEnclosure","State":"On","Flag":"OK","Enabled":false,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":FAKE} response: status_code: 500 @@ -477,6 +501,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7r9FAKE9","Type":"RouterBMC","State":"Ready","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 400 @@ -515,6 +541,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"FAKE":"x9999c7r9","Type":"RouterModule","State":"Empty","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 400 @@ -553,6 +581,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -590,6 +620,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9998c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Component":{"ID":"x9998c7s9b9n9","Type":"Node","State":"Standby","Flag":"Alert","Enabled":"FAKE","SoftwareStatus":"AdminStatus","Role":"Compute","NID":9998999999,"NetType":"Infiniband","Arch":"ARM","Class":"River"},"Force":false} response: #TODO: this should be a "Bad Request" status code 400 instead, or the Swagger needs to be updated with "Internal Server Error" code 500 CASMHMS-5828 @@ -629,6 +661,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9998c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Component":{"ID":"x9998c7s9b9n9","Type":"Node","State":"Standby","Flag":"Alert","Enabled":"FAKE","SoftwareStatus":"AdminStatus","Role":"Compute","NID":9998999999,"NetType":"Infiniband","Arch":"ARM","Class":"River"},"Force":true} response: #TODO: this should be a "Bad Request" status code 400 instead, or the Swagger needs to be updated with "Internal Server Error" code 500 CASMHMS-5828 @@ -668,6 +702,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -705,6 +741,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -742,6 +780,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkStateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n8","FAKE"],"State":"On","Flag":"Alert","Force":true} response: status_code: 400 @@ -780,6 +820,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkStateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n8","x9999c7s9b8n7"],"State":"FAKE","Flag":"Alert","Force":true} response: status_code: 400 @@ -818,6 +860,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkStateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n8","x9999c7s9b8n7"],"State":"FAKE","Force":true} response: status_code: 400 @@ -856,6 +900,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/StateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"State":"Ready","Flag":"OK","Force":true} response: status_code: 400 @@ -894,6 +940,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/StateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"State":"Ready","Force":true} response: status_code: 400 @@ -932,6 +980,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7/StateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"State":"FAKE","Flag":"OK","Force":true} response: status_code: 400 @@ -970,6 +1020,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkFlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["FAKE","x9999c7s9b8n6"],"Flag":"Warning"} response: status_code: 400 @@ -1008,6 +1060,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkFlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"Flag":"FAKE"} response: status_code: 400 @@ -1046,6 +1100,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkFlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"]} response: status_code: 400 @@ -1084,6 +1140,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/FlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Flag":"OK"} response: status_code: 400 @@ -1122,6 +1180,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/FlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Flag":"FAKE"} response: status_code: 400 @@ -1160,6 +1220,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/FlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"foo":"bar"} response: status_code: 400 @@ -1198,6 +1260,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkEnabled" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"Enabled":"FAKE"} response: #TODO: this should be a "Bad Request" status code 400 instead, or the Swagger needs to be updated with "Internal Server Error" code 500 CASMHMS-5828 @@ -1237,6 +1301,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/Enabled" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Enabled":false} response: status_code: 400 @@ -1275,6 +1341,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkSoftwareStatus" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["FAKE","x9999c7s9b8n6"],"SoftwareStatus":"UpdatedBulkSoftwareStatus"} response: status_code: 400 @@ -1313,6 +1381,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/SoftwareStatus" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"SoftwareStatus":"UpdatedXnameSoftwareStatus"} response: status_code: 400 @@ -1351,6 +1421,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/Role" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Role":"FAKE","SubRole":"Worker"} response: status_code: 400 @@ -1389,6 +1461,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkNID" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b8n7","NID":9999999977},{"ID":"x9999c7s9b8n6","NID":""}]} response: #TODO: this should be a "Bad Request" status code 400 instead, or the Swagger needs to be updated with "Internal Server Error" code 500 CASMHMS-5828 @@ -1428,6 +1502,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/FAKE/NID" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999978} response: status_code: 400 @@ -1466,6 +1542,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/State/Components/Query" # method: POST # verify: !bool "{verify}" +# headers: +# Authorization: "Bearer {access_token}" # #TODO: this should be a "Bad Request" with "invalid xname" returned, instead it attempts to use the invalid xname CASMHMS-5829 # json: {"ComponentIDs":["FAKE"]} # response: @@ -1505,6 +1583,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["FAKE"]} response: status_code: 400 @@ -1544,6 +1624,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/State/Components/Query/FAKE" # method: GET # verify: !bool "{verify}" +# headers: +# Authorization: "Bearer {access_token}" # response: # status_code: 400 # verify_response_with: diff --git a/test/ct/api/3-disruptive/test_ethernet_interfaces.tavern.yaml b/test/ct/api/3-disruptive/test_ethernet_interfaces.tavern.yaml index fe5269c5..d2b97e23 100644 --- a/test/ct/api/3-disruptive/test_ethernet_interfaces.tavern.yaml +++ b/test/ct/api/3-disruptive/test_ethernet_interfaces.tavern.yaml @@ -51,6 +51,16 @@ test_name: hsmAPIinventoryEthernetInterfacesDisruptive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # DELETE /Inventory/EthernetInterfaces/{ethInterfaceID} - name: Delete test component ethernet interface (if present) request: @@ -64,6 +74,8 @@ stages: json: {"Description":"Test Component Interface","MACAddress":"9A:99:99:99:99:99","IPAddresses":[{"IPAddress":"99.9.9.9","Network":"HSMTavernTest"}]} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 json: @@ -78,6 +90,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -131,6 +145,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces?ComponentID={compID}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -183,6 +199,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces?ComponentID=BADID" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 json: @@ -197,6 +215,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -254,6 +274,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Description":"Test Patch Component Interface"} response: status_code: 200 @@ -264,6 +286,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"IPAddresses":[{"IPAddress":"99.9.9.9","Network":"HSMTavernTestPatch"}]} response: status_code: 200 @@ -274,6 +298,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -331,6 +357,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -361,6 +389,8 @@ stages: json: {"IPAddress":"99.9.9.8","Network":"HSMTavernTestPatch"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 json: @@ -372,6 +402,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -404,6 +436,8 @@ stages: json: {"Network":"HSMTavernTest2"} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -413,6 +447,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -445,6 +481,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses/99.9.9.8" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -457,6 +495,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -487,6 +527,8 @@ stages: json: {"IPAddress":"99.9.9.7","Network":"HSMTavernTestPatch"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 json: @@ -500,6 +542,8 @@ stages: json: {"Network":"HSMTavernTest2PATCH"} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -510,6 +554,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999/IPAddresses/99.9.9.7" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -522,6 +568,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -534,6 +582,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -548,6 +598,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces/9a9999999999" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: diff --git a/test/ct/api/3-disruptive/test_groups.tavern.yaml b/test/ct/api/3-disruptive/test_groups.tavern.yaml index 4a57be3f..1777b8cb 100644 --- a/test/ct/api/3-disruptive/test_groups.tavern.yaml +++ b/test/ct/api/3-disruptive/test_groups.tavern.yaml @@ -78,11 +78,23 @@ test_name: Verify POST, GET, PATCH, and DELETE methods for various /groups APIs stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Get four Node xnames from the HSM Components collection to use in upcoming stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -97,6 +109,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /groups group1 API response code - name: Verify /groups POST method group1 @@ -105,6 +119,8 @@ stages: json: {"label":"hsmtestgroup1","description":"Test group 1 for HSM API testing in CT framework.","tags":["hsmtestgroup1_tag1","hsmtestgroup1_tag2"],"members":{"ids":["{xname1}","{xname2}"]}} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -115,6 +131,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/labels" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -142,6 +160,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -193,6 +213,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups?group=hsmtestgroup1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -211,6 +233,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups?tag=hsmtestgroup1_tag1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -229,6 +253,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups?tag=hsmtestgroup1_tag2" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -247,6 +273,8 @@ stages: json: {"description":"Test group 1 for HSM API testing in CT framework (UPDATED).","tags":["hsmtestgroup1_tag3","hsmtestgroup1_tag4"]} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 204 @@ -257,6 +285,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -306,6 +336,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup2" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /groups group2 API response code - name: Verify /groups POST method group2 @@ -314,6 +346,8 @@ stages: json: {"label":"hsmtestgroup2","description":"Test group 2 for HSM API testing in CT framework.","tags":["hsmtestgroup2_tag1","hsmtestgroup2_tag2"],"members":{"ids":["{xname2}","{xname3}"]}} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -324,6 +358,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup2" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -375,6 +411,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/labels" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -403,6 +441,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -426,6 +466,8 @@ stages: json: {"id":"{xname4}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -436,6 +478,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -462,6 +506,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1/members/{xname1}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -489,6 +535,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -513,6 +561,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /partitions API response code - name: Verify /partitions POST method @@ -521,6 +571,8 @@ stages: json: {"name":"p98","description":"Test partition 1 for HSM API testing in CT framework.","tags":["p98_tag1","p98_tag2"],"members":{"ids":["{xname4}"]}} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -531,6 +583,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -590,6 +644,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1?partition=p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -649,6 +705,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1/members?partition=p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -689,6 +747,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -716,6 +776,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup1" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -743,6 +805,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroup2" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -767,11 +831,23 @@ stages: test_name: Verify POST, GET, PATCH, and DELETE methods for various /groups APIs with exclusive groups stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Get four Node xnames from the HSM Components collection to use in upcoming stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -786,6 +862,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupBlue" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /groups exclusive group Blue API response code - name: Verify /groups POST method exclusive group Blue @@ -794,6 +872,8 @@ stages: json: {"label":"hsmtestgroupBlue","description":"Exclusive test group Blue for HSM API testing in CT framework.","tags":["hsmtestgroupBlue_tag1"],"members":{"ids":["{xname1}"]},"exclusiveGroup":"hsmtestgroupColors"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -802,6 +882,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupLion" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /groups exclusive group Lion API response code - name: Verify /groups POST method exclusive group Lion @@ -810,6 +892,8 @@ stages: json: {"label":"hsmtestgroupLion","description":"Exclusive test group Lion for HSM API testing in CT framework.","tags":["hsmtestgroupLion_tag1"],"members":{"ids":["{xname1}","{xname2}"]},"exclusiveGroup":"hsmtestgroupAnimals"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -818,6 +902,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupRed" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /groups exclusive group Red conflicting member API response code # POST /groups exclusive group Red conflicting member API response body @@ -827,6 +913,8 @@ stages: json: {"label":"hsmtestgroupRed","description":"Exclusive test group Red for HSM API testing in CT framework.","tags":["hsmtestgroupRed_tag1"],"members":{"ids":["{xname1}"]},"exclusiveGroup":"hsmtestgroupColors"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 409 verify_response_with: @@ -864,6 +952,8 @@ stages: json: {"label":"hsmtestgroupRed","description":"Exclusive test group Red for HSM API testing in CT framework.","tags":["hsmtestgroupRed_tag1"],"members":{"ids":["{xname2}"]},"exclusiveGroup":"hsmtestgroupColors"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -875,6 +965,8 @@ stages: json: {"id":"{xname1}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 409 verify_response_with: @@ -912,6 +1004,8 @@ stages: json: {"id":"{xname3}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -922,6 +1016,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupRed/members/{xname3}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -949,6 +1045,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupBlue" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -976,6 +1074,8 @@ stages: json: {"id":"{xname1}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -986,6 +1086,8 @@ stages: json: {"description":"Exclusive test group Red for HSM API testing in CT framework (UPDATED).","tags":["hsmtestgroupRed_tag2"]} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 204 @@ -996,6 +1098,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupRed" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1023,6 +1127,8 @@ stages: url: "{hsm_base_url}/hsm/v2/groups/hsmtestgroupLion" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_hardware.tavern.yaml b/test/ct/api/3-disruptive/test_hardware.tavern.yaml index c276e7f9..21b71bbc 100644 --- a/test/ct/api/3-disruptive/test_hardware.tavern.yaml +++ b/test/ct/api/3-disruptive/test_hardware.tavern.yaml @@ -143,6 +143,16 @@ test_name: hsmAPIinventoryHardwareDisruptive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # POST /Inventory/Hardware CMMRectifier API response code # POST /Inventory/Hardware CMMRectifier API response body - name: hsmAPIinventoryHardwarePOSTcmmRectifier - Create a CMMRectifier Hardware Inventory entry using POST. @@ -150,6 +160,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7t9","Type":"CMMRectifier","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocCMMRectifier","CMMRectifierLocationInfo":{"Name":"Rectifier9","FirmwareVersion":""},"PopulatedFRU":{"FRUID":"CMMRectifier.ABB.LBGEPE20KZ46051725","Type":"CMMRectifier","Subtype":"","HWInventoryByFRUType":"HWInvByFRUCMMRectifier","CMMRectifierFRUInfo":{"Manufacturer":"ABB","SerialNumber":"LBGEPE20KZ46051725","Model":"CC15000H3C380T","PartNumber":"","PowerCapacityWatts":0,"PowerInputWatts":0,"PowerOutputWatts":0,"PowerSupplyType":""}}}]} response: status_code: 200 @@ -178,6 +190,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7t9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -302,6 +316,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7","Type":"Chassis","Ordinal":7,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocChassis","ChassisLocationInfo":{"Id":"Enclosure","Name":"Enclosure","Description":"CMM","HostName":""},"PopulatedFRU":{"FRUID":"Chassis.HPE.101426404D.IMZ2409069079","Type":"Chassis","Subtype":"","HWInventoryByFRUType":"HWInvByFRUChassis","ChassisFRUInfo":{"AssetTag":"","ChassisType":"Enclosure","Model":"CMM","Manufacturer":"HPE","PartNumber":"101426404.D","SerialNumber":"IMZ2409069079","SKU":""}}}]} response: status_code: 200 @@ -330,6 +346,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -459,6 +477,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9","Type":"ComputeModule","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocComputeModule","ComputeModuleLocationInfo":{"Id":"Blade9","Name":"Blade9","Description":"","HostName":""},"PopulatedFRU":{"FRUID":"FRUIDforx9999c7s9","Type":"ComputeModule","Subtype":"","HWInventoryByFRUType":"HWInvByFRUComputeModule","ComputeModuleFRUInfo":{"AssetTag":"","ChassisType":"Blade","Model":"Blade9","Manufacturer":"HPE","PartNumber":"","SerialNumber":"","SKU":""}}}]} response: status_code: 200 @@ -487,6 +507,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -616,6 +638,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7r9e9","Type":"HSNBoard","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocHSNBoard","HSNBoardLocationInfo":{"Id":"Enclosure","Name":"Enclosure","Description":"HPE_Slingshot_1_Switch_Blade","HostName":""},"PopulatedFRU":{"FRUID":"HSNBoard.HPE.102000002A.HER1920112770","Type":"HSNBoard","Subtype":"","HWInventoryByFRUType":"HWInvByFRUHSNBoard","HSNBoardFRUInfo":{"AssetTag":"","ChassisType":"Enclosure","Model":"HPE_Slingshot_1_Switch_Blade","Manufacturer":"HPE","PartNumber":"102000002.A","SerialNumber":"HER1920112770","SKU":""}}}]} response: status_code: 200 @@ -644,6 +668,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9e9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -773,6 +799,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9d9","Type":"Memory","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocMemory","MemoryLocationInfo":{"Id":"DIMM9","Name":"DIMM9","Description":"","MemoryLocation":{"Socket":9,"MemoryController":9,"Channel":9,"Slot":9}},"PopulatedFRU":{"FRUID":"Memory.SKHynix.HMA82GR7CJR8NXN.YBZ0215997182","Type":"Memory","Subtype":"","HWInventoryByFRUType":"HWInvByFRUMemory","MemoryFRUInfo":{"BaseModuleType":"RDIMM","BusWidthBits":72,"CapacityMiB":16384,"DataWidthBits":64,"ErrorCorrection":"Multi-bitECC","Manufacturer":"SKHynix","MemoryType":"DRAM","MemoryDeviceType":"DDR4","OperatingSpeedMhz":3200,"PartNumber":"HMA82GR7CJR8N-XN","RankCount":2,"SerialNumber":"YBZ0215997182"}}}]} response: status_code: 200 @@ -801,6 +829,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9d9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -974,6 +1004,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9","Type":"NodeBMC","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNodeBMC","NodeBMCLocationInfo":{"DateTime":"2022-10-17T16:22:13+00:00","DateTimeLocalOffset":"+00:00","Description":"ShastaManager","FirmwareVersion":"","Id":"BMC","Name":"BMC"},"PopulatedFRU":{"FRUID":"FRUIDforx9999c7s9b9","Type":"NodeBMC","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNodeBMC","NodeBMCFRUInfo":{"ManagerType":"EnclosureManager","Model":"","Manufacturer":"","PartNumber":"","SerialNumber":""}}}]} response: status_code: 200 @@ -1002,6 +1034,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1131,6 +1165,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9e9","Type":"NodeEnclosure","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNodeEnclosure","NodeEnclosureLocationInfo":{"Id":"Enclosure","Name":"Enclosure","Description":"WNC","HostName":""},"PopulatedFRU":{"FRUID":"NodeEnclosure.HPE.101920703D.XJJ7679069386","Type":"NodeEnclosure","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNodeEnclosure","NodeEnclosureFRUInfo":{"AssetTag":"","ChassisType":"Enclosure","Model":"WNC","Manufacturer":"HPE","PartNumber":"101920703.D","SerialNumber":"XJJ7679069386","SKU":""}}}]} response: status_code: 200 @@ -1159,6 +1195,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9e9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1288,6 +1326,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9h3","Type":"NodeHsnNic","Ordinal":3,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNodeHsnNic","NodeHsnNicLocationInfo":{"Id":"HPCNet0","Name":"","Description":"SS11200Gb2PNICMezzREV02(HSN)"},"PopulatedFRU":{"FRUID":"NodeHsnNic.HPEPRM.P43012001.OTI6996696413","Type":"NodeHsnNic","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNodeHsnNic","NodeHsnNicFRUInfo":{"Manufacturer":"HPE-PRM","Model":"R4K44A","PartNumber":"P43012-001","SerialNumber":"OTI6996696413"}}}]} response: status_code: 200 @@ -1316,6 +1356,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9h3" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1425,6 +1467,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9","Type":"Node","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNode","NodeLocationInfo":{"Id":"Node9","Name":"Node9","Description":"WNC","HostName":"","ProcessorSummary":{"Count":2,"Model":"AMDEPYC776364-CoreProcessor"},"MemorySummary":{"TotalSystemMemoryGiB":256}},"PopulatedFRU":{"FRUID":"Node.HPE.101920703D.XJJ7679069386_9","Type":"Node","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNode","NodeFRUInfo":{"AssetTag":"","BiosVersion":"ex425.bios-1.6.3","Model":"HPECRAYEX425(MILAN)","Manufacturer":"HPE","PartNumber":"101920703.D","SerialNumber":"XJJ7679069386","SKU":"","SystemType":"Physical","UUID":""}}}]} response: status_code: 200 @@ -1453,6 +1497,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1615,6 +1661,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9","Type":"Node","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNode","NodeLocationInfo":{"Id":"Node9","Name":"Node9","Description":"WNC-Updated","HostName":"","ProcessorSummary":{"Count":2,"Model":"AMDEPYC776364-CoreProcessor"},"MemorySummary":{"TotalSystemMemoryGiB":512}},"PopulatedFRU":{"FRUID":"Node.HPE.101920703D.XJJ7679069386_9","Type":"Node","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNode","NodeFRUInfo":{"AssetTag":"","BiosVersion":"ex425.bios-1.6.3-updated","Model":"HPECRAYEX425(MILAN)","Manufacturer":"HPE","PartNumber":"101920703.D","SerialNumber":"XJJ7679069386","SKU":"Updated-SKU","SystemType":"Physical","UUID":"Updated-UUID"}}}]} response: status_code: 200 @@ -1643,6 +1691,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1805,6 +1855,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9p3","Type":"Processor","Ordinal":3,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocProcessor","ProcessorLocationInfo":{"Id":"CPU3","Name":"Processor","Description":"","Socket":"CPU3"},"PopulatedFRU":{"FRUID":"Processor.AdvancedMicroDevicesInc.EWN8203534712","Type":"Processor","Subtype":"","HWInventoryByFRUType":"HWInvByFRUProcessor","ProcessorFRUInfo":{"InstructionSet":"","Manufacturer":"AdvancedMicroDevices,Inc.","MaxSpeedMHz":3525,"Model":"AMDEPYC776364-CoreProcessor","SerialNumber":"EWN8203534712","PartNumber":"","ProcessorArchitecture":"","ProcessorId":{"EffectiveFamily":"0x19","EffectiveModel":"0x01","IdentificationRegisters":"","MicrocodeInfo":"","Step":"0x1","VendorID":"AuthenticAMD"},"ProcessorType":"CPU","TotalCores":64,"TotalThreads":128,"Oem":null}}}]} response: status_code: 200 @@ -1833,6 +1885,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9p3" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2013,6 +2067,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7r9b9","Type":"RouterBMC","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocRouterBMC","RouterBMCLocationInfo":{"DateTime":"2022-10-18T15:36:06Z","DateTimeLocalOffset":"0","Description":"ShastaManager","FirmwareVersion":"","Id":"BMC","Name":"BMC"},"PopulatedFRU":{"FRUID":"FRUIDforx9999c7r9b9","Type":"RouterBMC","Subtype":"","HWInventoryByFRUType":"HWInvByFRURouterBMC","RouterBMCFRUInfo":{"ManagerType":"EnclosureManager","Model":"","Manufacturer":"","PartNumber":"","SerialNumber":""}}}]} response: status_code: 200 @@ -2041,6 +2097,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -2051,6 +2109,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7r9","Type":"RouterModule","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocRouterModule","RouterModuleLocationInfo":{"Id":"Perif9","Name":"Perif9","Description":"","HostName":""},"PopulatedFRU":{"FRUID":"FRUIDforx9999c7r9","Type":"RouterModule","Subtype":"","HWInventoryByFRUType":"HWInvByFRURouterModule","RouterModuleFRUInfo":{"AssetTag":"","ChassisType":"Blade","Model":"Perif9","Manufacturer":"HPE","PartNumber":"","SerialNumber":"","SKU":""}}}]} response: status_code: 200 @@ -2079,6 +2139,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2208,6 +2270,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2262,6 +2326,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?id=x9999c7t9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2317,6 +2383,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?type=Chassis" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2372,6 +2440,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?manufacturer=AdvancedMicroDevices,Inc." method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2435,6 +2505,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?partnumber=HMA82GR7CJR8N-XN" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2498,6 +2570,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?serialnumber=HER1920112770" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2561,6 +2635,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?fruid=Memory.SKHynix.HMA82GR7CJR8NXN.YBZ0215997182" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2616,6 +2692,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7t9?children=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2758,6 +2836,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7?children=False&parents=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2905,6 +2985,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9?xname=x9999c7s9&children=False" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3052,6 +3134,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7r9e9?type=HSNBoard" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3199,6 +3283,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9n9d9?format=FullyFlat" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3390,6 +3476,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9?format=NestNodesOnly&children=False" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3537,6 +3625,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9e9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3684,6 +3774,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9n9h3" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3811,6 +3903,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9n9?children=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4051,6 +4145,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9n9p3" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4249,6 +4345,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7r9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4392,6 +4490,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7r9?children=False" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4539,6 +4639,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7t9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4566,6 +4668,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4593,6 +4697,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4620,6 +4726,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9e9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4647,6 +4755,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9d9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4674,6 +4784,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4701,6 +4813,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9e9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4728,6 +4842,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9h3" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4755,6 +4871,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4782,6 +4900,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9p3" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4809,6 +4929,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9b9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -4836,6 +4958,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7r9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_hardware_negative.tavern.yaml b/test/ct/api/3-disruptive/test_hardware_negative.tavern.yaml index 62dc657e..6f75e986 100644 --- a/test/ct/api/3-disruptive/test_hardware_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_hardware_negative.tavern.yaml @@ -59,6 +59,16 @@ test_name: hsmAPIinventoryHardwareNegative stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # POST /Inventory/Hardware CMMRectifier Missing ID API response code # POST /Inventory/Hardware CMMRectifier Missing ID API response body - name: hsmAPIinventoryHardwarePOSTcmmRectifierMissingID - Attempt to create a CMMRectifier Hardware Inventory entry with a missing ID using POST. @@ -66,6 +76,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"Type":"CMMRectifier","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocCMMRectifier","CMMRectifierLocationInfo":{"Name":"Rectifier9","FirmwareVersion":""},"PopulatedFRU":{"FRUID":"CMMRectifier.ABB.LBGEPE20KZ46051725","Type":"CMMRectifier","Subtype":"","HWInventoryByFRUType":"HWInvByFRUCMMRectifier","CMMRectifierFRUInfo":{"Manufacturer":"ABB","SerialNumber":"LBGEPE20KZ46051725","Model":"CC15000H3C380T","PartNumber":"","PowerCapacityWatts":0,"PowerInputWatts":0,"PowerOutputWatts":0,"PowerSupplyType":""}}}]} response: status_code: 400 @@ -104,6 +116,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"","Type":"Chassis","Ordinal":7,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocChassis","ChassisLocationInfo":{"Id":"Enclosure","Name":"Enclosure","Description":"CMM","HostName":""},"PopulatedFRU":{"FRUID":"Chassis.HPE.101426404D.IMZ2409069079","Type":"Chassis","Subtype":"","HWInventoryByFRUType":"HWInvByFRUChassis","ChassisFRUInfo":{"AssetTag":"","ChassisType":"Enclosure","Model":"CMM","Manufacturer":"HPE","PartNumber":"101426404.D","SerialNumber":"IMZ2409069079","SKU":""}}}]} response: status_code: 400 @@ -142,6 +156,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" # method: POST # verify: !bool "{verify}" +# headers: +# Authorization: "Bearer {access_token}" # #TODO: Improve handling of bad or conflicting data for /Inventory/Hardware POST CASMHMS-5834 # json: {"Hardware":[{"ID":"x9999c7s9","Type":"MgmtSwitchConnector","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocComputeModule","ComputeModuleLocationInfo":{"Id":"Blade9","Name":"Blade9","Description":"","HostName":""},"PopulatedFRU":{"FRUID":"FRUIDforx9999c7s9","Type":"ComputeModule","Subtype":"","HWInventoryByFRUType":"HWInvByFRUComputeModule","ComputeModuleFRUInfo":{"AssetTag":"","ChassisType":"Blade","Model":"Blade9","Manufacturer":"HPE","PartNumber":"","SerialNumber":"","SKU":""}}}]} # response: @@ -181,6 +197,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" # method: POST # verify: !bool "{verify}" +# headers: +# Authorization: "Bearer {access_token}" # #TODO: Improve handling of bad or conflicting data for /Inventory/Hardware POST CASMHMS-5834 # json: {"Hardware":[{"ID":"x9999c7r9e9","Type":"","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocHSNBoard","HSNBoardLocationInfo":{"Id":"Enclosure","Name":"Enclosure","Description":"HPE_Slingshot_1_Switch_Blade","HostName":""},"PopulatedFRU":{"FRUID":"HSNBoard.HPE.102000002A.HER1920112770","Type":"HSNBoard","Subtype":"","HWInventoryByFRUType":"HWInvByFRUHSNBoard","HSNBoardFRUInfo":{"AssetTag":"","ChassisType":"Enclosure","Model":"HPE_Slingshot_1_Switch_Blade","Manufacturer":"HPE","PartNumber":"102000002.A","SerialNumber":"HER1920112770","SKU":""}}}]} # response: @@ -220,6 +238,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9n9d9"}]} response: status_code: 400 @@ -258,6 +278,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9b9","PopulatedFRU":{"FRUID":"FRUIDforx9999c7s9b9","Type":"NodeBMC","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNodeBMC","NodeBMCFRUInfo":{"ManagerType":"EnclosureManager","Model":"","Manufacturer":"","PartNumber":"","SerialNumber":""}}}]} response: status_code: 400 @@ -296,6 +318,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"x9999c7s9e9","Type":"NodeEnclosure","Ordinal":9,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNodeEnclosure","NodeEnclosureLocationInfo":{},"PopulatedFRU":{}}]} response: status_code: 400 @@ -334,6 +358,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hardware":[{"ID":"FAKE","Type":"NodeHsnNic","Ordinal":3,"Status":"Populated","HWInventoryByLocationType":"HWInvByLocNodeHsnNic","NodeHsnNicLocationInfo":{"Id":"HPCNet0","Name":"","Description":"SS11200Gb2PNICMezzREV02(HSN)"},"PopulatedFRU":{"FRUID":"NodeHsnNic.HPEPRM.P43012001.OTI6996696413","Type":"NodeHsnNic","Subtype":"","HWInventoryByFRUType":"HWInvByFRUNodeHsnNic","NodeHsnNicFRUInfo":{"Manufacturer":"HPE-PRM","Model":"R4K44A","PartNumber":"P43012-001","SerialNumber":"OTI6996696413"}}}]} response: status_code: 400 @@ -372,6 +398,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9989c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -409,6 +437,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?id=FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -446,6 +476,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware?type=FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -483,6 +515,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/x9999c7s9b9n9?children=False" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -510,6 +544,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/Query/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -547,6 +583,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -584,6 +622,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_locks.tavern.yaml b/test/ct/api/3-disruptive/test_locks.tavern.yaml index 9493d2bb..9936ff41 100644 --- a/test/ct/api/3-disruptive/test_locks.tavern.yaml +++ b/test/ct/api/3-disruptive/test_locks.tavern.yaml @@ -64,6 +64,16 @@ test_name: hsmAPILocks stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token ############################################## # Remove any test components we previously created. # This will also remove any locks/reservations @@ -75,21 +85,29 @@ stages: request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9996" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9997 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9997 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9997" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9998 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9998 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9998" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9999 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9999 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9999" method: DELETE + headers: + Authorization: "Bearer {access_token}" ############################################## # Begin Tests @@ -101,6 +119,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9996","p9999.9997","p9999.9998","p9999.9999"]} response: status_code: 400 @@ -138,6 +158,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status?type=Partition" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -177,6 +199,8 @@ stages: request: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"p9999.9996","State":"Populated"},{"ID":"p9999.9997","State":"Populated"},{"ID":"p9999.9998","State":"Populated"},{"ID":"p9999.9999","State":"Populated"}]} # POST /lock/status w/ Components @@ -185,6 +209,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9996","p9999.9997","p9999.9998","p9999.9999"]} response: status_code: 200 @@ -239,6 +265,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status?type=Partition" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -292,6 +320,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/lock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 200 @@ -362,6 +392,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/lock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 400 @@ -399,6 +431,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/unlock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 200 @@ -469,6 +503,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/unlock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 400 @@ -506,6 +542,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/lock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9996","p9999.9997"]} response: status_code: 200 @@ -574,6 +612,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ReservationDuration":15,"ProcessingModel":"rigid"} response: status_code: 400 @@ -611,6 +651,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ReservationDuration":15,"ProcessingModel":"flexible"} response: status_code: 200 @@ -681,6 +723,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9998","p9999.9999"],"ReservationDuration":15,"ProcessingModel":"flexible"} response: status_code: 200 @@ -744,6 +788,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/check" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"DeputyKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.DeputyKey}"},{"ID":"{service_key_data_1.ID}","Key":"{service_key_data_1.DeputyKey}"}]} response: status_code: 200 @@ -808,6 +854,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.ReservationKey}"},{"ID":"{service_key_data_1.ID}","Key":"{service_key_data_1.ReservationKey}"}],"ReservationDuration":15} response: status_code: 200 @@ -879,6 +927,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.ReservationKey}"}]} response: status_code: 200 @@ -949,6 +999,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.ReservationKey}"}]} response: status_code: 400 @@ -986,6 +1038,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/check" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"DeputyKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.DeputyKey}"},{"ID":"{service_key_data_1.ID}","Key":"{service_key_data_1.DeputyKey}"}]} response: status_code: 200 @@ -1052,6 +1106,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.ReservationKey}"},{"ID":"{service_key_data_1.ID}","Key":"{service_key_data_1.ReservationKey}"}],"ReservationDuration":15} response: status_code: 400 @@ -1089,6 +1145,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{service_key_data_0.ID}","Key":"{service_key_data_0.ReservationKey}"},{"ID":"{service_key_data_1.ID}","Key":"{service_key_data_1.ReservationKey}"}],"ReservationDuration":15,"ProcessingModel":"flexible"} response: status_code: 200 @@ -1163,6 +1221,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/lock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9999"]} response: status_code: 400 @@ -1200,6 +1260,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 400 @@ -1237,6 +1299,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ProcessingModel":"flexible"} response: status_code: 200 @@ -1303,6 +1367,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/remove" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 400 @@ -1340,6 +1406,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/remove" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ProcessingModel":"flexible"} response: status_code: 200 @@ -1416,6 +1484,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ProcessingModel":"flexible"} response: status_code: 200 @@ -1483,6 +1553,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{key_data_0.ID}","Key":"{key_data_0.ReservationKey}"}]} response: status_code: 200 @@ -1553,6 +1625,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationKeys":[{"ID":"{key_data_0.ID}","Key":"{key_data_0.ReservationKey}"}]} response: status_code: 400 @@ -1590,6 +1664,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/disable" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9998","p9999.9999"]} response: status_code: 200 @@ -1661,6 +1737,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/disable" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 200 @@ -1734,6 +1812,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/repair" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["p9999.9998","p9999.9999"]} response: status_code: 200 @@ -1805,6 +1885,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/repair" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 200 @@ -1878,6 +1960,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/unlock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"]} response: status_code: 400 @@ -1915,6 +1999,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/unlock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Type":["Partition"],"ProcessingModel":"flexible"} response: status_code: 200 @@ -1995,18 +2081,26 @@ stages: request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9996" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9997 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9997 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9997" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9998 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9998 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9998" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /State/Components/p9999.9999 - name: hsmAPIlocksDELETE - Delete leftover test component p9999.9999 request: url: "{hsm_base_url}/hsm/v2/State/Components/p9999.9999" - method: DELETE \ No newline at end of file + method: DELETE + headers: + Authorization: "Bearer {access_token}" diff --git a/test/ct/api/3-disruptive/test_locks_negative.tavern.yaml b/test/ct/api/3-disruptive/test_locks_negative.tavern.yaml index 72732da2..29fadae8 100644 --- a/test/ct/api/3-disruptive/test_locks_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_locks_negative.tavern.yaml @@ -47,6 +47,16 @@ test_name: hsmAPILocksNegative stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # POST /locks/reservations/remove Invalid processing model - name: hsmAPILocksReservationsRemovePOSTInvalidParams - Invalid processing model @@ -54,6 +64,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/remove" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -91,6 +103,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -128,6 +142,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {} response: status_code: 400 @@ -165,6 +181,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -202,6 +220,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -239,6 +259,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/release" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {} response: status_code: 400 @@ -276,6 +298,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -313,6 +337,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationDuration":16} response: status_code: 400 @@ -350,6 +376,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -387,6 +415,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationDuration":16} response: status_code: 400 @@ -424,6 +454,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/renew" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ReservationDuration":1} response: status_code: 400 @@ -461,6 +493,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/service/reservations/check" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {} response: status_code: 400 @@ -498,6 +532,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["foo","bar"]} response: status_code: 400 @@ -535,6 +571,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/status?role=foo" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -571,6 +609,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/lock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -608,6 +648,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/unlock" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -645,6 +687,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/disable" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 @@ -682,6 +726,8 @@ stages: url: "{hsm_base_url}/hsm/v2/locks/repair" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ProcessingModel":"fail"} response: status_code: 400 diff --git a/test/ct/api/3-disruptive/test_nodemaps.tavern.yaml b/test/ct/api/3-disruptive/test_nodemaps.tavern.yaml index 07f89609..9fc09c55 100644 --- a/test/ct/api/3-disruptive/test_nodemaps.tavern.yaml +++ b/test/ct/api/3-disruptive/test_nodemaps.tavern.yaml @@ -71,6 +71,16 @@ test_name: hsmAPIdefaultsNodeMapsDisruptive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # DELETE /Defaults/NodeMaps/{xname} NodeA API response code # DELETE /Defaults/NodeMaps/{xname} NodeA API response body - name: hsmAPIdefaultsNodeMapsXnameDELETEnodeA - DELETE any previously leftover test NodeMap for NodeA. @@ -78,6 +88,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -90,6 +102,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -102,6 +116,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n7" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -114,6 +130,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"Compute","SubRole":"Worker"},{"ID":"x9999c7s9b9n8","NID":9999999998,"Role":"Compute","SubRole":"Worker"},{"ID":"x9999c7s9b9n7","NID":9999999997,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 200 @@ -142,6 +160,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -187,6 +207,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -224,6 +246,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -261,6 +285,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -298,6 +324,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"Compute","SubRole":"Worker"},{"ID":"x9999c7s9b9n8","NID":9999999988,"Role":"Service","SubRole":"Master"},{"ID":"x9999c7s9b9n7","NID":9999999987,"Role":"Service","SubRole":"Worker"}]} response: status_code: 200 @@ -326,6 +354,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -371,6 +401,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -408,6 +440,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -445,6 +479,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -482,6 +518,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -509,6 +547,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n7" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -536,6 +576,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999979,"Role":"Storage","SubRole":"Storage"} response: status_code: 200 @@ -574,6 +616,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -611,6 +655,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999978,"Role":"Management","SubRole":"Master"} response: status_code: 200 @@ -649,6 +695,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -686,6 +734,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -713,6 +763,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_nodemaps_negative.tavern.yaml b/test/ct/api/3-disruptive/test_nodemaps_negative.tavern.yaml index 3d19a478..22f83b83 100644 --- a/test/ct/api/3-disruptive/test_nodemaps_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_nodemaps_negative.tavern.yaml @@ -89,6 +89,16 @@ test_name: hsmAPIdefaultsNodeMapsNegative stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token # POST /Defaults/NodeMaps Missing ID API response code # POST /Defaults/NodeMaps Missing ID API response body - name: hsmAPIdefaultsNodeMapsPOSTmissingID - Attempt to create a NodeMap with a payload that is missing its ID using POST. @@ -96,6 +106,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"NID":9999999999,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 400 @@ -134,6 +146,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","Role":"Compute","SubRole":"Worker"}]} response: status_code: 400 @@ -172,6 +186,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9v0","Role":"Compute","SubRole":"Worker"}]} response: status_code: 400 @@ -210,6 +226,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"Compute","SubRole":"Worker"},{"ID":"x9999c7s9b9n8","NID":9999999999,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 409 @@ -248,6 +266,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9v0","NID":9999999999,"Role":"Compute","SubRole":"Worker"},{"ID":"x9999c7s9b9n8v0","NID":9999999999,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 409 @@ -286,6 +306,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"FAKE","SubRole":"Worker"}]} response: status_code: 400 @@ -324,6 +346,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9v0","NID":9999999999,"Role":"FAKE","SubRole":"Worker"}]} response: status_code: 400 @@ -362,6 +386,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"Compute","SubRole":"FAKE"}]} response: status_code: 400 @@ -400,6 +426,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9v0","NID":9999999999,"Role":"Compute","SubRole":"FAKE"}]} response: status_code: 400 @@ -438,6 +466,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -475,6 +505,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -512,6 +544,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -549,6 +583,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/FAKE" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: #TODO: this should be a "Bad Request" with "invalid xname" returned, instead it attempts to use the invalid xname CASMHMS-5829 status_code: 404 @@ -587,6 +623,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -624,6 +662,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8n9v0" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -661,6 +701,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b8" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -698,6 +740,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -735,6 +779,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/FAKE" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"Storage","SubRole":"Storage"} response: status_code: 400 @@ -773,6 +819,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b7n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Role":"Storage","SubRole":"Storage"} response: status_code: 400 @@ -811,6 +859,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b7n9v0" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Role":"Storage","SubRole":"Storage"} response: status_code: 400 @@ -849,6 +899,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"FAKE","SubRole":"Worker"} response: status_code: 400 @@ -887,6 +939,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9v0" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"FAKE","SubRole":"Worker"} response: status_code: 400 @@ -925,6 +979,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"Service","SubRole":"FAKE"} response: status_code: 400 @@ -963,6 +1019,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9v0" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"Service","SubRole":"FAKE"} response: status_code: 400 @@ -1001,6 +1059,10 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9","NID":9999999999,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 200 @@ -1029,6 +1091,10 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"Compute","SubRole":"Worker"} response: status_code: 409 @@ -1067,6 +1133,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1094,6 +1162,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NodeMaps":[{"ID":"x9999c7s9b9n9v0","NID":9999999999,"Role":"Compute","SubRole":"Worker"}]} response: status_code: 200 @@ -1122,6 +1192,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n8v0" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999999,"Role":"Compute","SubRole":"Worker"} response: status_code: 409 @@ -1160,6 +1232,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/x9999c7s9b9n9v0" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_partitions.tavern.yaml b/test/ct/api/3-disruptive/test_partitions.tavern.yaml index e7ddc045..294b5052 100644 --- a/test/ct/api/3-disruptive/test_partitions.tavern.yaml +++ b/test/ct/api/3-disruptive/test_partitions.tavern.yaml @@ -67,11 +67,23 @@ test_name: Verify POST, GET, PATCH, and DELETE methods for various /partitions APIs stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token - name: Get four Node xnames from the HSM Components collection to use in upcoming stages request: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -86,6 +98,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /partitions partition1 API response code - name: Verify /partitions POST method @@ -94,6 +108,8 @@ stages: json: {"name":"p98","description":"Test partition 1 for HSM API testing in CT framework.","tags":["p98_tag1","p98_tag2"],"members":{"ids":["{xname1}","{xname2}"]}} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -104,6 +120,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -155,6 +173,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions?partition=p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -173,6 +193,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions?tag=p98_tag1" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -191,6 +213,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions?tag=p98_tag2" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -210,6 +234,8 @@ stages: json: {"description":"Fake test partition for HSM API testing in CT framework.","tags":["FAKE_tag1","FAKE_tag2"]} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -247,6 +273,8 @@ stages: json: {"description":"Test partition 1 for HSM API testing in CT framework (UPDATED).","tags":["p98_tag3","p98_tag4"]} method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 204 @@ -257,6 +285,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -306,6 +336,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p99" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" # POST /partitions partition2 API response code - name: Verify /partitions POST method @@ -314,6 +346,8 @@ stages: json: {"name":"p99","description":"Test partition 2 for HSM API testing in CT framework.","tags":["p99_tag1","p99_tag2"],"members":{"ids":["{xname3}"]}} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -324,6 +358,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p99" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -374,6 +410,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/names" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -405,6 +443,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -443,6 +483,8 @@ stages: json: {"id":"{xname4}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 201 @@ -453,6 +495,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -495,6 +539,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98/members/{xname1}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -522,6 +568,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98/members" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -563,6 +611,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98/members/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -600,6 +650,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p98" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -627,6 +679,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/p99" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -654,6 +708,8 @@ stages: url: "{hsm_base_url}/hsm/v2/partitions/names" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -683,6 +739,8 @@ stages: json: {"id":"{xname4}"} method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_redfish_endpoints.tavern.yaml b/test/ct/api/3-disruptive/test_redfish_endpoints.tavern.yaml index f253376f..ee2795f4 100644 --- a/test/ct/api/3-disruptive/test_redfish_endpoints.tavern.yaml +++ b/test/ct/api/3-disruptive/test_redfish_endpoints.tavern.yaml @@ -60,6 +60,18 @@ test_name: hsmAPIRedfishEndpoints stages: + + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + ############################################## # Remove any test RFEndpoints we previously created. # This will also remove any locks/reservations @@ -71,24 +83,32 @@ stages: request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname2} Clean up leftovers 2 - name: hsmAPIRedfishEndpointsDELETE - Delete leftover test RFEndpoint x9999c7s99b92 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b92" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname3} Clean up leftovers 3 - name: hsmAPIRedfishEndpointsDELETE - Delete leftover test RFEndpoint x9999c7s99b93 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname4} Clean up leftovers 4 - name: hsmAPIRedfishEndpointsDELETE - Delete leftover test RFEndpoint x9999c7s99b94 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b94" method: DELETE + headers: + Authorization: "Bearer {access_token}" ############################################## # Begin Tests @@ -100,6 +120,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b91","Enabled":true,"RediscoverOnUpdate":true} response: status_code: 201 @@ -131,6 +153,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b91","Enabled":true,"RediscoverOnUpdate":true} response: status_code: 409 @@ -168,6 +192,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -247,6 +273,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -273,6 +301,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -309,6 +339,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RedfishEndpoints":[{"ID":"x9999c7s99b92","Enabled":true,"RediscoverOnUpdate":true},{"ID":"x9999c7s99b93","Enabled":false,"RediscoverOnUpdate":false},{"ID":"x9999c7s99b94","Enabled":false,"RediscoverOnUpdate":false}]} response: status_code: 201 @@ -342,6 +374,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?id=x9999c7s99b92" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -434,6 +468,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?id=x9999c7s99b93&id=x9999c7s99b94" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -525,6 +561,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hostname":"MyHostname"} response: status_code: 500 @@ -562,6 +600,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Hostname":"MyHostname","FQDN":"MyHostname"} response: status_code: 200 @@ -645,6 +685,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b94" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"FQDN":"MyHostname"} response: status_code: 409 @@ -682,6 +724,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"MACAddr":"ff:ff:ff:ff:ff:ff:ff:ff"} response: status_code: 200 @@ -767,6 +811,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RediscoverOnUpdate":true} response: status_code: 200 @@ -852,6 +898,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -936,6 +984,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RediscoverOnUpdate":false,"Enabled":true} response: status_code: 200 @@ -1021,6 +1071,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1105,6 +1157,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RediscoverOnUpdate":true} response: status_code: 200 @@ -1190,6 +1244,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1211,6 +1267,7 @@ stages: enum: - "DiscoveryStarted" - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -1276,6 +1333,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b94" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b94","Enabled":true,"RediscoverOnUpdate":true} response: status_code: 200 @@ -1359,6 +1418,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b94" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1380,6 +1441,7 @@ stages: enum: - "DiscoveryStarted" - "HTTPsGetFailed" + - "NotYetQueried" RedfishVersion: type: str required: False @@ -1442,6 +1504,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1469,6 +1533,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" # method: PUT # verify: !bool "{verify}" + # headers: + # Authorization: "Bearer {access_token}" # json: {"ID":"x9999c7s99b93","Enabled":true,"RediscoverOnUpdate":true} # response: # status_code: 404 @@ -1506,6 +1572,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Enabled":true,"RediscoverOnUpdate":true} response: status_code: 404 @@ -1543,21 +1611,29 @@ stages: request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname2} Clean up leftovers 2 - name: hsmAPIRedfishEndpointsDELETE - Clean up test RFEndpoint x9999c7s99b92 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b92" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname3} Clean up leftovers 3 - name: hsmAPIRedfishEndpointsDELETE - Clean up test RFEndpoint x9999c7s99b93 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b93" method: DELETE + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/RedfishEndpoints/{xname4} Clean up leftovers 4 - name: hsmAPIRedfishEndpointsDELETE - Clean up test RFEndpoint x9999c7s99b94 request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b94" method: DELETE + headers: + Authorization: "Bearer {access_token}" diff --git a/test/ct/api/3-disruptive/test_redfish_endpoints_negative.tavern.yaml b/test/ct/api/3-disruptive/test_redfish_endpoints_negative.tavern.yaml index dcb9db49..506788d7 100644 --- a/test/ct/api/3-disruptive/test_redfish_endpoints_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_redfish_endpoints_negative.tavern.yaml @@ -47,12 +47,25 @@ test_name: hsmAPIRedfishEndpointsNegative stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # GET /Inventory/RedfishEndpoints Invalid xname - name: hsmAPIRedfishEndpointsGET - Invalid xname request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?id=foo" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -89,6 +102,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?type=foo" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -125,6 +140,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"foo"} response: status_code: 400 @@ -162,6 +179,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b91","FQDN":"MyFQDN","Hostname":"MyHostname"} response: status_code: 400 @@ -199,6 +218,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RedfishEndpoints":[{"ID":"foo"}]} response: status_code: 400 @@ -236,6 +257,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"RedfishEndpoints":[{"ID":"x9999c7s99b91","FQDN":"MyFQDN","Hostname":"MyHostname"}]} response: status_code: 400 @@ -273,6 +296,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/foo" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -309,6 +334,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -345,6 +372,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/foo" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"foo"} response: status_code: 400 @@ -382,6 +411,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"foo"} response: status_code: 400 @@ -419,6 +450,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b91","FQDN":"MyFQDN","Hostname":"MyHostname"} response: status_code: 400 @@ -457,6 +490,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" # method: PUT # verify: !bool "{verify}" + # headers: + # Authorization: "Bearer {access_token}" # json: {"ID":"x9999c7s99b91"} # response: # status_code: 404 @@ -494,6 +529,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/foo" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"foo"} response: status_code: 400 @@ -531,6 +568,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ID":"x9999c7s99b91"} response: status_code: 404 @@ -568,6 +607,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/foo" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 verify_response_with: @@ -604,6 +645,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints/x9999c7s99b91" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: diff --git a/test/ct/api/3-disruptive/test_service_negative.tavern.yaml b/test/ct/api/3-disruptive/test_service_negative.tavern.yaml index 466dce88..51ce009f 100644 --- a/test/ct/api/3-disruptive/test_service_negative.tavern.yaml +++ b/test/ct/api/3-disruptive/test_service_negative.tavern.yaml @@ -62,7 +62,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PATCH /service/ready API response code # PATCH /service/ready API response body @@ -73,7 +73,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PUT /service/ready API response code # PUT /service/ready API response body @@ -84,7 +84,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # DELETE /service/ready API response code # DELETE /service/ready API response body @@ -94,7 +94,7 @@ stages: method: DELETE verify: !bool "{verify}" response: - status_code: 404 + status_code: 405 # POST /service/liveness API response code # POST /service/liveness API response body @@ -105,7 +105,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PATCH /service/liveness API response code # PATCH /service/liveness API response body @@ -116,7 +116,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PUT /service/liveness API response code # PUT /service/liveness API response body @@ -127,7 +127,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # DELETE /service/liveness API response code # DELETE /service/liveness API response body @@ -137,7 +137,7 @@ stages: method: DELETE verify: !bool "{verify}" response: - status_code: 404 + status_code: 405 # POST /service/values API response code # POST /service/values API response body @@ -148,7 +148,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PATCH /service/values API response code # PATCH /service/values API response body @@ -159,7 +159,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # PUT /service/values API response code # PUT /service/values API response body @@ -170,7 +170,7 @@ stages: verify: !bool "{verify}" json: {"fake":"payload"} response: - status_code: 404 + status_code: 405 # DELETE /service/values API response code # DELETE /service/values API response body @@ -180,4 +180,4 @@ stages: method: DELETE verify: !bool "{verify}" response: - status_code: 404 \ No newline at end of file + status_code: 405 diff --git a/test/ct/api/3-disruptive/test_state_change_notifications.tavern.yaml b/test/ct/api/3-disruptive/test_state_change_notifications.tavern.yaml deleted file mode 100644 index 2f2ac013..00000000 --- a/test/ct/api/3-disruptive/test_state_change_notifications.tavern.yaml +++ /dev/null @@ -1,647 +0,0 @@ -# MIT License -# -# (C) Copyright [2023] 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 Hardware State Manager (HSM) State Change Notifications (SCN) API. -# Author: Mitch Schooler -# Service: Hardware State Manager - -# HMS test metrics test cases: 13 -# POST /Subscriptions/SCN -# GET /Subscriptions/SCN -# GET /Subscriptions/SCN/{id} initial subscription -# PATCH /Subscriptions/SCN/{id} remove -# GET /Subscriptions/SCN/{id} updated remove subscription -# PATCH /Subscriptions/SCN/{id} add -# GET /Subscriptions/SCN/{id} updated add subscription -# PATCH /Subscriptions/SCN/{id} replace -# GET /Subscriptions/SCN/{id} updated replace subscription -# PUT /Subscriptions/SCN/{id} -# GET /Subscriptions/SCN/{id} replaced subscription -# DELETE /Subscriptions/SCN/{id} existing subscription -# DELETE /Subscriptions/SCN/{id} nonexistent subscription ---- -test_name: Verify POST, GET, PATCH, PUT, and DELETE methods for the State Change Notifications APIs - -stages: - ############# - # Setup # - ############# - - - name: Retrieve first test subscription ID to delete (if present) - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - $ext: - function: hsm_test_utils:get_id_of_scn_subscriber_url - extra_kwargs: - subscriber_url: "test-hmnfd-9z9z999zzz-9zz9z_9http://test-hmnfd/hmi/v1/scn" - - - name: Delete first test subscription to prevent conflicts (if present) - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subscriber_url_id}" - method: DELETE - verify: !bool "{verify}" - - - name: Retrieve second test subscription ID to delete (if present) - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - save: - $ext: - function: hsm_test_utils:get_id_of_scn_subscriber_url - extra_kwargs: - subscriber_url: "test-hmnfd-9z9z999zzz-9zz9z_8http://test-hmnfd/hmi/v1/scn" - - - name: Delete second test subscription to prevent conflicts (if present) - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subscriber_url_id}" - method: DELETE - verify: !bool "{verify}" - - ############# - # Tests # - ############# - - # POST /Subscriptions/SCN - - name: Create a State Change Notification subscription - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" - method: POST - verify: !bool "{verify}" - json: {"Subscriber":"test-hmnfd-9z9z999zzz-9zz9z_9","Enabled":true,"Roles":["compute","service"],"SoftwareStatus":["SCN subscription for CT testing."],"States":["Empty","Populated","Off","On","Standby","Halt","Ready"],"Url":"http://test-hmnfd/hmi/v1/scn"} - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - required: True - mapping: - ID: - type: int - required: True - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_9" - Enabled: - type: bool - required: True - enum: - - true - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "compute" - - "service" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "Populated" - - "Off" - - "On" - - "Standby" - - "Halt" - - "Ready" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - save: - json: - subID: ID - - # GET /Subscriptions/SCN - - name: Retrieve all State Change Notification subscriptions - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" - 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: - SubscriptionList: - type: seq - required: True - matching: all - sequence: - - type: map - required: True - mapping: - ID: - type: int - required: True - Subscriber: - type: str - required: True - Enabled: - type: bool - required: False - Roles: - type: seq - required: False - matching: all - sequence: - - type: str - SoftwareStatus: - type: seq - required: False - matching: all - sequence: - - type: str - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "empty" - - "Unknown" - - "unknown" - - "Populated" - - "populated" - - "Off" - - "off" - - "On" - - "on" - - "Standby" - - "standby" - - "Halt" - - "halt" - - "Ready" - - "ready" - Url: - type: str - required: True - - # GET /Subscriptions/SCN/{id} initial subscription - - name: Retrieve a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - enum: - - !int "{subID}" - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_9" - Enabled: - type: bool - required: True - enum: - - true - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "compute" - - "service" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "Populated" - - "Off" - - "On" - - "Standby" - - "Halt" - - "Ready" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - - # PATCH /Subscriptions/SCN/{id} remove - - name: Update a State Change Notification subscription with a remove operation - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: PATCH - verify: !bool "{verify}" - json: {"Op":"remove","Roles":["compute"],"States":["Empty","Populated"]} - response: - status_code: 204 - - # GET /Subscriptions/SCN/{id} updated remove subscription - - name: Retrieve a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - enum: - - !int "{subID}" - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_9" - Enabled: - type: bool - required: True - enum: - - true - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "service" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Off" - - "On" - - "Standby" - - "Halt" - - "Ready" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - - # PATCH /Subscriptions/SCN/{id} add - - name: Update a State Change Notification subscription with an add operation - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: PATCH - verify: !bool "{verify}" - json: {"Op":"add","Roles":["compute"],"States":["Populated"]} - response: - status_code: 204 - - # GET /Subscriptions/SCN/{id} updated add subscription - - name: Retrieve a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - enum: - - !int "{subID}" - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_9" - Enabled: - type: bool - required: True - enum: - - true - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "compute" - - "service" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Populated" - - "Off" - - "On" - - "Standby" - - "Halt" - - "Ready" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - - # PATCH /Subscriptions/SCN/{id} replace - - name: Update a State Change Notification subscription with a replace operation - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: PATCH - verify: !bool "{verify}" - json: {"Op":"replace","Roles":["service"],"States":["Ready","On","Standby"]} - response: - status_code: 204 - - # GET /Subscriptions/SCN/{id} updated replace subscription - - name: Retrieve a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - enum: - - !int "{subID}" - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_9" - Enabled: - type: bool - required: True - enum: - - true - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "service" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Ready" - - "On" - - "Standby" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - - # PUT /Subscriptions/SCN/{id} - - name: Replace a State Change Notification subscription - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: PUT - verify: !bool "{verify}" - json: {"Subscriber":"test-hmnfd-9z9z999zzz-9zz9z_8","Enabled":false,"Roles":["compute"],"SoftwareStatus":["SCN subscription for CT testing."],"States":["Empty","Populated","Off","On","Halt"],"Url":"http://test-hmnfd/hmi/v1/scn"} - response: - status_code: 204 - - # GET /Subscriptions/SCN/{id} replaced subscription - - name: Retrieve a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: int - required: True - enum: - - !int "{subID}" - Subscriber: - type: str - required: True - enum: - - "test-hmnfd-9z9z999zzz-9zz9z_8" - Enabled: - type: bool - required: True - enum: - - false - Roles: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "compute" - SoftwareStatus: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "SCN subscription for CT testing." - States: - type: seq - required: True - matching: all - sequence: - - type: str - enum: - - "Empty" - - "Populated" - - "On" - - "Off" - - "Halt" - Url: - type: str - required: True - enum: - - "http://test-hmnfd/hmi/v1/scn" - - # DELETE /Subscriptions/SCN/{id} existing subscription - - name: Delete a State Change Notification subscription by ID - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - code: - type: int - required: True - enum: - - 0 - message: - type: str - required: True - enum: - - "Subscription deleted" - - # DELETE /Subscriptions/SCN/{id} nonexistent subscription - - name: Attempt to delete a State Change Notification subscription by ID that doesn't exist - request: - url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN/{subID}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 404 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - type: - type: str - required: True - enum: - - "about:blank" - title: - type: str - required: True - enum: - - "Not Found" - detail: - type: str - required: True - enum: - - "Subscription not found" - status: - type: int - required: True - enum: - - 404 diff --git a/test/ct/api/4-destructive-initial/test_component_endpoints.tavern.yaml b/test/ct/api/4-destructive-initial/test_component_endpoints.tavern.yaml index c101a68c..68ed6ebb 100644 --- a/test/ct/api/4-destructive-initial/test_component_endpoints.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_component_endpoints.tavern.yaml @@ -37,12 +37,25 @@ test_name: Verify destructive ComponentEndpoint operations stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # GET /Inventory/ComponentEndpoints retrieve ID - name: Retrieve a ComponentEndpoint ID for a Node to be used in later stages request: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -77,6 +90,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -101,6 +116,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -113,6 +130,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/{id}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -127,6 +146,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -136,6 +157,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -150,6 +173,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ComponentEndpoints/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 400 json: diff --git a/test/ct/api/4-destructive-initial/test_components.tavern.yaml b/test/ct/api/4-destructive-initial/test_components.tavern.yaml index e6ddd914..9f6786c5 100644 --- a/test/ct/api/4-destructive-initial/test_components.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_components.tavern.yaml @@ -337,6 +337,17 @@ test_name: hsmAPIstateComponentsDestructive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # DELETE /State/Components API response code # DELETE /State/Components API response body - name: hsmAPIstateComponentsDELETE - Remove all Components using DELETE. @@ -344,6 +355,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -356,6 +369,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -393,6 +408,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -405,6 +422,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9n9","Type":"Node","State":"On","Flag":"OK","Enabled":true,"SoftwareStatus":"AdminStatus","Role":"Compute","NID":9999999999,"NetType":"Sling","Arch":"X86","Class":"River"}],"Force":false} response: status_code: 204 @@ -416,6 +435,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -428,6 +449,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -506,6 +529,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Component":{"ID":"x9999c7s9b9n9","Type":"Node","State":"Standby","Flag":"Alert","Enabled":true,"SoftwareStatus":"AdminStatus","Role":"Compute","NID":9999999999,"NetType":"Infiniband","Arch":"ARM","Class":"River"},"Force":false} response: status_code: 204 @@ -517,6 +542,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -587,6 +614,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Component":{"ID":"x9999c7s9b9n9","Type":"Node","State":"Standby","Flag":"Alert","Enabled":true,"SoftwareStatus":"AdminStatus","Role":"Compute","NID":9999999999,"NetType":"Infiniband","Arch":"ARM","Class":"River"},"Force":true} response: status_code: 204 @@ -598,6 +627,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -668,6 +699,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -695,6 +728,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -732,6 +767,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -769,6 +806,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/9999999999" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -806,6 +845,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: PUT verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Component":{"ID":"x9999c7s9b9n9","Type":"Node","State":"Ready","Flag":"OK","Enabled":true,"SoftwareStatus":"AdminStatus","Role":"Compute","NID":9999999999,"NetType":"Ethernet","Arch":"Other","Class":"River"},"Force":false} response: status_code: 204 @@ -817,6 +858,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9n9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -887,6 +930,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -914,6 +959,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9","Type":"NodeBMC","State":"Ready","Flag":"OK","Enabled":true,"Role":"Management","NetType":"Sling","Arch":"X86","Class":"River","Locked":false}],"Force":false} response: status_code: 204 @@ -925,6 +972,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9","Type":"NodeBMC","State":"Off","Flag":"Warning","Enabled":false,"Role":"Management","NetType":"Infiniband","Arch":"ARM","Class":"Mountain","Locked":true}],"Force":false} response: status_code: 204 @@ -936,6 +985,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -996,6 +1047,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9","Type":"NodeBMC","State":"Off","Flag":"Warning","Enabled":false,"Role":"Management","NetType":"Infiniband","Arch":"ARM","Class":"Mountain","Locked":true}],"Force":true} response: status_code: 204 @@ -1007,6 +1060,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b9" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1067,6 +1122,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b9n8","Type":"Node","State":"Unknown","Flag":"Unknown","Enabled":true,"SoftwareStatus":"TestStatus8","Role":"Compute","SubRole":"Master","NID":9999999998,"NetType":"Sling","Arch":"X86","Class":"River"},{"ID":"x9999c7s9b9n7","Type":"Node","State":"Empty","Flag":"OK","Enabled":true,"SoftwareStatus":"TestStatus7","Role":"Service","SubRole":"Worker","NID":9999999997,"NetType":"Infiniband","Arch":"X86","Class":"River"},{"ID":"x9999c7s9b9n6","Type":"Node","State":"Populated","Flag":"Warning","Enabled":true,"SoftwareStatus":"TestStatus6","Role":"System","SubRole":"Storage","NID":9999999996,"NetType":"Ethernet","Arch":"ARM","Class":"River"},{"ID":"x9999c7s9b9n5","Type":"Node","State":"Off","Flag":"Warn","Enabled":true,"SoftwareStatus":"TestStatus5","Role":"Application","SubRole":"Master","NID":9999999995,"NetType":"OEM","Arch":"ARM","Class":"Mountain"},{"ID":"x9999c7s9b9n4","Type":"Node","State":"On","Flag":"Alert","Enabled":false,"SoftwareStatus":"TestStatus4","Role":"Storage","SubRole":"Worker","NID":9999999994,"NetType":"None","Arch":"Other","Class":"Mountain"},{"ID":"x9999c7s9b9n3","Type":"Node","State":"Standby","Flag":"Locked","Enabled":false,"SoftwareStatus":"TestStatus3","Role":"Management","SubRole":"Storage","NID":9999999993,"NetType":"Sling","Arch":"Other","Class":"Mountain"},{"ID":"x9999c7s9b9n2","Type":"Node","State":"Halt","Flag":"OK","Enabled":false,"SoftwareStatus":"TestStatus2","Role":"Compute","SubRole":"Master","NID":9999999992,"NetType":"Sling","Arch":"Unknown","Class":"Hill"},{"ID":"x9999c7s9b9n1","Type":"Node","State":"Ready","Flag":"OK","Enabled":false,"SoftwareStatus":"TestStatus1","Role":"Compute","SubRole":"Worker","NID":9999999991,"NetType":"Sling","Arch":"Unknown","Class":"Hill"},{"ID":"x9999c7s9b9n0","Type":"Node","State":"Ready","Flag":"OK","Enabled":true,"SoftwareStatus":"TestStatus0","Role":"Compute","SubRole":"Storage","NID":9999999990,"NetType":"Sling","Arch":"X86","Class":"Hill"}],"Force":false} response: status_code: 204 @@ -1078,6 +1135,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9e9","Type":"NodeEnclosure","State":"On","Flag":"OK","Enabled":false,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 204 @@ -1089,6 +1148,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7r9b9","Type":"RouterBMC","State":"Ready","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"},{"ID":"x9999c7r9","Type":"RouterModule","State":"Empty","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 204 @@ -1100,6 +1161,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7","Type":"Chassis","State":"Off","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"},{"ID":"x9999c7b0","Type":"ChassisBMC","State":"Ready","Flag":"OK","Enabled":true,"NetType":"Sling","Arch":"X86","Class":"Mountain"}],"Force":false} response: status_code: 204 @@ -1111,6 +1174,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7r9e9","Type":"HSNBoard","State":"On","Flag":"Warning","Enabled":false,"NetType":"Sling","Arch":"X86","Class":"River"},{"ID":"x9999m3","Type":"CabinetPDUController","State":"Ready","Flag":"OK","Enabled":true,"NetType":"Infiniband","Arch":"X86"}],"Force":false} response: status_code: 204 @@ -1122,6 +1187,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=CabinetPDUController" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1180,6 +1247,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=ChassisBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1243,6 +1312,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Chassis" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1306,6 +1377,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=HSNBoard" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1369,6 +1442,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1437,6 +1512,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=NodeEnclosure" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1500,6 +1577,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1564,6 +1643,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1627,6 +1708,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?type=RouterModule" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1690,6 +1773,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Unknown&stateonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1735,6 +1820,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Empty" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1802,6 +1889,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Populated" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1885,6 +1974,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Off" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -1950,6 +2041,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=On" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2013,6 +2106,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Standby" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2096,6 +2191,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Halt" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2179,6 +2276,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?state=Ready" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2242,6 +2341,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?flag=OK&flagonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2278,6 +2379,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?flag=Warning" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2341,6 +2444,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?flag=Alert" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2424,6 +2529,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?flag=Locked" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2507,6 +2614,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Compute&roleonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2548,6 +2657,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Service" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2631,6 +2742,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=System" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2714,6 +2827,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Application" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2797,6 +2912,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Storage" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2880,6 +2997,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?role=Management" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -2945,6 +3064,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?subrole=Master" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3010,6 +3131,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?subrole=Worker" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3075,6 +3198,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?subrole=Storage" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3140,6 +3265,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?enabled=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3203,6 +3330,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?enabled=False" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3266,6 +3395,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?softwarestatus=TestStatus0" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3349,6 +3480,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?arch=X86" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3412,6 +3545,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?arch=ARM" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3475,6 +3610,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?arch=Other" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3538,6 +3675,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?class=River" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3601,6 +3740,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?class=Mountain" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3664,6 +3805,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?class=Hill" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3727,6 +3870,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?nid=9999999990&nidonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3767,6 +3912,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?nid_start=9999999996" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3838,6 +3985,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?nid_start=9999999996&nid_end=9999999997" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3907,6 +4056,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b9n0&type=Node&state=Ready&flag=OK&enabled=true&softwarestatus=TestStatus0&role=Compute&subrole=Storage&nid=9999999990&nettype=Sling&arch=X86&class=Hill" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -3992,6 +4143,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n8"]} response: status_code: 200 @@ -4078,6 +4231,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n8"],"Type":["Node"]} response: status_code: 200 @@ -4164,6 +4319,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n1"],"State":["Ready"],"stateonly":true} response: status_code: 200 @@ -4210,6 +4367,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n7"],"Flag":["OK"],"flagonly":true} response: status_code: 200 @@ -4251,6 +4410,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n6"],"Enabled":["true"]} response: status_code: 200 @@ -4337,6 +4498,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n5"],"SoftwareStatus":["TestStatus5"]} response: status_code: 200 @@ -4423,6 +4586,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n2"],"Role":["Compute"],"roleonly":true} response: status_code: 200 @@ -4469,6 +4634,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n8"],"SubRole":["Master"]} response: status_code: 200 @@ -4555,6 +4722,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n7"],"Arch":["X86"]} response: status_code: 200 @@ -4641,6 +4810,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n6"],"Class":["River"]} response: status_code: 200 @@ -4727,6 +4898,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n3"],"NID":["9999999993"],"nidonly":true} response: status_code: 200 @@ -4768,6 +4941,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n8","x9999c7s9b9n7","x9999c7s9b9n6"],"nid_start":["9999999996"]} response: status_code: 200 @@ -4840,6 +5015,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n8","x9999c7s9b9n7","x9999c7s9b9n6"],"nid_start":["9999999996"],"nid_end":["9999999997"]} response: status_code: 200 @@ -4910,6 +5087,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b9n3"],"Type":["Node"],"State":["Standby"],"Flag":["Locked"],"Enabled":["false"],"SoftwareStatus":["TestStatus3"],"Role":["Management"],"SubRole":["Storage"],"Arch":["Other"],"Class":["Mountain"],"NID":["9999999993"]} response: status_code: 200 @@ -4996,6 +5175,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999998"]} response: status_code: 200 @@ -5082,6 +5263,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999998"],"Type":["Node"]} response: status_code: 200 @@ -5168,6 +5351,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999991"],"State":["Ready"],"stateonly":true} response: status_code: 200 @@ -5214,6 +5399,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999997"],"Flag":["OK"],"flagonly":true} response: status_code: 200 @@ -5255,6 +5442,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999996"],"Enabled":["true"]} response: status_code: 200 @@ -5341,6 +5530,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999995"],"SoftwareStatus":["TestStatus5"]} response: status_code: 200 @@ -5427,6 +5618,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999995"],"Role":["Compute"],"roleonly":true} response: status_code: 200 @@ -5473,6 +5666,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999998"],"SubRole":["Master"]} response: status_code: 200 @@ -5559,6 +5754,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999997"],"Arch":["X86"]} response: status_code: 200 @@ -5645,6 +5842,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999996"],"Class":["River"]} response: status_code: 200 @@ -5731,6 +5930,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999993"],"NID":["9999999993"],"nidonly":true} response: status_code: 200 @@ -5772,6 +5973,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999996-9999999998"],"nid_start":["9999999996"]} response: status_code: 200 @@ -5844,6 +6047,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/Query" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NIDRanges":["9999999993"],"Type":["Node"],"State":["Standby"],"Flag":["Locked"],"Enabled":["false"],"SoftwareStatus":["TestStatus3"],"Role":["Management"],"SubRole":["Storage"],"Arch":["Other"],"Class":["Mountain"]} response: status_code: 200 @@ -5930,6 +6135,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6015,6 +6222,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n8?type=Node" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6100,6 +6309,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n1?state=Ready&stateonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6145,6 +6356,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n7?flag=OK&flagonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6185,6 +6398,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n6?enabled=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6270,6 +6485,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n5?softwarestatus=TestStatus5" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6355,6 +6572,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n2?role=Compute&roleonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6400,6 +6619,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n8?subrole=Master" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6485,6 +6706,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n7?arch=X86" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6570,6 +6793,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n6?class=River" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6655,6 +6880,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n3?nid=9999999993&nidonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6696,6 +6923,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n6?nid_start=9999999996" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6768,6 +6997,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n6?nid_start=9999999996&nid_end=9999999997" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6837,6 +7068,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/Query/x9999c7s9b9n3?type=Node&state=Standby&flag=Locked&enabled=False&SoftwareStatus=TestStatus3&role=Management&subrole=Storage&arch=Other&class=Mountain&NID=9999999993" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6922,6 +7155,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/9999999990" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -6999,6 +7234,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/ByNID/9999999998" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7076,6 +7313,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b8n8","Type":"Node","State":"Ready","Flag":"OK","Enabled":true,"SoftwareStatus":"TestStatus8","Role":"Compute","SubRole":"Master","NID":9999999988,"NetType":"Sling","Arch":"X86","Class":"River"},{"ID":"x9999c7s9b8n7","Type":"Node","State":"On","Flag":"Alert","Enabled":true,"SoftwareStatus":"TestStatus7","Role":"Service","SubRole":"Worker","NID":9999999987,"NetType":"Infiniband","Arch":"Other","Class":"Mountain"},{"ID":"x9999c7s9b8n6","Type":"Node","State":"Off","Flag":"Warning","Enabled":true,"SoftwareStatus":"TestStatus6","Role":"System","SubRole":"Storage","NID":9999999986,"NetType":"Ethernet","Arch":"ARM","Class":"Hill"}],"Force":false} response: status_code: 204 @@ -7087,6 +7326,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkStateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" #TODO: Example payload shows force option but Swagger doesn't explain what it does, Force=false seemed to only update the first node x9999c7s9b8n8 CASMHMS-5837 #json: {"ComponentIDs":["x9999c7s9b8n8","x9999c7s9b8n7"],"State":"Standby","Flag":"Alert","Force":false} json: {"ComponentIDs":["x9999c7s9b8n8","x9999c7s9b8n7"],"State":"Standby","Flag":"Alert","Force":true} @@ -7100,6 +7341,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7177,6 +7420,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7254,6 +7499,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7331,6 +7578,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6/StateData" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" #TODO: Example payload shows force option but Swagger doesn't explain what it does, Force=false and Force=true seem to do the same thing here CASMHMS-5837 #json: {"State":"Ready","Flag":"OK","Force":false} json: {"State":"Ready","Force":true} @@ -7344,6 +7593,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b8n6&stateonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7389,6 +7640,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b8n6&flagonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7429,6 +7682,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b8n6&roleonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7474,6 +7729,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b8n6&nidonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7514,6 +7771,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkFlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"Flag":"Warning"} response: status_code: 204 @@ -7525,6 +7784,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7602,6 +7863,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7679,6 +7942,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7756,6 +8021,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/FlagOnly" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Flag":"OK"} response: status_code: 204 @@ -7767,6 +8034,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components?id=x9999c7s9b8n8&flagonly=True" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7807,6 +8076,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkEnabled" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"Enabled":false} response: status_code: 204 @@ -7818,6 +8089,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7895,6 +8168,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -7972,6 +8247,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8049,6 +8326,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/Enabled" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Enabled":false} response: status_code: 204 @@ -8060,6 +8339,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8137,6 +8418,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkSoftwareStatus" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"SoftwareStatus":"UpdatedBulkSoftwareStatus"} response: status_code: 204 @@ -8148,6 +8431,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8225,6 +8510,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8302,6 +8589,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8379,6 +8668,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/SoftwareStatus" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"SoftwareStatus":"UpdatedXnameSoftwareStatus"} response: status_code: 204 @@ -8390,6 +8681,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8467,6 +8760,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkRole" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"ComponentIDs":["x9999c7s9b8n7","x9999c7s9b8n6"],"Role":"Compute","SubRole":"Worker"} response: status_code: 204 @@ -8478,6 +8773,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8555,6 +8852,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8632,6 +8931,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8709,6 +9010,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/Role" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Role":"Service","SubRole":"Worker"} response: status_code: 204 @@ -8720,6 +9023,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8797,6 +9102,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/BulkNID" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"Components":[{"ID":"x9999c7s9b8n7","NID":9999999977},{"ID":"x9999c7s9b8n6","NID":9999999976}]} response: status_code: 204 @@ -8808,6 +9115,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n7" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8885,6 +9194,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n6" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -8962,6 +9273,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -9039,6 +9352,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8/NID" method: PATCH verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"NID":9999999978} response: status_code: 204 @@ -9050,6 +9365,8 @@ stages: url: "{hsm_base_url}/hsm/v2/State/Components/x9999c7s9b8n8" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -9128,1129 +9445,1131 @@ stages: method: DELETE verify: !bool "{verify}" ---- -test_name: Verify Component operations on (Virtual)Nodes with no system role information in SLS or NodeMaps - -marks: - - parametrize: - key: - - type - - xname - - bogus_nid - vals: - - [Node, x9999c5s17b0n0, 163850784] - - [Node, x9999c5s17b0n1, 163850785] - - [VirtualNode, x9999c5s17b0n0v0, 163850784] - - [VirtualNode, x9999c5s17b0n0v1, 163850785] - -stages: - # Remove test node from SLS - - name: Remove any test {type} from SLS - request: - url: "{sls_base_url}/v1/hardware/{xname}" - method: DELETE - verify: !bool "{verify}" - - # Remove any node maps from HSM for the node - - name: Remove any test {type} from NodeMaps - request: - url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" - method: DELETE - verify: !bool "{verify}" - - # Remove any test Node from State Components - - name: Remove any test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - - # POST Create Node with no system role information - - name: Create {type} component using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Compute" # This is the role that nodes get by default - NID: - type: int - enum: - - !int "{bogus_nid}" # Bogus NID computed from xname - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # POST Create node with System role information - - name: Create {type} component using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - Role: Management - SubRole: Worker - NID: 9999999977 - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with no system role information - - name: Create Node component using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Compute" # This is the role that nodes get by default - NID: - type: int - enum: - - !int "{bogus_nid}" # Bogus NID computed from xname - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with system role information - - name: Create {type} component using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - Role: Management - SubRole: Worker - NID: 9999999977 - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - # DELETE Node - - name: Remove test Node from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - ---- -test_name: Verify Component operations on (Virtual)Nodes with system role information in SLS - -marks: - - parametrize: - key: - - type - - xname - vals: - - [Node, x9999c5s17b0n0] - - [Node, x9999c5s17b0n1] - - [VirtualNode, x9999c5s17b0n0v0] - - [VirtualNode, x9999c5s17b0n0v1] - -stages: - # PUT test virtual node from SLS - - name: Create using PUT the test {type} into SLS - request: - url: "{sls_base_url}/v1/hardware/{xname}" - method: PUT - verify: !bool "{verify}" - json: - ID: "{xname}" - Class: River - ExtraProperties: - Role: Application - SubRole: Storage - NID: 9999999967 - Aliases: - - uan999 - response: - status_code: - - 201 - - - # Remove any node maps from HSM for the node - - name: Remove any test {type} from NodeMaps - request: - url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" - method: DELETE - verify: !bool "{verify}" - - # Remove any test Node from State Components - - name: Remove any test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - - # POST Create Node with no system role information - - name: Create {type} component using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Application" - SubRole: - type: str - enum: - - "Storage" - NID: - type: int - enum: - - 9999999967 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # POST Create node with System role information - - name: Create {type} component using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - Role: Management # This ROle is different than SLS - SubRole: Worker # This SubRole is different than SLS - NID: 9999999977 # This NID is different than SLS - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with no system role information - - name: Create Node component using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Application" - SubRole: - type: str - enum: - - "Storage" - NID: - type: int - enum: - - 9999999967 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with system role information - - name: Create {type} component using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - Role: Management - SubRole: Worker - NID: 9999999977 - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - # DELETE Node - - name: Remove test Node from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - - # Remove test node from SLS - - name: Remove the test {type} from SLS - request: - url: "{sls_base_url}/v1/hardware/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - ---- -test_name: Verify Component operations on (Virtual)Nodes with system role information in NodeMaps - -marks: - - parametrize: - key: - - type - - xname - vals: - - [Node, x9999c5s17b0n0] - - [Node, x9999c5s17b0n1] - - [VirtualNode, x9999c5s17b0n0v0] - - [VirtualNode, x9999c5s17b0n0v1] - -stages: - # Delete test virtual node from SLS - - name: Remove any test {type} from SLS - request: - url: "{sls_base_url}/v1/hardware/{xname}" - method: DELETE - verify: !bool "{verify}" - - # PUT test virtual node into HSM NodeMaps - - name: Create test {type} in NodeMaps - request: - url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Role: Application - SubRole: Storage - NID: 9999999967 - response: - status_code: 200 - - # Remove any test Node from State Components - - name: Remove any test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - - # POST Create Node with no system role information - - name: Create {type} component using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Application" - SubRole: - type: str - enum: - - "Storage" - NID: - type: int - enum: - - 9999999967 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # POST Create node with System role information - - name: Create {type} component using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components" - method: POST - verify: !bool "{verify}" - json: - Components: - - ID: "{xname}" - State: Populated - Role: Management # This ROle is different than NodeMaps - SubRole: Worker # This SubRole is different than NodeMaps - NID: 9999999977 # This NID is different than NodeMaps - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using POST with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with no system role information - - name: Create Node component using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with no system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Application" - SubRole: - type: str - enum: - - "Storage" - NID: - type: int - enum: - - 9999999967 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - - # DELETE Node - - name: Remove test {type} from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - # PUT Node with system role information - - name: Create {type} component using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: PUT - verify: !bool "{verify}" - json: - Component: - ID: "{xname}" - State: Populated - Role: Management - SubRole: Worker - NID: 9999999977 - Class: River - Arch: X86 - NetType: "Sling" - - response: - status_code: 204 - - # GET Verify Node was created successfully - - name: Verify {type} component was successfully created using PUT with system role information - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: GET - verify: !bool "{verify}" - response: - status_code: 200 - verify_response_with: - function: tavern.testutils.helpers:validate_pykwalify - extra_kwargs: - schema: - type: map - mapping: - ID: - type: str - enum: - - "{xname}" - Type: - type: str - enum: - - "{type}" - State: - type: str - enum: - - Populated - Flag: - type: str - enum: - - OK - Enabled: - type: bool - enum: - - True - Role: - type: str - enum: - - "Management" - SubRole: - type: str - enum: - - "Worker" - NID: - type: int - enum: - - 9999999977 - Class: - type: str - enum: - - "River" - Arch: - type: str - enum: - - "X86" - NetType: - type: str - enum: - - "Sling" - # DELETE Node - - name: Remove test Node from State Components - request: - url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 - - - # Remove test node from NodeMaps - - name: Remove the test {type} from NodeMaps - request: - url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" - method: DELETE - verify: !bool "{verify}" - response: - status_code: 200 +# --- +# test_name: Verify Component operations on (Virtual)Nodes with no system role information in SLS or NodeMaps +# +# marks: +# - parametrize: +# key: +# - type +# - xname +# - bogus_nid +# vals: +# - [Node, x9999c5s17b0n0, 163850784] +# - [Node, x9999c5s17b0n1, 163850785] +# - [VirtualNode, x9999c5s17b0n0v0, 163850784] +# - [VirtualNode, x9999c5s17b0n0v1, 163850785] +# +# stages: +# # Remove test node from SLS +# - name: Remove any test {type} from SLS +# request: +# url: "{sls_base_url}/v1/hardware/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # Remove any node maps from HSM for the node +# - name: Remove any test {type} from NodeMaps +# request: +# url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # Remove any test Node from State Components +# - name: Remove any test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # POST Create Node with no system role information +# - name: Create {type} component using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Compute" # This is the role that nodes get by default +# NID: +# type: int +# enum: +# - !int "{bogus_nid}" # Bogus NID computed from xname +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # POST Create node with System role information +# - name: Create {type} component using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# Role: Management +# SubRole: Worker +# NID: 9999999977 +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with no system role information +# - name: Create Node component using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Compute" # This is the role that nodes get by default +# NID: +# type: int +# enum: +# - !int "{bogus_nid}" # Bogus NID computed from xname +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with system role information +# - name: Create {type} component using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# Role: Management +# SubRole: Worker +# NID: 9999999977 +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# # DELETE Node +# - name: Remove test Node from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# --- +# test_name: Verify Component operations on (Virtual)Nodes with system role information in SLS +# +# marks: +# - parametrize: +# key: +# - type +# - xname +# vals: +# - [Node, x9999c5s17b0n0] +# - [Node, x9999c5s17b0n1] +# - [VirtualNode, x9999c5s17b0n0v0] +# - [VirtualNode, x9999c5s17b0n0v1] +# +# stages: +# # PUT test virtual node from SLS +# - name: Create using PUT the test {type} into SLS +# request: +# url: "{sls_base_url}/v1/hardware/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# ID: "{xname}" +# Class: River +# ExtraProperties: +# Role: Application +# SubRole: Storage +# NID: 9999999967 +# Aliases: +# - uan999 +# response: +# status_code: +# - 201 +# +# +# # Remove any node maps from HSM for the node +# - name: Remove any test {type} from NodeMaps +# request: +# url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # Remove any test Node from State Components +# - name: Remove any test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # POST Create Node with no system role information +# - name: Create {type} component using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Application" +# SubRole: +# type: str +# enum: +# - "Storage" +# NID: +# type: int +# enum: +# - 9999999967 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # POST Create node with System role information +# - name: Create {type} component using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# Role: Management # This ROle is different than SLS +# SubRole: Worker # This SubRole is different than SLS +# NID: 9999999977 # This NID is different than SLS +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with no system role information +# - name: Create Node component using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Application" +# SubRole: +# type: str +# enum: +# - "Storage" +# NID: +# type: int +# enum: +# - 9999999967 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with system role information +# - name: Create {type} component using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# Role: Management +# SubRole: Worker +# NID: 9999999977 +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# # DELETE Node +# - name: Remove test Node from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# +# # Remove test node from SLS +# - name: Remove the test {type} from SLS +# request: +# url: "{sls_base_url}/v1/hardware/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# --- +# test_name: Verify Component operations on (Virtual)Nodes with system role information in NodeMaps +# +# marks: +# - parametrize: +# key: +# - type +# - xname +# vals: +# - [Node, x9999c5s17b0n0] +# - [Node, x9999c5s17b0n1] +# - [VirtualNode, x9999c5s17b0n0v0] +# - [VirtualNode, x9999c5s17b0n0v1] +# +# stages: +# # Delete test virtual node from SLS +# - name: Remove any test {type} from SLS +# request: +# url: "{sls_base_url}/v1/hardware/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # PUT test virtual node into HSM NodeMaps +# - name: Create test {type} in NodeMaps +# request: +# url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Role: Application +# SubRole: Storage +# NID: 9999999967 +# response: +# status_code: 200 +# +# # Remove any test Node from State Components +# - name: Remove any test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# +# # POST Create Node with no system role information +# - name: Create {type} component using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Application" +# SubRole: +# type: str +# enum: +# - "Storage" +# NID: +# type: int +# enum: +# - 9999999967 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # POST Create node with System role information +# - name: Create {type} component using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components" +# method: POST +# verify: !bool "{verify}" +# json: +# Components: +# - ID: "{xname}" +# State: Populated +# Role: Management # This ROle is different than NodeMaps +# SubRole: Worker # This SubRole is different than NodeMaps +# NID: 9999999977 # This NID is different than NodeMaps +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using POST with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with no system role information +# - name: Create Node component using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with no system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Application" +# SubRole: +# type: str +# enum: +# - "Storage" +# NID: +# type: int +# enum: +# - 9999999967 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# +# # DELETE Node +# - name: Remove test {type} from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# # PUT Node with system role information +# - name: Create {type} component using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: PUT +# verify: !bool "{verify}" +# json: +# Component: +# ID: "{xname}" +# State: Populated +# Role: Management +# SubRole: Worker +# NID: 9999999977 +# Class: River +# Arch: X86 +# NetType: "Sling" +# +# response: +# status_code: 204 +# +# # GET Verify Node was created successfully +# - name: Verify {type} component was successfully created using PUT with system role information +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: GET +# verify: !bool "{verify}" +# response: +# status_code: 200 +# verify_response_with: +# function: tavern.testutils.helpers:validate_pykwalify +# extra_kwargs: +# schema: +# type: map +# mapping: +# ID: +# type: str +# enum: +# - "{xname}" +# Type: +# type: str +# enum: +# - "{type}" +# State: +# type: str +# enum: +# - Populated +# Flag: +# type: str +# enum: +# - OK +# Enabled: +# type: bool +# enum: +# - True +# Role: +# type: str +# enum: +# - "Management" +# SubRole: +# type: str +# enum: +# - "Worker" +# NID: +# type: int +# enum: +# - 9999999977 +# Class: +# type: str +# enum: +# - "River" +# Arch: +# type: str +# enum: +# - "X86" +# NetType: +# type: str +# enum: +# - "Sling" +# # DELETE Node +# - name: Remove test Node from State Components +# request: +# url: "{hsm_base_url}/hsm/v2/State/Components/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# +# +# # Remove test node from NodeMaps +# - name: Remove the test {type} from NodeMaps +# request: +# url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps/{xname}" +# method: DELETE +# verify: !bool "{verify}" +# response: +# status_code: 200 +# headers: +# Authorization: "Bearer {access_token}" diff --git a/test/ct/api/4-destructive-initial/test_ethernet_interfaces.tavern.yaml b/test/ct/api/4-destructive-initial/test_ethernet_interfaces.tavern.yaml index b2a4066b..5d3e6c6d 100644 --- a/test/ct/api/4-destructive-initial/test_ethernet_interfaces.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_ethernet_interfaces.tavern.yaml @@ -33,12 +33,25 @@ test_name: HSM Ethernet Interfaces Collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # POST /Inventory/EthernetInterfaces - name: Create new component ethernet interface request: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces" json: {"Description":"Test Component Interface","MACAddress":"9A:99:99:99:99:99","IPAddresses":[{"IPAddress":"99.9.9.9","Network":"HSMTavernTest"}]} method: POST + headers: + Authorization: "Bearer {access_token}" # DELETE /Inventory/EthernetInterfaces # Warning: this will delete ALL ENTRIES @@ -46,6 +59,8 @@ stages: request: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces" method: DELETE + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 @@ -55,6 +70,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -69,5 +86,7 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/EthernetInterfaces" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 diff --git a/test/ct/api/4-destructive-initial/test_hardware.tavern.yaml b/test/ct/api/4-destructive-initial/test_hardware.tavern.yaml index 3497b7a3..462b22fd 100644 --- a/test/ct/api/4-destructive-initial/test_hardware.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_hardware.tavern.yaml @@ -49,6 +49,17 @@ test_name: hsmAPIinventoryHardware[ByFRU]destructive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # DELETE /Inventory/Hardware API response code # DELETE /Inventory/Hardware API response body - name: hsmAPIinventoryHardwareDELETE - Remove all Hardware using DELETE. @@ -56,6 +67,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -68,6 +81,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -105,6 +120,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -129,6 +146,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -167,6 +186,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{fruid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -198,6 +219,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{fruid}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -225,6 +248,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{fruid}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -262,6 +287,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/{fruid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -299,6 +326,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -325,6 +354,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: diff --git a/test/ct/api/4-destructive-initial/test_hardware_history.tavern.yaml b/test/ct/api/4-destructive-initial/test_hardware_history.tavern.yaml index 5d69275a..f0c5fc86 100644 --- a/test/ct/api/4-destructive-initial/test_hardware_history.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_hardware_history.tavern.yaml @@ -61,6 +61,17 @@ test_name: hsmAPIinventoryHardware[ByFRU]historyDestructive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # GET /Inventory/Hardware/History API response code # GET /Inventory/Hardware/History API response body - name: hsmAPIinventoryHardwareHistoryGET - Retrieve all Hardware Inventory History entries using GET. @@ -68,6 +79,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -119,6 +132,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History?id={xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -171,6 +186,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -215,6 +232,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -266,6 +285,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History?fruid={fruid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -318,6 +339,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History/{fruid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -362,6 +385,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History/{xname}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -388,6 +413,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History/{xname}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -425,6 +452,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -472,6 +501,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -498,6 +529,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -535,6 +568,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Hardware/History" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -586,6 +621,8 @@ stages: # url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History/{fruid}" # method: DELETE # verify: !bool "{verify}" +# headers: +# Authorization: "Bearer {access_token}" # response: # status_code: 200 # verify_response_with: @@ -612,6 +649,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History/{fruid}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -649,6 +688,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History/#" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 @@ -659,6 +700,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/HardwareByFRU/History/{fruid}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/4-destructive-initial/test_nodemaps.tavern.yaml b/test/ct/api/4-destructive-initial/test_nodemaps.tavern.yaml index 98ce4ab4..c2610600 100644 --- a/test/ct/api/4-destructive-initial/test_nodemaps.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_nodemaps.tavern.yaml @@ -35,6 +35,17 @@ test_name: hsmAPIdefaultsNodeMapsDestructive stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # DELETE /Defaults/NodeMaps API response code # DELETE /Defaults/NodeMaps API response body - name: hsmAPIdefaultsNodeMapsDELETE - Remove all NodeMaps using DELETE. @@ -42,6 +53,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 200 @@ -54,6 +67,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 verify_response_with: @@ -91,6 +106,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Defaults/NodeMaps" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: diff --git a/test/ct/api/4-destructive-initial/test_service_endpoints.tavern.yaml b/test/ct/api/4-destructive-initial/test_service_endpoints.tavern.yaml index aa5e8731..78bde87c 100644 --- a/test/ct/api/4-destructive-initial/test_service_endpoints.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_service_endpoints.tavern.yaml @@ -42,12 +42,25 @@ test_name: HSM Service Endpoint Collection stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # GET /Inventory/ServiceEndpoints - name: Get Service Endpoints request: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -113,6 +126,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/{service}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -178,6 +193,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/{service}/RedfishEndpoints/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -233,6 +250,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/{service}/RedfishEndpoints/{xname}" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -245,6 +264,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/{service}/RedfishEndpoints/{xname}" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -259,6 +280,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints/{service}/RedfishEndpoints/FAKE" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: @@ -273,6 +296,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 json: @@ -285,6 +310,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/ServiceEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 404 json: diff --git a/test/ct/api/4-destructive-initial/test_state_change_notifications.tavern.yaml b/test/ct/api/4-destructive-initial/test_state_change_notifications.tavern.yaml index a554b515..498a5ab2 100644 --- a/test/ct/api/4-destructive-initial/test_state_change_notifications.tavern.yaml +++ b/test/ct/api/4-destructive-initial/test_state_change_notifications.tavern.yaml @@ -32,12 +32,25 @@ test_name: Verify DELETE ALL method for the State Change Notifications API stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # DELETE /Subscriptions/SCN - name: Delete all State Change Notification subscriptions request: url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -62,6 +75,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -86,6 +101,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Subscriptions/SCN" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/5-destructive-final/test_discover.tavern.yaml b/test/ct/api/5-destructive-final/test_discover.tavern.yaml index ea8a39a8..340f8d08 100644 --- a/test/ct/api/5-destructive-final/test_discover.tavern.yaml +++ b/test/ct/api/5-destructive-final/test_discover.tavern.yaml @@ -32,11 +32,24 @@ test_name: hsmAPIinventoryDiscover stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + - name: Retrieve three NodeBMC RedfishEndpoints from HSM to use in upcoming stages request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints?type=NodeBMC" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 save: @@ -51,6 +64,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Discover" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"xnames":["{redfishEndpoint1}"],"force":false} response: status_code: 200 @@ -76,6 +91,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/Discover" method: POST verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" json: {"xnames":["{redfishEndpoint2}","{redfishEndpoint3}"],"force":false} response: status_code: 200 @@ -101,6 +118,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/DiscoveryStatus" method: GET verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: diff --git a/test/ct/api/5-destructive-final/test_redfish_endpoints.tavern.yaml b/test/ct/api/5-destructive-final/test_redfish_endpoints.tavern.yaml index 3b9c276f..fb934f97 100644 --- a/test/ct/api/5-destructive-final/test_redfish_endpoints.tavern.yaml +++ b/test/ct/api/5-destructive-final/test_redfish_endpoints.tavern.yaml @@ -31,12 +31,25 @@ test_name: hsmAPIinventoryRedfishEndpointsDeleteAll stages: + - name: Get access token + request: + url: "{opaal_base_url}/token" + method: GET + verify: !bool "{verify}" + response: + status_code: 200 + save: + json: + access_token: access_token + # DELETE /Inventory/RedfishEndpoints endpoints present - name: hsmAPIinventoryRedfishEndpointsDeleteAll - Delete all RFEndpoints request: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: 200 verify_response_with: @@ -62,6 +75,8 @@ stages: url: "{hsm_base_url}/hsm/v2/Inventory/RedfishEndpoints" method: DELETE verify: !bool "{verify}" + headers: + Authorization: "Bearer {access_token}" response: status_code: - 404 # expected diff --git a/test/ct/smoke/smoke.json b/test/ct/smoke/smoke.json index 5d298d35..206d44dc 100644 --- a/test/ct/smoke/smoke.json +++ b/test/ct/smoke/smoke.json @@ -1,6 +1,6 @@ { "smoke_test_name": "hsm-smoke-tests", - "default_base_url": "http://cray-smd/", + "default_base_url": "http://smd:27779/", "test_paths": [ { "path": "hsm/v2/service/ready", @@ -91,6 +91,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -98,6 +99,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -105,6 +107,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -112,6 +115,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -119,6 +123,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -126,6 +131,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -133,6 +139,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -140,6 +147,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -147,6 +155,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -161,6 +170,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -168,6 +178,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -175,6 +186,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -182,6 +194,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -189,6 +202,7 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} }, { @@ -196,13 +210,7 @@ "expected_status_code": 200, "method": "GET", "body": null, - "headers": {} - }, - { - "path": "hsm/v2/locks/status", - "expected_status_code": 200, - "method": "GET", - "body": null, + "use_auth": true, "headers": {} }, { @@ -210,7 +218,8 @@ "expected_status_code": 200, "method": "GET", "body": null, + "use_auth": true, "headers": {} } ] -} \ No newline at end of file +} diff --git a/test/docker-compose/computes.yml b/test/docker-compose/computes.yml new file mode 100644 index 00000000..7b9da430 --- /dev/null +++ b/test/docker-compose/computes.yml @@ -0,0 +1,57 @@ +## SPDX-FileCopyrightText: Copyright © 2025 OpenCHAMI a Series of LF Projects, LLC +## +## SPDX-License-Identifier: MIT + +services: + rf-x0c0s1b0: + container_name: rf-x0c0s1b0 + hostname: x0c0s1b0 + image: ghcr.io/openchami/csm-rie:latest + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s1b0 + - PORT=443 + networks: + internal: + aliases: + - x0c0s1b0 + rf-x0c0s2b0: + container_name: rf-x0c0s2b0 + hostname: x0c0s2b0 + image: ghcr.io/openchami/csm-rie:latest + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s2b0 + - PORT=443 + networks: + internal: + aliases: + - x0c0s2b0 + rf-x0c0s3b0: + container_name: rf-x0c0s3b0 + hostname: x0c0s3b0 + image: ghcr.io/openchami/csm-rie:latest + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s3b0 + - PORT=443 + networks: + internal: + aliases: + - x0c0s3b0 + rf-x0c0s4b0: + container_name: rf-x0c0s4b0 + hostname: x0c0s4b0 + image: ghcr.io/openchami/csm-rie:latest + environment: + - MOCKUPFOLDER=EX235a + - MAC_SCHEMA=Mountain + - XNAME=x0c0s4b0 + - PORT=443 + networks: + internal: + aliases: + - x0c0s4b0 diff --git a/test/libs/pytest.ini b/test/libs/pytest.ini new file mode 100644 index 00000000..b98cf9d1 --- /dev/null +++ b/test/libs/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +filterwarnings = + ignore::FutureWarning + ignore::DeprecationWarning + ignore::urllib3.exceptions.InsecureRequestWarning diff --git a/test/libs/tavern_global_config_ct_test.yaml b/test/libs/tavern_global_config_ct_test.yaml new file mode 100644 index 00000000..3a5402d5 --- /dev/null +++ b/test/libs/tavern_global_config_ct_test.yaml @@ -0,0 +1,8 @@ +# This file contains the base common configurations for running pytest tavern tests. It is statically +# generated, because we anticipate the same settings for all CT test containers that inherit from it. +name: tavern_global_configuration +description: common configuration for all tavern invocations +variables: + verify: false + opaal_base_url: http://opaal:3333 + hsm_base_url: http://smd:27779 diff --git a/test/smoke_pytest/conftest.py b/test/smoke_pytest/conftest.py new file mode 100644 index 00000000..2d031ee5 --- /dev/null +++ b/test/smoke_pytest/conftest.py @@ -0,0 +1,57 @@ +# MIT License +# +# SPDX-FileCopyrightText: Copyright © 2025 OpenCHAMI a Series of LF Projects, LLC +# +# SPDX-License-Identifier: MIT + +import json + +from urllib.parse import urljoin + +def pytest_addoption(parser): + # Add extra arguments to pytest to support passing in data to configure smoke tests. + parser.addoption( + "--smoke-json", + action="store", + default="", + required=True, + help="Path to smoke.json", + ) + parser.addoption( + "--smoke-url", + action="store", + default=None, + help="Base service url", + ) + +def pytest_generate_tests(metafunc): + print(metafunc.function, metafunc.fixturenames) + if "smoke_test_data" in metafunc.fixturenames: + # Generate tests cases based on the contents from the provided smoke.json file. + + # Read in smoke data + print("Reading in smoke json file") + ids = [] + testdata = [] + with open(metafunc.config.getoption("smoke_json"), 'r') as f: + smoke_test = json.load(f) + + # Determine the base URL for the service + base_url = smoke_test["default_base_url"] + override_url = metafunc.config.getoption("smoke_url") + if override_url is not None: + base_url = override_url + + # Add a trailing slash if not present, needed by urljoin to work properly. + if not base_url.endswith("/"): + base_url += "/" + + for test_case in smoke_test["test_paths"]: + test_case["url"] = urljoin(base_url, test_case["path"]) + testdata.append(test_case) + + # Override the string that is shown by pytest to be more informational in log output, instead of 'smoke_test_data0'. + ids.append(f'Verify {test_case["method"]} {test_case["path"]}') + # ids.append(json.dumps(test_case)) + + metafunc.parametrize('smoke_test_data', testdata, ids=ids, indirect=False,) diff --git a/test/smoke_pytest/test_smoke.py b/test/smoke_pytest/test_smoke.py new file mode 100644 index 00000000..92a561db --- /dev/null +++ b/test/smoke_pytest/test_smoke.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python3 +# +# SPDX-FileCopyrightText: Copyright © 2025 OpenCHAMI a Series of LF Projects, LLC +# +# SPDX-License-Identifier: MIT + +import requests + +def get_access_token(): + req = requests.request(url="http://opaal:3333/token", method="GET") + return req.json().get("access_token") + +def test_smoke(smoke_test_data): + + headers=smoke_test_data["headers"] + if smoke_test_data.get("use_auth"): + if "Authorization" not in headers: + access_token = get_access_token() + headers["Authorization"] = f"Bearer {access_token}" + + + req = requests.request(url=smoke_test_data["url"], method=str(smoke_test_data["method"]).upper(), data=smoke_test_data["body"], + headers=smoke_test_data["headers"]) + + assert req.status_code == smoke_test_data["expected_status_code"], "unexpected status code."