diff --git a/deployment/infrastructure/README.md b/deployment/infrastructure/README.md new file mode 100644 index 000000000..6864c69e1 --- /dev/null +++ b/deployment/infrastructure/README.md @@ -0,0 +1,51 @@ + + +# Test data Uploader +## TL;DR + +- Configure the following script parameters (shown in below table) in `upload-testdata.sh` script. +- The `testdata-payload.json` file contains structured data for the edc policy and digital twins. +- Run the following script to upload test data to the provider setup: +```bash +./upload-testdata.sh +``` + +#### Script Parameters: +| Parameter | Description | Example value | Required/Optionl | +| :---: | :--- | :--- | :---: | +| -s | Submodel server URL | https://materialpass.dev.demo.catena-x.net/provider_backend | Required | +| -e | Provider control plane URL | https://materialpass.dev.demo.catena-x.net/BPNL000000000000 | Required | +| -a | AAS registry URL | https://materialpass.dev.demo.catena-x.net/semantics/registry/api/v3.0 | Required | +| -k | EDC API Key | xxxxxxxx | Required | +| -f | input JSON testdata file | ./testdata/testdata-payload.json | Required | +| | | | | + + +### Delete test data + +Use the following script to remove all test data from the provider edc and registry: +```bash +./delete-testdata.sh -e -a -k +``` + + diff --git a/deployment/infrastructure/delete-provider-dtr.sh b/deployment/infrastructure/delete-provider-dtr.sh deleted file mode 100644 index 995b906d3..000000000 --- a/deployment/infrastructure/delete-provider-dtr.sh +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN_1='32aa72de-297a-4405-9148-13e12744028a' -DIGITAL_TWIN_SUBMODEL_ID_1='699f1245-f57e-4d6b-acdb-ab763665554a' - -DIGITAL_TWIN_2='1f4a64f0-aba9-498a-917c-4936c24c50cd' -DIGITAL_TWIN_SUBMODEL_ID_2='49a06ad2-64b7-46c8-9f3b-a718c462ca23' - -DIGITAL_TWIN_3='365e6fbe-bb34-11ec-8422-0242ac120002' -DIGITAL_TWIN_SUBMODEL_ID_3='61125dc3-5e6f-4f4b-838d-447432b97918' - -DIGITAL_TWIN_4='1f0ef836-40b7-4f31-a9bd-cb6a8960779e' -DIGITAL_TWIN_SUBMODEL_ID_4='26bf39c5-68a5-43a1-8db7-d33e116a6f61' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' - - -# put access token without 'Bearer ' prefix -BEARER_TOKEN='' - -API_KEY='' -ASSET_DTR='digital-twin-registry' -ASSET_ID_1=${DIGITAL_TWIN_1}-${DIGITAL_TWIN_SUBMODEL_ID_1} -ASSET_ID_2=${DIGITAL_TWIN_2}-${DIGITAL_TWIN_SUBMODEL_ID_2} -ASSET_ID_3=${DIGITAL_TWIN_3}-${DIGITAL_TWIN_SUBMODEL_ID_3} -ASSET_ID_4=${DIGITAL_TWIN_4}-${DIGITAL_TWIN_SUBMODEL_ID_4} - - -echo '**************************Asset 1 - Digital Twin Registry **********************' -echo - -# Delete a contract definition -echo "Delete contract definition for asset 1 - DTR..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/10 -echo - -# Delete a asset -echo "Delete asset 1 - DTR..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_DTR} -echo - -# Delete a general policy -echo "Delete policy for asset 1 - DTR..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/4b480f48-79a0-4851-a56c-6ef71e19ebc4 -echo - - -echo '**************************Asset 2 **********************' -echo -# Delete Submodel data -echo "Delete sample data for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/X123456789012X12345678901234566.json" $SERVER_URL/provider_backend/data/${ASSET_ID_1} -echo - -# Delete a contract definition -echo "Delete contract definition for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/1 -echo - -# Delete a asset -echo "Delete asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_1} -echo - -# Delete a general policy -echo "Delete policy for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/ad8d2c57-cf32-409c-96a8-be59675b6ae5 -echo - -# Delete a digital twin and register from the registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 2 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/X123456789012X12345678901234566.json" $REGISTRY_URL/${DIGITAL_TWIN_1} -echo -echo - - - -echo '**************************Asset 3 **********************' - -echo - -# Delete a contract definition -echo "Delete contract definition for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/2 -echo - - -# Delete Submodel data -echo "Delete sample data for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/NCR186850B.json" $SERVER_URL/provider_backend/data/${ASSET_ID_2} -echo - -# Delete a asset -echo "Delete asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_2} -echo - -# Delete a general policy -echo "Delete policy for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/f873e234-112c-4598-893b-eda0671b7402 -echo - -# Delete a digital twin and register from the registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 3 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/NCR186850B.json" $REGISTRY_URL/${DIGITAL_TWIN_2} -echo -echo - - - -echo '**************************Asset 4 **********************' -# Delete Submodel data -echo "Delete sample data for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/IMR18650V1.json" $SERVER_URL/provider_backend/data/${ASSET_ID_3} -echo - - -# Delete a contract definition -echo "Delete contract definition for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/3 -echo - -# Delete a asset -echo "Delete asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_3} -echo - -# Delete a general policy -echo "Delete policy for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/4b480f48-79a0-4851-a56c-6ef71e19ebb3 -echo - - -# Delete a digital twin and register from the registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 4 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/IMR18650V1.json" $REGISTRY_URL/${DIGITAL_TWIN_3} -echo - - -echo '**************************Asset 5 **********************' -# Delete Submodel data -echo "Delete sample data for asset 5..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/Y792927456954B81677903848654570.json" $SERVER_URL/provider_backend/data/${ASSET_ID_4} -echo - - -# Delete a contract definition -echo "Delete contract definition for asset 5..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/131 -echo - -# Delete a asset -echo "Delete asset 5..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_4} -echo - -# Delete a general policy -echo "Delete policy for asset 5..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/0a216bb0-934d-4c93-8e92-ca3b4f862e33 -echo - - - -# Delete a digital twin and register from the registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 5 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/Y792927456954B81677903848654570.json" $REGISTRY_URL/${DIGITAL_TWIN_4} -echo - -echo 'Provider setup completed...' -echo 'Done' diff --git a/deployment/infrastructure/delete-provider.sh b/deployment/infrastructure/delete-provider.sh deleted file mode 100644 index 3c704e408..000000000 --- a/deployment/infrastructure/delete-provider.sh +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN_1='32aa72de-297a-4405-9148-13e12744028a' -DIGITAL_TWIN_SUBMODEL_ID_1='699f1245-f57e-4d6b-acdb-ab763665554a' - -DIGITAL_TWIN_2='1f4a64f0-aba9-498a-917c-4936c24c50cd' -DIGITAL_TWIN_SUBMODEL_ID_2='49a06ad2-64b7-46c8-9f3b-a718c462ca23' - -DIGITAL_TWIN_3='365e6fbe-bb34-11ec-8422-0242ac120002' -DIGITAL_TWIN_SUBMODEL_ID_3='61125dc3-5e6f-4f4b-838d-447432b97918' - -DIGITAL_TWIN_4='1f0ef836-40b7-4f31-a9bd-cb6a8960779e' -DIGITAL_TWIN_SUBMODEL_ID_4='26bf39c5-68a5-43a1-8db7-d33e116a6f61' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' - - -# put access token without 'Bearer ' prefix -BEARER_TOKEN='' - -API_KEY='' -ASSET_ID_1=${DIGITAL_TWIN_1}-${DIGITAL_TWIN_SUBMODEL_ID_1} -ASSET_ID_2=${DIGITAL_TWIN_2}-${DIGITAL_TWIN_SUBMODEL_ID_2} -ASSET_ID_3=${DIGITAL_TWIN_3}-${DIGITAL_TWIN_SUBMODEL_ID_3} -ASSET_ID_4=${DIGITAL_TWIN_4}-${DIGITAL_TWIN_SUBMODEL_ID_4} - - -echo '**************************Asset 1 **********************' -echo -# Delete Submodel data -echo "Delete sample data for asset 1..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/X123456789012X12345678901234566.json" $SERVER_URL/provider_backend/data/${ASSET_ID_1} -echo - -# Delete a contract definition -echo "Delete contract definition for asset 1..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/1 -echo - -# Delete a asset -echo "Delete asset 1..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_1} -echo - -# Delete a general policy -echo "Delete policy for asset 1..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/ad8d2c57-cf32-409c-96a8-be59675b6ae5 -echo - -# Delete a digital twin and register from CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 1 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/X123456789012X12345678901234566.json" $REGISTRY_URL/${DIGITAL_TWIN_1} -echo -echo - - - -echo '**************************Asset 2 **********************' - -echo - -# Delete a contract definition -echo "Delete contract definition for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/2 -echo - - -# Delete Submodel data -echo "Delete sample data for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/NCR186850B.json" $SERVER_URL/provider_backend/data/${ASSET_ID_2} -echo - -# Delete a asset -echo "Delete asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_2} -echo - -# Delete a general policy -echo "Delete policy for asset 2..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/f873e234-112c-4598-893b-eda0671b7402 -echo - -# Delete a digital twin and register from CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 2 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/NCR186850B.json" $REGISTRY_URL/${DIGITAL_TWIN_2} -echo -echo - - - -echo '**************************Asset 3 **********************' -# Delete Submodel data -echo "Delete sample data for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/IMR18650V1.json" $SERVER_URL/provider_backend/data/${ASSET_ID_3} -echo - - -# Delete a contract definition -echo "Delete contract definition for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/3 -echo - -# Delete a asset -echo "Delete asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_3} -echo - -# Delete a general policy -echo "Delete policy for asset 3..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/4b480f48-79a0-4851-a56c-6ef71e19ebb3 -echo - - -# Delete a digital twin and register from CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 3 and register it devo CX registry..." - -curl -X DELETE -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/IMR18650V1.json" $REGISTRY_URL/${DIGITAL_TWIN_3} -echo - - -echo '**************************Asset 4 **********************' -# Delete Submodel data -echo "Delete sample data for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/Y792927456954B81677903848654570.json" $SERVER_URL/provider_backend/data/${ASSET_ID_4} -echo - - -# Delete a contract definition -echo "Delete contract definition for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions/131 -echo - -# Delete a asset -echo "Delete asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets/${ASSET_ID_4} -echo - -# Delete a general policy -echo "Delete policy for asset 4..." -curl -X DELETE -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions/0a216bb0-934d-4c93-8e92-ca3b4f862e33 -echo - - - -# Delete a digital twin and register from CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Delete a DT for asset 4 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/Y792927456954B81677903848654570.json" $REGISTRY_URL/${DIGITAL_TWIN_4} -echo - -echo 'Provider setup completed...' -echo 'Done' diff --git a/deployment/infrastructure/init-provider-dtr-irs.sh b/deployment/infrastructure/init-provider-dtr-irs.sh deleted file mode 100644 index 5491e3b07..000000000 --- a/deployment/infrastructure/init-provider-dtr-irs.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN_1='urn:uuid:3d050cd8-cdc7-4d65-9f37-70a65d5f53f5' -DT1_SUBMODEL_ID_1='urn:uuid:777a3f0a-6d29-4fcd-81ea-1c27c1b870cc' -DT1_SUBMODEL_ID_2='urn:uuid:09d5d8a9-9073-47b6-93c6-80caff176dca' - -DIGITAL_TWIN_2='urn:uuid:ace301f6-92c5-4623-a022-c2a30dfee0e2' -DT2_SUBMODEL_ID_1='urn:uuid:754b6c6c-d74a-4dd0-a62c-f07959f15332' -DT2_SUBMODEL_ID_2='urn:uuid:25ea2646-d57f-4b31-97a0-d0d7b3b35d37' -DT2_SUBMODEL_ID_3='urn:uuid:c216bece-b17f-4679-8b62-ec25810ca1c4' - -DIGITAL_TWIN_3='urn:uuid:d3e7cc6c-0e9b-49db-8d0d-25c6a1e68690' -DT3_SUBMODEL_ID_1='urn:uuid:0f8eb434-32af-48cb-8dc2-6391fb3d8aa8' -DT3_SUBMODEL_ID_2='urn:uuid:7e3f0673-fa92-43c3-af0d-e86485a97bda' -DT3_SUBMODEL_ID_3='urn:uuid:d7f23694-6d38-44ca-8ba5-3256e3b4b219' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' -SUBMODEL_SERVER='' - -API_KEY='' - -DPP_ASSET='urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195' -REGISTRY_ASSET='registry-asset' - -echo '**************************Asset 1 - Digital Twin Registry **********************' -echo - -# Create a asset -echo "Create asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/assets/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractpolicies/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractdefinitions/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo -echo - - -echo '**************************Battery**********************' -echo -# Create Submodel data -echo "Create battery sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/BAT-XYZ789.json" $SUBMODEL_SERVER/provider_backend/data/${DT1_SUBMODEL_ID_1} -echo - -echo "Create Battery BomAsBuilt sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/singleLevelBomAsBuilt-BAT-XYZ789.json" $SUBMODEL_SERVER/provider_backend/data/${DT1_SUBMODEL_ID_2} -echo - -# Create a asset -echo "Create asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/assets/DT-BAT-XYZ789.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractpolicies/DT-BAT-XYZ789.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractdefinitions/DT-BAT-XYZ789.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 2 and register it devo CX registry..." - -curl -X POST -s -H 'Content-Type: application/json' --data "@resources/irs/digitaltwins/DT-BAT-XYZ789+BOMAsBuilt.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Battery Module**********************' - -echo -# Create Submodel data -echo "Create Battery module sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/EVMODULE-TRJ712.json" $SUBMODEL_SERVER/provider_backend/data/${DT2_SUBMODEL_ID_1} -echo - -echo "Create Battery module BomAsUsage sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json" $SUBMODEL_SERVER/provider_backend/data/${DT2_SUBMODEL_ID_2} -echo - -echo "Create Battery module BomAsBuilt sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/singleLevelBomAsBuilt-EVMODULE-TRJ712.json" $SUBMODEL_SERVER/provider_backend/data/${DT2_SUBMODEL_ID_3} -echo - - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 3 and register it devo CX registry..." - -curl -X POST -s -H 'Content-Type: application/json' --data "@resources/irs/digitaltwins/DT-EVMODULE-TRJ712+BOMAsBuilt.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Battery Cell**********************' -# Create Submodel data -echo "Create Battery Cell sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/singleLevelBOMAsBuilt-CTA-13123.json" $SUBMODEL_SERVER/provider_backend/data/${DT3_SUBMODEL_ID_1} -echo - -echo "Create Battery Cell BomAsBuilt sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/CTA-13123.json" $SUBMODEL_SERVER/provider_backend/data/${DT3_SUBMODEL_ID_2} -echo - -echo "Create Battery Cell BomAsUsage sample data..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/payloads/singleLevelUsageAsBuilt-CTA-13123.json" $SUBMODEL_SERVER/provider_backend/data/${DT3_SUBMODEL_ID_3} -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 4 and register it devo CX registry..." - -curl -X POST -s -H 'Content-Type: application/json' --data "@resources/irs/digitaltwins/DT-CTA-13123+BOMAsBuilt.json" $REGISTRY_URL -echo - -echo 'Provider setup completed...' -echo 'Done' diff --git a/deployment/infrastructure/init-provider-dtr.sh b/deployment/infrastructure/init-provider-dtr.sh deleted file mode 100644 index 1c0c479fe..000000000 --- a/deployment/infrastructure/init-provider-dtr.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN_1='32aa72de-297a-4405-9148-13e12744028a' -DIGITAL_TWIN_SUBMODEL_ID_1='699f1245-f57e-4d6b-acdb-ab763665554a' - -DIGITAL_TWIN_2='1f4a64f0-aba9-498a-917c-4936c24c50cd' -DIGITAL_TWIN_SUBMODEL_ID_2='49a06ad2-64b7-46c8-9f3b-a718c462ca23' - -DIGITAL_TWIN_3='365e6fbe-bb34-11ec-8422-0242ac120002' -DIGITAL_TWIN_SUBMODEL_ID_3='61125dc3-5e6f-4f4b-838d-447432b97918' - -DIGITAL_TWIN_4='1f0ef836-40b7-4f31-a9bd-cb6a8960779e' -DIGITAL_TWIN_SUBMODEL_ID_4='26bf39c5-68a5-43a1-8db7-d33e116a6f61' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' - - -# put access token without 'Bearer ' prefix -BEARER_TOKEN='' - -API_KEY='' - -ASSET_ID_1=${DIGITAL_TWIN_1}-${DIGITAL_TWIN_SUBMODEL_ID_1} -ASSET_ID_2=${DIGITAL_TWIN_2}-${DIGITAL_TWIN_SUBMODEL_ID_2} -ASSET_ID_3=${DIGITAL_TWIN_3}-${DIGITAL_TWIN_SUBMODEL_ID_3} -ASSET_ID_4=${DIGITAL_TWIN_4}-${DIGITAL_TWIN_SUBMODEL_ID_4} - -echo '**************************Asset 1 - Digital Twin Registry **********************' -echo - -# Create a asset -echo "Create asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 1 - DTR..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo -echo - - -echo '**************************Asset 2 **********************' -echo -# Create Submodel data -echo "Create sample data for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/X123456789012X12345678901234566.json" $SERVER_URL/provider_backend/data/${ASSET_ID_1} -echo - -# Create a asset -echo "Create asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 2 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/X123456789012X12345678901234566.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Asset 3 **********************' - -echo -# Create Submodel data -echo "Create sample data for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/NCR186850B.json" $SERVER_URL/provider_backend/data/${ASSET_ID_2} -echo - -# Create a asset -echo "Create asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 3 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/NCR186850B.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Asset 4 **********************' -# Create Submodel data -echo "Create sample data for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/IMR18650V1.json" $SERVER_URL/provider_backend/data/${ASSET_ID_3} -echo - -# Create a asset -echo "Create asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 4 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/IMR18650V1.json" $REGISTRY_URL -echo - - -echo '**************************Asset 5 **********************' -# Create Submodel data -echo "Create sample data for asset 5..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/Y792927456954B81677903848654570.json" $SERVER_URL/provider_backend/data/${ASSET_ID_4} -echo - -# Create a asset -echo "Create asset 5..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 5..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 5..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 5 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/Y792927456954B81677903848654570.json" $REGISTRY_URL -echo - -echo 'Provider setup completed...' -echo 'Done' diff --git a/deployment/infrastructure/init-provider.sh b/deployment/infrastructure/init-provider.sh deleted file mode 100644 index ce969090a..000000000 --- a/deployment/infrastructure/init-provider.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN_1='32aa72de-297a-4405-9148-13e12744028a' -DIGITAL_TWIN_SUBMODEL_ID_1='699f1245-f57e-4d6b-acdb-ab763665554a' - -DIGITAL_TWIN_2='1f4a64f0-aba9-498a-917c-4936c24c50cd' -DIGITAL_TWIN_SUBMODEL_ID_2='49a06ad2-64b7-46c8-9f3b-a718c462ca23' - -DIGITAL_TWIN_3='365e6fbe-bb34-11ec-8422-0242ac120002' -DIGITAL_TWIN_SUBMODEL_ID_3='61125dc3-5e6f-4f4b-838d-447432b97918' - -DIGITAL_TWIN_4='1f0ef836-40b7-4f31-a9bd-cb6a8960779e' -DIGITAL_TWIN_SUBMODEL_ID_4='26bf39c5-68a5-43a1-8db7-d33e116a6f61' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' - - -# put access token without 'Bearer ' prefix -BEARER_TOKEN='' - -API_KEY='' - -ASSET_ID_1=${DIGITAL_TWIN_1}-${DIGITAL_TWIN_SUBMODEL_ID_1} -ASSET_ID_2=${DIGITAL_TWIN_2}-${DIGITAL_TWIN_SUBMODEL_ID_2} -ASSET_ID_3=${DIGITAL_TWIN_3}-${DIGITAL_TWIN_SUBMODEL_ID_3} -ASSET_ID_4=${DIGITAL_TWIN_4}-${DIGITAL_TWIN_SUBMODEL_ID_4} - - -echo '**************************Asset 1 **********************' -echo -# Create Submodel data -echo "Create sample data for asset 1..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/X123456789012X12345678901234566.json" $SERVER_URL/provider_backend/data/${ASSET_ID_1} -echo - -# Create a asset -echo "Create asset 1..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 1..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 1..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/X123456789012X12345678901234566.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 1 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/X123456789012X12345678901234566.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Asset 2 **********************' - -echo -# Create Submodel data -echo "Create sample data for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/NCR186850B.json" $SERVER_URL/provider_backend/data/${ASSET_ID_2} -echo - -# Create a asset -echo "Create asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 2..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/NCR186850B.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 2 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/NCR186850B.json" $REGISTRY_URL -echo -echo - - - -echo '**************************Asset 3 **********************' -# Create Submodel data -echo "Create sample data for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/IMR18650V1.json" $SERVER_URL/provider_backend/data/${ASSET_ID_3} -echo - -# Create a asset -echo "Create asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 3..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/IMR18650V1.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 3 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/IMR18650V1.json" $REGISTRY_URL -echo - - -echo '**************************Asset 4 **********************' -# Create Submodel data -echo "Create sample data for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/payloads/Y792927456954B81677903848654570.json" $SERVER_URL/provider_backend/data/${ASSET_ID_4} -echo - -# Create a asset -echo "Create asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/assets/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/assets -echo - -# Create a general policy -echo "Create policy for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractpolicies/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create contract definition for asset 4..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json" --header 'X-Api-Key: '${API_KEY} $SERVER_URL/management/v2/contractdefinitions -echo - - -# Create a digital twin and register inside CX registry -# To authenticate against CX registry, one needs a valid bearer token which can be issued through postman given the clientId and clientSecret -echo "Create a DT for asset 4 and register it devo CX registry..." - -curl -X POST -s --header 'Content-Type: application/json' --header "Authorization: Bearer ${BEARER_TOKEN//[$'\t\r\n ']}" --data "@resources/dpp/digitaltwins/Y792927456954B81677903848654570.json" $REGISTRY_URL -echo - -echo 'Provider setup completed...' -echo 'Done' diff --git a/deployment/infrastructure/resources/dpp/assets/IMR18650V1.json b/deployment/infrastructure/resources/dpp/assets/IMR18650V1.json deleted file mode 100644 index 778bb0a14..000000000 --- a/deployment/infrastructure/resources/dpp/assets/IMR18650V1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", - "properties": { - "description": "Battery Passport test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "baseUrl": "https://materialpass.int.demo.catena-x.net/provider_backend/data/365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" - } -} diff --git a/deployment/infrastructure/resources/dpp/assets/NCR186850B.json b/deployment/infrastructure/resources/dpp/assets/NCR186850B.json deleted file mode 100644 index 0859879f8..000000000 --- a/deployment/infrastructure/resources/dpp/assets/NCR186850B.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23", - "properties": { - "description": "Battery Passport test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "baseUrl": "https://materialpass.int.demo.catena-x.net/provider_backend/data/1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23" - } -} diff --git a/deployment/infrastructure/resources/dpp/assets/X123456789012X12345678901234566.json b/deployment/infrastructure/resources/dpp/assets/X123456789012X12345678901234566.json deleted file mode 100644 index f2e97b5f4..000000000 --- a/deployment/infrastructure/resources/dpp/assets/X123456789012X12345678901234566.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a", - "properties": { - "description": "Battery Passport test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "baseUrl": "https://materialpass.int.demo.catena-x.net/provider_backend/data/32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a" - } -} diff --git a/deployment/infrastructure/resources/dpp/assets/Y792927456954B81677903848654570.json b/deployment/infrastructure/resources/dpp/assets/Y792927456954B81677903848654570.json deleted file mode 100644 index 9d05135ee..000000000 --- a/deployment/infrastructure/resources/dpp/assets/Y792927456954B81677903848654570.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "1f0ef836-40b7-4f31-a9bd-cb6a8960779e-26bf39c5-68a5-43a1-8db7-d33e116a6f61", - "properties": { - "description": "Battery Passport test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "baseUrl": "https://materialpass.int.demo.catena-x.net/provider_backend/data/1f0ef836-40b7-4f31-a9bd-cb6a8960779e-26bf39c5-68a5-43a1-8db7-d33e116a6f61" - } -} diff --git a/deployment/infrastructure/resources/dpp/assets/digital-twin-registry.json b/deployment/infrastructure/resources/dpp/assets/digital-twin-registry.json deleted file mode 100644 index 5b9db9c51..000000000 --- a/deployment/infrastructure/resources/dpp/assets/digital-twin-registry.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "data.core.digitalTwinRegistry", - "@id": "digital-twin-registry", - "properties": { - "type": "data.core.digitalTwinRegistry", - "description": "Digital Twin Registry for DPP", - "contenttype": "application/json" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "proxyPath": "true", - "proxyBody": "true", - "proxyMethod": "true", - "proxyQueryParams": "true", - "baseUrl": "https://materialpass.int.demo.catena-x.net/semantics/registry/api/v3.0" - } -} diff --git a/deployment/infrastructure/resources/dpp/contractdefinitions/IMR18650V1.json b/deployment/infrastructure/resources/dpp/contractdefinitions/IMR18650V1.json deleted file mode 100644 index b17a30a0f..000000000 --- a/deployment/infrastructure/resources/dpp/contractdefinitions/IMR18650V1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "3", - "@type": "ContractDefinition", - "accessPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebb3", - "contractPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebb3", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" - } -} \ No newline at end of file diff --git a/deployment/infrastructure/resources/dpp/contractdefinitions/NCR186850B.json b/deployment/infrastructure/resources/dpp/contractdefinitions/NCR186850B.json deleted file mode 100644 index 3072643a5..000000000 --- a/deployment/infrastructure/resources/dpp/contractdefinitions/NCR186850B.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "2", - "@type": "ContractDefinition", - "accessPolicyId": "f873e234-112c-4598-893b-eda0671b7402", - "contractPolicyId": "f873e234-112c-4598-893b-eda0671b7402", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23" - } -} \ No newline at end of file diff --git a/deployment/infrastructure/resources/dpp/contractdefinitions/X123456789012X12345678901234566.json b/deployment/infrastructure/resources/dpp/contractdefinitions/X123456789012X12345678901234566.json deleted file mode 100644 index e0f9c1e38..000000000 --- a/deployment/infrastructure/resources/dpp/contractdefinitions/X123456789012X12345678901234566.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "1", - "@type": "ContractDefinition", - "accessPolicyId": "ad8d2c57-cf32-409c-96a8-be59675b6ae5", - "contractPolicyId": "ad8d2c57-cf32-409c-96a8-be59675b6ae5", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a" - } -} \ No newline at end of file diff --git a/deployment/infrastructure/resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json b/deployment/infrastructure/resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json deleted file mode 100644 index a7c32ec48..000000000 --- a/deployment/infrastructure/resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "131", - "@type": "ContractDefinition", - "accessPolicyId": "0a216bb0-934d-4c93-8e92-ca3b4f862e33", - "contractPolicyId": "0a216bb0-934d-4c93-8e92-ca3b4f862e33", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "1f0ef836-40b7-4f31-a9bd-cb6a8960779e-26bf39c5-68a5-43a1-8db7-d33e116a6f61" - } -} \ No newline at end of file diff --git a/deployment/infrastructure/resources/dpp/contractdefinitions/digital-twin-registry.json b/deployment/infrastructure/resources/dpp/contractdefinitions/digital-twin-registry.json deleted file mode 100644 index ec17448b0..000000000 --- a/deployment/infrastructure/resources/dpp/contractdefinitions/digital-twin-registry.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "10", - "@type": "ContractDefinition", - "accessPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "contractPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "digital-twin-registry" - } -} diff --git a/deployment/infrastructure/resources/dpp/contractpolicies/IMR18650V1.json b/deployment/infrastructure/resources/dpp/contractpolicies/IMR18650V1.json deleted file mode 100644 index 88bafca83..000000000 --- a/deployment/infrastructure/resources/dpp/contractpolicies/IMR18650V1.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "4b480f48-79a0-4851-a56c-6ef71e19ebb3", - "policy": { - "@type": "Policy", - "odrl:permission" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstradev", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "" - } - ] - } - } - }] - } -} diff --git a/deployment/infrastructure/resources/dpp/contractpolicies/NCR186850B.json b/deployment/infrastructure/resources/dpp/contractpolicies/NCR186850B.json deleted file mode 100644 index c343060a4..000000000 --- a/deployment/infrastructure/resources/dpp/contractpolicies/NCR186850B.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "f873e234-112c-4598-893b-eda0671b7402", - "policy": { - "@type": "Policy", - "odrl:permission" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstradev", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "" - } - ] - } - } - }] - } -} diff --git a/deployment/infrastructure/resources/dpp/contractpolicies/X123456789012X12345678901234566.json b/deployment/infrastructure/resources/dpp/contractpolicies/X123456789012X12345678901234566.json deleted file mode 100644 index 0f3a75587..000000000 --- a/deployment/infrastructure/resources/dpp/contractpolicies/X123456789012X12345678901234566.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "ad8d2c57-cf32-409c-96a8-be59675b6ae5", - "policy": { - "@type": "Policy", - "odrl:permission" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstradev", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "" - } - ] - } - } - }] - } -} diff --git a/deployment/infrastructure/resources/dpp/contractpolicies/Y792927456954B81677903848654570.json b/deployment/infrastructure/resources/dpp/contractpolicies/Y792927456954B81677903848654570.json deleted file mode 100644 index 9f8fe098e..000000000 --- a/deployment/infrastructure/resources/dpp/contractpolicies/Y792927456954B81677903848654570.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "0a216bb0-934d-4c93-8e92-ca3b4f862e33", - "policy": { - "@type": "Policy", - "odrl:permission": [ - { - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstradev", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "" - } - ] - } - } - } - ] - } -} diff --git a/deployment/infrastructure/resources/dpp/contractpolicies/digital-twin-registry.json b/deployment/infrastructure/resources/dpp/contractpolicies/digital-twin-registry.json deleted file mode 100644 index e4f7e7a83..000000000 --- a/deployment/infrastructure/resources/dpp/contractpolicies/digital-twin-registry.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "policy": { - "@type": "Policy", - "odrl:permission" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstradev", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "" - } - ] - } - } - }] - } -} diff --git a/deployment/infrastructure/resources/dpp/digitaltwins/IMR18650V1.json b/deployment/infrastructure/resources/dpp/digitaltwins/IMR18650V1.json deleted file mode 100644 index 249c717b7..000000000 --- a/deployment/infrastructure/resources/dpp/digitaltwins/IMR18650V1.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_IMR18650V1", - "id": "365e6fbe-bb34-11ec-8422-0242ac120002", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "IMR18650V1", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918/submodel", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "61125dc3-5e6f-4f4b-838d-447432b97918", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Battery Passport Submodel" - } - ] - } - ] -} diff --git a/deployment/infrastructure/resources/dpp/digitaltwins/NCR186850B.json b/deployment/infrastructure/resources/dpp/digitaltwins/NCR186850B.json deleted file mode 100644 index 0c2e2cf33..000000000 --- a/deployment/infrastructure/resources/dpp/digitaltwins/NCR186850B.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_NCR186850B", - "id": "1f4a64f0-aba9-498a-917c-4936c24c50cd", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "NCR186850B", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23/submodel", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "49a06ad2-64b7-46c8-9f3b-a718c462ca23", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Battery Passport Submodel" - } - ] - } - ] -} diff --git a/deployment/infrastructure/resources/dpp/digitaltwins/X123456789012X12345678901234566.json b/deployment/infrastructure/resources/dpp/digitaltwins/X123456789012X12345678901234566.json deleted file mode 100644 index 260caa95a..000000000 --- a/deployment/infrastructure/resources/dpp/digitaltwins/X123456789012X12345678901234566.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_X123456789012X12345678901234566", - "id": "32aa72de-297a-4405-9148-13e12744028a", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "X123456789012X12345678901234566", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a/submodel", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "699f1245-f57e-4d6b-acdb-ab763665554a", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Battery Passport Submodel" - } - ] - } - ] -} diff --git a/deployment/infrastructure/resources/dpp/digitaltwins/Y792927456954B81677903848654570.json b/deployment/infrastructure/resources/dpp/digitaltwins/Y792927456954B81677903848654570.json deleted file mode 100644 index 0bff04ea4..000000000 --- a/deployment/infrastructure/resources/dpp/digitaltwins/Y792927456954B81677903848654570.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_Y792927456954B81677903848654570", - "id": "1f0ef836-40b7-4f31-a9bd-cb6a8960779e", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "Y792927456954B81677903848654570", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/1f0ef836-40b7-4f31-a9bd-cb6a8960779e-26bf39c5-68a5-43a1-8db7-d33e116a6f61/submodel", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=1f0ef836-40b7-4f31-a9bd-cb6a8960779e-26bf39c5-68a5-43a1-8db7-d33e116a6f61;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "26bf39c5-68a5-43a1-8db7-d33e116a6f61", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Battery Passport Submodel" - } - ] - } - ] -} \ No newline at end of file diff --git a/deployment/infrastructure/resources/irs/assets/DT-BAT-XYZ789.json b/deployment/infrastructure/resources/irs/assets/DT-BAT-XYZ789.json deleted file mode 100644 index cf3a8f7dc..000000000 --- a/deployment/infrastructure/resources/irs/assets/DT-BAT-XYZ789.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195", - "properties": { - "description": "IRS EDC Test Asset" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "baseUrl": "https://materialpass.int.demo.catena-x.net/provider_backend", - "proxyPath": "true", - "proxyBody": "false", - "proxyMethod": "false", - "proxyQueryParams": "false" - } -} diff --git a/deployment/infrastructure/resources/irs/assets/digital-twin-registry.json b/deployment/infrastructure/resources/irs/assets/digital-twin-registry.json deleted file mode 100644 index 82cc4fbb9..000000000 --- a/deployment/infrastructure/resources/irs/assets/digital-twin-registry.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "registry-asset", - "properties": { - "type": "data.core.digitalTwinRegistry", - "description": "Digital Twin Registry for DPP-IRS", - "contenttype": "application/json" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "proxyPath": "true", - "proxyBody": "true", - "proxyMethod": "true", - "proxyQueryParams": "true", - "baseUrl": "https://materialpass.int.demo.catena-x.net/semantics/registry/api/v3.0" - } -} diff --git a/deployment/infrastructure/resources/irs/contractdefinitions/DT-BAT-XYZ789.json b/deployment/infrastructure/resources/irs/contractdefinitions/DT-BAT-XYZ789.json deleted file mode 100644 index a2dfbdcf7..000000000 --- a/deployment/infrastructure/resources/irs/contractdefinitions/DT-BAT-XYZ789.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "6289e746-0390-4a4a-8cd3-3c10fb701bd7", - "@type": "ContractDefinition", - "accessPolicyId": "id-3.0-trace", - "contractPolicyId": "id-3.0-trace", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195" - } -} diff --git a/deployment/infrastructure/resources/irs/contractdefinitions/digital-twin-registry.json b/deployment/infrastructure/resources/irs/contractdefinitions/digital-twin-registry.json deleted file mode 100644 index d7fea3acd..000000000 --- a/deployment/infrastructure/resources/irs/contractdefinitions/digital-twin-registry.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": {}, - "@id": "aead5322-5c42-4954-bb78-4319638923cd", - "@type": "ContractDefinition", - "accessPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "contractPolicyId": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "assetsSelector" : { - "@type" : "CriterionDto", - "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", - "operator": "=", - "operandRight": "registry-asset" - } -} diff --git a/deployment/infrastructure/resources/irs/contractpolicies/DT-BAT-XYZ789.json b/deployment/infrastructure/resources/irs/contractpolicies/DT-BAT-XYZ789.json deleted file mode 100644 index d82b595f9..000000000 --- a/deployment/infrastructure/resources/irs/contractpolicies/DT-BAT-XYZ789.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "id-3.0-trace", - "policy": { - "@type": "Policy", - "odrl:permission": [ - { - "odrl:action": "USE", - "odrl:constraint": { - "@type": "AtomicConstraint", - "odrl:or": [ - { - "@type": "Constraint", - "odrl:leftOperand": "PURPOSE", - "odrl:operator": { - "@id": "odrl:eq" - }, - "odrl:rightOperand": "ID 3.0 Trace" - } - ] - } - } - ] - } -} diff --git a/deployment/infrastructure/resources/irs/contractpolicies/digital-twin-registry.json b/deployment/infrastructure/resources/irs/contractpolicies/digital-twin-registry.json deleted file mode 100644 index 89960e845..000000000 --- a/deployment/infrastructure/resources/irs/contractpolicies/digital-twin-registry.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "4b480f48-79a0-4851-a56c-6ef71e19ebc4", - "policy": { - "@type": "Policy", - "odrl:permission": [] - } -} diff --git a/deployment/infrastructure/resources/irs/digitaltwins/DT-BAT-XYZ789+BOMAsBuilt.json b/deployment/infrastructure/resources/irs/digitaltwins/DT-BAT-XYZ789+BOMAsBuilt.json deleted file mode 100644 index eb7e123da..000000000 --- a/deployment/infrastructure/resources/irs/digitaltwins/DT-BAT-XYZ789+BOMAsBuilt.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Digital Twin" - } - ], - "displayName": [], - "globalAssetId": "urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d", - "idShort": "Battery_BAT-XYZ789", - "id": "urn:uuid:3d050cd8-cdc7-4d65-9f37-70a65d5f53f5", - "specificAssetIds": [ - { - "name": "manufacturerPartId", - "value": "XYZ78901", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - }, - { - "name": "partInstanceId", - "value": "BAT-XYZ789", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:1ea64f49-8b2b-4cd2-818e-cf9d452c6fea", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SerialPart", - "id": "urn:uuid:1ea64f49-8b2b-4cd2-818e-cf9d452c6fea", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" - } - ] - }, - "description": [], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:09d5d8a9-9073-47b6-93c6-80caff176dca", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "urn:uuid:09d5d8a9-9073-47b6-93c6-80caff176dca", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" - } - ] - }, - "description": [], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:777a3f0a-6d29-4fcd-81ea-1c27c1b870cc", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "urn:uuid:777a3f0a-6d29-4fcd-81ea-1c27c1b870cc", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - } - ] -} diff --git a/deployment/infrastructure/resources/irs/digitaltwins/DT-CTA-13123+BOMAsBuilt.json b/deployment/infrastructure/resources/irs/digitaltwins/DT-CTA-13123+BOMAsBuilt.json deleted file mode 100644 index 8b5b1728a..000000000 --- a/deployment/infrastructure/resources/irs/digitaltwins/DT-CTA-13123+BOMAsBuilt.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Cell Digital Twin" - } - ], - "displayName": [], - "globalAssetId": "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1", - "idShort": "BatteryCell_CTA-13123", - "id": "urn:uuid:d3e7cc6c-0e9b-49db-8d0d-25c6a1e68690", - "specificAssetIds": [ - { - "name": "manufacturerPartId", - "value": "XYZ78901", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - }, - { - "name": "partInstanceId", - "value": "CTA-13123", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:0f8eb434-32af-48cb-8dc2-6391fb3d8aa8", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "urn:uuid:0f8eb434-32af-48cb-8dc2-6391fb3d8aa8", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:d32d3ada-b013-4f4a-b64a-0df8fd11e6ba", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SerialPart", - "id": "urn:uuid:d32d3ada-b013-4f4a-b64a-0df8fd11e6ba", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" - } - ] - }, - "description": [], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:7e3f0673-fa92-43c3-af0d-e86485a97bda", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "urn:uuid:7e3f0673-fa92-43c3-af0d-e86485a97bda", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:d7f23694-6d38-44ca-8ba5-3256e3b4b219", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelUsageAsBuilt", - "id": "urn:uuid:d7f23694-6d38-44ca-8ba5-3256e3b4b219", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_usage_as_built:1.0.1#SingleLevelUsageAsBuilt" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - } - ] -} diff --git a/deployment/infrastructure/resources/irs/digitaltwins/DT-EVMODULE-TRJ712+BOMAsBuilt.json b/deployment/infrastructure/resources/irs/digitaltwins/DT-EVMODULE-TRJ712+BOMAsBuilt.json deleted file mode 100644 index 7b853072e..000000000 --- a/deployment/infrastructure/resources/irs/digitaltwins/DT-EVMODULE-TRJ712+BOMAsBuilt.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "description": [ - { - "language": "en", - "text": "Battery Module Digital Twin" - } - ], - "displayName": [], - "globalAssetId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552", - "idShort": "BatteryModule_EVMODULE-TRJ712", - "id": "urn:uuid:ace301f6-92c5-4623-a022-c2a30dfee0e2", - "specificAssetIds": [ - { - "name": "manufacturerPartId", - "value": "XYZ78901", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - }, - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - } - ] - } - }, - { - "name": "partInstanceId", - "value": "EVMODULE-TRJ712", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "BPNL00000000CBA5" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:c216bece-b17f-4679-8b62-ec25810ca1c4", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "urn:uuid:c216bece-b17f-4679-8b62-ec25810ca1c4", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:906e5e5e-f9c1-427c-b923-e5f863bc40df", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SerialPart", - "id": "urn:uuid:906e5e5e-f9c1-427c-b923-e5f863bc40df", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" - } - ] - }, - "description": [], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:25ea2646-d57f-4b31-97a0-d0d7b3b35d37", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SingleLevelUsageAsBuilt", - "id": "urn:uuid:25ea2646-d57f-4b31-97a0-d0d7b3b35d37", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_usage_as_built:1.0.1#SingleLevelUsageAsBuilt" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "https://materialpass.int.demo.catena-x.net/BPNL000000000000/api/public/data/urn:uuid:754b6c6c-d74a-4dd0-a62c-f07959f15332", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id=urn:uuid:3e4a5957-f226-478a-ab18-79ced49d6195;dspEndpoint=https://materialpass.int.demo.catena-x.net/BPNL000000000000/", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "urn:uuid:754b6c6c-d74a-4dd0-a62c-f07959f15332", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Digital Product Passport Submodel" - } - ], - "displayName": [] - } - ] -} diff --git a/deployment/infrastructure/testing/delete-testdata.sh b/deployment/infrastructure/testing/delete-testdata.sh new file mode 100644 index 000000000..f831ac31c --- /dev/null +++ b/deployment/infrastructure/testing/delete-testdata.sh @@ -0,0 +1,99 @@ +#!/bin/bash +################################################################################# +# Catena-X - Product Passport Consumer Application +# +# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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 govern in permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################# + +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +#ARGS=[] + +# ./delete-testdata.sh -e -a -k + +while getopts e:a:k:h flag +do + case "${flag}" in + e) edc=${OPTARG};; + a) registry=${OPTARG};; + k) api_key=${OPTARG};; + h) echo "Usage: ./upload-testdata.sh " + echo "-e, Provider edc controlplane url" + echo "-a, AAS registry url" + echo "-k, API Key" + exit 1 + esac +done + +EDC_URL=$edc +REGISTRY_URL=$registry +API_KEY=$api_key +MANAGEMENT_API="management/v2" + +echo "Delete EDC contracts..." +JSON_RESPONSE=$(curl --location --silent --request POST "${EDC_URL}/${MANAGEMENT_API}/contractdefinitions/request" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}") +items=$(echo "$JSON_RESPONSE" | jq '.[]["@id"]') +for id in ${items[@]}; do + echo "Delete EDC contract id: $id" + # remove quotes around the id + id=$(echo "${id}" | sed 's/"//g') + curl --location --silent --request DELETE "${EDC_URL}/${MANAGEMENT_API}/contractdefinitions/${id}" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}" + echo +done + +echo "Delete EDC policies..." +JSON_RESPONSE=$(curl --location --silent --request POST "${EDC_URL}/${MANAGEMENT_API}/policydefinitions/request" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}") +items=$(echo "$JSON_RESPONSE" | jq '.[]["@id"]') +for id in ${items[@]}; do + echo "Delete EDC policy id: $id" + # remove quotes around the id + id=$(echo "${id}" | sed 's/"//g') + curl --location --silent --request DELETE "${EDC_URL}/${MANAGEMENT_API}/policydefinitions/${id}" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}" + echo +done + + +echo "Delete EDC assets..." +JSON_RESPONSE=$(curl --location --silent --request POST "${EDC_URL}/${MANAGEMENT_API}/assets/request" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}") +items=$(echo "$JSON_RESPONSE" | jq '.[]["@id"]') +for id in ${items[@]}; do + echo "Delete EDC asset id: $id" + # remove quotes around the id + id=$(echo "${id}" | sed 's/"//g') + curl --location --silent --request DELETE "${EDC_URL}/${MANAGEMENT_API}/assets/${id}" --header "Content-Type: application/json" --header "X-Api-Key: ${API_KEY}" + echo +done + +echo "Delete aas shells..." +JSON_RESPONSE=$(curl --location --silent --request GET "${REGISTRY_URL}/shell-descriptors" --header "Content-Type: application/json") +items=$(echo "$JSON_RESPONSE" | jq -r ".result[].id") +for id in ${items[@]}; do + echo "Delete shell id: $id" + # remove quotes around the id + id=$(echo "${id}" | sed 's/"//g') + base64_id=$(echo -n $id | base64) + curl --location --silent --request DELETE "${REGISTRY_URL}/shell-descriptors/${base64_id}" --header "Content-Type: application/json" + echo +done + +echo 'Delete test data script complete...' +echo 'Done' diff --git a/deployment/infrastructure/testing/functions.sh b/deployment/infrastructure/testing/functions.sh new file mode 100644 index 000000000..f3cecaa12 --- /dev/null +++ b/deployment/infrastructure/testing/functions.sh @@ -0,0 +1,375 @@ +#!/bin/bash +################################################################################# +# Catena-X - Product Passport Consumer Application +# +# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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 govern in permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################# + +# ./upload-testdata.sh -s -e -a -k -b + +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +# global variables +UUID='' +ASSET_ID='' +POLICY_ID='' +CONTRACT_DEF_ID='' +PASSPORT_ID='' +HTTP_RESPONSE='' +PREFIX='urn:uuid' +declare -a ARRAY_SUBMODELS=[] +declare -a BATCH_IDS=[] + +generate_UUID () { + local uuid=$(openssl rand -hex 16) + UUID=${PREFIX}:${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12} +} + +check_status_code () { + success_message=$1 + + if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then + echo "RESPONSE CODE: [$HTTP_RESPONSE] - OK" + echo "${success_message}" + elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then + echo "RESPONSE CODE: [$HTTP_RESPONSE] - Created" + echo "${success_message}" + elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then + echo "RESPONSE CODE: [$HTTP_RESPONSE] - Bad Request" + elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then + echo "RESPONSE CODE: [$HTTP_RESPONSE] - Conflict: the object already exists" + else + echo "RESPONSE CODE: [$HTTP_RESPONSE] - Internal Server Error" + fi +} + +create_edc_asset () { + + generate_UUID + ASSET_ID=${UUID} + + payload='{ + "@context": {}, + "asset": { + "@type": "Asset", + "@id": "'${ASSET_ID}'", + "properties": { + "description": "Digital Product Passport (DPP) test data" + } + }, + "dataAddress": { + "@type": "DataAddress", + "type": "HttpData", + "proxyPath": "true", + "proxyBody": "true", + "proxyMethod": "true", + "proxyQueryParams": "true", + "baseUrl": "'${SUBMODEL_SERVER}'" + } + }' + HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${payload}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/assets) + check_status_code "[DPP] - edc asset created with uuid : ${ASSET_ID}" +} + +create_registry_asset () { + PAYLOAD='{ + "@context": {}, + "asset": { + "@type": "data.core.digitalTwinRegistry", + "@id": "'${REGISTRY_ASSET_ID}'", + "properties": { + "type": "data.core.digitalTwinRegistry", + "description": "Digital Twin Registry for DPP", + "contenttype": "application/json" + } + }, + "dataAddress": { + "@type": "DataAddress", + "type": "HttpData", + "proxyPath": "true", + "proxyBody": "true", + "proxyMethod": "true", + "proxyQueryParams": "true", + "baseUrl": "'${REGISTRY_URL}'" + } + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/assets) + check_status_code "registry asset created with uuid : registry-asset" +} + +create_default_policy () { + payload='{ + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/leftOperand" + }, + "@type": "PolicyDefinitionRequestDto", + "@id": "default-policy", + "policy": { + "@type": "Policy", + "odrl:permission": [] + } + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${payload}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/policydefinitions) + check_status_code "policy created with uuid : default-policy" +} + +create_edc_policy () { + + policy=$1 + POLICY_ID=$(echo "${policy}" | jq -r '.["@id"]') + + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${policy}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/policydefinitions) + check_status_code "policy created with uuid : ${POLICY_ID}" +} + +create_default_contractdefinition () { + + PAYLOAD='{ + "@context": {}, + "@id": "default-contract-definition", + "@type": "ContractDefinition", + "accessPolicyId": "default-policy", + "contractPolicyId": "default-policy", + "assetsSelector" : { + "@type": "CriterionDto", + "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", + "operator": "=", + "operandRight": "'${REGISTRY_ASSET_ID}'" + } + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/contractdefinitions) + check_status_code "contract created with uuid : default-contract-definition" +} + +create_contractdefinition () { + + # since contract id does not support urn:uuid as prefix, generate a new one with the prerfix + UUID=$(openssl rand -hex 16) + CONTRACT_DEF_ID=${UUID:0:8}-${UUID:8:4}-${UUID:12:4}-${UUID:16:4}-${UUID:20:12} + + payload='{ + "@context": {}, + "@id": "'${CONTRACT_DEF_ID}'", + "@type": "ContractDefinition", + "accessPolicyId": "'${POLICY_ID}'", + "contractPolicyId": "'${POLICY_ID}'", + "assetsSelector" : { + "@type": "CriterionDto", + "operandLeft": "https://w3id.org/edc/v0.0.1/ns/id", + "operator": "=", + "operandRight": "'${ASSET_ID}'" + } + }' + + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${payload}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/contractdefinitions) + check_status_code "contract created with id : ${CONTRACT_DEF_ID}" +} + +create_submodel_payload (){ + + submodels=$1 + type=$2 + noOfSubmodels=$(echo ${submodels} | jq -r '. | length') + + echo "***********************Create Submodel data*****************************************" + for ((i = 0; i < $noOfSubmodels; i++)); do + + generate_UUID + SUBMODEL_ID=${UUID} + + # -- prepare the submodel data with the generated SUBMODEL_ID + data=$(echo "${submodels}" | jq -r ".[$i].data") + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${data}" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${SUBMODEL_ID}) + check_status_code "[${type}] - Created submodel data with uuid: ${SUBMODEL_ID}" + + submodelIdShort=$(echo "${submodels}" | jq -r ".[$i].name") + semanticId=$(echo "${submodels}" | jq -r ".[$i].semanticId") + description=$(echo "${submodels}" | jq -r ".[$i].description") + + submodelDescriptor=$(cat < " + echo "-s, Submodel server url" + echo "-e, Provider edc controlplane url" + echo "-a, AAS registry url" + echo "-k, API Key" + echo "-f, input JSON file containing AAS shells configuration and submodel data" + exit 1 + esac +done + +# script parameters +export SUBMODEL_SERVER=${submodel_server} +export PROVIDER_EDC=${edc} +export REGISTRY_URL=${registry} +export API_KEY=${api_key} + +export REGISTRY_ASSET_ID='registry-asset' +export SUBMODEL_ID='' + +source ./functions.sh + +POLICY='' +# create edc assets, policies and contracts for the registry (DTR) +echo "Creating default edc assets for the registry asset" +create_registry_asset +create_default_policy +create_default_contractdefinition +echo + +POLICY=$(jq '.policies' "${datapath}") + +# create assets for passes +echo "Creating edc assets for the passport" +create_edc_asset +create_edc_policy "${POLICY}" +create_contractdefinition +echo + +jq -c '.shells[]' "${datapath}" | while read indexx; do create_aas3_shell "${indexx}"; echo "------------------------------------------------------------------------------------" ; + done + +echo 'Test data upload complete...' +echo 'Done' diff --git a/deployment/infrastructure/testing/upload-testdata.sh b/deployment/infrastructure/testing/upload-testdata.sh new file mode 100644 index 000000000..c483cad00 --- /dev/null +++ b/deployment/infrastructure/testing/upload-testdata.sh @@ -0,0 +1,28 @@ +#!/bin/bash +################################################################################# +# Catena-X - Product Passport Consumer Application +# +# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://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 govern in permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################# + +./transform-and-upload.sh -s https://materialpass.dev.demo.catena-x.net/provider_backend \ + -e https://materialpass.dev.demo.catena-x.net/BPNL000000000000 \ + -a https://materialpass.dev.demo.catena-x.net/semantics/registry/api/v3.0 \ + -k \ + -f ./testdata/testdata-payload.json diff --git a/deployment/infrastructure/upload-smc-data.sh b/deployment/infrastructure/upload-smc-data.sh deleted file mode 100644 index 80fcd61ed..000000000 --- a/deployment/infrastructure/upload-smc-data.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -################################################################################# -# Catena-X - Product Passport Consumer Application -# -# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://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 govern in permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -DIGITAL_TWIN='urn:uuid:479ceed8-0eef-4c28-a74f-4eac9e01335b' -DT_SUBMODEL_ID_1='urn:uuid:d1707d00-d714-40a6-8229-11b14086029f' -DT_SUBMODEL_ID_2='urn:uuid:88d6d37e-4bac-4770-8583-f9a50a8b4a87' - -SERVER_URL='' -REGISTRY_URL='/api/v3.0/shell-descriptors' -SUBMODEL_SERVER='' - -API_KEY='' - -DPP_ASSET='urn:uuid:d0724e94-6fa5-4551-9e07-abba7a1ecd8b' -REGISTRY_ASSET='registry-asset' - -echo '************************** Digital Twin Registry (DTR) EDC Asset **********************' -echo - -# Create a asset -echo "Create DTR asset..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/assets/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/assets -echo - -# Create a general policy -echo "Create DTR policy..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractpolicies/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create DTR contract definition..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/irs/contractdefinitions/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/contractdefinitions -echo -echo - -echo '************************** SMC EDC Asset **********************' -echo - -# Create a asset -echo "Create SMC EDC asset..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/smc/smc_asset.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/assets -echo - -# Create a general policy -echo "Create SMC EDC policy..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/smc/smc_policiy.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/policydefinitions -echo - -# Create a contract definition -echo "Create SMC EDC contract definition..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/smc/smc_contract-definition.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/contractdefinitions -echo -echo - - -echo '************************** Secondary Material Content - SMC_KLZ-90-8564-96 **********************' -echo - -# Create Submodel data -echo "Create sample data for SMC KLZ-90-8564-96..." -curl -X POST -H 'Content-Type: application/json' -s --data "@resources/smc/smc_manual_payload.json" ${SUBMODEL_SERVER}/${DT_SUBMODEL_ID_1} -echo - -echo "Create BomAsBuilt sample data of SMC serialized part..." -curl -X POST -s -H 'Content-Type: application/json' --data "@resources/smc/smc_payload_partAsPlanned.json" ${SUBMODEL_SERVER}/${DT_SUBMODEL_ID_2} -echo - -# Create a digital twin -echo "Create a Digital Twin of SMC KLZ-90-8564-96..." - -curl -X POST -s -H 'Content-Type: application/json' --data "@resources/smc/smc_digital-twin.json" ${REGISTRY_URL} -echo -echo - -echo 'DPP test data upload completed...' -echo 'Done'