Skip to content

Commit

Permalink
test(backend): test nvme entities over HTTP
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Feb 1, 2024
1 parent 5d8b8d7 commit 61cc755
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ grep "Total" log.txt
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 GetNvmeRemoteController "{name: 'nvmeRemoteControllers/nvmetcp12'}"
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 GetNvmePath "{name: 'nvmeRemoteControllers/nvmetcp12/nvmePaths/nvmetcp12path0'}"

# check http gateway is responding on List commands
curl -X GET -f "http://127.0.0.1:8082/v1/nvmeRemoteControllers" | jq '.nvmeRemoteControllers[0].name'
curl -X GET -f "http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths" | jq .nvmePaths[0].name
curl -X GET -f "http://127.0.0.1:8082/v1/nvmeSubsystems" | jq .nvmeSubsystems[1].spec.nqn

"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 DeleteNvmePath "{name: 'nvmeRemoteControllers/nvmetcp12/nvmePaths/nvmetcp12path0'}"
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 DeleteNvmeRemoteController "{name: 'nvmeRemoteControllers/nvmetcp12'}"
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 DeleteNvmeNamespace "{name : 'subsystems/subsystem1/namespaces/namespace1'}"
Expand All @@ -111,5 +106,32 @@ grep "Total" log.txt
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 DeleteNvmeController "{name : 'subsystems/subsystem2/controllers/controller2'}"
"${grpc_cli[@]}" call --json_input --json_output opi-spdk-server:50051 DeleteNvmeSubsystem "{name : 'subsystems/subsystem2'}"


# HTTP gateway to Nvme
# Backend
# create
curl -X POST -f http://127.0.0.1:8082/v1/nvmeRemoteControllers?nvme_remote_controller_id=nvmetcp12 -d '{"multipath": "NVME_MULTIPATH_MULTIPATH"}'
curl -X POST -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths?nvme_path_id=nvmetcp12path0 -d "{\"traddr\":\"${SPDK_IP}\", \"trtype\":\"NVME_TRANSPORT_TYPE_TCP\", \"fabrics\":{\"subnqn\":\"nqn.2016-06.io.spdk:cnode1\", \"trsvcid\":\"4444\", \"adrfam\":\"NVME_ADDRESS_FAMILY_IPV4\", \"hostnqn\":\"nqn.2014-08.org.nvmexpress:uuid:feb98abe-d51f-40c8-b348-2753f3571d3c\"}}"

# get
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths/nvmetcp12path0
# list
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers | jq '.nvmeRemoteControllers[0].name'
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths | jq .nvmePaths[0].name
# stats
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12:stats
curl -X GET -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths/nvmetcp12path0:stats
# update
curl -X PATCH -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12 -d '{"multipath": "NVME_MULTIPATH_MULTIPATH"}'
curl -X PATCH -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths -d '{"traddr":"127.0.0.1", "trtype":"NVME_TRANSPORT_TYPE_TCP", "fabrics":{"subnqn":"nqn.2019-06.io.spdk:0", "trsvcid":"4420", "adrfam":"NVME_ADDRESS_FAMILY_IPV4", "hostnqn":"nqn.2014-08.org.nvmexpress:uuid:feb98abe-d51f-40c8-b348-2753f3571d3c"}}'
# delete
curl -X DELETE -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12/nvmePaths/nvmetcp12path0
curl -X DELETE -f http://127.0.0.1:8082/v1/nvmeRemoteControllers/nvmetcp12

# Frontend
# list
# curl -X GET -f "http://127.0.0.1:8082/v1/nvmeSubsystems" | jq .nvmeSubsystems[1].spec.nqn

# this is last line
docker-compose ps -a

0 comments on commit 61cc755

Please sign in to comment.