From 5fbc2d141c3166ff1948eca309aafda9a6f66a24 Mon Sep 17 00:00:00 2001 From: ambrishest Date: Thu, 8 Feb 2024 10:45:49 +0000 Subject: [PATCH] Kserve participant for simple rApp Issue-ID: NONRTRIC-965 Change-Id: Ie054c934a5941cc07df5df62085885703f23e077 Signed-off-by: ambrishest --- .../rapp-kserve/Definitions/asd.yaml | 39 ++++ .../rapp-kserve/Definitions/asd_types.yaml | 79 ++++++++ .../Files/Acm/definition/compositions.json | 201 +++++++++++++++++++++ .../Files/Acm/instances/kserve-instance.json | 29 +++ .../Files/Sme/providers/provider-function-1.json | 20 ++ .../Files/Sme/serviceapis/api-set-1.json | 32 ++++ .../rapp-kserve/TOSCA-Metadata/TOSCA.meta | 5 + sample-rapp-generator/rapp-kserve/asd.mf | 14 ++ 8 files changed, 419 insertions(+) create mode 100644 sample-rapp-generator/rapp-kserve/Definitions/asd.yaml create mode 100644 sample-rapp-generator/rapp-kserve/Definitions/asd_types.yaml create mode 100644 sample-rapp-generator/rapp-kserve/Files/Acm/definition/compositions.json create mode 100644 sample-rapp-generator/rapp-kserve/Files/Acm/instances/kserve-instance.json create mode 100644 sample-rapp-generator/rapp-kserve/Files/Sme/providers/provider-function-1.json create mode 100644 sample-rapp-generator/rapp-kserve/Files/Sme/serviceapis/api-set-1.json create mode 100644 sample-rapp-generator/rapp-kserve/TOSCA-Metadata/TOSCA.meta create mode 100644 sample-rapp-generator/rapp-kserve/asd.mf diff --git a/sample-rapp-generator/rapp-kserve/Definitions/asd.yaml b/sample-rapp-generator/rapp-kserve/Definitions/asd.yaml new file mode 100644 index 0000000..e2aeffb --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Definitions/asd.yaml @@ -0,0 +1,39 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: rApp Kserve + +imports: + - asd_types.yaml + +topology_template: + node_templates: + applicationServiceDescriptor: + type: tosca.nodes.asd + description: "rapp-kserve" + properties: + descriptor_id: 0fd5d1a0-805b-4b05-9e9a-bb150990fe2f + descriptor_invariant_id: 1a2e99e1-3f57-4a7c-8b85-3a9c991d2c0e + descriptor_version: 1.0 + schema_version: 2.0 + function_description: rApp description + provider: Ericsson Software Technology (O-RAN SC NONRTRIC team) + application_name: rapp-kserve + application_version: 1.0 diff --git a/sample-rapp-generator/rapp-kserve/Definitions/asd_types.yaml b/sample-rapp-generator/rapp-kserve/Definitions/asd_types.yaml new file mode 100644 index 0000000..237ccfd --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Definitions/asd_types.yaml @@ -0,0 +1,79 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_2 +description: ASD types definitions version 0.1 +node_types: + tosca.nodes.asd: + derived_from: tosca.nodes.Root + description: "The ASD node type" + version: 0.1 + properties: + descriptor_id: + type: string # UUID + required: true + description: Identifier of this ASD. It is in UUID format as specified in RFC 4122 + descriptor_invariant_id: + type: string # UUID + required: true + description: > + Identifier of this descriptor in a version independent manner. This attribute + is invariant across versions of ASD. It is in UUID format as specified in RFC 4122 + descriptor_version: + type: string + required: true + description: Identifies the version of the ASD. + schema_version: + type: string + required: true + description: Identifies the Identifies the version of this ASD’s schema. + function_description: + type: string + required: false + description: Description of the application service described by this ASD. + provider: + type: string + required: true + description: Identifies the provider of the ASD. + application_name: + type: string + required: true + description: Name to identify the application service described by this ASD + application_version: + type: string + required: true + description: Identifies the version of the application service described by this ASD. + +artifact_types: +tosca.artifacts.asd.deploymentItem: + version: 0.1 + derived_from: tosca.artifacts.Root + description: "Describes the artifact type of asd deployment item" + file: "Relative path of the artifact in the package" + properties: + item_id: + description: "The identifier of this asd deployment item" + required: true + type: string + artifact_type: + description: > + Specify artifact type. + required: true + type: string + constraints: + - valid_values: ["helm_chart"] diff --git a/sample-rapp-generator/rapp-kserve/Files/Acm/definition/compositions.json b/sample-rapp-generator/rapp-kserve/Files/Acm/definition/compositions.json new file mode 100644 index 0000000..377cd71 --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Files/Acm/definition/compositions.json @@ -0,0 +1,201 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_3", + "data_types": { + "onap.datatypes.ToscaConceptIdentifier": { + "derived_from": "tosca.datatypes.Root", + "properties": { + "name": { + "type": "string", + "required": true + }, + "version": { + "type": "string", + "required": true + } + } + }, + "org.onap.datatypes.policy.clamp.acm.kserveAutomationCompositionElement.KserveInferenceEntity": { + "version": "1.0.0", + "derived_from": "tosca.datatypes.Root", + "properties": { + "kserveEntityId": { + "type": "onap.datatypes.ToscaConceptIdentifier", + "required": true, + "description": "The name and version of a Configuration Entity to be handled by the Kserve Automation Composition Element" + }, + "name": { + "type": "string", + "required": true, + "description": "Inference service name to be created" + }, + "payload": { + "type": "string", + "required": true, + "description": "Inference Service payload" + } + } + } + }, + "node_types": { + "org.onap.policy.clamp.acm.Participant": { + "version": "1.0.1", + "derived_from": "tosca.nodetypes.Root", + "properties": { + "provider": { + "type": "string", + "required": false + } + } + }, + "org.onap.policy.clamp.acm.AutomationCompositionElement": { + "version": "1.0.1", + "derived_from": "tosca.nodetypes.Root", + "properties": { + "provider": { + "type": "string", + "required": false + }, + "participantType": { + "type": "onap.datatypes.ToscaConceptIdentifier", + "required": true + }, + "startPhase": { + "type": "integer", + "required": false, + "constraints": [ + { + "greater-or-equal": 0 + } + ], + "metadata": { + "common": true + }, + "description": "A value indicating the start phase in which this automation composition element will be started, the first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously" + }, + "passiveToRunningTimeout": { + "type": "integer", + "required": false, + "constraints": [ + { + "greater_or_equal": 0 + } + ], + "default": 60, + "metadata": { + "common": true + }, + "description": "The maximum time in seconds to wait for a state chage from passive to running" + }, + "runningToPassiveTimeout": { + "type": "integer", + "required": false, + "constraints": [ + { + "greater_or_equal": 0 + } + ], + "default": 60, + "metadata": { + "common": true + }, + "description": "The maximum time in seconds to wait for a state chage from running to passive" + }, + "passiveToUninitializedTimeout": { + "type": "integer", + "required": false, + "constraints": [ + { + "greater_or_equal": 0 + } + ], + "default": 60, + "metadata": { + "common": true + }, + "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized" + } + } + }, + "org.onap.policy.clamp.acm.AutomationComposition": { + "version": "1.0.1", + "derived_from": "tosca.nodetypes.Root", + "properties": { + "provider": { + "type": "string", + "required": false, + "metadata": { + "common": true + } + }, + "elements": { + "type": "list", + "required": true, + "metadata": { + "common": true + }, + "entry_schema": { + "type": "onap.datatypes.ToscaConceptIdentifier" + } + } + } + }, + "org.onap.policy.clamp.acm.KserveAutomationCompositionElement": { + "version": "1.0.1", + "derived_from": "org.onap.policy.clamp.acm.AutomationCompositionElement", + "properties": { + "kserveInferenceEntities": { + "type": "list", + "required": true, + "entry_schema": { + "type": "org.onap.datatypes.policy.clamp.acm.kserveAutomationCompositionElement.KserveInferenceEntity", + "type_version": "1.0.0" + }, + "description": "The configuration entities of Kserve inference service" + } + } + } + }, + "topology_template": { + "node_templates": { + "org.onap.policy.clamp.acm.KserveParticipant": { + "version": "2.3.4", + "type": "org.onap.policy.clamp.acm.Participant", + "type_version": "1.0.1", + "description": "Participant for Kserve requests", + "properties": { + "provider": "ONAP" + } + }, + "onap.policy.clamp.ac.element.KserveAutomationCompositionElement": { + "version": "1.2.3", + "type": "org.onap.policy.clamp.acm.KserveAutomationCompositionElement", + "type_version": "1.0.1", + "description": "Automation composition element for the Kserve Requests", + "properties": { + "provider": "ONAP", + "participantType": { + "name": "org.onap.policy.clamp.acm.KserveParticipant", + "version": "2.3.4" + }, + "uninitializedToPassiveTimeout": 300, + "statusCheckInterval": 30 + } + }, + "onap.policy.clamp.ac.element.AutomationCompositionDefinition": { + "version": "1.2.3", + "type": "org.onap.policy.clamp.acm.AutomationComposition", + "type_version": "1.0.1", + "description": "Automation composition for rapp deployment", + "properties": { + "provider": "ONAP", + "elements": [ + { + "name": "onap.policy.clamp.ac.element.KserveAutomationCompositionElement", + "version": "1.2.3" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/sample-rapp-generator/rapp-kserve/Files/Acm/instances/kserve-instance.json b/sample-rapp-generator/rapp-kserve/Files/Acm/instances/kserve-instance.json new file mode 100644 index 0000000..09a5759 --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Files/Acm/instances/kserve-instance.json @@ -0,0 +1,29 @@ +{ + "name": "DemoKserveInstance0", + "version": "1.0.1", + "compositionId": "COMPOSITIONID", + "description": "Demo automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "onap.policy.clamp.ac.element.KserveAutomationCompositionElement", + "version": "1.2.3" + }, + "description": "Starter Automation Composition Element for the Demo", + "properties": { + "kserveInferenceEntities": [ + { + "kserveInferenceEntityId": { + "name": "entity1", + "version": "1.0.1" + }, + "name": "sklearn-iris", + "namespace": "kserve-test", + "payload": "{\"apiVersion\": \"serving.kserve.io/v1beta1\",\"kind\": \"InferenceService\",\"metadata\": {\"name\": \"sklearn-iris\"},\"spec\": {\"predictor\": {\"model\":{\"modelFormat\": {\"name\": \"sklearn\"},\"storageUri\": \"gs://kfserving-examples/models/sklearn/1.0/model\"}}}}" + } + ] + } + } + } +} \ No newline at end of file diff --git a/sample-rapp-generator/rapp-kserve/Files/Sme/providers/provider-function-1.json b/sample-rapp-generator/rapp-kserve/Files/Sme/providers/provider-function-1.json new file mode 100644 index 0000000..875a30d --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Files/Sme/providers/provider-function-1.json @@ -0,0 +1,20 @@ +{ + "apiProvDomInfo": "Provider domain", + "apiProvFuncs": [ + { + "apiProvFuncInfo": "sklearn-iris as APF", + "apiProvFuncRole": "APF", + "regInfo": { + "apiProvPubKey": "NOT USED here" + } + }, + { + "apiProvFuncInfo": "sklearn-iris as AEF", + "apiProvFuncRole": "AEF", + "regInfo": { + "apiProvPubKey": "NOT USED here" + } + } + ], + "regSec": "plain" +} \ No newline at end of file diff --git a/sample-rapp-generator/rapp-kserve/Files/Sme/serviceapis/api-set-1.json b/sample-rapp-generator/rapp-kserve/Files/Sme/serviceapis/api-set-1.json new file mode 100644 index 0000000..5137b82 --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/Files/Sme/serviceapis/api-set-1.json @@ -0,0 +1,32 @@ +{ + "apiName": "sklearn-iris API Set", + "description": "sklearn-iris API", + "aefProfiles": [ + { + "aefId": "sklearn-iris as AEF", + "description": "sklearn-iris API", + "versions": [ + { + "apiVersion": "v1", + "resources": [ + { + "resourceName": "sklearn", + "commType": "REQUEST_RESPONSE", + "uri": "v1/models/sklearn-iris:predict", + "operations": [ + "POST" + ] + } + ] + } + ], + "protocol": "HTTP_1_1", + "interfaceDescriptions": [ + { + "ipv4Addr": "sklearn-iris-predictor-default.kserve-test.svc.cluster.local", + "port": 80 + } + ] + } + ] +} \ No newline at end of file diff --git a/sample-rapp-generator/rapp-kserve/TOSCA-Metadata/TOSCA.meta b/sample-rapp-generator/rapp-kserve/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..3da5f0d --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.0 +Created-By: Ericsson Software Technology (O-RAN SC NONRTRIC team) +Entry-Definitions: Definitions/asd.yaml +ETSI-Entry-Manifest: asd.mf \ No newline at end of file diff --git a/sample-rapp-generator/rapp-kserve/asd.mf b/sample-rapp-generator/rapp-kserve/asd.mf new file mode 100644 index 0000000..ce4b6b4 --- /dev/null +++ b/sample-rapp-generator/rapp-kserve/asd.mf @@ -0,0 +1,14 @@ +metadata: + application_name: rapp-kserve + application_provider: Ericsson Software Technology (O-RAN SC NONRTRIC team) + release_date_time: 2024-02-12T11:30:00+00:00 + entry_definition_type: asd + +Source: asd.mf +Source: Definitions/asd.yaml +Source: Definitions/asd_types.yaml +Source: TOSCA-Metadata/TOSCA.meta +Source: Files/Acm/definition/compositions.json +Source: Files/Acm/instances/kserve-instance.json +Source: Files/Sme/provider/provider-function-1.json +Source: Files/Sme/serviceapis/api-set-1.json -- 2.16.6