diff options
67 files changed, 4477 insertions, 1 deletions
@@ -2,7 +2,8 @@ bears = YAMLLintBear yamllint_config = .yamllint ignore = - .tox/** + .tox/**, + operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/* [json] bears = JSONFormatBear @@ -27,3 +28,4 @@ ignore = bears = MarkdownBear ignore = .tox/** + @@ -77,3 +77,5 @@ local.properties # Annotation Processing .apt_generated/ .apt_generated_test/ + +!operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/k8s-profiles @@ -17,5 +17,6 @@ Assumptions: Repository contain: +- operations/a1-pe-sim-package - folder that provides the CBA, HELM_CHARTS, CSAR for A1-PE simulator as a CNF - operations/dcae - DCAE CLI that deploys RAPPs in the DCAE framework - operations/scripts - helper scripts to support the use case diff --git a/operations/a1-pe-sim-packages/README.md b/operations/a1-pe-sim-packages/README.md new file mode 100644 index 0000000..4c8896e --- /dev/null +++ b/operations/a1-pe-sim-packages/README.md @@ -0,0 +1,218 @@ +# A1-PE-Simulator + +A1-PE-Simulator (a1-pe-sim) is this is a Java SpringBoot application. +This application contains docker image with shared docker volume to store the configuration. + +## Build package + +Following mvn command in the current directory will build a1-pe-simulator package: +`mvn clean install` + +### Artifacts + +After build process described above, **/target** directory should contain: + +- oran-sim-cba.zip - enriched CBA package for a1-pe-sim +- oran-sim-helm.tar.gz - helm chart for a1-pe-sim +- oran-sim-csar.zip - ONAP package with embedded the *cba* and *helm chart* for a1-pe-sim and can be used to onboard CNF to ONAP + +## Docker image + +The a1-pe-sim is stored in dedicated repo: https://gerrit.onap.org/r/admin/repos/integration/usecases/A1-policy-enforcement-r-apps +To create docker image pull and build this repository: + +``` +git clone "https://gerrit.onap.org/r/integration/simulators/A1-policy-enforcement-simulator" +cd A1-policy-enforcement-simulator +mvn clean install +``` + +After building you should find following docker image from local repository: + +``` +user@machine:~/A1-policy-enforcement-simulator$ docker images | grep sim +onap/integration/simulators/a1-pe-simulator latest 171e5843928d 41 seconds ago 187MB +``` + +## Run as docker + +To run built docker images use `docker-compose up -d` in docker directory. You can stop it later with `docker-compose down -v` or without `-v` if you want to preserve shared volume (most likely, you don't). + +## Test A1-PE-Simulator + +### Manual test + +Simulator part can be manually tested to be working e.g. by using curl request. + +1. Get the configured cells (in *configuration/cells.json*): + +curl --location --request GET 'http://localhost:9998/v1/ran/cells/' + +Example response: + +```json +{ + "cells": [ + { + "id": "Cell1", + "latitude": 50.11, + "longitude": 19.98, + "connectedUserEquipments": [ + "emergency_samsung_s10_01" + ], + "currentState": { + "value": "INACTIVE" + } + }, + { + "id": "Cell2", + "latitude": 50.06, + "longitude": 20.03, + "connectedUserEquipments": [], + "currentState": { + "value": "INACTIVE" + } + }, + { + "id": "Cell3", + "latitude": 50.06, + "longitude": 19.94, + "connectedUserEquipments": [ + "emergency_police_01", + "mobile_samsung_s20_02" + ], + "currentState": { + "value": "INACTIVE" + } + }, + { + "id": "Cell4", + "latitude": 50.11, + "longitude": 19.88, + "connectedUserEquipments": [], + "currentState": { + "value": "INACTIVE" + } + }, + { + "id": "Cell5", + "latitude": 50.01, + "longitude": 19.99, + "connectedUserEquipments": [], + "currentState": { + "value": "INACTIVE" + } + } + ], + "itemsLength": 5 +} +``` + +2. Get the configured user equipments (in *configuration/ue.json*): + +curl --location --request GET 'http://localhost:9998/v1/ran/ues/' + +Example response: + +```json +{ + "ues": [ + { + "id": "emergency_police_01", + "latitude": 50.035, + "longitude": 19.97, + "cellId": "Cell3", + "cellsInRange": [ + "Cell3", + "Cell5" + ] + }, + { + "id": "mobile_samsung_s20_02", + "latitude": 50.05, + "longitude": 19.95, + "cellId": "Cell3", + "cellsInRange": [ + "Cell3" + ] + }, + { + "id": "emergency_samsung_s10_01", + "latitude": 50.09, + "longitude": 19.94, + "cellId": "Cell1", + "cellsInRange": [ + "Cell1", + "Cell3", + "Cell4" + ] + } + ], + "itemsLength": 3 +} +``` + +3. Start sending events (based on the configuration in *configuration/vnf.config* directory). Also in *vnf.config* file, replace the vesHost=vesconsumer, vesPort=30417 with real values. + +curl --location --request POST 'http://localhost:9998/v1/ran/cells/Cell1/start' + +Success response: + +``` +VES Event sending started +``` + +Check A1-PE-Simulator container logs by executing command: + +```shell script + docker exec -it a1-pe-simulator tail -f log/a1-pe-simulator/application/metrics-2021-04-28.0.log +``` + +Example logs: + +``` +2021-04-28T08:47:14.758+00:00|NULL|INFO :o.o.a.service.ves.RanVesSender:send:66: Sending following VES event: { + "event" : { + "commonEventHeader" : { + "version" : "4.0.1", + "vesEventListenerVersion" : "7.0.1", + "sourceId" : "de305d54-75b4-431b-adb2-eb6b9e546014", + "reportingEntityName" : "ibcx0001vm002oam001", + "startEpochMicrosec" : 1619599800000000, + "eventId" : "measurement0000259", + "lastEpochMicrosec" : 1619599634754559, + "priority" : "Normal", + "sequence" : 3, + "sourceName" : "ibcx0001vm002ssc001", + "domain" : "measurement", + "eventName" : "Measurement_vIsbcMmc", + "reportingEntityId" : "cc305d54-75b4-431b-adb2-eb6b9e541234", + "nfcNamingCode" : "ssc", + "nfNamingCode" : "ibcx" + }, + "measurementFields" : { + "measurementInterval" : 5, + "measurementFieldsVersion" : "4.0", + "additionalMeasurements" : [ { + "name" : "latency", + "hashMap" : { + "value" : "80" + } + }, { + "name" : "throughput", + "hashMap" : { + "value" : "60" + } + }, { + "name" : "identifier", + "hashMap" : { + "value" : "Cell1" + } + }, { + "name" : "trafficModel", + "hashMap" : { + "emergency_samsung_s10_01" : "33" + } + } ] + } +``` diff --git a/operations/a1-pe-sim-packages/cba-resource.xml b/operations/a1-pe-sim-packages/cba-resource.xml new file mode 100644 index 0000000..4839ffd --- /dev/null +++ b/operations/a1-pe-sim-packages/cba-resource.xml @@ -0,0 +1,26 @@ +<!-- + ~ Copyright (C) 2021 Samsung Electronics + ~ 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 + --> + +<assembly> + <id>oran-sim-cba</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>resources/oran-sim-cba</directory> + <outputDirectory>/</outputDirectory> + </fileSet> + </fileSets> +</assembly> diff --git a/operations/a1-pe-sim-packages/csar-resource.xml b/operations/a1-pe-sim-packages/csar-resource.xml new file mode 100644 index 0000000..352145d --- /dev/null +++ b/operations/a1-pe-sim-packages/csar-resource.xml @@ -0,0 +1,43 @@ +<!-- + ~ Copyright (C) 2021 Samsung Electronics + ~ 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 + --> + +<assembly> + <id>oran-sim-cnf-csar</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>resources/oran-sim-csar/</directory> + <excludes> + <!-- This directory is already packed earlier --> + <exclude>o-ran-simulator/</exclude> + <!-- And we don't want to include any vim swapfiles --> + <exclude>.*.swp</exclude> + </excludes> + <outputDirectory>/</outputDirectory> + </fileSet> + </fileSets> + <files> + <file> + <source>target/oran-sim-helm.tar.gz</source> + <outputDirectory>/</outputDirectory> + <destName>o-ran-simulator_cloudtech_k8s_charts.tgz</destName> + </file> + <file> + <source>target/oran-sim-cba.zip</source> + <outputDirectory>/</outputDirectory> + </file> + </files> +</assembly> diff --git a/operations/a1-pe-sim-packages/docker/configuration/cells.json b/operations/a1-pe-sim-packages/docker/configuration/cells.json new file mode 100644 index 0000000..42e94c2 --- /dev/null +++ b/operations/a1-pe-sim-packages/docker/configuration/cells.json @@ -0,0 +1,125 @@ +{ + "cellList": [ + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell1", + "physicalCellId": 0, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.11", + "longitude": "19.98" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell4", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell2", + "physicalCellId": 1, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.06", + "longitude": "20.03" + }, + "neighbor": [ + { + "nodeId": "Cell5", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + }, + { + "nodeId": "Cell3", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell3", + "physicalCellId": 3, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.06", + "longitude": "19.94" + }, + "neighbor": [ + { + "nodeId": "Cell5", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + }, + { + "nodeId": "Cell4", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell4", + "physicalCellId": 4, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.11", + "longitude": "19.88" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell5", + "physicalCellId": 6, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.01", + "longitude": "19.99" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + } + ] +} diff --git a/operations/a1-pe-sim-packages/docker/configuration/ue.json b/operations/a1-pe-sim-packages/docker/configuration/ue.json new file mode 100644 index 0000000..2342723 --- /dev/null +++ b/operations/a1-pe-sim-packages/docker/configuration/ue.json @@ -0,0 +1,20 @@ +[ + { + "id": "emergency_samsung_s10_01", + "latitude": "50.09", + "longitude": "19.94", + "cellId": "Cell1" + }, + { + "id": "mobile_samsung_s20_02", + "latitude": "50.05", + "longitude": "19.95", + "cellId": "Cell3" + }, + { + "id": "emergency_police_01", + "latitude": "50.035", + "longitude": "19.97", + "cellId": "Cell3" + } +] diff --git a/operations/a1-pe-sim-packages/docker/configuration/vnf.config b/operations/a1-pe-sim-packages/docker/configuration/vnf.config new file mode 100644 index 0000000..695a222 --- /dev/null +++ b/operations/a1-pe-sim-packages/docker/configuration/vnf.config @@ -0,0 +1,7 @@ +vesHost=vesconsumer +vesPort=30417 +vesUser=sample1 +vesPassword=sample1 +vnfId=de305d54-75b4-431b-adb2-eb6b9e546014 +vnfName=ibcx0001vm002ssc001 +vnfType=oran_sim_type
\ No newline at end of file diff --git a/operations/a1-pe-sim-packages/docker/docker-compose.yml b/operations/a1-pe-sim-packages/docker/docker-compose.yml new file mode 100644 index 0000000..02b9010 --- /dev/null +++ b/operations/a1-pe-sim-packages/docker/docker-compose.yml @@ -0,0 +1,9 @@ +a1-pe-simulator: + image: "onap/integration/simulators/a1-pe-simulator:latest" + container_name: a1-pe-simulator + ports: + - "9998:9998" + volumes: + - ./configuration:/var/a1pesim + environment: + A1_BACKEND_HOST: a1-simulator diff --git a/operations/a1-pe-sim-packages/helm-resource.xml b/operations/a1-pe-sim-packages/helm-resource.xml new file mode 100644 index 0000000..c7d89c8 --- /dev/null +++ b/operations/a1-pe-sim-packages/helm-resource.xml @@ -0,0 +1,30 @@ +<!-- + ~ Copyright (C) 2021 Samsung Electronics + ~ 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 + --> + +<assembly> + <id>oran-sim-helm</id> + <formats> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>resources/oran-sim-csar/o-ran-simulator</directory> + <excludes> + <!-- Exclude all "hidden" files --> + <exclude>.*</exclude> + </excludes> + <outputDirectory>/</outputDirectory> + </fileSet> + </fileSets> +</assembly> diff --git a/operations/a1-pe-sim-packages/pom.xml b/operations/a1-pe-sim-packages/pom.xml new file mode 100644 index 0000000..8d12b8b --- /dev/null +++ b/operations/a1-pe-sim-packages/pom.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.onap.a1pesimulator</groupId> + <artifactId>cnf-packages</artifactId> + <version>1.0.0</version> + <packaging>pom</packaging> + + <name>a1-pe-simulator</name> + <description>a1-pe-simulator Parent</description> + + <parent> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>3.2.0</version> + </parent> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>cba</id> + <phase>generate-resources</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>oran-sim-cba</finalName> + <appendAssemblyId>false</appendAssemblyId> + <descriptors> + <descriptor>cba-resource.xml</descriptor> + </descriptors> + </configuration> + </execution> + <execution> + <id>helm</id> + <phase>generate-resources</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>oran-sim-helm</finalName> + <appendAssemblyId>false</appendAssemblyId> + <descriptors> + <descriptor>helm-resource.xml</descriptor> + </descriptors> + </configuration> + </execution> + <execution> + <id>csar</id> + <phase>generate-resources</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>oran-sim-csar</finalName> + <appendAssemblyId>false</appendAssemblyId> + <descriptors> + <descriptor>csar-resource.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/README.txt b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/README.txt new file mode 100644 index 0000000..1e5bf79 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/README.txt @@ -0,0 +1,3 @@ +This directory contains data dictionary entries you would want to put into CDS before enrichment process. These files are not necessary at runtime, only during development. + +This CBA may utilize not only variables (data dictionary entries) defined here, but also CDS default ones and/or ones defined in vcu usecase (Repository: vcu-onap-community, File: data-dict.json) diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/aic-cloud-region.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/aic-cloud-region.json new file mode 100644 index 0000000..8f39ca6 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/aic-cloud-region.json @@ -0,0 +1,44 @@ +{ + "name": "aic-cloud-region", + "tags": "aic-cloud-region", + "data_type": "string", + "description": "aic-cloud-region", + "entry_schema": "string", + "updatedBy": "Singal, Kapil <ks220y@att.com>", + "definition": { + "tags": "aic-cloud-region", + "name": "aic-cloud-region", + "property": { + "description": "aic-cloud-region", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-request-input", + "path": "/vnf-request-input/aic-cloud-region", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "aic-cloud-region": "aic-cloud-region" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/cells-payload.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/cells-payload.json new file mode 100644 index 0000000..f9ed7e5 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/cells-payload.json @@ -0,0 +1,25 @@ +{ + "tags": "cells-payload", + "name": "cells-payload", + "data_type": "string", + "entry_schema": "string", + "updatedBy": "Konrad Banka <k.banka@samsung.com>", + "definition": { + "tags": "cells-payload", + "name": "cells-payload", + "property": { + "description": "Cells topology json config", + "type": "string" + }, + "updated-by": "Konrad Banka <k.banka@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/externalNodeIp.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/externalNodeIp.json new file mode 100644 index 0000000..875ede3 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/externalNodeIp.json @@ -0,0 +1,27 @@ +{ + "name": "externalNodeIp", + "tags": "externalNodeIp", + "data_type": "string", + "description": "Host name or IP address for VNF Event Stream (VES) collector in ONAP DCAE", + "entry_schema": "string", + "updatedBy": "Samuli, Silvius <s.silvius@partner.samsung.com>", + "definition": { + "tags": "externalNodeIp", + "name": "externalNodeIp", + "property": { + "description": "Host name or IP address for VNF Event Stream (VES) collector in ONAP DCAE", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius <s.silvius@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/oran_name.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/oran_name.json new file mode 100644 index 0000000..b062fcc --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/oran_name.json @@ -0,0 +1,26 @@ +{ + "name": "oran_name", + "tags": "oran_name", + "data_type": "string", + "description": "ORAN name", + "entry_schema": "string", + "updatedBy": "L.K.", + "definition": { + "tags": "oran_name", + "name": "oran_name", + "property": { + "description": "ORAN name", + "type": "string" + }, + "updated-by": "L.K.", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/service-instance-id.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/service-instance-id.json new file mode 100644 index 0000000..966d218 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/service-instance-id.json @@ -0,0 +1,70 @@ +{ + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "data_type": "string", + "description": "To be provided", + "entry_schema": "string", + "updatedBy": "Singal, Kapil <ks220y@att.com>", + "definition": { + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "name": "service-instance-id", + "property": { + "description": "To be provided", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "any-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "capability": { + "type": "source-capability", + "properties": { + "script-type": "jython", + "script-class-reference": "SampleRAProcessor", + "instance-dependencies": [] + } + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id", + "path": "/service/0/service-instance-id", + "input-key-mapping": { + "service-instance-id": "service-instance.service-instance-id" + }, + "output-key-mapping": { + "service-instance-id": "service-instance-id" + }, + "key-dependencies": [ + "service-instance.service-instance-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ues-payload.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ues-payload.json new file mode 100644 index 0000000..27caf4b --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ues-payload.json @@ -0,0 +1,25 @@ +{ + "tags": "ues-payload", + "name": "ues-payload", + "data_type": "string", + "entry_schema": "string", + "updatedBy": "Konrad Banka <k.banka@samsung.com>", + "definition": { + "tags": "ues-payload", + "name": "ues-payload", + "property": { + "description": "User Equipment json config", + "type": "string" + }, + "updated-by": "Konrad Banka <k.banka@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-password.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-password.json new file mode 100644 index 0000000..ed08839 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-password.json @@ -0,0 +1,27 @@ +{ + "name": "ves-password", + "tags": "ves, dcae", + "data_type": "string", + "description": "Ves password", + "entry_schema": "string", + "updatedBy": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "definition": { + "tags": "ves, dcae", + "name": "ves-password", + "property": { + "description": "Ves password", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-port.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-port.json new file mode 100644 index 0000000..47bc604 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-port.json @@ -0,0 +1,27 @@ +{ + "name": "ves-port", + "tags": "ves-port", + "data_type": "string", + "description": "Port for VNF Event Stream (VES) collector in ONAP DCAE.", + "entry_schema": "string", + "updatedBy": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "definition": { + "tags": "ves-port", + "name": "ves-port", + "property": { + "description": "Port for VNF Event Stream (VES) collector in ONAP DCAE.", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-user.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-user.json new file mode 100644 index 0000000..bc582a1 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/ves-user.json @@ -0,0 +1,27 @@ +{ + "name": "ves-user", + "tags": "ves, dcae", + "data_type": "string", + "description": "Username for VNF Event Stream (VES) collector in ONAP DCAE.", + "entry_schema": "string", + "updatedBy": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "definition": { + "tags": "ves, dcae", + "name": "ves-user", + "property": { + "description": "Username for VNF Event Stream (VES) collector in ONAP DCAE.", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-id.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-id.json new file mode 100644 index 0000000..e021226 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-id.json @@ -0,0 +1,23 @@ +{ + "name": "vf-module-id", + "tags": "vf-module-id", + "data_type": "string", + "description": "vf-module-id", + "entry_schema": "string", + "updatedBy": "Singal, Kapil <ks220y@att.com>", + "definition": { + "tags": "vf-module-id", + "name": "vf-module-id", + "property": { + "description": "vf-module-id", + "type": "string" + }, + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-label.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-label.json new file mode 100644 index 0000000..f3d5fa9 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-label.json @@ -0,0 +1,43 @@ +{ + "name": "vf-module-label", + "tags": "vf-module-label", + "data_type": "string", + "description": "vf-module-label", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "definition": { + "tags": "vf-module-label", + "name": "vf-module-label", + "property": { + "description": "vf-module-label", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping": { + "customizationid": "vf-module-model-customization-uuid" + }, + "output-key-mapping": { + "vf-module-label": "vf_module_label" + }, + "key-dependencies": [ + "vf-module-model-customization-uuid" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-model-customization-uuid.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-model-customization-uuid.json new file mode 100644 index 0000000..f950ff7 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-module-model-customization-uuid.json @@ -0,0 +1,27 @@ +{ + "name": "vf-module-model-customization-uuid", + "tags": "vf-module-model-customization-uuid", + "data_type": "string", + "description": "vf-module-model-customization-uuid", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "definition": { + "tags": "vf-module-model-customization-uuid", + "name": "vf-module-model-customization-uuid", + "property": { + "description": "vf-module-model-customization-uuid", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-naming-policy.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-naming-policy.json new file mode 100644 index 0000000..7ccd23a --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vf-naming-policy.json @@ -0,0 +1,60 @@ +{ + "name": "vf-naming-policy", + "tags": "vf-naming-policy", + "data_type": "string", + "description": "vf-naming-policy", + "entry_schema": "string", + "updatedBy": "Robert Bogacki <r.bogacki@samsung.com>", + "definition": { + "tags": "vf-naming-policy", + "name": "vf-naming-policy", + "property": { + "description": "vf-naming-policy", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vf-naming-policy", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vf-naming-policy": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", + "input-key-mapping": { + "vnf_model_customization_uuid": "vnf-model-customization-uuid" + }, + "output-key-mapping": { + "vf-naming-policy": "vf_naming_policy" + }, + "key-dependencies": [ + "vnf-model-customization-uuid" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-id.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-id.json new file mode 100644 index 0000000..fe10ea8 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-id.json @@ -0,0 +1,47 @@ +{ + "name": "vnf-id", + "tags": "vnf-id", + "data_type": "string", + "description": "vnf-id", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "definition": { + "tags": "vnf-id", + "name": "vnf-id", + "property": { + "description": "vnf-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/", + "path": "/vnf/0/vnf-id", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "generic-vnf.vnf-id" + }, + "output-key-mapping": { + "vnf-id": "vnf-id" + }, + "key-dependencies": [ + "service-instance-id", + "generic-vnf.vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-ip-address.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-ip-address.json new file mode 100644 index 0000000..acd05dd --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-ip-address.json @@ -0,0 +1,65 @@ +{ + "name": "vnf-ip-address", + "tags": "vnf-ip-address", + "data_type": "string", + "description": "vnf-ip-address", + "entry_schema": "string", + "updatedBy": "Robert Bogacki <r.bogacki@samsung.com>", + "definition": { + "tags": "vnf-ip-address", + "name": "vnf-ip-address", + "property": { + "description": "vnf-ip-address", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-ip-address", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf-ip-address": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "aai-data": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/aai/v19/network/generic-vnfs/generic-vnf/$vnf-id", + "path": "", + "input-key-mapping": { + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "ipv4-oam-address": "ipv4-oam-address" + }, + "key-dependencies": [ + "vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-name.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-name.json new file mode 100644 index 0000000..65230bb --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-name.json @@ -0,0 +1,47 @@ +{ + "name": "vnf-name", + "tags": "vnf-name", + "data_type": "string", + "description": "vnf-name", + "entry_schema": "string", + "updatedBy": "Robert Bogacki <r.bogacki@samsung.com>", + "definition": { + "tags": "vnf-name", + "name": "vnf-name", + "property": { + "description": "vnf-name", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-type.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-type.json new file mode 100644 index 0000000..d9b88b5 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf-type.json @@ -0,0 +1,27 @@ +{ + "name": "vnf-type", + "tags": "vnf-type", + "data_type": "string", + "description": "vnf-type", + "entry_schema": "string", + "updatedBy": "Robert Bogacki <r.bogacki@samsung.com>", + "definition": { + "tags": "vnf-type", + "name": "vnf-type", + "property": { + "description": "vnf-type", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf_name.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf_name.json new file mode 100644 index 0000000..ce8c8de --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba-data-dictionary/vnf_name.json @@ -0,0 +1,47 @@ +{ + "name": "vnf_name", + "tags": "vnf_name", + "data_type": "string", + "description": "vnf_name", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "definition": { + "tags": "vnf_name", + "name": "vnf_name", + "property": { + "description": "vnf_name", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/artifact_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/artifact_types.json new file mode 100644 index 0000000..224e7b6 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/artifact_types.json @@ -0,0 +1,20 @@ +{ + "artifact_types": { + "artifact-mapping-resource": { + "description": "Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "derived_from": "tosca.artifacts.Implementation", + "file_ext": [ + "json" + ] + }, + "artifact-template-velocity": { + "description": " Velocity Template used for Configuration", + "version": "1.0.0", + "derived_from": "tosca.artifacts.Implementation", + "file_ext": [ + "vtl" + ] + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/data_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/data_types.json new file mode 100644 index 0000000..b64e404 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/data_types.json @@ -0,0 +1,174 @@ +{ + "data_types": { + "dt-config-assign-properties": { + "description": "Dynamic DataType definition for workflow(config-assign).", + "version": "1.0.0", + "properties": { + "vnf-id": { + "type": "string" + }, + "cells-payload": { + "type": "string", + "default": "" + }, + "ves-port": { + "type": "string", + "default": "30417" + }, + "ues-payload": { + "type": "string", + "default": "" + }, + "ves-user": { + "type": "string", + "default": "sample1" + }, + "externalNodeIp": { + "type": "string" + }, + "vnf-name": { + "type": "string", + "default": "oran-sim-name" + }, + "vnf-type": { + "type": "string", + "default": "oran-sim-type" + }, + "ves-password": { + "type": "string", + "default": "sample1" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, + "dt-config-deploy-properties": { + "description": "Dynamic DataType definition for workflow(config-deploy).", + "version": "1.0.0", + "properties": { + "vnf-id": { + "type": "string" + }, + "service-instance-id": { + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, + "dt-resource-assignment-properties": { + "description": "Dynamic DataType definition for workflow(resource-assignment).", + "version": "1.0.0", + "properties": { + "vnf-ip-address": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "default": "${vnf-ip-address}", + "entry_schema": { + "type": "" + } + }, + "vnf-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "service-instance-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "vnf_name": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "vf-module-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "aic-cloud-region": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "oran_name": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "default": "${oran_name}", + "entry_schema": { + "type": "" + } + }, + "vf-module-label": { + "description": "", + "required": false, + "type": "string" + }, + "vf-naming-policy": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "default": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", + "entry_schema": { + "type": "" + } + }, + "vf-module-model-customization-uuid": { + "description": "", + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/node_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/node_types.json new file mode 100644 index 0000000..3d7d15b --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/node_types.json @@ -0,0 +1,372 @@ +{ + "node_types": { + "component-resource-resolution": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "attributes": { + "assignment-params": { + "description": "Holds resolved template, resolution-summary or key-value", + "required": true, + "type": "string" + }, + "assignment-map": { + "description": "Holds resolved values for each artifact prefix eg. { vdns: { vnf-id: 123 } }", + "required": true, + "type": "map" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "resolution-key": { + "description": "Key for service instance related correlation.", + "required": false, + "type": "string" + }, + "occurrence": { + "description": "Number of time to perform the resolution.", + "required": false, + "type": "integer", + "default": 1 + }, + "store-result": { + "description": "Whether or not to store the output.", + "required": false, + "type": "boolean" + }, + "resource-type": { + "description": "Request type.", + "required": false, + "type": "string" + }, + "resolution-summary": { + "description": "Enable resolution-summary output", + "required": false, + "type": "boolean" + }, + "artifact-prefix-names": { + "description": "Template , Resource Assignment Artifact Prefix names", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id, Unique Id for the request.", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Resource Id.", + "required": false, + "type": "string" + }, + "action-name": { + "description": "Action Name of the process", + "required": false, + "type": "string" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "resource-assignment-map": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-script-executor": { + "description": "This is CLI Transaction Configuration Component API", + "version": "1.0.0", + "attributes": { + "response-data": { + "required": false, + "type": "json" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": { + "description": "Script type, kotlin type is supported", + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython", + "internal" + ] + } + ], + "default": "internal" + }, + "script-class-reference": { + "description": "Kotlin Script class name or jython script name.", + "required": true, + "type": "string" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "source-capability": { + "description": "This is Component Resource Source Node Type", + "version": "1.0.0", + "properties": { + "script-type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "kotlin", + "internal", + "jython" + ] + } + ], + "default": "kotlin" + }, + "script-class-reference": { + "description": "Capability reference name for internal and kotlin, for jython script file path", + "required": true, + "type": "string" + }, + "instance-dependencies": { + "description": "Instance dependency Names to Inject to Kotlin / Jython Script.", + "required": false, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "description": "Resource Resolution dependency dictionary names.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" + }, + "source-db": { + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ], + "default": "SQL" + }, + "endpoint-selector": { + "required": false, + "type": "string" + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" + }, + "source-default": { + "description": "This is Default Resource Source Node Type", + "version": "1.0.0", + "properties": {}, + "derived_from": "tosca.nodes.ResourceSource" + }, + "source-input": { + "description": "This is Input Resource Source Node Type", + "version": "1.0.0", + "properties": {}, + "derived_from": "tosca.nodes.ResourceSource" + }, + "source-rest": { + "description": "This is Rest Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "JSON" + ] + } + ], + "default": "JSON" + }, + "headers": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "verb": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "GET", + "POST", + "DELETE", + "PUT" + ] + } + ], + "default": "GET" + }, + "payload": { + "required": false, + "type": "string", + "default": "" + }, + "endpoint-selector": { + "required": false, + "type": "string" + }, + "url-path": { + "required": true, + "type": "string" + }, + "path": { + "required": true, + "type": "string" + }, + "expression-type": { + "required": false, + "type": "string", + "constraints": [ + { + "valid_values": [ + "JSON_PATH", + "JSON_POINTER" + ] + } + ], + "default": "JSON_PATH" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component": { + "description": "This is default Component Node", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource": { + "description": "TOSCA base type for Resource Sources", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/oran-sim-blueprint.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/oran-sim-blueprint.json new file mode 100644 index 0000000..9ad633e --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/oran-sim-blueprint.json @@ -0,0 +1,296 @@ +{ + "tosca_definitions_version": "controller_blueprint_1_0_0", + "metadata": { + "template_author": "Lasse Kaihlavirta", + "author-email": "l.kaihlavirt@partner.samsung.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "a1_pe_simulator", + "template_version": "1.3.2", + "template_tags": "samsung, oran", + "template_type": "DEFAULT" + }, + "imports": [ + { + "file": "Definitions/data_types.json" + }, + { + "file": "Definitions/relationship_types.json" + }, + { + "file": "Definitions/artifact_types.json" + }, + { + "file": "Definitions/node_types.json" + }, + { + "file": "Definitions/policy_types.json" + } + ], + "dsl_definitions": { + "multicloud-k8s-api": { + "type": "basic-auth", + "username": "admin", + "password": "admin", + "url": "http://multicloud-k8s:9015" + }, + "aai-api": { + "type": "basic-auth", + "username": "AAI", + "password": "AAI", + "url": "https://aai.onap:8443" + }, + "config-deploy-properties": { + "resolution-key": { + "get_input": "resolution-key" + }, + "vnf-id-value": { + "get_input": "vnf-id" + }, + "api-access": "*multicloud-k8s-api", + "aai-access": "*aai-api" + } + }, + "topology_template": { + "workflows": { + "resource-assignment": { + "steps": { + "resource-assignment": { + "description": "Parameters resolution phase", + "target": "resource-assignment", + "activities": [ + { + "call_operation": "" + } + ] + } + }, + "inputs": { + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "resource-assignment-properties": { + "description": "Dynamic PropertyDefinition for workflow(resource-assignment).", + "required": true, + "type": "dt-resource-assignment-properties" + } + }, + "outputs": { + "meshed-template": { + "type": "json", + "value": { + "get_attribute": [ + "resource-assignment", + "assignment-params" + ] + } + } + } + }, + "config-assign": { + "steps": { + "config-assign": { + "description": "Config Assign Workflow", + "target": "config-assign", + "activities": [ + { + "call_operation": "" + } + ] + } + }, + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "config-assign-properties": { + "description": "Dynamic PropertyDefinition for workflow(config-assign).", + "required": true, + "type": "dt-config-assign-properties" + } + }, + "outputs": { + "dry-run": { + "type": "json", + "value": { + "get_attribute": [ + "config-assign", + "assignment-params" + ] + } + } + } + }, + "config-deploy": { + "steps": { + "resolve-netconfaccount": { + "description": "Resolve VNF Management Ip Address and Netconf username/password for the Netconf operation.", + "target": "resolve-netconfaccount", + "activities": [ + { + "call_operation": "" + } + ], + "on_success": [ + "imperative-workflow-step-1" + ] + }, + "imperative-workflow-step-1": { + "description": "Config Deploy workflow", + "target": "execute-post", + "activities": [ + { + "call_operation": "ComponentScriptExecutor.process" + } + ] + } + }, + "inputs": { + "resolution-key": { + "required": false, + "type": "string" + }, + "config-deploy-properties": { + "description": "Dynamic PropertyDefinition for workflow(config-deploy).", + "required": true, + "type": "dt-config-deploy-properties" + } + } + } + }, + "node_templates": { + "resource-assignment": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "artifact-prefix-names": { + "get_input": "template-prefix" + } + } + } + } + } + }, + "artifacts": { + "vnf-template": { + "type": "artifact-template-velocity", + "file": "Templates/vnf-template.vtl" + }, + "vnf-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/vnf-mapping.json" + }, + "o-ran-simulator-template": { + "type": "artifact-template-velocity", + "file": "Templates/o-ran-simulator-template.vtl" + }, + "o-ran-simulator-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/o-ran-simulator-mapping.json" + } + } + }, + "config-assign": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "resolution-key": { + "get_input": "resolution-key" + }, + "store-result": true, + "artifact-prefix-names": [ + "ves", + "ues", + "cells" + ] + } + } + } + } + }, + "artifacts": { + "ves-template": { + "type": "artifact-template-velocity", + "file": "Templates/ves-template.vtl" + }, + "ves-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/ves-mapping.json" + }, + "ues-template": { + "type": "artifact-template-velocity", + "file": "Templates/ues-template.vtl" + }, + "ues-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/ues-mapping.json" + }, + "cells-template": { + "type": "artifact-template-velocity", + "file": "Templates/cells-template.vtl" + }, + "cells-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/cells-mapping.json" + } + } + }, + "resolve-netconfaccount": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "resolution-key": { + "get_input": "resolution-key" + }, + "store-result": true, + "artifact-prefix-names": [ + "req-input" + ] + } + } + } + } + }, + "artifacts": { + "req-input-template": { + "type": "artifact-template-velocity", + "file": "Templates/req-input-template.vtl" + }, + "req-input-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/req-input-mapping.json" + } + } + }, + "execute-post": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": "kotlin", + "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.DayOneConfig", + "dynamic-properties": "*config-deploy-properties" + } + } + } + } + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/policy_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/policy_types.json new file mode 100644 index 0000000..ff6420e --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types": {} +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/relationship_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/relationship_types.json new file mode 100644 index 0000000..5000ce5 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/relationship_types.json @@ -0,0 +1,3 @@ +{ + "relationship_types": {} +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/resources_definition_types.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/resources_definition_types.json new file mode 100644 index 0000000..5885e0f --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Definitions/resources_definition_types.json @@ -0,0 +1,548 @@ +{ + "aic-cloud-region": { + "tags": "aic-cloud-region", + "name": "aic-cloud-region", + "property": { + "description": "aic-cloud-region", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-request-input", + "path": "/vnf-request-input/aic-cloud-region", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "aic-cloud-region": "aic-cloud-region" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + }, + "cells-payload": { + "tags": "cells-payload", + "name": "cells-payload", + "property": { + "description": "Cells topology json config", + "type": "string" + }, + "group": "default", + "updated-by": "Konrad Banka <k.banka@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "externalNodeIp": { + "tags": "externalNodeIp", + "name": "externalNodeIp", + "property": { + "description": "Host name or IP address for VNF Event Stream (VES) collector in ONAP DCAE", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius <s.silvius@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "oran_name": { + "tags": "oran_name", + "name": "oran_name", + "property": { + "description": "ORAN name", + "type": "string" + }, + "group": "default", + "updated-by": "L.K.", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "service-instance-id": { + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "name": "service-instance-id", + "property": { + "description": "To be provided", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "any-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "capability": { + "type": "source-capability", + "properties": { + "script-type": "jython", + "script-class-reference": "SampleRAProcessor", + "instance-dependencies": [] + } + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id", + "path": "/service/0/service-instance-id", + "input-key-mapping": { + "service-instance-id": "service-instance.service-instance-id" + }, + "output-key-mapping": { + "service-instance-id": "service-instance-id" + }, + "key-dependencies": [ + "service-instance.service-instance-id" + ] + } + } + } + }, + "ues-payload": { + "tags": "ues-payload", + "name": "ues-payload", + "property": { + "description": "User Equipment json config", + "type": "string" + }, + "group": "default", + "updated-by": "Konrad Banka <k.banka@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "ves-password": { + "tags": "ves, dcae", + "name": "ves-password", + "property": { + "description": "Ves password", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "ves-port": { + "tags": "ves-port", + "name": "ves-port", + "property": { + "description": "Port for VNF Event Stream (VES) collector in ONAP DCAE.", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "ves-user": { + "tags": "ves, dcae", + "name": "ves-user", + "property": { + "description": "Username for VNF Event Stream (VES) collector in ONAP DCAE.", + "type": "string" + }, + "group": "default", + "updated-by": "Lasse Kaihlavirta <l.kaihlavirt@partner.samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "vf-module-id": { + "tags": "vf-module-id", + "name": "vf-module-id", + "property": { + "description": "vf-module-id", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil <ks220y@att.com>", + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vf-module-label": { + "tags": "vf-module-label", + "name": "vf-module-label", + "property": { + "description": "vf-module-label", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping": { + "customizationid": "vf-module-model-customization-uuid" + }, + "output-key-mapping": { + "vf-module-label": "vf_module_label" + }, + "key-dependencies": [ + "vf-module-model-customization-uuid" + ] + } + } + } + }, + "vf-module-model-customization-uuid": { + "tags": "vf-module-model-customization-uuid", + "name": "vf-module-model-customization-uuid", + "property": { + "description": "vf-module-model-customization-uuid", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "vf-naming-policy": { + "tags": "vf-naming-policy", + "name": "vf-naming-policy", + "property": { + "description": "vf-naming-policy", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vf-naming-policy", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vf-naming-policy": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", + "input-key-mapping": { + "vnf_model_customization_uuid": "vnf-model-customization-uuid" + }, + "output-key-mapping": { + "vf-naming-policy": "vf_naming_policy" + }, + "key-dependencies": [ + "vnf-model-customization-uuid" + ] + } + } + } + }, + "vnf-id": { + "tags": "vnf-id", + "name": "vnf-id", + "property": { + "description": "vnf-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/", + "path": "/vnf/0/vnf-id", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "generic-vnf.vnf-id" + }, + "output-key-mapping": { + "vnf-id": "vnf-id" + }, + "key-dependencies": [ + "service-instance-id", + "generic-vnf.vnf-id" + ] + } + } + } + }, + "vnf-ip-address": { + "tags": "vnf-ip-address", + "name": "vnf-ip-address", + "property": { + "description": "vnf-ip-address", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-ip-address", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf-ip-address": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "aai-data": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/aai/v19/network/generic-vnfs/generic-vnf/$vnf-id", + "path": "", + "input-key-mapping": { + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "ipv4-oam-address": "ipv4-oam-address" + }, + "key-dependencies": [ + "vnf-id" + ] + } + } + } + }, + "vnf-name": { + "tags": "vnf-name", + "name": "vnf-name", + "property": { + "description": "vnf-name", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + }, + "vnf-type": { + "tags": "vnf-type", + "name": "vnf-type", + "property": { + "description": "vnf-type", + "type": "string" + }, + "group": "default", + "updated-by": "Robert Bogacki <r.bogacki@samsung.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "vnf_name": { + "tags": "vnf_name", + "name": "vnf_name", + "property": { + "description": "vnf_name", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Scripts/kotlin/DayOneConfig.kt b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Scripts/kotlin/DayOneConfig.kt new file mode 100644 index 0000000..28628dc --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Scripts/kotlin/DayOneConfig.kt @@ -0,0 +1,682 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts + +/* +* Copyright © 2019 TechMahindra +* Author: Malinconico Aniello Paolo, Vamshi Namilikonda, Thamlur Raju +* 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. +*/ + + +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.node.ObjectNode +import java.io.File +import java.nio.file.Path +import java.nio.file.Paths +import org.apache.commons.io.FileUtils +import org.apache.commons.io.IOUtils +import org.apache.http.client.ClientProtocolException +import org.apache.http.client.entity.EntityBuilder +import org.apache.http.client.methods.HttpPost +import org.apache.http.client.methods.HttpUriRequest +import org.apache.http.message.BasicHeader +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.RestLoggerService +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.utils.ArchiveType +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.slf4j.LoggerFactory +import org.springframework.http.HttpHeaders +import org.springframework.http.HttpMethod +import org.springframework.http.MediaType +import org.yaml.snakeyaml.Yaml +import java.io.IOException +import java.util.Base64 +import java.nio.charset.Charset +import java.nio.file.Files +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService + +open class DayOneConfig : AbstractScriptComponentFunction() { + + private val log = LoggerFactory.getLogger(DayOneConfig::class.java)!! + + override fun getName(): String { + return "DayOneConfig" + } + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + log.info("DAY-1 Script execution started") + + val baseK8sApiUrl = getDynamicProperties("api-access").get("url").asText() + val k8sApiUsername = getDynamicProperties("api-access").get("username").asText() + val k8sApiPassword = getDynamicProperties("api-access").get("password").asText() + + log.info("Multi-cloud params $baseK8sApiUrl") + + val aaiApiUrl = getDynamicProperties("aai-access").get("url").asText() + val aaiApiUsername = getDynamicProperties("aai-access").get("username").asText() + val aaiApiPassword = getDynamicProperties("aai-access").get("password").asText() + + log.info("AAI params $aaiApiUrl") + + val vnfID: String = getDynamicProperties("vnf-id-value").asText() + + log.info("Get vnfID $vnfID") + + val vnfUrl = aaiApiUrl + "/aai/v19/network/generic-vnfs/generic-vnf/" + vnfID + "/vf-modules"; + + val mapOfHeaders = hashMapOf<String, String>() + mapOfHeaders.put("Accept", "application/json") + mapOfHeaders.put("Content-Type", "application/json") + mapOfHeaders.put("x-FromAppId", "SO") + mapOfHeaders.put("X-TransactionId", "get_aai_subscr") + val basicAuthRestClientProperties: BasicAuthRestClientProperties = BasicAuthRestClientProperties() + basicAuthRestClientProperties.username = aaiApiUsername + basicAuthRestClientProperties.password = aaiApiPassword + basicAuthRestClientProperties.url = vnfUrl + basicAuthRestClientProperties.additionalHeaders = mapOfHeaders + val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties) + try { + val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "") + + val aaiBody = resultOfGet.body + val aaiPayloadObject = JacksonUtils.jsonNode(aaiBody) as ObjectNode + + for (item in aaiPayloadObject.get("vf-module")) { + + log.info("item payload Deatils : $item") + + val vfModuleID: String = item.get("vf-module-id").asText() + log.info("AAI Vf-module ID is : $vfModuleID") + + val vfModuleInvariantID: String = item.get("model-invariant-id").asText() + log.info("AAI Vf-module Invariant ID is : $vfModuleInvariantID") + + val vfModuleUUID: String = item.get("model-version-id").asText() + log.info("AAI Vf-module UUID is : $vfModuleUUID") + + val vfModuleInstance: String = item.get("heat-stack-id").asText() + log.info("AAI Vf-module Heat Stack ID : $vfModuleInstance") + + var delimiter = "/" + + val Instance = vfModuleInstance.split(delimiter) + val instanceName = Instance[0] + val instanceID = Instance[1] + log.info("instance name is : $instanceName") + log.info("K8S instance ID is : $instanceID") + + val typOfVfmodule = "cnf" + log.info("Type of vf-module: $typOfVfmodule") + + val k8sRbProfileName = "default" + + val k8sConfigTemplateName = "template_$vfModuleID" + + val api = K8sConfigTemplateApi(k8sApiUsername, k8sApiPassword, baseK8sApiUrl, vfModuleInvariantID, vfModuleUUID, k8sConfigTemplateName) + + // Check if definition exists + if (!api.hasDefinition()) { + throw BluePrintProcessorException("K8s Config Template ($vfModuleInvariantID/$vfModuleUUID) - $k8sConfigTemplateName not found ") + } + + log.info("Config Template name: $k8sConfigTemplateName") + + val configmapName = "res-default-a1-pe-simulator-app-cm" + log.info("configmap retrieved " + typOfVfmodule + " vfmodule -> " + configmapName) + modifyTemplate(configmapName, typOfVfmodule) + + + var configTemplate = K8sConfigTemplate() + configTemplate.templateName = k8sConfigTemplateName + configTemplate.description = " " + configTemplate.ChartName = typOfVfmodule + log.info("Chart name: ${configTemplate.ChartName}") + + if (!api.hasConfigTemplate(configTemplate)) { + log.info("K8s Config Template Upload Started") + api.createConfigTemplate(configTemplate) + val configTemplateFile: Path = prepareConfigTemplateJson() + api.uploadConfigTemplateContent(configTemplate, configTemplateFile) + log.info("K8s Config Template Upload Completed") + val configName = "config_1" + val config = K8sConfigPayloadJson() + config.configName = configName + config.templateName = k8sConfigTemplateName + log.info("Get ves, ues, cells from CDS") + config.values.topic.ves = getVes() + config.values.topic.ues = getUes() + config.values.topic.cells = getCells() + + log.info("config $config.values.topic") + + api.createOrUpdateConfig(config, k8sRbProfileName) + } + } + log.info("DAY-1 Script execution completed") + } catch (e: Exception) { + log.info("Caught exception executing day one operation: ") + log.info("${e}") + // throw BluePrintProcessorException("${e.message}") + } + } + + suspend fun getUes(): String { + val resolutionKey = getDynamicProperties("resolution-key").asText() + + val ues = storedContentFromResolvedArtifactNB(resolutionKey, "ues") + log.info("ues: $ues") + + return ues + } + + suspend fun getVes(): String{ + val resolutionKey = getDynamicProperties("resolution-key").asText() + + val ves = storedContentFromResolvedArtifactNB(resolutionKey, "ves") + log.info("ves: $ves") + + return ves + } + + suspend fun getCells(): String { + val resolutionKey = getDynamicProperties("resolution-key").asText() + + val cells = storedContentFromResolvedArtifactNB(resolutionKey, "cells") + log.info("cells: $cells") + + return cells + } + + fun prepareConfigTemplateJson(): Path { + val bluePrintContext = bluePrintRuntimeService.bluePrintContext() + val bluePrintBasePath: String = bluePrintContext.rootPath + + var profileFilePath: Path = Paths.get(bluePrintBasePath.plus(File.separator).plus("Templates").plus(File.separator).plus("k8s-profiles").plus(File.separator).plus("cnf-config-template.tar.gz")) + log.info("Reading K8s Config Template file: $profileFilePath") + + val profileFile = profileFilePath.toFile() + + if (!profileFile.exists()) + throw BluePrintProcessorException("K8s Profile template file $profileFilePath does not exists") + + return profileFilePath + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + bluePrintRuntimeService.getBluePrintError().addError("${runtimeException.message}") + } + + fun modifyTemplate(configmapName: String, typOfVfmodule: String): String { + + log.info("Executing modifyTemplate ->") + + val bluePrintContext = bluePrintRuntimeService.bluePrintContext() + val bluePrintBasePath: String = bluePrintContext.rootPath + + val destPath: String = "/tmp/config-template-" + typOfVfmodule + + var templateFilePath: Path = Paths.get(bluePrintBasePath.plus(File.separator).plus("Templates").plus(File.separator).plus("k8s-profiles").plus(File.separator).plus("cnf-config-template.tar.gz")) + + log.info("Reading config template file: ${templateFilePath}") + val templateFile = templateFilePath.toFile() + + if (!templateFile.exists()) + throw BluePrintProcessorException("K8s Profile template file ${templateFilePath} does not exists") + + log.info("Purging ${destPath} before decompression") + + FileUtils.deleteQuietly(File(destPath)) + + log.info("Decompressing config template to ${destPath}") + + val decompressedProfile: File = BluePrintArchiveUtils.deCompress(templateFilePath.toFile(), + "${destPath}", ArchiveType.TarGz) + + log.info("${templateFilePath.toString()} decompression completed") + + //Here we update override.yaml file + + val manifestFileName = destPath.plus(File.separator).plus(typOfVfmodule).plus(File.separator).plus("templates").plus(File.separator).plus("configmap.yaml") + log.info("Modification of configmap.yaml file at ${manifestFileName.toString()}") + var finalManifest = "" + File(manifestFileName).bufferedReader().use { inr -> + try { + val manifestYaml = Yaml() + val manifestObject: Map<String, Any> = manifestYaml.load(inr) + + for ((k, v) in manifestObject) { + log.info("manifestObject: ${k}, ${v}") + } + + log.info("Uploaded YAML object") + + val metadata: MutableMap<String, Any> = manifestObject.get("metadata") as MutableMap<String, Any> + log.info("Uploaded config YAML object") + + for ((k, v) in metadata) { + metadata.put(k, configmapName) + } + + finalManifest = manifestYaml.dump(manifestObject) + } catch (e: Exception) { + log.info("Error during parsing the configmap.yaml: ${e}") + } + } + + File(manifestFileName).bufferedWriter().use { out -> out.write(finalManifest) } + + log.info(finalManifest) + + log.info("Reading config template file: ${templateFilePath}") + + if (!templateFile.exists()) + throw BluePrintProcessorException("config template file ${templateFilePath} does not exists") + + val tempMainPath: File = createTempDir("config-template-", "") + val tempConfigTemplatePath: File = createTempDir("conftemplate-", "", tempMainPath) + log.info("Decompressing profile to ${tempConfigTemplatePath.toString()}") + + val decompressedProfile2: File = BluePrintArchiveUtils.deCompress(templateFilePath.toFile(), + "${tempConfigTemplatePath.toString()}", ArchiveType.TarGz) + + log.info("${templateFilePath.toString()} decompression completed") + + //Here we update configmap.yaml file + + log.info("Modification of configmap.yaml file ") + val manifestFileName2 = destPath.toString().plus(File.separator).plus(typOfVfmodule).plus(File.separator).plus("templates").plus(File.separator).plus("configmap.yaml") + val destOverrideFile = tempConfigTemplatePath.toString().plus(File.separator).plus(typOfVfmodule).plus(File.separator).plus("templates").plus(File.separator).plus("configmap.yaml") + log.info("destination override file ${destOverrideFile}") + + File(manifestFileName2).copyTo(File(destOverrideFile), true) + + if (!BluePrintArchiveUtils.compress(decompressedProfile2, templateFilePath.toFile(), + ArchiveType.TarGz)) { + throw BluePrintProcessorException("Profile compression has failed") + } + + log.info("${templateFilePath.toString()} compression completed") + + return "" + } + + inner class K8sInstanceApi( + val username: String, + val password: String, + val baseUrl: String, + val definition: String, + val definitionVersion: String + ) { + private val service: UploadConfigTemplateRestClientService // BasicAuthRestClientService + + init { + var mapOfHeaders = hashMapOf<String, String>() + mapOfHeaders.put("Accept", "application/json") + mapOfHeaders.put("Content-Type", "application/json") + mapOfHeaders.put("cache-control", " no-cache") + mapOfHeaders.put("Accept", "application/json") + var basicAuthRestClientProperties: BasicAuthRestClientProperties = BasicAuthRestClientProperties() + basicAuthRestClientProperties.username = username + basicAuthRestClientProperties.password = password + basicAuthRestClientProperties.url = "$baseUrl/v1/instance" + basicAuthRestClientProperties.additionalHeaders = mapOfHeaders + + this.service = UploadConfigTemplateRestClientService(basicAuthRestClientProperties) + } + + fun getInstanceDetails(instanceId: String): String { + log.info("Executing K8sInstanceApi.getInstanceDetails") + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.exchangeResource(HttpMethod.GET.name, "/${instanceId}", "") + print(result) + if (result.status >= 200 && result.status < 300) { + log.info("K8s instance details retrieved, processing it for configmap details") + log.info("response body -> " + result.body.toString()) + val cmName: String = processInstanceResponse(result.body) + return cmName + } else + return "" + } catch (e: Exception) { + log.info("Caught exception trying to get k8s instance details") + throw BluePrintProcessorException("${e.message}") + } + } + + fun processInstanceResponse(response: String): String { + + log.info("K8s instance details retrieved, processing it for configmap details") + + val gson = Gson() + + val startInd = response.indexOf('[') + val endInd = response.indexOf(']') + + val subStr = response.substring(startInd, endInd + 1) + + val resourceType = object : TypeToken<Array<K8sResources>>() {}.type + + var resources: Array<K8sResources> = gson.fromJson(subStr, resourceType) + + for (resource in resources) { + + if (resource.GVK?.Kind == "ConfigMap") { + + return resource.Name + + } + + } + return "" + + } + + } + + inner class K8sConfigTemplateApi( + val username: String, + val password: String, + val baseUrl: String, + val definition: String, + val definitionVersion: String, + val configTemplateName: String + ) { + private val service: UploadConfigTemplateRestClientService // BasicAuthRestClientService + + init { + var mapOfHeaders = hashMapOf<String, String>() + mapOfHeaders.put("Accept", "application/json") + mapOfHeaders.put("Content-Type", "application/json") + mapOfHeaders.put("cache-control", " no-cache") + mapOfHeaders.put("Accept", "application/json") + var basicAuthRestClientProperties: BasicAuthRestClientProperties = BasicAuthRestClientProperties() + basicAuthRestClientProperties.username = username + basicAuthRestClientProperties.password = password + basicAuthRestClientProperties.url = "$baseUrl/v1/rb/definition/$definition/$definitionVersion" + basicAuthRestClientProperties.additionalHeaders = mapOfHeaders + + this.service = UploadConfigTemplateRestClientService(basicAuthRestClientProperties) + } + + fun hasDefinition(): Boolean { + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.exchangeResource(HttpMethod.GET.name, "", "") + print(result) + return result.status >= 200 && result.status < 300 + } catch (e: Exception) { + log.info("Caught exception trying to get k8s config template definition") + throw BluePrintProcessorException("${e.message}") + } + } + + fun hasConfigTemplate(profile: K8sConfigTemplate): Boolean { + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.exchangeResource(HttpMethod.GET.name, "/config-template/${profile.templateName}", "") + print(result) + if (result.status >= 200 && result.status < 300) { + log.info("ConfigTemplate already exists") + return true + } else + return false + } catch (e: Exception) { + log.info("Caught exception trying to get k8s config trmplate definition") + throw BluePrintProcessorException("${e.message}") + } + } + + fun createOrUpdateConfig(configJson: K8sConfigPayloadJson, profileName: String) { + val objectMapper = ObjectMapper() + + val configJsonString: String = objectMapper.writeValueAsString(configJson) + + log.info("payload generated -> " + configJsonString) + + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.exchangeResource(HttpMethod.POST.name, + "/profile/${profileName}/config", configJsonString) + if (result.status < 200 || result.status >= 300) { + throw Exception(result.body) + } + } catch (e: Exception) { + log.info("Caught exception trying to create or update configuration ") + throw BluePrintProcessorException("${e.message}") + } + } + + fun createConfigTemplate(profile: K8sConfigTemplate) { + val objectMapper = ObjectMapper() + val profileJsonString: String = objectMapper.writeValueAsString(profile) + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.exchangeResource( + HttpMethod.POST.name, + "/config-template", + profileJsonString + ) + + if (result.status >= 200 && result.status < 300) { + log.info("Config template json info uploaded correctly") + } else if (result.status < 200 || result.status >= 300) { + log.info("Config template already exists") + } + } catch (e: Exception) { + log.info("Caught exception trying to create k8s config template ${profile.templateName} - updated") +// throw BluePrintProcessorException("${e.message}") + } + } + + fun uploadConfigTemplateContent(profile: K8sConfigTemplate, filePath: Path) { + try { + val result: BlueprintWebClientService.WebClientResponse<String> = service.uploadBinaryFile( + "/config-template/${profile.templateName}/content", + filePath + ) + if (result.status < 200 || result.status >= 300) { + throw Exception(result.body) + } + } catch (e: Exception) { + log.info("Caught exception trying to upload k8s config template ${profile.templateName}") + throw BluePrintProcessorException("${e.message}") + } + } + + + } +} + +class UploadConfigTemplateRestClientService( + private val restClientProperties: BasicAuthRestClientProperties +) : BlueprintWebClientService { + + override fun defaultHeaders(): Map<String, String> { + + val encodedCredentials = setBasicAuth( + restClientProperties.username, + restClientProperties.password + ) + return mapOf( + HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE, + HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE, + HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials" + ) + } + + override fun host(uri: String): String { + return restClientProperties.url + uri + } + + override fun convertToBasicHeaders(headers: Map<String, String>): + Array<BasicHeader> { + val customHeaders: MutableMap<String, String> = headers.toMutableMap() + // inject additionalHeaders + customHeaders.putAll(verifyAdditionalHeaders(restClientProperties)) + + if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) { + val encodedCredentials = setBasicAuth( + restClientProperties.username, + restClientProperties.password + ) + customHeaders[HttpHeaders.AUTHORIZATION] = + "Basic $encodedCredentials" + } + return super.convertToBasicHeaders(customHeaders) + } + + private fun setBasicAuth(username: String, password: String): String { + val credentialsString = "$username:$password" + return Base64.getEncoder().encodeToString( + credentialsString.toByteArray(Charset.defaultCharset()) + ) + } + + @Throws(IOException::class, ClientProtocolException::class) + private fun performHttpCall(httpUriRequest: HttpUriRequest): BlueprintWebClientService.WebClientResponse<String> { + val httpResponse = httpClient().execute(httpUriRequest) + val statusCode = httpResponse.statusLine.statusCode + httpResponse.entity.content.use { + val body = IOUtils.toString(it, Charset.defaultCharset()) + return BlueprintWebClientService.WebClientResponse(statusCode, body) + } + } + + fun uploadBinaryFile(path: String, filePath: Path): BlueprintWebClientService.WebClientResponse<String> { + val convertedHeaders: Array<BasicHeader> = convertToBasicHeaders(defaultHeaders()) + val httpPost = HttpPost(host(path)) + val entity = EntityBuilder.create().setBinary(Files.readAllBytes(filePath)).build() + httpPost.setEntity(entity) + RestLoggerService.httpInvoking(convertedHeaders) + httpPost.setHeaders(convertedHeaders) + return performHttpCall(httpPost) + } +} + +class K8sConfigTemplate { + @get:JsonProperty("template-name") + var templateName: String? = null + + @get:JsonProperty("description") + var description: String? = null + + @get:JsonProperty("ChartName") + var ChartName: String? = null + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + return true + } + + override fun hashCode(): Int { + return javaClass.hashCode() + } +} + +class K8sConfigPayloadJson { + @get:JsonProperty("template-name") + var templateName: String? = null + + @get:JsonProperty("config-name") + var configName: String? = null + + @get:JsonProperty("values") + var values: Values = Values() + + override fun toString(): String { + return "$templateName:$configName:$values" + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + return true + } + + override fun hashCode(): Int { + return javaClass.hashCode() + } + +} + +class Values { + @get:JsonProperty("namespace") + var namespace = "default" + + @get:JsonProperty("topic") + var topic = Topic() + + override fun toString(): String { + return "$namespace:$topic" + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + return true + } + + override fun hashCode(): Int { + return javaClass.hashCode() + } + +} + +class Topic { + @get:JsonProperty("ves") + var ves: String? = null + + @get:JsonProperty("cells") + var cells: String? = null + + @get:JsonProperty("ues") + var ues: String? = null + + override fun toString(): String { + return "$ves:$cells:$ues" + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + return true + } + + override fun hashCode(): Int { + return javaClass.hashCode() + } + +} + +class K8sResources { + + var GVK: GVK? = null + lateinit var Name: String + +} + +class GVK { + + var Group: String? = null + var Version: String? = null + var Kind: String? = null + +} + diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/TOSCA-Metadata/TOSCA.meta b/operations/a1-pe-sim-packages/resources/oran-sim-cba/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..f5b072c --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,8 @@ +TOSCA-Meta-File-Version: 0.0.1 +CSAR-Version: 1.0 +Created-By: Lasse Kaihlavirta +Entry-Definitions: Definitions/oran-sim-blueprint.json +Template-Name: a1_pe_simulator +Template-Version: 1.3.2 +Template-Tags: samsung, oran +Content-Type: application/vnd.oasis.bpmn diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-mapping.json new file mode 100644 index 0000000..d75c4f3 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "cells-payload", + "input-param": true, + "property": { + "type": "string", + "default": "" + }, + "dictionary-name": "cells-payload", + "dictionary-source": "default", + "dependencies": [] + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-template.vtl new file mode 100644 index 0000000..9ab26ca --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/cells-template.vtl @@ -0,0 +1,129 @@ +#if( $cells-payload != "") +$cells-payload +#else +{ + "cellList": [ + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell1", + "physicalCellId": 0, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.11", + "longitude": "19.98" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell4", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell2", + "physicalCellId": 1, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.06", + "longitude": "20.03" + }, + "neighbor": [ + { + "nodeId": "Cell5", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + }, + { + "nodeId": "Cell3", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell3", + "physicalCellId": 3, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.06", + "longitude": "19.94" + }, + "neighbor": [ + { + "nodeId": "Cell5", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + }, + { + "nodeId": "Cell4", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell4", + "physicalCellId": 4, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.11", + "longitude": "19.88" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell1", + "blacklisted": "false" + } + ] + }, + { + "Cell": { + "networkId": "RAN001", + "nodeId": "Cell5", + "physicalCellId": 6, + "pnfName": "ncserver1", + "sectorNumber": 0, + "latitude": "50.01", + "longitude": "19.99" + }, + "neighbor": [ + { + "nodeId": "Cell3", + "blacklisted": "false" + }, + { + "nodeId": "Cell2", + "blacklisted": "false" + } + ] + } + ] +} +#end diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/k8s-profiles/cnf-config-template.tar.gz b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/k8s-profiles/cnf-config-template.tar.gz Binary files differnew file mode 100644 index 0000000..d5bcef4 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/k8s-profiles/cnf-config-template.tar.gz diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-mapping.json new file mode 100644 index 0000000..b8b779c --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-mapping.json @@ -0,0 +1,155 @@ +[ + { + "name": "vnf_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf_name", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "oran_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + }, + "default": "${oran_name}" + }, + "input-param": false, + "dictionary-name": "oran_name", + "dictionary-source": "default", + "dependencies": [], + "version": 0 + }, + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [], + "version": 0 + }, + { + "name": "vf-module-id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-id", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + }, + { + "name": "vf-module-label", + "property": { + "description": "", + "required": false, + "type": "string" + }, + "input-param": false, + "dictionary-name": "vf-module-label", + "dictionary-source": "processor-db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vf-module-model-customization-uuid", + "property": { + "description": "", + "required": false, + "type": "string" + }, + "input-param": false, + "dictionary-name": "vf-module-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + }, + { + "name": "service-instance-id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-template.vtl new file mode 100644 index 0000000..014d074 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/o-ran-simulator-template.vtl @@ -0,0 +1,61 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "k8s-rb-instance-release-name", + "param-value": "default" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "payload": [ + { + "param-name": "VF_MODULE_TYPE", + "param-value": "vfmt" + }, + { + "param-name": "resource-name", + "param-value": "oran_name" + }, + { + "param-name": "resource-value", + "param-value": "${oran_name}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_oran_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "naming-type", + "param-value": "VF-MODULE" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf_name}" + }, + { + "param-name": "VF_MODULE_LABEL", + "param-value": "${vf-module-label}" + }, + { + "param-name": "NFC_NAMING_CODE", + "param-value": "ORAN" + } + ], + "output-key-mapping": [ + { + "resource-name": "oran_name", + "resource-value": "${oran_name}" + } + ] + } + ] + } + ] +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-mapping.json new file mode 100644 index 0000000..77326e8 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-mapping.json @@ -0,0 +1,22 @@ +[ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [] + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-template.vtl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/req-input-template.vtl diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-mapping.json new file mode 100644 index 0000000..23e82dc --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "ues-payload", + "input-param": true, + "property": { + "type": "string", + "default": "" + }, + "dictionary-name": "ues-payload", + "dictionary-source": "default", + "dependencies": [] + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-template.vtl new file mode 100644 index 0000000..954478c --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ues-template.vtl @@ -0,0 +1,24 @@ +#if( $ues-payload != "") +${ues-payload} +#else +[ + { + "id": "emergency_samsung_s10_01", + "latitude": "50.09", + "longitude": "19.94", + "cellId": "Cell1" + }, + { + "id": "mobile_samsung_s20_02", + "latitude": "50.05", + "longitude": "19.95", + "cellId": "Cell3" + }, + { + "id": "emergency_police_01", + "latitude": "50.035", + "longitude": "19.97", + "cellId": "Cell3" + } +] +#end diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-mapping.json new file mode 100644 index 0000000..596bae2 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-mapping.json @@ -0,0 +1,77 @@ +[ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "vnf-name", + "input-param": true, + "property": { + "type": "string", + "default": "oran-sim-name" + }, + "dictionary-name": "vnf-name", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "vnf-type", + "input-param": true, + "property": { + "type": "string", + "default": "oran-sim-type" + }, + "dictionary-name": "vnf-type", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "externalNodeIp", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "externalNodeIp", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "ves-port", + "input-param": true, + "property": { + "type": "string", + "default": "30417" + }, + "dictionary-name": "ves-port", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "ves-user", + "input-param": true, + "property": { + "type": "string", + "default": "sample1" + }, + "dictionary-name": "ves-user", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "ves-password", + "input-param": true, + "property": { + "type": "string", + "default": "sample1" + }, + "dictionary-name": "ves-password", + "dictionary-source": "default", + "dependencies": [] + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-template.vtl new file mode 100644 index 0000000..af7669e --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/ves-template.vtl @@ -0,0 +1,7 @@ +vnfType=$vnf-type +vnfId=$vnf-id +vnfName=$vnf-name +vesHost=$externalNodeIp +vesPort=$ves-port +vesPassword=$ves-user +vesUser=$ves-password diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-mapping.json b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-mapping.json new file mode 100644 index 0000000..cba47d9 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-mapping.json @@ -0,0 +1,104 @@ +[ + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + }, + { + "name": "vnf-ip-address", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + }, + "default": "${vnf-ip-address}" + }, + "input-param": false, + "dictionary-name": "vnf-ip-address", + "dictionary-source": "aai-data", + "dependencies": [], + "version": 0 + }, + { + "name": "service-instance-id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [], + "version": 0 + } +] diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-template.vtl b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-template.vtl new file mode 100644 index 0000000..cc7d0d6 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-cba/Templates/vnf-template.vtl @@ -0,0 +1,49 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "vnf-ip-address", + "param-value": "${vnf-ip-address}" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "output-key-mapping": [ + { + "resource-name": "vnf_name", + "resource-value": "${vnf_name}" + } + ], + "payload": [ + { + "param-name": "resource-name", + "param-value": "vnf_name" + }, + { + "param-name": "resource-value", + "param-value": "${vnf_name}" + }, + { + "param-name": "external-key", + "param-value": "${vnf-id}_vnf_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "naming-type", + "param-value": "VNF" + }, + { + "param-name": "AIC_CLOUD_REGION", + "param-value": "${aic-cloud-region}" + } + ] + } + ] + } + ] +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/MANIFEST.json b/operations/a1-pe-sim-packages/resources/oran-sim-csar/MANIFEST.json new file mode 100644 index 0000000..c605362 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/MANIFEST.json @@ -0,0 +1,19 @@ +{ + "name": "SamsungORANSimulator", + "description": "ORAN Simulator; Samsung Electronics.", + "data": [ + { + "file": "oran-sim-cba.zip", + "type": "CONTROLLER_BLUEPRINT_ARCHIVE" + }, + { + "file": "o-ran-simulator.yml", + "type": "HEAT", + "isBase": "true" + }, + { + "file": "o-ran-simulator_cloudtech_k8s_charts.tgz", + "type": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT" + } + ] +} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator.yml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator.yml new file mode 100644 index 0000000..93bbcfa --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator.yml @@ -0,0 +1,35 @@ +--- +heat_template_version: 2017-02-24 +description: "O-RAN Simulator Dummy Heat" +parameters: + vnf_name: + type: string + description: VNF Name (provided by ONAP) + vnf_id: + type: string + description: VNF ID (provided by ONAP) + vf_module_id: + type: string + description: VF Module ID (provided by ONAP) + skip_post_instantiation_configuration: + type: boolean + default: false + sdnc_model_name: + type: string + default: a1_pe_simulator + sdnc_model_version: + type: string + default: 1.3.2 + sdnc_artifact_name: + type: string + default: vnf + controller_actor: + type: string + default: CDS +resources: + dummy_node: + type: OS::Nova::Server + properties: + name: dummy + image: dummy + flavor: dummy diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/.helmignore b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/Chart.yaml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/Chart.yaml new file mode 100644 index 0000000..1f10a6f --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm Chart for Handover Simulator +name: o-ran-simulator +version: 0.1.0 diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_common.tpl b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_common.tpl new file mode 100644 index 0000000..b46d402 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_common.tpl @@ -0,0 +1,38 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* + Functions here are generated by helm, please don't use them directly +*/}} + + +{{/* +Expand the name of the chart. +*/}} +{{- define "handover-simulator.common.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "handover-simulator.common.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{/* +Common labels +*/}} +{{- define "handover-simulator.common.labels" -}} +app.kubernetes.io/name: {{ include "handover-simulator.common.name" . }} +helm.sh/chart: {{ include "handover-simulator.common.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Values.oran_name }} +oran_name: {{ .Values.oran_name | quote }} +{{- end }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_deployment.tpl b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_deployment.tpl new file mode 100644 index 0000000..1bfc3a9 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_deployment.tpl @@ -0,0 +1,59 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* + Functions here are intended for Deployment resources use only +*/}} + + +{{/* Generate Deployment's container section */}} +{{/* Input: Dict with "dot", "name" and "spec" keys */}} +{{- define "handover-simulator.deployment.containers" -}} +{{- $name := .name -}} +{{- $spec := .spec -}} +{{- $dot := . -}} +{{- with .dot -}} +{{- range $owner, $containerSpec := $spec.containers }} +- name: {{ $owner }} + image: "{{ $containerSpec.image.repository }}:{{ $containerSpec.image.tag }}" + imagePullPolicy: {{ $containerSpec.image.pullPolicy }} + {{- with $containerSpec.env }} + env: + {{- range $containerSpec.env }} + {{/* This is ugly but helm's tpl required root object */}} + - name: {{ .name }} + value: {{ tpl .value $dot.dot | quote }} + {{- end }} + {{- end }} + {{- with $containerSpec.volumeMounts }} + volumeMounts: + {{- range $containerSpec.volumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + {{- end }} + ports: + {{- range $spec.service.ports }} + {{- if eq $owner .owner }} + - name: {{ .name }} + containerPort: {{ .port }} + protocol: TCP + {{- end }} + {{- end }} + {{- with $containerSpec.volumes }} + volumes: {{ toYaml . | nindent 4 }} + {{- end }} + {{- with $spec.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $spec.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $spec.resources }} + resources: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_utils.tpl b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_utils.tpl new file mode 100644 index 0000000..c59770a --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_utils.tpl @@ -0,0 +1,25 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* + Functions here define utilities for unique name/labels generation +*/}} + + +{{/* Generate Deployment labels */}} +{{/* Input: Dict with "dot", "name" and "spec" keys */}} +{{- define "handover-simulator.utils.labels" -}} +{{- $name := .name -}} +{{- $spec := .spec -}} +{{- with .dot -}} +app: {{ $name }} +{{ include "handover-simulator.common.labels" . }} +{{- end -}} +{{- end -}} + + +{{/* Generate Resource name based unique between different chart instances */}} +{{/* Input: List with strings */}} +{{/* Output: Provided elements joined with dash and trimmed according to DNS requirements */}} +{{- define "handover-simulator.utils.name" -}} +res-{{- join "-" . | trunc 59 | trimSuffix "-" -}} +{{- end -}} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-configmapa.yaml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-configmapa.yaml new file mode 100644 index 0000000..15c6d46 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-configmapa.yaml @@ -0,0 +1,14 @@ +{{/* Set up subresource name */}} + {{- $spec := .Values.a1pesimulator -}} + {{- $name := $spec.name -}} + {{- $input := dict "dot" . "name" $name "spec" $spec }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "handover-simulator.utils.name" (list .Release.Name $name "app-cm") }} + labels: {{ include "handover-simulator.utils.labels" $input | nindent 4 }} +data: #Initial data is empty as it will be populated by CDS at runtime + vnf.config: + cells.json: + ue.json: + diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-deployment.yaml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-deployment.yaml new file mode 100644 index 0000000..c5690b6 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-deployment.yaml @@ -0,0 +1,22 @@ +{{/* Set up subresource name */}} + {{- $spec := .Values.a1pesimulator -}} + {{- $name := $spec.name -}} + {{- $input := dict "dot" . "name" $name "spec" $spec }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "handover-simulator.utils.name" (list .Release.Name $name) }} + labels: {{ include "handover-simulator.utils.labels" $input | nindent 4 }} +spec: + replicas: {{ $spec.replicaCount }} + selector: + matchLabels: {{ include "handover-simulator.utils.labels" $input | nindent 6 }} + template: + metadata: + labels: {{ include "handover-simulator.utils.labels" $input | nindent 8 }} + spec: + containers: {{ include "handover-simulator.deployment.containers" $input | nindent 8 }} + volumes: + - name: config + configMap: + name: {{ include "handover-simulator.utils.name" (list .Release.Name $name "app-cm") }} diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-service.yaml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-service.yaml new file mode 100644 index 0000000..320e83e --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/a1-pe-sim-service.yaml @@ -0,0 +1,23 @@ +{{/* Set up subresource name */}} + {{- $spec := .Values.a1pesimulator -}} + {{- $name := $spec.name -}} + {{- $input := dict "dot" . "name" $name "spec" $spec }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "handover-simulator.utils.name" (list .Release.Name $name) }} + labels: {{ include "handover-simulator.utils.labels" $input | nindent 4 }} +spec: + type: {{ $spec.service.type }} + ports: + {{- range $spec.service.ports }} + - port: {{ .port }} + targetPort: {{ .port }} + protocol: TCP + name: {{ .name }} + {{- with .nodePort }} + nodePort: {{ tpl . $ }} + {{- end }} + {{- end }} + selector: {{ include "handover-simulator.utils.labels" $input | nindent 4 }} + diff --git a/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/values.yaml b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/values.yaml new file mode 100644 index 0000000..3bec165 --- /dev/null +++ b/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/values.yaml @@ -0,0 +1,30 @@ +# Default values for handover-simulator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +#To easier define node ports: +backendRESTNodePort: 32766 +a1NodePort: 32085 + +#oran_name can be provided from onap and will set custom label +oran_name: null + +a1pesimulator: + name: a1-pe-simulator + replicaCount: 1 + containers: + backend: + image: + repository: nexus3.onap.org:10001/onap/integration/simulators/a1-pe-simulator + tag: latest + pullPolicy: Always + volumeMounts: + - name: config + mountPath: /var/a1pesim + service: + type: NodePort + ports: + - port: 9998 + name: a1-pe-simulator-http + owner: a1pesimulator + nodePort: "{{ .Values.backendRESTNodePort }}" diff --git a/operations/scripts/enrich.sh b/operations/scripts/enrich.sh new file mode 100755 index 0000000..0e3921f --- /dev/null +++ b/operations/scripts/enrich.sh @@ -0,0 +1,158 @@ +#!/bin/bash + +usage() { + echo "Usage:" + echo " ./enrich.sh IP [BLUEPRINT_PROCESSOR_PORT] [CBA_PATH] [DD_PATH]" + echo + echo "Parameters:" + echo "IP - ip of the k8s instance" + echo "BLUEPRINT_PROCESSOR_PORT (default 30499) - exposed cds-blueprints-processor-http service port" + echo "CBA_PATH (default ./oran-sim-cba) - path for folder with CBA" + echo "DD_PATH (default ./oran-sim-cba-data-dictionary) - path for folder with DD required to execute the enrichment" + echo + echo "Environment variables respected:" + echo "ENABLE_PUBLISHING - if set to 1, script will also try to upload CBA to CDS after successful enrichment." + echo " Use only if you're sure what you're doing" + echo "SKIP_BOOTSTRAP - if set to 1, script won't try to 'bootstrap' CDS for enrichment (operation needed just once per lifecycle of CDS instance)." + echo "SKIP_DD_UPLOAD - if set to 1, script won't try to upload DataDictionary files." + echo " This can be used to speed up a bit subsequent attempts to enrich when there were no changes to Data Dictionary files in the meantime." + exit 1 +} + +# Wrapper function log messages +log() { + echo -e "$L_GREEN$*$L_RESET" >&2 +} + + +# Curl wrapper with improved error handling and embed generic flags +# Safe to use with -o and -f (muted) +cds_curl() { + local res code preserve_res + declare -a cmd=(curl -sS -H 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' -w "%{http_code}") + res=$(mktemp) + cmd+=(-o "${res}") + + while test $# -gt 0; do + case "$1" in + -f|--fail) + shift + ;; + -o) + preserve_res="$2" + shift 2 + ;; + --output) + preserve_res="${1##*=}" + shift + ;; + *) + cmd+=("$1") + shift + ;; + esac + done + + + log "Running: $L_BOLD'${cmd[*]}'" + if ! code="$("${cmd[@]}")"; then + log "Curl Failure: '$code'; body:" + cat "$res" + rm -f "$res" + return 1 + fi + if ! [[ "${code}" =~ 20* ]]; then + log "Remote responded with code $code; body:" + cat "$res" + rm -f "$res" + return 1 + fi + if test -n "${preserve_res:-}"; then + mv "$res" "$preserve_res" + else + cat "$res" + rm -f "$res" + fi +} + +if test -t 1 && test -t 2; then + L_BOLD=$(tput bold) + L_GREEN=$(tput setaf 2) + L_RESET=$(tput sgr0) +else + L_BOLD= + L_GREEN= + L_RESET= +fi + +IP=$1 +if [ -z "${IP}" ]; then + usage +fi + +set -euo pipefail + +# SINCE FRANKFURT RELEASE THE BLUEPRINT_PROCESSOR POD SERVICE MUST BE EXPOSED +DEFAULT_PROCESSOR_PORT=30499 +BLUEPRINT_PROCESSOR_PORT="${2:-$DEFAULT_PROCESSOR_PORT}" +BLUEPRINT_PROCESSOR_URI=http://${IP}:${BLUEPRINT_PROCESSOR_PORT} + +URL_BOOTSTRAP=${BLUEPRINT_PROCESSOR_URI}/api/v1/blueprint-model/bootstrap +URL_ENRICH=${BLUEPRINT_PROCESSOR_URI}/api/v1/blueprint-model/enrich +URL_PUBLISH=${BLUEPRINT_PROCESSOR_URI}/api/v1/blueprint-model/publish +URL_DD=${BLUEPRINT_PROCESSOR_URI}/api/v1/dictionary + +CBA_PATH="${3:-./oran-sim-cba}" +DD_PATH="${4:-./oran-sim-cba-data-dictionary}" + +CBA_FILE=tmp/cba.zip +CBA_ENRICHED_FILE=tmp/cba_enriched.zip + +CBA_ZIP=${CBA_PATH}/${CBA_FILE} +CBA_ZIP_ENRICHED=${CBA_PATH}/${CBA_ENRICHED_FILE} + +if [ "${SKIP_BOOTSTRAP:-0}" == "1" ]; then + log "Skipping Bootstrap." +else + log "Bootstraping CDS..." + cds_curl -X POST "$URL_BOOTSTRAP" -H 'Content-Type: application/json' \ + -d '{ "loadModelType": true, "loadResourceDictionary": true, "loadCBA": false }' + log "Success" +fi +log "\n" + +if [ "${SKIP_DD_UPLOAD:-0}" == "1" ]; then + log "Skipping Data Dictionary upload." +else + for f in "$DD_PATH"/*.json; do + log "Pushing data dictionary '$f'" + cds_curl -X POST "$URL_DD" -H 'Content-Type: application/json' -d "@$f" + log + done +fi +log "\n" + + +[ ! -d "$(dirname "$CBA_ZIP")" ] && mkdir -p "$(dirname "$CBA_ZIP")" +[ -f "$CBA_ZIP" ] && rm "$CBA_ZIP" +[ -f "$CBA_ZIP_ENRICHED" ] && rm "$CBA_ZIP_ENRICHED" + +pushd "$CBA_PATH" || exit +zip -uqr $CBA_FILE . --exclude=*.git* +popd || exit + +log "Doing enrichment..." +file "$CBA_ZIP" +cds_curl -X POST "$URL_ENRICH" -H 'Content-Type: multipart/form-data' -F file=@"$CBA_ZIP" -o "$CBA_ZIP_ENRICHED" +file "$CBA_ZIP_ENRICHED" +log "Success" +log "\n" + +if [ "${ENABLE_PUBLISHING:-0}" == "1" ]; then + log "Publishing..." + cds_curl -X POST "$URL_PUBLISH" -H 'Content-Type: multipart/form-data' -F file=@"$CBA_ZIP_ENRICHED" + log + log "Success" +else + log "Publishing skipped. Enable by calling script with environment variable ENABLE_PUBLISHING=1" +fi diff --git a/operations/scripts/k8s_get_node_ip.sh b/operations/scripts/k8s_get_node_ip.sh index 4f423e8..4f423e8 100644..100755 --- a/operations/scripts/k8s_get_node_ip.sh +++ b/operations/scripts/k8s_get_node_ip.sh diff --git a/operations/scripts/onboard-cba.sh b/operations/scripts/onboard-cba.sh new file mode 100755 index 0000000..9c80d58 --- /dev/null +++ b/operations/scripts/onboard-cba.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright (C) 2019 by Samsung Electronics Co., Ltd. +# +# This software is the confidential and proprietary information of Samsung Electronics co., Ltd. +# ("Confidential Information"). You shall not disclose such Confidential Information and shall use +# it only in accordance with the terms of the license agreement you entered into with Samsung. + +# +# Onboards CDS model into CDS runtime. CDS model package file is called CBA (CDS Model Package). +# +set -e + +# Parameters +# $1 Path to cba zip file (Optional) +# $2 Kubernetes node ip (Optional) + + +CBA_ZIP=${1:-../examples/vnf/vnf-simulator-for-onap-me/cds/cba/onap-me-cba.zip} +if [[ "$1" == "" ]]; then + echo "CBA zip not provided. Using default: ${CBA_ZIP}" +fi +NODE_IP=${2:-$(../common/k8s_get_node_ip.sh)} +curl -X POST http://${NODE_IP}:30499/api/v1/blueprint-model/publish -H 'content-type: multipart/form-data' -H 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' -F file=@${CBA_ZIP} |