-
Notifications
You must be signed in to change notification settings - Fork 216
USHIFT-5079: Add online AI Model Serving RF test #4662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
73d5c2f
Add online AI Model Serving RF test
agullon 3899fcb
Merge remote-tracking branch 'origin/main' into USHIFT-5079
agullon 4ede391
rename offline ai-model-serving test files
agullon defdc3b
Merge remote-tracking branch 'origin' into USHIFT-5079
agullon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
set -xeuo pipefail | ||
|
||
OUTPUT=$1 | ||
PAYLOAD=/tmp/bee.jpeg | ||
|
||
# Download payload | ||
curl -o "${PAYLOAD}" https://raw.githubusercontent.com/openvinotoolkit/model_server/main/demos/common/static/images/bee.jpeg | ||
|
||
# Add an inference header (len=63) | ||
echo -n '{"inputs" : [{"name": "0", "shape": [1], "datatype": "BYTES"}]}' > "${OUTPUT}" | ||
|
||
# Add size of the data (image) in binary format (4 bytes, little endian) | ||
printf "%08X" "$(stat --format=%s "${PAYLOAD}")" | sed 's/\(..\)/\1\n/g' | tac | tr -d '\n' | xxd -r -p >> "${OUTPUT}" | ||
|
||
# Add the data, i.e. the image | ||
cat "${PAYLOAD}" >> "${OUTPUT}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Definition of InferenceService with a model packages in form of OCI image. | ||
# Features extra argument for the model server (--layout), so the data layout | ||
# format expected by the model server matches what we send during testing. | ||
apiVersion: "serving.kserve.io/v1beta1" | ||
kind: "InferenceService" | ||
metadata: | ||
name: openvino-resnet | ||
spec: | ||
predictor: | ||
model: | ||
protocolVersion: v2 | ||
modelFormat: | ||
name: openvino_ir | ||
storageUri: "oci://quay.io/microshift/ai-testing-model:ovms-resnet50" | ||
args: | ||
- --layout=NHWC:NCHW | ||
--- | ||
apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
name: openvino-resnet-predictor | ||
spec: | ||
host: openvino-resnet-predictor-test-ai.apps.example.com | ||
port: | ||
targetPort: 8888 | ||
to: | ||
kind: Service | ||
name: openvino-resnet-predictor | ||
weight: 100 | ||
wildcardPolicy: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ge-blueprints-bootc/layer2-source/group3/rhel96-bootc-source-ai-model-serving.image-bootc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{- if and (env.Getenv "UNAME_M" "") (eq "x86_64" .Env.UNAME_M) }} | ||
localhost/rhel96-bootc-source-ai-model-serving:latest | ||
{{- end }} | ||
{{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Sourced from scenario.sh and uses functions defined there. | ||
|
||
# Currently, RHOAI is only available for x86_64 | ||
check_platform() { | ||
local -r record_junit=${1:-false} | ||
|
||
if [[ "${UNAME_M}" =~ aarch64 ]]; then | ||
if "${record_junit}"; then | ||
record_junit "setup" "scenario_create_vms" "SKIPPED" | ||
agullon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fi | ||
exit 0 | ||
fi | ||
} | ||
|
||
scenario_create_vms() { | ||
check_platform true | ||
|
||
# Increased disk size because of the additional embedded images (especially OVMS which is ~3.5GiB) | ||
agullon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
LVM_SYSROOT_SIZE=20480 prepare_kickstart host1 kickstart-bootc.ks.template rhel96-bootc-source-optionals | ||
launch_vm --boot_blueprint rhel96-bootc --vm_disksize 30 | ||
} | ||
|
||
scenario_remove_vms() { | ||
check_platform | ||
|
||
remove_vm host1 | ||
} | ||
|
||
scenario_run_tests() { | ||
check_platform | ||
|
||
run_tests host1 \ | ||
suites/ai-model-serving/ai-model-serving-online.robot | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
test/suites/ai-model-serving/ai-model-serving-online.robot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
*** Settings *** | ||
Documentation Sanity test for AI Model Serving | ||
|
||
Library ../../resources/DataFormats.py | ||
Resource ../../resources/common.resource | ||
Resource ../../resources/oc.resource | ||
|
||
Suite Setup Setup Suite | ||
Suite Teardown Teardown Suite | ||
|
||
|
||
*** Variables *** | ||
${USHIFT_HOST}= ${EMPTY} | ||
${OVMS_KSERVE_MANIFEST}= /tmp/ovms-kserve.yaml | ||
${OVMS_REQUEST}= /tmp/ovms-request.json | ||
|
||
|
||
*** Test Cases *** | ||
Test OpenVINO model | ||
[Documentation] Sanity test for AI OpenVino Model Serving | ||
|
||
Set Test Variable ${MODEL_NAME} openvino-resnet | ||
Set Test Variable ${DOMAIN} ${MODEL_NAME}-predictor-test-ai.apps.example.com | ||
${ns}= Create Unique Namespace | ||
Set Test Variable ${NAMESPACE} ${ns} | ||
|
||
Deploy OpenVINO Serving Runtime | ||
Deploy OpenVINO Resnet Model | ||
|
||
Check If Model Is Ready | ||
Query Model Metrics Endpoint | ||
Prepare Request Data | ||
Query Model Infer Endpoint | ||
|
||
[Teardown] Run Keywords | ||
... Remove Namespace ${NAMESPACE} | ||
... AND | ||
... Remove Tmp Data | ||
|
||
|
||
*** Keywords *** | ||
Deploy OpenVINO Serving Runtime | ||
[Documentation] Deploys OpenVino server. | ||
|
||
${ovms_image}= Command Should Work | ||
... jq -r '.images | with_entries(select(.key == "ovms-image")) | .[]' /usr/share/microshift/release/release-ai-model-serving-"$(uname -i)".json | ||
SSHLibrary.Get File | ||
... /usr/lib/microshift/manifests.d/001-microshift-ai-model-serving/runtimes/ovms-kserve.yaml | ||
... ${OVMS_KSERVE_MANIFEST} | ||
Local Command Should Work sed -i "s,image: ovms-image,image: ${ovms_image}," "${OVMS_KSERVE_MANIFEST}" | ||
Oc Apply -n ${NAMESPACE} -f ${OVMS_KSERVE_MANIFEST} | ||
|
||
Deploy OpenVINO Resnet Model | ||
[Documentation] Deploys InferenceService object to create Deployment and Service to serve the model. | ||
... Also creates a Route to export the model endpoint outside the MicroShift cluster. | ||
|
||
Oc Apply -n ${NAMESPACE} -f ./assets/ai-model-serving/ovms-resources.yaml | ||
Wait Until Keyword Succeeds 30x 1s | ||
... Run With Kubeconfig oc rollout status -n\=${NAMESPACE} --timeout=60s deployment openvino-resnet-predictor | ||
|
||
Check If Model Is Ready | ||
[Documentation] Asks model server is model is ready for inference. | ||
${cmd}= Catenate | ||
... curl | ||
... --fail | ||
... -i ${DOMAIN}/v2/models/${MODEL_NAME}/ready | ||
... --connect-to "${DOMAIN}::${USHIFT_HOST}:" | ||
Wait Until Keyword Succeeds 10x 10s | ||
... Local Command Should Work ${cmd} | ||
|
||
Query Model Metrics Endpoint | ||
[Documentation] Makes a query against the model server metrics endpoint. | ||
|
||
${cmd}= Catenate | ||
... curl | ||
... --fail | ||
... --request GET | ||
... ${DOMAIN}/metrics | ||
... --connect-to "${DOMAIN}::${USHIFT_HOST}:" | ||
${output}= Local Command Should Work ${cmd} | ||
Should Contain ${output} ovms_requests_success Number of successful requests to a model or a DAG. | ||
|
||
Prepare Request Data | ||
[Documentation] Executes a script that prepares a request data. | ||
|
||
Local Command Should Work bash -x assets/ai-model-serving/ovms-query-preparation.sh ${OVMS_REQUEST} | ||
|
||
Remove Tmp Data | ||
[Documentation] Remove temp data for this test. | ||
|
||
Local Command Should Work rm ${OVMS_REQUEST} ${OVMS_KSERVE_MANIFEST} | ||
|
||
Query Model Infer Endpoint | ||
[Documentation] Makes a query against the model server. | ||
|
||
# Inference-Header-Content-Length is the len of the JSON at the begining of the request.json | ||
${cmd}= Catenate | ||
... curl | ||
... --silent | ||
... --fail | ||
... --request POST | ||
... --data-binary "@${OVMS_REQUEST}" | ||
... --header "Inference-Header-Content-Length: 63" | ||
... ${DOMAIN}/v2/models/${MODEL_NAME}/infer | ||
... --connect-to "${DOMAIN}::${USHIFT_HOST}:" | ||
${output}= Local Command Should Work ${cmd} | ||
${result}= Json Parse ${output} | ||
${data}= Set Variable ${result["outputs"][0]["data"]} | ||
# Following expression can be referred to as 'argmax': index of the highest element. | ||
${argmax}= Evaluate ${data}.index(max(${data})) | ||
|
||
# Request data includes bee.jpeg file so according to the OpenVino examples, | ||
# we should expect argmax to be 309. | ||
# See following for reference | ||
# - https://github.com/openvinotoolkit/model_server/tree/releases/2025/0/client/python/kserve-api/samples#run-the-client-to-perform-inference-1 | ||
# - https://github.com/openvinotoolkit/model_server/blob/releases/2025/0/demos/image_classification/input_images.txt | ||
Should Be Equal As Integers ${argmax} 309 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.