From 61432814ba88081ed8850b88e07fdb0f87f5e426 Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Fri, 3 Nov 2023 18:33:32 +0100 Subject: [PATCH 1/6] feat: prepare shell scripts to upload testdata to the mock setup dynamically, remove individual json files --- .../resources/dpp/assets/IMR18650V1.json | 15 - .../resources/dpp/assets/NCR186850B.json | 15 - .../X123456789012X12345678901234566.json | 15 - .../Y792927456954B81677903848654570.json | 15 - .../dpp/assets/digital-twin-registry.json | 21 - .../dpp/contractdefinitions/IMR18650V1.json | 13 - .../dpp/contractdefinitions/NCR186850B.json | 13 - .../X123456789012X12345678901234566.json | 13 - .../Y792927456954B81677903848654570.json | 13 - .../digital-twin-registry.json | 13 - .../dpp/contractpolicies/IMR18650V1.json | 26 - .../dpp/contractpolicies/NCR186850B.json | 26 - .../X123456789012X12345678901234566.json | 26 - .../Y792927456954B81677903848654570.json | 28 - .../digital-twin-registry.json | 26 - .../dpp/digitaltwins/IMR18650V1.json | 68 -- .../dpp/digitaltwins/NCR186850B.json | 68 -- .../X123456789012X12345678901234566.json | 68 -- .../Y792927456954B81677903848654570.json | 68 -- .../resources/irs/assets/DT-BAT-XYZ789.json | 19 - .../irs/assets/digital-twin-registry.json | 21 - .../contractdefinitions/DT-BAT-XYZ789.json | 13 - .../digital-twin-registry.json | 13 - .../irs/contractpolicies/DT-BAT-XYZ789.json | 28 - .../digital-twin-registry.json | 11 - .../DT-BAT-XYZ789+BOMAsBuilt.json | 162 ---- .../digitaltwins/DT-CTA-13123+BOMAsBuilt.json | 209 ----- .../DT-EVMODULE-TRJ712+BOMAsBuilt.json | 209 ----- .../testdata/dpp}/BAT-XYZ789.json | 0 .../testdata/dpp}/CTA-13123.json | 0 .../testdata/dpp}/EVMODULE-TRJ712.json | 0 .../testdata/dpp}/IMR18650V1.json | 0 .../testdata/dpp}/NCR186850B.json | 0 .../dpp}/X123456789012X12345678901234566.json | 0 .../dpp}/Y792927456954B81677903848654570.json | 0 .../singleLevelBomAsBuilt-BAT-XYZ789.json | 0 .../dpp/singleLevelBomAsBuilt-CTA-13123.json} | 0 ...singleLevelBomAsBuilt-EVMODULE-TRJ712.json | 0 .../singleLevelUsageAsBuilt-CTA-13123.json | 0 ...ngleLevelUsageAsBuilt-EVMODULE-TRJ712.json | 0 .../testdata}/smc/smc_asset.json | 0 .../smc/smc_contract-definition.json | 0 .../testdata}/smc/smc_digital-twin.json | 0 .../testdata}/smc/smc_manual_payload.json | 0 .../smc/smc_payload_partAsPlanned.json | 0 .../testdata}/smc/smc_policiy.json | 0 .../infrastructure/upload-batterypass-data.sh | 369 ++++++++ deployment/infrastructure/upload-dpp-data.sh | 826 ++++++++++++++++++ deployment/infrastructure/upload-smc-data.sh | 18 +- deployment/infrastructure/upload-testdata.sh | 57 ++ 50 files changed, 1261 insertions(+), 1244 deletions(-) delete mode 100644 deployment/infrastructure/resources/dpp/assets/IMR18650V1.json delete mode 100644 deployment/infrastructure/resources/dpp/assets/NCR186850B.json delete mode 100644 deployment/infrastructure/resources/dpp/assets/X123456789012X12345678901234566.json delete mode 100644 deployment/infrastructure/resources/dpp/assets/Y792927456954B81677903848654570.json delete mode 100644 deployment/infrastructure/resources/dpp/assets/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/dpp/contractdefinitions/IMR18650V1.json delete mode 100644 deployment/infrastructure/resources/dpp/contractdefinitions/NCR186850B.json delete mode 100644 deployment/infrastructure/resources/dpp/contractdefinitions/X123456789012X12345678901234566.json delete mode 100644 deployment/infrastructure/resources/dpp/contractdefinitions/Y792927456954B81677903848654570.json delete mode 100644 deployment/infrastructure/resources/dpp/contractdefinitions/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/dpp/contractpolicies/IMR18650V1.json delete mode 100644 deployment/infrastructure/resources/dpp/contractpolicies/NCR186850B.json delete mode 100644 deployment/infrastructure/resources/dpp/contractpolicies/X123456789012X12345678901234566.json delete mode 100644 deployment/infrastructure/resources/dpp/contractpolicies/Y792927456954B81677903848654570.json delete mode 100644 deployment/infrastructure/resources/dpp/contractpolicies/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/dpp/digitaltwins/IMR18650V1.json delete mode 100644 deployment/infrastructure/resources/dpp/digitaltwins/NCR186850B.json delete mode 100644 deployment/infrastructure/resources/dpp/digitaltwins/X123456789012X12345678901234566.json delete mode 100644 deployment/infrastructure/resources/dpp/digitaltwins/Y792927456954B81677903848654570.json delete mode 100644 deployment/infrastructure/resources/irs/assets/DT-BAT-XYZ789.json delete mode 100644 deployment/infrastructure/resources/irs/assets/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/irs/contractdefinitions/DT-BAT-XYZ789.json delete mode 100644 deployment/infrastructure/resources/irs/contractdefinitions/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/irs/contractpolicies/DT-BAT-XYZ789.json delete mode 100644 deployment/infrastructure/resources/irs/contractpolicies/digital-twin-registry.json delete mode 100644 deployment/infrastructure/resources/irs/digitaltwins/DT-BAT-XYZ789+BOMAsBuilt.json delete mode 100644 deployment/infrastructure/resources/irs/digitaltwins/DT-CTA-13123+BOMAsBuilt.json delete mode 100644 deployment/infrastructure/resources/irs/digitaltwins/DT-EVMODULE-TRJ712+BOMAsBuilt.json rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/BAT-XYZ789.json (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/CTA-13123.json (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/EVMODULE-TRJ712.json (100%) rename deployment/infrastructure/{resources/dpp/payloads => testing/testdata/dpp}/IMR18650V1.json (100%) rename deployment/infrastructure/{resources/dpp/payloads => testing/testdata/dpp}/NCR186850B.json (100%) rename deployment/infrastructure/{resources/dpp/payloads => testing/testdata/dpp}/X123456789012X12345678901234566.json (100%) rename deployment/infrastructure/{resources/dpp/payloads => testing/testdata/dpp}/Y792927456954B81677903848654570.json (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/singleLevelBomAsBuilt-BAT-XYZ789.json (100%) rename deployment/infrastructure/{resources/irs/payloads/singleLevelBOMAsBuilt-CTA-13123.json => testing/testdata/dpp/singleLevelBomAsBuilt-CTA-13123.json} (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/singleLevelBomAsBuilt-EVMODULE-TRJ712.json (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/singleLevelUsageAsBuilt-CTA-13123.json (100%) rename deployment/infrastructure/{resources/irs/payloads => testing/testdata/dpp}/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_asset.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_contract-definition.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_digital-twin.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_manual_payload.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_payload_partAsPlanned.json (100%) rename deployment/infrastructure/{resources => testing/testdata}/smc/smc_policiy.json (100%) create mode 100644 deployment/infrastructure/upload-batterypass-data.sh create mode 100644 deployment/infrastructure/upload-dpp-data.sh create mode 100644 deployment/infrastructure/upload-testdata.sh 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/resources/irs/payloads/BAT-XYZ789.json b/deployment/infrastructure/testing/testdata/dpp/BAT-XYZ789.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/BAT-XYZ789.json rename to deployment/infrastructure/testing/testdata/dpp/BAT-XYZ789.json diff --git a/deployment/infrastructure/resources/irs/payloads/CTA-13123.json b/deployment/infrastructure/testing/testdata/dpp/CTA-13123.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/CTA-13123.json rename to deployment/infrastructure/testing/testdata/dpp/CTA-13123.json diff --git a/deployment/infrastructure/resources/irs/payloads/EVMODULE-TRJ712.json b/deployment/infrastructure/testing/testdata/dpp/EVMODULE-TRJ712.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/EVMODULE-TRJ712.json rename to deployment/infrastructure/testing/testdata/dpp/EVMODULE-TRJ712.json diff --git a/deployment/infrastructure/resources/dpp/payloads/IMR18650V1.json b/deployment/infrastructure/testing/testdata/dpp/IMR18650V1.json similarity index 100% rename from deployment/infrastructure/resources/dpp/payloads/IMR18650V1.json rename to deployment/infrastructure/testing/testdata/dpp/IMR18650V1.json diff --git a/deployment/infrastructure/resources/dpp/payloads/NCR186850B.json b/deployment/infrastructure/testing/testdata/dpp/NCR186850B.json similarity index 100% rename from deployment/infrastructure/resources/dpp/payloads/NCR186850B.json rename to deployment/infrastructure/testing/testdata/dpp/NCR186850B.json diff --git a/deployment/infrastructure/resources/dpp/payloads/X123456789012X12345678901234566.json b/deployment/infrastructure/testing/testdata/dpp/X123456789012X12345678901234566.json similarity index 100% rename from deployment/infrastructure/resources/dpp/payloads/X123456789012X12345678901234566.json rename to deployment/infrastructure/testing/testdata/dpp/X123456789012X12345678901234566.json diff --git a/deployment/infrastructure/resources/dpp/payloads/Y792927456954B81677903848654570.json b/deployment/infrastructure/testing/testdata/dpp/Y792927456954B81677903848654570.json similarity index 100% rename from deployment/infrastructure/resources/dpp/payloads/Y792927456954B81677903848654570.json rename to deployment/infrastructure/testing/testdata/dpp/Y792927456954B81677903848654570.json diff --git a/deployment/infrastructure/resources/irs/payloads/singleLevelBomAsBuilt-BAT-XYZ789.json b/deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-BAT-XYZ789.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/singleLevelBomAsBuilt-BAT-XYZ789.json rename to deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-BAT-XYZ789.json diff --git a/deployment/infrastructure/resources/irs/payloads/singleLevelBOMAsBuilt-CTA-13123.json b/deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-CTA-13123.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/singleLevelBOMAsBuilt-CTA-13123.json rename to deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-CTA-13123.json diff --git a/deployment/infrastructure/resources/irs/payloads/singleLevelBomAsBuilt-EVMODULE-TRJ712.json b/deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-EVMODULE-TRJ712.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/singleLevelBomAsBuilt-EVMODULE-TRJ712.json rename to deployment/infrastructure/testing/testdata/dpp/singleLevelBomAsBuilt-EVMODULE-TRJ712.json diff --git a/deployment/infrastructure/resources/irs/payloads/singleLevelUsageAsBuilt-CTA-13123.json b/deployment/infrastructure/testing/testdata/dpp/singleLevelUsageAsBuilt-CTA-13123.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/singleLevelUsageAsBuilt-CTA-13123.json rename to deployment/infrastructure/testing/testdata/dpp/singleLevelUsageAsBuilt-CTA-13123.json diff --git a/deployment/infrastructure/resources/irs/payloads/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json b/deployment/infrastructure/testing/testdata/dpp/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json similarity index 100% rename from deployment/infrastructure/resources/irs/payloads/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json rename to deployment/infrastructure/testing/testdata/dpp/singleLevelUsageAsBuilt-EVMODULE-TRJ712.json diff --git a/deployment/infrastructure/resources/smc/smc_asset.json b/deployment/infrastructure/testing/testdata/smc/smc_asset.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_asset.json rename to deployment/infrastructure/testing/testdata/smc/smc_asset.json diff --git a/deployment/infrastructure/resources/smc/smc_contract-definition.json b/deployment/infrastructure/testing/testdata/smc/smc_contract-definition.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_contract-definition.json rename to deployment/infrastructure/testing/testdata/smc/smc_contract-definition.json diff --git a/deployment/infrastructure/resources/smc/smc_digital-twin.json b/deployment/infrastructure/testing/testdata/smc/smc_digital-twin.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_digital-twin.json rename to deployment/infrastructure/testing/testdata/smc/smc_digital-twin.json diff --git a/deployment/infrastructure/resources/smc/smc_manual_payload.json b/deployment/infrastructure/testing/testdata/smc/smc_manual_payload.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_manual_payload.json rename to deployment/infrastructure/testing/testdata/smc/smc_manual_payload.json diff --git a/deployment/infrastructure/resources/smc/smc_payload_partAsPlanned.json b/deployment/infrastructure/testing/testdata/smc/smc_payload_partAsPlanned.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_payload_partAsPlanned.json rename to deployment/infrastructure/testing/testdata/smc/smc_payload_partAsPlanned.json diff --git a/deployment/infrastructure/resources/smc/smc_policiy.json b/deployment/infrastructure/testing/testdata/smc/smc_policiy.json similarity index 100% rename from deployment/infrastructure/resources/smc/smc_policiy.json rename to deployment/infrastructure/testing/testdata/smc/smc_policiy.json diff --git a/deployment/infrastructure/upload-batterypass-data.sh b/deployment/infrastructure/upload-batterypass-data.sh new file mode 100644 index 000000000..46149cad4 --- /dev/null +++ b/deployment/infrastructure/upload-batterypass-data.sh @@ -0,0 +1,369 @@ +#!/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 + +# script parameters +SUBMODEL_SERVER=$1 +PROVIDER_EDC=$2 +REGISTRY_URL=$3 +API_KEY=$4 +BPN=$5 + +# global variables +UUID='' +ASSET_ID='' +POLICY_ID='' +CONTRACT_DEF_ID='' +DT_ID='' +SUBMODEL_ID='' +BATTERY_ID='' +HTTP_RESPONSE='' + +PREFIX='urn:uuid' +REGISTRY_ASSET_ID='registry-asset' +MANUFACTURER_PART_ID='XYZ78901' + +# declare an array variable +declare -a batteries=("IMR18650V1" "NCR186850B" "X123456789012X12345678901234566" "Y792927456954B81677903848654570") + +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 () { + if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then + echo "[$HTTP_RESPONSE] - OK" + elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then + echo "[$HTTP_RESPONSE] - Created" + elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then + echo "[$HTTP_RESPONSE] - Bad Request" + elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then + echo "[$HTTP_RESPONSE] - Conflict: the object already exists" + else + echo "[$HTTP_RESPONSE] - Internal Server Error" + fi +} + +create_submodel_payload () { + + generate_UUID + SUBMODEL_ID=${UUID} + + curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${BATTERY_ID}.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID} + echo "Created submodel data with uuid: " ${SUBMODEL_ID} +} + +create_edc_asset () { + + generate_UUID + ASSET_ID=${UUID} + + PAYLOAD='{ + "@context": {}, + "asset": { + "@type": "Asset", + "@id": "'${ASSET_ID}'", + "properties": { + "description": "Battery Passport test data" + } + }, + "dataAddress": { + "@type": "DataAddress", + "type": "HttpData", + "proxyPath": "true", + "proxyBody": "true", + "proxyMethod": "true", + "proxyQueryParams": "true", + "baseUrl": "'${SUBMODEL_SERVER}'" + } + }' + 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 + echo "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 + echo "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" : [{ + "odrl:action": "USE", + "odrl:constraint": { + "odrl:constraint": { + "@type": "LogicalConstraint", + "odrl:or": [ + { + "@type": "Contraint", + "odrl:leftOperand": "BusinessPartnerNumber", + "odrl:operator": "EQ", + "odrl:rightOperand": "'${BPN}'" + } + ] + } + } + }] + } + }' + 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 + echo "policy created with uuid : default-policy" +} + +create_policy () { + + generate_UUID + POLICY_ID=${UUID} + + PAYLOAD='{ + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/" + }, + "@type": "PolicyDefinitionRequestDto", + "@id": "'${POLICY_ID}'", + "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" + } + ] + } + } + ] + } + }' + 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 + echo "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 + echo "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 + echo "contract created with id : ${CONTRACT_DEF_ID}" +} + +create_aas3_shell () { + + generate_UUID + AAS_ID=${UUID} + + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Battery Passport shell descriptor" + } + ], + "idShort": "Battery_'${BATTERY_ID}'", + "globalAssetId": "'${AAS_ID}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${BATTERY_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "batteryPass", + "id": "'${SUBMODEL_ID}'", + "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" + } + ] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "AAS shell created with uuid : ${AAS_ID}" +} + +# create edc assets, policies and contracts for the registry (DTR) +create_registry_asset +create_default_policy +create_default_contractdefinition + + +## now loop through the above array +for battery in "${batteries[@]}" +do + BATTERY_ID=$battery + echo + echo "++++++++++++++++++ Battery ID: " ${BATTERY_ID} "++++++++++++++++++++++" + echo + create_submodel_payload + create_edc_asset + create_policy + create_contractdefinition + create_aas3_shell + echo +done + +# You can access them using echo "${arr[0]}", "${arr[1]}" also + +echo 'Battery test data upload complete...' +echo 'Done' diff --git a/deployment/infrastructure/upload-dpp-data.sh b/deployment/infrastructure/upload-dpp-data.sh new file mode 100644 index 000000000..60d685379 --- /dev/null +++ b/deployment/infrastructure/upload-dpp-data.sh @@ -0,0 +1,826 @@ +#!/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 + +# script parameters +SUBMODEL_SERVER=$1 +PROVIDER_EDC=$2 +REGISTRY_URL=$3 +API_KEY=$4 +BPN=$5 + +# global variables +UUID='' +ASSET_ID='' +POLICY_ID='' +CONTRACT_DEF_ID='' +DT_ID='' +SUBMODEL_ID='' +PASSPORT_ID='' +HTTP_RESPONSE='' +BAT_ASPECT_ID='' +BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID='' +BAT_MODULE_ID='' +BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID='' +BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID='' +BAT_CELL_ASPECT_ID='' +BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID='' +BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID='' + + +PREFIX='urn:uuid' +REGISTRY_ASSET_ID='registry-asset' +MANUFACTURER_PART_ID='XYZ78901' + +# declare an array variable +declare -a passports=("BAT-XYZ789" "EVMODULE-TRJ712" "CTA-13123") +# decare fixed uuids for the reltionships +declare -a globalAssetIds=("urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d" "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552" "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1") + +display_message () { + + echo + echo "++++++++++++++++++ Passport ID: " ${PASSPORT_ID} "++++++++++++++++++++++" + echo +} + +generate_submodel_id () { + + generate_UUID + BAT_ASPECT_ID=${UUID} # digital product pass aspect + generate_UUID + BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} + + generate_UUID + BAT_MODULE_ID=${UUID} # digital product pass aspect + generate_UUID + BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} + generate_UUID + BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID=${UUID} + + generate_UUID + BAT_CELL_ASPECT_ID=${UUID} # digital product pass aspect + generate_UUID + BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} + generate_UUID + BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID=${UUID} +} + +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 () { + if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then + echo "[$HTTP_RESPONSE] - OK" + elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then + echo "[$HTTP_RESPONSE] - Created" + elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then + echo "[$HTTP_RESPONSE] - Bad Request" + elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then + echo "[$HTTP_RESPONSE] - Conflict: the object already exists" + else + echo "[$HTTP_RESPONSE] - Internal Server Error" + fi +} + +create_submodel_payload () { + + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[0]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_ASPECT_ID}) + check_status_code + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[0]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}) + check_status_code + + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_ID}) + check_status_code + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}) + check_status_code + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelUsageAsBuilt-${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}) + check_status_code + + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_ASPECT_ID}) + check_status_code + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}) + check_status_code + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelUsageAsBuilt-${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}) + check_status_code + + echo "[DPP] - Submodel data upload complete" +} + +create_edc_asset () { + + generate_UUID + ASSET_ID=${UUID} + + PAYLOAD='{ + "@context": { + "dct": "https://purl.org/dc/terms/", + "tx": "https://w3id.org/tractusx/v0.0.1/ns/", + "edc": "https://w3id.org/edc/v0.0.1/ns/", + "dcat": "https://www.w3.org/ns/dcat/", + "odrl": "http://www.w3.org/ns/odrl/2/", + "dspace": "https://w3id.org/dspace/v0.8/" + }, + "asset": { + "@type": "Asset", + "@id": "'${ASSET_ID}'", + "properties": { + "description": "DPP EDC Test Asset" + } + }, + "dataAddress": { + "@type": "DataAddress", + "type": "HttpData", + "proxyPath": "true", + "proxyBody": "true", + "proxyMethod": "true", + "proxyQueryParams": "true", + "baseUrl": "'${SUBMODEL_SERVER}'" + } + }' + 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 + echo "[DPP] - edc asset creation complete 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 + echo "[DPP] - registry asset creation complete 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" : [{ + "odrl:action": "USE", + "odrl:constraint": { + "odrl:constraint": { + "@type": "LogicalConstraint", + "odrl:or": [ + { + "@type": "Contraint", + "odrl:leftOperand": "BusinessPartnerNumber", + "odrl:operator": "EQ", + "odrl:rightOperand": "'${BPN}'" + } + ] + } + } + }] + } + }' + 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 + echo "[DPP] - policy creation complete with uuid : default-policy" +} + +create_policy () { + + generate_UUID + POLICY_ID=${UUID} + + PAYLOAD='{ + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/" + }, + "@type": "PolicyDefinitionRequestDto", + "@id": "'${POLICY_ID}'", + "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" + } + ] + } + } + ] + } + }' + 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 + echo "[DPP] - policy creation complete 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 + echo "[DPP] - Contract creation complete 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 + echo "[DPP] - Contract creation complete with id : ${CONTRACT_DEF_ID}" +} + +create_battery_payload() { + + display_message + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Battery Digital Twin" + } + ], + "idShort": "Battery_'${PASSPORT_ID}'", + "globalAssetId": "'${globalAssetIds[0]}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${PASSPORT_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_ASPECT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "digitalProductPass", + "id": "'${BAT_ASPECT_ID}'", + "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" + } + ] + }, + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "singleLevelBomAsBuilt", + "id": "'${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "semanticId": { + "type": "ExternalReference", + "keys": [ + { + "type": "Submodel", + "value": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" + } + ] + }, + "description": [], + "displayName": [] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "Battery digital twin created with uuid : ${AAS_ID}" + +} + +create_batteryModule_payload() { + + display_message + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Battery Module Digital Twin" + } + ], + "idShort": "Battery_'${PASSPORT_ID}'", + "globalAssetId": "'${globalAssetIds[1]}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${PASSPORT_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "digitalProductPass", + "id": "'${BAT_MODULE_ID}'", + "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" + } + ] + }, + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "singleLevelBomAsBuilt", + "id": "'${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "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": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "SingleLevelUsageAsBuilt", + "id": "'${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", + "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": [] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "Battery module digital twin created with uuid : ${AAS_ID}" +} + +create_batteryCell_payload() { + + display_message + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Battery Cell Digital Twin" + } + ], + "idShort": "Battery_'${PASSPORT_ID}'", + "globalAssetId": "'${globalAssetIds[2]}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${PASSPORT_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_ASPECT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "digitalProductPass", + "id": "'${BAT_CELL_ASPECT_ID}'", + "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" + } + ] + }, + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "singleLevelBomAsBuilt", + "id": "'${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", + "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": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "SingleLevelUsageAsBuilt", + "id": "'${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", + "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": [] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "Battery cell digital twin created with uuid : ${AAS_ID}" +} + +create_aas3_shell () { + + # create and register battery digital twin + generate_UUID + AAS_ID=${UUID} + PASSPORT_ID=${passports[0]} + create_battery_payload + + # create and register battery module digital twin + generate_UUID + AAS_ID=${UUID} + PASSPORT_ID=${passports[1]} + create_batteryModule_payload + + # create and register battery cell digital twin + generate_UUID + AAS_ID=${UUID} + PASSPORT_ID=${passports[2]} + create_batteryCell_payload +} + +# generate submodel uuids to be used in digital twin aspect models and to create submodel payloads +generate_submodel_id + +# create edc assets, policies and contracts for the registry (DTR) +create_registry_asset +create_default_policy +create_default_contractdefinition + +#create dpp asset, policy and contract +create_edc_asset +create_policy +create_contractdefinition +create_aas3_shell +create_submodel_payload + +echo 'DPP test data upload complete...' +echo 'Done' diff --git a/deployment/infrastructure/upload-smc-data.sh b/deployment/infrastructure/upload-smc-data.sh index 80fcd61ed..453c47e13 100644 --- a/deployment/infrastructure/upload-smc-data.sh +++ b/deployment/infrastructure/upload-smc-data.sh @@ -44,17 +44,17 @@ 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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/smc/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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/smc/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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/smc/contractdefinitions/digital-twin-registry.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/contractdefinitions echo echo @@ -63,17 +63,17 @@ 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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/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 +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/smc/smc_contract-definition.json" --header 'X-Api-Key: '${API_KEY} ${SUBMODEL_SERVER}/management/v2/contractdefinitions echo echo @@ -83,17 +83,17 @@ 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} +curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/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} +curl -X POST -s -H 'Content-Type: application/json' --data "@testing/testdata/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} +curl -X POST -s -H 'Content-Type: application/json' --data "@testing/testdata/smc/smc_digital-twin.json" ${REGISTRY_URL} echo echo diff --git a/deployment/infrastructure/upload-testdata.sh b/deployment/infrastructure/upload-testdata.sh new file mode 100644 index 000000000..cabd7237d --- /dev/null +++ b/deployment/infrastructure/upload-testdata.sh @@ -0,0 +1,57 @@ +#!/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 -edc -a -api -bpn -d +# args: SUBMODEL_SERVER_URL, PROVIDER_CONTROLPLANE, REGISTRY_URL, API_KEY, ALLOWED_BPNS, RESOURCE_DIR +# ./upload-testdata.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 password -b BPNL00000003CRHL -f @resources + +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +#ARGS=[] + +while getopts s:e:a:k:b:f flag +do + case "${flag}" in + s) submodel_server=${OPTARG};; + e) edc=${OPTARG};; + a) registry=${OPTARG};; + k) api_key=${OPTARG};; + b) bpn=${OPTARG};; + #f) resource_dir=${OPTARG};; + esac +done +echo "submodel_server: $submodel_server"; +echo "edc: $edc"; +echo "registry: $registry"; +echo "api_key: $api_key"; +echo "bpn: $bpn"; + + +./upload-batterypass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} +./upload-dpp-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} + +echo 'Test data upload complete...' +echo 'Done' From f3de3932b2b70e082e8470376264dd07c4191153 Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Mon, 6 Nov 2023 16:23:02 +0100 Subject: [PATCH 2/6] chore: prepare delete script to wipe out the mock setup --- deployment/infrastructure/delete-testdata.sh | 99 ++++++++++++++++++++ deployment/infrastructure/upload-testdata.sh | 25 ++--- 2 files changed, 113 insertions(+), 11 deletions(-) create mode 100644 deployment/infrastructure/delete-testdata.sh diff --git a/deployment/infrastructure/delete-testdata.sh b/deployment/infrastructure/delete-testdata.sh new file mode 100644 index 000000000..f831ac31c --- /dev/null +++ b/deployment/infrastructure/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/upload-testdata.sh b/deployment/infrastructure/upload-testdata.sh index cabd7237d..6acbf9f96 100644 --- a/deployment/infrastructure/upload-testdata.sh +++ b/deployment/infrastructure/upload-testdata.sh @@ -21,9 +21,7 @@ # SPDX-License-Identifier: Apache-2.0 ################################################################################# -# ./upload-testdata.sh -s -edc -a -api -bpn -d -# args: SUBMODEL_SERVER_URL, PROVIDER_CONTROLPLANE, REGISTRY_URL, API_KEY, ALLOWED_BPNS, RESOURCE_DIR -# ./upload-testdata.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 password -b BPNL00000003CRHL -f @resources +# ./upload-testdata.sh -s -e -a -k -b set -o errexit set -o errtrace @@ -32,7 +30,7 @@ set -o nounset #ARGS=[] -while getopts s:e:a:k:b:f flag +while getopts s:e:a:k:b:h flag do case "${flag}" in s) submodel_server=${OPTARG};; @@ -40,18 +38,23 @@ do a) registry=${OPTARG};; k) api_key=${OPTARG};; b) bpn=${OPTARG};; - #f) resource_dir=${OPTARG};; + h) echo "Usage: ./upload-testdata.sh " + echo "-s, Submodel server url" + echo "-e, Provider edc controlplane url" + echo "-a, AAS registry url" + echo "-k, API Key" + echo "-b, BPN number" + exit 1 esac done -echo "submodel_server: $submodel_server"; -echo "edc: $edc"; -echo "registry: $registry"; -echo "api_key: $api_key"; -echo "bpn: $bpn"; - +echo "****************Start upload battery test data*************" ./upload-batterypass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} +echo "*****************End upload battery test data**************" +echo +echo "****************Start upload dpp test data****************" ./upload-dpp-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} +echo "***************End upload dpp test data*******************" echo 'Test data upload complete...' echo 'Done' From f0312ba27545a21a8c5ee6ab593bd8514a8fe34f Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Wed, 8 Nov 2023 09:48:00 +0100 Subject: [PATCH 3/6] chore: refactor scripts and prepare transmission pass test data for edc, prepare readme instructions --- deployment/infrastructure/README.md | 75 +++ deployment/infrastructure/functions.sh | 580 ++++++++++++++++++ .../testdata/dpp/SNJ-4654-76_payload.json | 145 +++++ .../infrastructure/upload-batterypass-data.sh | 320 +--------- deployment/infrastructure/upload-dpp-data.sh | 225 +------ deployment/infrastructure/upload-smc-data.sh | 133 ++-- deployment/infrastructure/upload-testdata.sh | 24 +- .../upload-transmissionpass-data.sh | 83 +++ 8 files changed, 996 insertions(+), 589 deletions(-) create mode 100644 deployment/infrastructure/README.md create mode 100644 deployment/infrastructure/functions.sh create mode 100644 deployment/infrastructure/testing/testdata/dpp/SNJ-4654-76_payload.json create mode 100644 deployment/infrastructure/upload-transmissionpass-data.sh diff --git a/deployment/infrastructure/README.md b/deployment/infrastructure/README.md new file mode 100644 index 000000000..2681ea08d --- /dev/null +++ b/deployment/infrastructure/README.md @@ -0,0 +1,75 @@ + + +# Test data Uploader +## TL;DR + +Use the following script to upload test data to the provider edc and registry: +```bash +./upload-testdata.sh -s -e -a -k -b +``` + +#### Script Parameters: +| Parameter | Description | Example value | Required/Optionl | +| :---: | :--- | :--- | :---: | +| -s | Submodel server URL | https://materialpass.int.demo.catena-x.net/provider_backend | Required | +| -e | Provider control plane URL | https://materialpass.int.demo.catena-x.net/BPNL000000000000 | Required | +| -a | AAS registry URL | https://materialpass.int.demo.catena-x.net/semantics/registry/api/v3.0 | Required | +| -k | EDC API Key | xxxxxxxx | Required | +| -b | BPN number | BPNL00000000CBA5 | Required | +| | | | | + + +Use the following script to upload specific test data file + +### Digital Product Pass (DPP) + +```bash +./upload-dpp-data.sh +``` + +### Battery Pass + +```bash +./upload-batterypass-data.sh +``` + +### Transmission Pass + +```bash +./upload-transmissionpass-data.sh +``` + +### Secondary Material Content (SMC) + +```bash +./upload-smc-data.sh +``` + +### 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/functions.sh b/deployment/infrastructure/functions.sh new file mode 100644 index 000000000..d5ba509a0 --- /dev/null +++ b/deployment/infrastructure/functions.sh @@ -0,0 +1,580 @@ +#!/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' + +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} +} + +display_message () { + + echo + echo "++++++++++++++++++ Passport ID: " ${PASSPORT_ID} "++++++++++++++++++++++" + echo +} + +check_status_code () { + if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then + echo "[$HTTP_RESPONSE] - OK" + elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then + echo "[$HTTP_RESPONSE] - Created" + elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then + echo "[$HTTP_RESPONSE] - Bad Request" + elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then + echo "[$HTTP_RESPONSE] - Conflict: the object already exists" + else + echo "[$HTTP_RESPONSE] - Internal Server Error" + fi +} + +create_edc_asset () { + + generate_UUID + ASSET_ID=${UUID} + + PAYLOAD='{ + "@context": {}, + "asset": { + "@type": "Asset", + "@id": "'${ASSET_ID}'", + "properties": { + "description": "'${PASSPORT_TYPE}' test data" + } + }, + "dataAddress": { + "@type": "DataAddress", + "type": "HttpData", + "proxyPath": "true", + "proxyBody": "true", + "proxyMethod": "true", + "proxyQueryParams": "true", + "baseUrl": "'${SUBMODEL_SERVER}'" + } + }' + 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 + echo "[${PASSPORT_TYPE}] - 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 + echo "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" : [{ + "odrl:action": "USE", + "odrl:constraint": { + "odrl:constraint": { + "@type": "LogicalConstraint", + "odrl:or": [ + { + "@type": "Contraint", + "odrl:leftOperand": "BusinessPartnerNumber", + "odrl:operator": "EQ", + "odrl:rightOperand": "'${BPN}'" + } + ] + } + } + }] + } + }' + 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 + echo "policy created with uuid : default-policy" +} + +create_policy () { + + generate_UUID + POLICY_ID=${UUID} + + PAYLOAD='{ + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/" + }, + "@type": "PolicyDefinitionRequestDto", + "@id": "'${POLICY_ID}'", + "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" + } + ] + } + } + ] + } + }' + 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 + echo "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 + echo "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 + echo "contract created with id : ${CONTRACT_DEF_ID}" +} + +create_batterypass_aas_payload (){ + + BATTERY_ID=$1 + AAS_ID=$2 + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Battery Passport shell descriptor" + } + ], + "idShort": "Battery_'${BATTERY_ID}'", + "globalAssetId": "'${AAS_ID}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${BATTERY_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "batteryPass", + "id": "'${SUBMODEL_ID}'", + "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" + } + ] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "[BatteryPass] - AAS shell created with uuid : ${AAS_ID}" +} + +create_transmissionpass_aas_payload (){ + + GEARBOX_ID=$1 + AAS_ID=$2 + + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Transmission Passport shell descriptor" + } + ], + "idShort": "Transmission_'${GEARBOX_ID}'", + "globalAssetId": "'${AAS_ID}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "'${GEARBOX_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "transmissionPass", + "id": "'${SUBMODEL_ID}'", + "semanticId": { + "type": "ExternalReference", + "keys": [ + { + "type": "Submodel", + "value": "urn:bamm:io.catenax.transmission.transmission_pass:1.0.0#TransmissionPass" + } + ] + }, + "description": [ + { + "language": "en", + "text": "Transmission Passport Submodel" + } + ] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "AAS shell created with uuid : ${AAS_ID}" +} + +create_smc_aas_payload (){ + + MATERIAL_ID=$1 + AAS_ID=$2 + PAYLOAD='{ + "description": [ + { + "language": "en", + "text": "Secondary Material Content" + } + ], + "idShort": "SMC_'${MATERIAL_ID}'", + "globalAssetId": "'${AAS_ID}'", + "id": "'${AAS_ID}'", + "specificAssetIds": [ + { + "name": "orderNumber", + "value": "'${MATERIAL_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "BPNL00000003AYRE" + } + ] + } + }, + { + "name": "manufacturerPartId", + "value": "'${MANUFACTURER_PART_ID}'", + "externalSubjectId": { + "type": "ExternalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "'${BPN}'" + }, + { + "type": "GlobalReference", + "value": "BPNL00000003AYRE" + }, + { + "type": "GlobalReference", + "value": "PUBLIC_READABLE" + } + ] + } + } + ], + "submodelDescriptors": [ + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "'${PROVIDER_EDC}'/api/public/data/'${SERIAL_PART_ASPECT_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "SerialPart", + "id": "'${SERIAL_PART_ASPECT_ID}'", + "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": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": [ + "1.1" + ], + "subprotocol": "DSP", + "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "secondaryMaterialContent", + "id": "'${SUBMODEL_ID}'", + "semanticId": { + "type": "ExternalReference", + "keys": [ + { + "type": "Submodel", + "value": "urn:samm:io.catenax.secondary_material_content:1.0.0#SecondaryMaterialContent" + } + ] + }, + "description": [], + "displayName": [] + } + ] + }' + HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) + check_status_code + echo "[SecondaryMaterialContent] - AAS shell created with uuid : ${AAS_ID}" + +} + + +create_aas3_shell () { + + PASSPORT_ID=$1 + PASSPORT_TYPE=$2 + generate_UUID + AAS_ID=${UUID} + + if [[ $PASSPORT_TYPE = "batterypass" ]] ; then + create_batterypass_aas_payload ${PASSPORT_ID} ${AAS_ID} + elif [[ $PASSPORT_TYPE = "transmissionpass" ]] ; then + create_transmissionpass_aas_payload ${PASSPORT_ID} ${AAS_ID} + elif [[ $PASSPORT_TYPE = "secondarymaterialcontent" ]] ; then + create_smc_aas_payload ${PASSPORT_ID} ${AAS_ID} + fi; + +} diff --git a/deployment/infrastructure/testing/testdata/dpp/SNJ-4654-76_payload.json b/deployment/infrastructure/testing/testdata/dpp/SNJ-4654-76_payload.json new file mode 100644 index 000000000..c08b80734 --- /dev/null +++ b/deployment/infrastructure/testing/testdata/dpp/SNJ-4654-76_payload.json @@ -0,0 +1,145 @@ +{ + "productSpecificParameters": { + "torqueConverter": [ + "ABC1234567890", + "XYZ9876543210" + ], + "driveType": "Combustion Engine", + "oilType": "ZF Lifeguard Hybrid 2", + "spreading": 6.79, + "torque": 500, + "power": 300, + "standardGearRatio": { + "gear": "1", + "ratio": 4.1567 + }, + "oilCapacity": 8.9, + "electricPerformance": [ + "Electric Performance Specification A", + "Electric Performance Specification B" + ], + "speedResistance": { + "speed": 7800, + "gear": "1" + } + }, + "instructions": { + "packagingInstructions": [ + { + "documentTitle": "Packaging Instructions", + "documentLink": "https://www.example.com/packaging-instructions.pdf" + } + ], + "transportationInstructions": [ + { + "documentTitle": "Transportation Instructions", + "documentLink": "https://www.example.com/transportation-instructions.pdf" + } + ], + "dismantlingProcedure": [ + { + "documentTitle": "Dismantling Procedure", + "documentLink": "https://www.example.com/dismantling-procedure.pdf" + } + ], + "safetyMeasures": [ + { + "documentTitle": "Safety Measures", + "documentLink": "https://www.example.com/safety-measures.pdf" + } + ], + "vehicleDismantlingProcedure": [ + { + "documentTitle": "Vehicle Dismantling Procedure", + "documentLink": "https://www.example.com/vehicle-dismantling-procedure.pdf" + } + ] + }, + "identification": { + "manufacturerId": "XYZ78901", + "localIdentifiers": [ + { + "value": "SNJ-4654-76", + "key": "partInstanceId" + } + ], + "dataMatrixCode": "ABCDEF1234567890" + }, + "sparePartSupplier": [ + { + "supplierContact": { + "faxNumber": "+49 89 0987654321", + "website": "https://www.example-supplier.com", + "phoneNumber": "+49 89 1234567890", + "email": "supplier@example.com" + }, + "supplierId": "BPNL1234567890ZZ", + "sparePartName": "Torque Converter" + } + ], + "stateOfHealth": { + "serviceHistory": [ + "2023-05-22T13:16:47.239+02:00" + ], + "expectedLifespan": 500000, + "remanufacturing": { + "remanufacturingDate": "2023-05-22T13:16:47.239+02:00", + "productStatusValue": "First Life" + } + }, + "generalInformation": { + "additionalInformation": "This is a test product with realistic data.", + "physicalDimensionsProperty": { + "width": 1000, + "length": 20000.1, + "weight": 100.7, + "diameter": 0.03, + "height": 0.1 + }, + "warrantyPeriod": 60, + "productDescription": "Manual Transmission", + "productType": "8HP60MH" + }, + "sustainability": { + "substancesOfConcern": [ + "Substance A", + "Substance B" + ], + "responsibleSourcingDocument": [ + { + "documentTitle": "Responsible Sourcing Document", + "documentLink": "https://www.example.com/responsible-sourcing.pdf" + } + ], + "recyclateContent": { + "nickel": 0.05, + "lithium": 0.01, + "cobalt": 0.02, + "otherSubstance": [ + { + "substancePercentage": 0.1, + "substanceName": "Lead" + } + ] + }, + "criticalRawMaterials": [ + "Material X", + "Material Y" + ], + "carbonFootprint": { + "crossSectoralStandardsUsed": [ + { + "crossSectoralStandard": "GHG Protocol Product Standard" + } + ], + "co2FootprintTotal": 200, + "productOrSectorSpecificRules": [ + { + "operator": "PEF", + "ruleNames": "ABC 2021", + "otherOperatorName": "NSF" + } + ] + } + } +} diff --git a/deployment/infrastructure/upload-batterypass-data.sh b/deployment/infrastructure/upload-batterypass-data.sh index 46149cad4..afefe1499 100644 --- a/deployment/infrastructure/upload-batterypass-data.sh +++ b/deployment/infrastructure/upload-batterypass-data.sh @@ -27,319 +27,33 @@ set -o pipefail set -o nounset # script parameters -SUBMODEL_SERVER=$1 -PROVIDER_EDC=$2 -REGISTRY_URL=$3 -API_KEY=$4 -BPN=$5 - -# global variables +export SUBMODEL_SERVER=$1 +export PROVIDER_EDC=$2 +export REGISTRY_URL=$3 +export API_KEY=$4 +export BPN=$5 +export REGISTRY_ASSET_ID='registry-asset' +export MANUFACTURER_PART_ID='XYZ78901' +export SUBMODEL_ID='' +export PASSPORT_TYPE="batterypass" + +source ./functions.sh + +# script global variables UUID='' -ASSET_ID='' -POLICY_ID='' -CONTRACT_DEF_ID='' -DT_ID='' -SUBMODEL_ID='' BATTERY_ID='' -HTTP_RESPONSE='' -PREFIX='urn:uuid' -REGISTRY_ASSET_ID='registry-asset' -MANUFACTURER_PART_ID='XYZ78901' # declare an array variable declare -a batteries=("IMR18650V1" "NCR186850B" "X123456789012X12345678901234566" "Y792927456954B81677903848654570") -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 () { - if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then - echo "[$HTTP_RESPONSE] - OK" - elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then - echo "[$HTTP_RESPONSE] - Created" - elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then - echo "[$HTTP_RESPONSE] - Bad Request" - elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then - echo "[$HTTP_RESPONSE] - Conflict: the object already exists" - else - echo "[$HTTP_RESPONSE] - Internal Server Error" - fi -} - create_submodel_payload () { generate_UUID SUBMODEL_ID=${UUID} - curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${BATTERY_ID}.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID} - echo "Created submodel data with uuid: " ${SUBMODEL_ID} -} - -create_edc_asset () { - - generate_UUID - ASSET_ID=${UUID} - - PAYLOAD='{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "'${ASSET_ID}'", - "properties": { - "description": "Battery Passport test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "proxyPath": "true", - "proxyBody": "true", - "proxyMethod": "true", - "proxyQueryParams": "true", - "baseUrl": "'${SUBMODEL_SERVER}'" - } - }' - 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 - echo "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 - echo "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" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstraint", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "'${BPN}'" - } - ] - } - } - }] - } - }' - 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 - echo "policy created with uuid : default-policy" -} - -create_policy () { - - generate_UUID - POLICY_ID=${UUID} - - PAYLOAD='{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "'${POLICY_ID}'", - "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" - } - ] - } - } - ] - } - }' - 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 - echo "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 - echo "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 - echo "contract created with id : ${CONTRACT_DEF_ID}" -} - -create_aas3_shell () { - - generate_UUID - AAS_ID=${UUID} - - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_'${BATTERY_ID}'", - "globalAssetId": "'${AAS_ID}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${BATTERY_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "'${SUBMODEL_ID}'", - "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" - } - ] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "AAS shell created with uuid : ${AAS_ID}" + HTTP_RESPONSE==$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${BATTERY_ID}.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID}) + echo "[BatteryPass] - Created submodel data with uuid: " ${SUBMODEL_ID} } # create edc assets, policies and contracts for the registry (DTR) @@ -355,11 +69,11 @@ do echo echo "++++++++++++++++++ Battery ID: " ${BATTERY_ID} "++++++++++++++++++++++" echo - create_submodel_payload + create_submodel_payload create_edc_asset create_policy create_contractdefinition - create_aas3_shell + create_aas3_shell ${BATTERY_ID} ${PASSPORT_TYPE} echo done diff --git a/deployment/infrastructure/upload-dpp-data.sh b/deployment/infrastructure/upload-dpp-data.sh index 60d685379..846447dac 100644 --- a/deployment/infrastructure/upload-dpp-data.sh +++ b/deployment/infrastructure/upload-dpp-data.sh @@ -27,21 +27,21 @@ set -o pipefail set -o nounset # script parameters -SUBMODEL_SERVER=$1 -PROVIDER_EDC=$2 -REGISTRY_URL=$3 -API_KEY=$4 -BPN=$5 - -# global variables +export SUBMODEL_SERVER=$1 +export PROVIDER_EDC=$2 +export REGISTRY_URL=$3 +export API_KEY=$4 +export BPN=$5 +export REGISTRY_ASSET_ID='registry-asset' +export MANUFACTURER_PART_ID='XYZ78901' +export SUBMODEL_ID='' +export PASSPORT_TYPE="dpp" + +source ./functions.sh + +# script global variables UUID='' -ASSET_ID='' -POLICY_ID='' -CONTRACT_DEF_ID='' -DT_ID='' -SUBMODEL_ID='' PASSPORT_ID='' -HTTP_RESPONSE='' BAT_ASPECT_ID='' BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID='' BAT_MODULE_ID='' @@ -51,11 +51,6 @@ BAT_CELL_ASPECT_ID='' BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID='' BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID='' - -PREFIX='urn:uuid' -REGISTRY_ASSET_ID='registry-asset' -MANUFACTURER_PART_ID='XYZ78901' - # declare an array variable declare -a passports=("BAT-XYZ789" "EVMODULE-TRJ712" "CTA-13123") # decare fixed uuids for the reltionships @@ -90,25 +85,6 @@ generate_submodel_id () { BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID=${UUID} } -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 () { - if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then - echo "[$HTTP_RESPONSE] - OK" - elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then - echo "[$HTTP_RESPONSE] - Created" - elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then - echo "[$HTTP_RESPONSE] - Bad Request" - elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then - echo "[$HTTP_RESPONSE] - Conflict: the object already exists" - else - echo "[$HTTP_RESPONSE] - Internal Server Error" - fi -} - create_submodel_payload () { HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[0]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_ASPECT_ID}) @@ -133,181 +109,6 @@ create_submodel_payload () { echo "[DPP] - Submodel data upload complete" } -create_edc_asset () { - - generate_UUID - ASSET_ID=${UUID} - - PAYLOAD='{ - "@context": { - "dct": "https://purl.org/dc/terms/", - "tx": "https://w3id.org/tractusx/v0.0.1/ns/", - "edc": "https://w3id.org/edc/v0.0.1/ns/", - "dcat": "https://www.w3.org/ns/dcat/", - "odrl": "http://www.w3.org/ns/odrl/2/", - "dspace": "https://w3id.org/dspace/v0.8/" - }, - "asset": { - "@type": "Asset", - "@id": "'${ASSET_ID}'", - "properties": { - "description": "DPP EDC Test Asset" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "proxyPath": "true", - "proxyBody": "true", - "proxyMethod": "true", - "proxyQueryParams": "true", - "baseUrl": "'${SUBMODEL_SERVER}'" - } - }' - 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 - echo "[DPP] - edc asset creation complete 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 - echo "[DPP] - registry asset creation complete 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" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstraint", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "'${BPN}'" - } - ] - } - } - }] - } - }' - 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 - echo "[DPP] - policy creation complete with uuid : default-policy" -} - -create_policy () { - - generate_UUID - POLICY_ID=${UUID} - - PAYLOAD='{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "'${POLICY_ID}'", - "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" - } - ] - } - } - ] - } - }' - 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 - echo "[DPP] - policy creation complete 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 - echo "[DPP] - Contract creation complete 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 - echo "[DPP] - Contract creation complete with id : ${CONTRACT_DEF_ID}" -} - create_battery_payload() { display_message diff --git a/deployment/infrastructure/upload-smc-data.sh b/deployment/infrastructure/upload-smc-data.sh index 453c47e13..77296700f 100644 --- a/deployment/infrastructure/upload-smc-data.sh +++ b/deployment/infrastructure/upload-smc-data.sh @@ -26,76 +26,65 @@ 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 "@testing/testdata/smc/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 "@testing/testdata/smc/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 "@testing/testdata/smc/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 "@testing/testdata/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 "@testing/testdata/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 "@testing/testdata/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 "@testing/testdata/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 "@testing/testdata/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 "@testing/testdata/smc/smc_digital-twin.json" ${REGISTRY_URL} -echo -echo - -echo 'DPP test data upload completed...' +# script parameters +export SUBMODEL_SERVER=$1 +export PROVIDER_EDC=$2 +export REGISTRY_URL=$3 +export API_KEY=$4 +export BPN=$5 +export REGISTRY_ASSET_ID='registry-asset' +export MANUFACTURER_PART_ID='XYZ78901' +export SUBMODEL_ID='' +export SERIAL_PART_ASPECT_ID='' +export PASSPORT_TYPE="secondarymaterialcontent" + +source ./functions.sh + +# script global variables +UUID='' +MATERIAL_ID='' + + +# declare an array variable +declare -a smc_orders=("KLZ-90-8564-96") + +create_submodel_payload () { + + generate_UUID + SUBMODEL_ID=${UUID} + echo "Create sample data for SMC KLZ-90-8564-96..." + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' --data "@testing/testdata/smc/smc_manual_payload.json" ${SUBMODEL_SERVER}/data/${SUBMODEL_ID}) + check_status_code + + generate_UUID + SERIAL_PART_ASPECT_ID=${UUID} + echo "Create BomAsBuilt sample data of SMC serialized part..." + HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' --data "@testing/testdata/smc/smc_payload_partAsPlanned.json" ${SUBMODEL_SERVER}/data/${SERIAL_PART_ASPECT_ID}) + check_status_code + + echo "[SecondaryMaterialContent] - Created submodel data" +} + +# create edc assets, policies and contracts for the registry (DTR) +create_registry_asset +create_default_policy +create_default_contractdefinition + + +## loop through the above array +for item in "${smc_orders[@]}" +do + ORDER_ID=$item + echo + echo "++++++++++++++++++ SMC Order ID: " ${ORDER_ID} "++++++++++++++++++++++" + echo + create_submodel_payload + create_edc_asset + create_policy + create_contractdefinition + create_aas3_shell ${ORDER_ID} ${PASSPORT_TYPE} + echo +done + +echo 'Secondary Material Content SMC test data upload complete...' echo 'Done' diff --git a/deployment/infrastructure/upload-testdata.sh b/deployment/infrastructure/upload-testdata.sh index 6acbf9f96..5e6592ed1 100644 --- a/deployment/infrastructure/upload-testdata.sh +++ b/deployment/infrastructure/upload-testdata.sh @@ -28,8 +28,6 @@ set -o errtrace set -o pipefail set -o nounset -#ARGS=[] - while getopts s:e:a:k:b:h flag do case "${flag}" in @@ -48,13 +46,35 @@ do esac done +# script parameters +export SUBMODEL_SERVER=${submodel_server} +export PROVIDER_EDC=${edc} +export REGISTRY_URL=${registry} +export API_KEY=${api_key} +export BPN=${bpn} + +export REGISTRY_ASSET_ID='registry-asset' +export MANUFACTURER_PART_ID='XYZ78901' + echo "****************Start upload battery test data*************" ./upload-batterypass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} echo "*****************End upload battery test data**************" echo + echo "****************Start upload dpp test data****************" ./upload-dpp-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} echo "***************End upload dpp test data*******************" +echo + +echo "****************Start upload Secondary Material Content SMC test data****************" +./upload-smc-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} +echo "***************End upload Secondary Material Content SMC test data*******************" +echo + +echo "****************Start upload transmission pass test data****************" +./upload-transmissionpass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} +echo "***************End upload transmission pass test data*******************" +echo echo 'Test data upload complete...' echo 'Done' diff --git a/deployment/infrastructure/upload-transmissionpass-data.sh b/deployment/infrastructure/upload-transmissionpass-data.sh new file mode 100644 index 000000000..49f8ae832 --- /dev/null +++ b/deployment/infrastructure/upload-transmissionpass-data.sh @@ -0,0 +1,83 @@ +#!/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 + +# script parameters +export SUBMODEL_SERVER=$1 +export PROVIDER_EDC=$2 +export REGISTRY_URL=$3 +export API_KEY=$4 +export BPN=$5 +export REGISTRY_ASSET_ID='registry-asset' +export MANUFACTURER_PART_ID='XYZ78901' +export SUBMODEL_ID='' +export PASSPORT_TYPE="transmissionpass" + +source ./functions.sh + +# script global variables +UUID='' +GEARBOX_ID='' + + +# declare an array variable +declare -a gearboxes=("SNJ-4654-76") + +create_submodel_payload () { + + generate_UUID + SUBMODEL_ID=${UUID} + + curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${GEARBOX_ID}_payload.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID} + echo "[TransmissionPass] - Created submodel data with uuid: " ${SUBMODEL_ID} +} + +# create edc assets, policies and contracts for the registry (DTR) +create_registry_asset +create_default_policy +create_default_contractdefinition + + +## now loop through the above array +for gearbox in "${gearboxes[@]}" +do + GEARBOX_ID=$gearbox + echo + echo "++++++++++++++++++ Gearbox ID: " ${GEARBOX_ID} "++++++++++++++++++++++" + echo + create_submodel_payload + create_edc_asset + create_policy + create_contractdefinition + create_aas3_shell ${GEARBOX_ID} ${PASSPORT_TYPE} + echo +done + +# You can access them using echo "${arr[0]}", "${arr[1]}" also + +echo 'Transmission pass test data upload complete...' +echo 'Done' From 2dbe2e0390b1b83b892e8373ad79c5c67ec5b4b5 Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Wed, 8 Nov 2023 15:06:29 +0100 Subject: [PATCH 4/6] chore: rename idShort attribute value to the battery drill down components --- deployment/infrastructure/upload-dpp-data.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/infrastructure/upload-dpp-data.sh b/deployment/infrastructure/upload-dpp-data.sh index 846447dac..d71f7ef66 100644 --- a/deployment/infrastructure/upload-dpp-data.sh +++ b/deployment/infrastructure/upload-dpp-data.sh @@ -251,7 +251,7 @@ create_batteryModule_payload() { "text": "Battery Module Digital Twin" } ], - "idShort": "Battery_'${PASSPORT_ID}'", + "idShort": "BatteryModule_'${PASSPORT_ID}'", "globalAssetId": "'${globalAssetIds[1]}'", "id": "'${AAS_ID}'", "specificAssetIds": [ @@ -424,7 +424,7 @@ create_batteryCell_payload() { "text": "Battery Cell Digital Twin" } ], - "idShort": "Battery_'${PASSPORT_ID}'", + "idShort": "BatteryCell_'${PASSPORT_ID}'", "globalAssetId": "'${globalAssetIds[2]}'", "id": "'${AAS_ID}'", "specificAssetIds": [ From 3065a32a2535ab4b0023dd1193f2370b1f419b3c Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Mon, 20 Nov 2023 12:03:21 +0100 Subject: [PATCH 5/6] chore: refactor scripts to upload and transform testdata to the data provider infrastructure --- .../infrastructure/delete-provider-dtr.sh | 206 ----- deployment/infrastructure/delete-provider.sh | 186 ----- deployment/infrastructure/functions.sh | 580 -------------- .../infrastructure/init-provider-dtr-irs.sh | 157 ---- .../infrastructure/init-provider-dtr.sh | 200 ----- deployment/infrastructure/init-provider.sh | 182 ----- .../{ => testing}/delete-testdata.sh | 0 .../infrastructure/testing/functions.sh | 379 +++++++++ .../testing/testdata/testdata-payload.json | 744 ++++++++++++++++++ .../transform-and-upload.sh} | 39 +- .../infrastructure/testing/upload-testdata.sh | 28 + .../infrastructure/upload-batterypass-data.sh | 83 -- deployment/infrastructure/upload-dpp-data.sh | 627 --------------- deployment/infrastructure/upload-smc-data.sh | 90 --- .../upload-transmissionpass-data.sh | 83 -- 15 files changed, 1171 insertions(+), 2413 deletions(-) delete mode 100644 deployment/infrastructure/delete-provider-dtr.sh delete mode 100644 deployment/infrastructure/delete-provider.sh delete mode 100644 deployment/infrastructure/functions.sh delete mode 100644 deployment/infrastructure/init-provider-dtr-irs.sh delete mode 100644 deployment/infrastructure/init-provider-dtr.sh delete mode 100644 deployment/infrastructure/init-provider.sh rename deployment/infrastructure/{ => testing}/delete-testdata.sh (100%) create mode 100644 deployment/infrastructure/testing/functions.sh create mode 100644 deployment/infrastructure/testing/testdata/testdata-payload.json rename deployment/infrastructure/{upload-testdata.sh => testing/transform-and-upload.sh} (61%) create mode 100644 deployment/infrastructure/testing/upload-testdata.sh delete mode 100644 deployment/infrastructure/upload-batterypass-data.sh delete mode 100644 deployment/infrastructure/upload-dpp-data.sh delete mode 100644 deployment/infrastructure/upload-smc-data.sh delete mode 100644 deployment/infrastructure/upload-transmissionpass-data.sh 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/functions.sh b/deployment/infrastructure/functions.sh deleted file mode 100644 index d5ba509a0..000000000 --- a/deployment/infrastructure/functions.sh +++ /dev/null @@ -1,580 +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 -################################################################################# - -# ./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' - -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} -} - -display_message () { - - echo - echo "++++++++++++++++++ Passport ID: " ${PASSPORT_ID} "++++++++++++++++++++++" - echo -} - -check_status_code () { - if [[ "$HTTP_RESPONSE" -eq 200 ]] ; then - echo "[$HTTP_RESPONSE] - OK" - elif [[ "$HTTP_RESPONSE" -eq 201 ]] ; then - echo "[$HTTP_RESPONSE] - Created" - elif [[ "$HTTP_RESPONSE" -eq 400 ]] ; then - echo "[$HTTP_RESPONSE] - Bad Request" - elif [[ "$HTTP_RESPONSE" -eq 409 ]] ; then - echo "[$HTTP_RESPONSE] - Conflict: the object already exists" - else - echo "[$HTTP_RESPONSE] - Internal Server Error" - fi -} - -create_edc_asset () { - - generate_UUID - ASSET_ID=${UUID} - - PAYLOAD='{ - "@context": {}, - "asset": { - "@type": "Asset", - "@id": "'${ASSET_ID}'", - "properties": { - "description": "'${PASSPORT_TYPE}' test data" - } - }, - "dataAddress": { - "@type": "DataAddress", - "type": "HttpData", - "proxyPath": "true", - "proxyBody": "true", - "proxyMethod": "true", - "proxyQueryParams": "true", - "baseUrl": "'${SUBMODEL_SERVER}'" - } - }' - 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 - echo "[${PASSPORT_TYPE}] - 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 - echo "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" : [{ - "odrl:action": "USE", - "odrl:constraint": { - "odrl:constraint": { - "@type": "LogicalConstraint", - "odrl:or": [ - { - "@type": "Contraint", - "odrl:leftOperand": "BusinessPartnerNumber", - "odrl:operator": "EQ", - "odrl:rightOperand": "'${BPN}'" - } - ] - } - } - }] - } - }' - 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 - echo "policy created with uuid : default-policy" -} - -create_policy () { - - generate_UUID - POLICY_ID=${UUID} - - PAYLOAD='{ - "@context": { - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@type": "PolicyDefinitionRequestDto", - "@id": "'${POLICY_ID}'", - "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" - } - ] - } - } - ] - } - }' - 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 - echo "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 - echo "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 - echo "contract created with id : ${CONTRACT_DEF_ID}" -} - -create_batterypass_aas_payload (){ - - BATTERY_ID=$1 - AAS_ID=$2 - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Battery Passport shell descriptor" - } - ], - "idShort": "Battery_'${BATTERY_ID}'", - "globalAssetId": "'${AAS_ID}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${BATTERY_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "batteryPass", - "id": "'${SUBMODEL_ID}'", - "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" - } - ] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "[BatteryPass] - AAS shell created with uuid : ${AAS_ID}" -} - -create_transmissionpass_aas_payload (){ - - GEARBOX_ID=$1 - AAS_ID=$2 - - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Transmission Passport shell descriptor" - } - ], - "idShort": "Transmission_'${GEARBOX_ID}'", - "globalAssetId": "'${AAS_ID}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${GEARBOX_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "transmissionPass", - "id": "'${SUBMODEL_ID}'", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.transmission.transmission_pass:1.0.0#TransmissionPass" - } - ] - }, - "description": [ - { - "language": "en", - "text": "Transmission Passport Submodel" - } - ] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "AAS shell created with uuid : ${AAS_ID}" -} - -create_smc_aas_payload (){ - - MATERIAL_ID=$1 - AAS_ID=$2 - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Secondary Material Content" - } - ], - "idShort": "SMC_'${MATERIAL_ID}'", - "globalAssetId": "'${AAS_ID}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "orderNumber", - "value": "'${MATERIAL_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "BPNL00000003AYRE" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "BPNL00000003AYRE" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${SERIAL_PART_ASPECT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SerialPart", - "id": "'${SERIAL_PART_ASPECT_ID}'", - "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": "'${PROVIDER_EDC}'/api/public/data/'${SUBMODEL_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "secondaryMaterialContent", - "id": "'${SUBMODEL_ID}'", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:samm:io.catenax.secondary_material_content:1.0.0#SecondaryMaterialContent" - } - ] - }, - "description": [], - "displayName": [] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -s -H 'Content-Type: application/json' --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "[SecondaryMaterialContent] - AAS shell created with uuid : ${AAS_ID}" - -} - - -create_aas3_shell () { - - PASSPORT_ID=$1 - PASSPORT_TYPE=$2 - generate_UUID - AAS_ID=${UUID} - - if [[ $PASSPORT_TYPE = "batterypass" ]] ; then - create_batterypass_aas_payload ${PASSPORT_ID} ${AAS_ID} - elif [[ $PASSPORT_TYPE = "transmissionpass" ]] ; then - create_transmissionpass_aas_payload ${PASSPORT_ID} ${AAS_ID} - elif [[ $PASSPORT_TYPE = "secondarymaterialcontent" ]] ; then - create_smc_aas_payload ${PASSPORT_ID} ${AAS_ID} - fi; - -} 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/delete-testdata.sh b/deployment/infrastructure/testing/delete-testdata.sh similarity index 100% rename from deployment/infrastructure/delete-testdata.sh rename to deployment/infrastructure/testing/delete-testdata.sh diff --git a/deployment/infrastructure/testing/functions.sh b/deployment/infrastructure/testing/functions.sh new file mode 100644 index 000000000..1d8a8fd0e --- /dev/null +++ b/deployment/infrastructure/testing/functions.sh @@ -0,0 +1,379 @@ +#!/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' --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 (){ + + declare -a arraySubmodels=() + submodels=$1 + type=$2 + noOfSubmodels=$(echo ${submodels} | jq -r '. | length') + # # -- for testing purposes + # generate_UUID + # ASSET_ID=${UUID} + + 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 "-b, BPN number" + echo "-f, input JSON file containing AAS shells configuration and submodel data" exit 1 esac done @@ -51,30 +51,31 @@ export SUBMODEL_SERVER=${submodel_server} export PROVIDER_EDC=${edc} export REGISTRY_URL=${registry} export API_KEY=${api_key} -export BPN=${bpn} export REGISTRY_ASSET_ID='registry-asset' -export MANUFACTURER_PART_ID='XYZ78901' +export SUBMODEL_ID='' -echo "****************Start upload battery test data*************" -./upload-batterypass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} -echo "*****************End upload battery test data**************" -echo +source ./functions.sh -echo "****************Start upload dpp test data****************" -./upload-dpp-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} -echo "***************End upload dpp test data*******************" +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 -echo "****************Start upload Secondary Material Content SMC test data****************" -./upload-smc-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} -echo "***************End upload Secondary Material Content SMC test data*******************" -echo +POLICY=$(jq '.policies' "${datapath}") -echo "****************Start upload transmission pass test data****************" -./upload-transmissionpass-data.sh ${submodel_server} ${edc} ${registry} ${api_key} ${bpn} -echo "***************End upload transmission pass test data*******************" +# 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-batterypass-data.sh b/deployment/infrastructure/upload-batterypass-data.sh deleted file mode 100644 index afefe1499..000000000 --- a/deployment/infrastructure/upload-batterypass-data.sh +++ /dev/null @@ -1,83 +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 - -# script parameters -export SUBMODEL_SERVER=$1 -export PROVIDER_EDC=$2 -export REGISTRY_URL=$3 -export API_KEY=$4 -export BPN=$5 -export REGISTRY_ASSET_ID='registry-asset' -export MANUFACTURER_PART_ID='XYZ78901' -export SUBMODEL_ID='' -export PASSPORT_TYPE="batterypass" - -source ./functions.sh - -# script global variables -UUID='' -BATTERY_ID='' - - -# declare an array variable -declare -a batteries=("IMR18650V1" "NCR186850B" "X123456789012X12345678901234566" "Y792927456954B81677903848654570") - -create_submodel_payload () { - - generate_UUID - SUBMODEL_ID=${UUID} - - HTTP_RESPONSE==$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${BATTERY_ID}.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID}) - echo "[BatteryPass] - Created submodel data with uuid: " ${SUBMODEL_ID} -} - -# create edc assets, policies and contracts for the registry (DTR) -create_registry_asset -create_default_policy -create_default_contractdefinition - - -## now loop through the above array -for battery in "${batteries[@]}" -do - BATTERY_ID=$battery - echo - echo "++++++++++++++++++ Battery ID: " ${BATTERY_ID} "++++++++++++++++++++++" - echo - create_submodel_payload - create_edc_asset - create_policy - create_contractdefinition - create_aas3_shell ${BATTERY_ID} ${PASSPORT_TYPE} - echo -done - -# You can access them using echo "${arr[0]}", "${arr[1]}" also - -echo 'Battery test data upload complete...' -echo 'Done' diff --git a/deployment/infrastructure/upload-dpp-data.sh b/deployment/infrastructure/upload-dpp-data.sh deleted file mode 100644 index d71f7ef66..000000000 --- a/deployment/infrastructure/upload-dpp-data.sh +++ /dev/null @@ -1,627 +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 - -# script parameters -export SUBMODEL_SERVER=$1 -export PROVIDER_EDC=$2 -export REGISTRY_URL=$3 -export API_KEY=$4 -export BPN=$5 -export REGISTRY_ASSET_ID='registry-asset' -export MANUFACTURER_PART_ID='XYZ78901' -export SUBMODEL_ID='' -export PASSPORT_TYPE="dpp" - -source ./functions.sh - -# script global variables -UUID='' -PASSPORT_ID='' -BAT_ASPECT_ID='' -BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID='' -BAT_MODULE_ID='' -BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID='' -BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID='' -BAT_CELL_ASPECT_ID='' -BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID='' -BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID='' - -# declare an array variable -declare -a passports=("BAT-XYZ789" "EVMODULE-TRJ712" "CTA-13123") -# decare fixed uuids for the reltionships -declare -a globalAssetIds=("urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d" "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552" "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1") - -display_message () { - - echo - echo "++++++++++++++++++ Passport ID: " ${PASSPORT_ID} "++++++++++++++++++++++" - echo -} - -generate_submodel_id () { - - generate_UUID - BAT_ASPECT_ID=${UUID} # digital product pass aspect - generate_UUID - BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} - - generate_UUID - BAT_MODULE_ID=${UUID} # digital product pass aspect - generate_UUID - BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} - generate_UUID - BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID=${UUID} - - generate_UUID - BAT_CELL_ASPECT_ID=${UUID} # digital product pass aspect - generate_UUID - BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID=${UUID} - generate_UUID - BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID=${UUID} -} - -create_submodel_payload () { - - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[0]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_ASPECT_ID}) - check_status_code - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[0]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}) - check_status_code - - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_ID}) - check_status_code - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}) - check_status_code - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelUsageAsBuilt-${passports[1]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}) - check_status_code - - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_ASPECT_ID}) - check_status_code - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelBomAsBuilt-${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}) - check_status_code - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/singleLevelUsageAsBuilt-${passports[2]}.json" -o /dev/null -w "%{http_code}\n" $SUBMODEL_SERVER/data/${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}) - check_status_code - - echo "[DPP] - Submodel data upload complete" -} - -create_battery_payload() { - - display_message - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Battery Digital Twin" - } - ], - "idShort": "Battery_'${PASSPORT_ID}'", - "globalAssetId": "'${globalAssetIds[0]}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${PASSPORT_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_ASPECT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "'${BAT_ASPECT_ID}'", - "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" - } - ] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "'${BAT_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "semanticId": { - "type": "ExternalReference", - "keys": [ - { - "type": "Submodel", - "value": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" - } - ] - }, - "description": [], - "displayName": [] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "Battery digital twin created with uuid : ${AAS_ID}" - -} - -create_batteryModule_payload() { - - display_message - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Battery Module Digital Twin" - } - ], - "idShort": "BatteryModule_'${PASSPORT_ID}'", - "globalAssetId": "'${globalAssetIds[1]}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${PASSPORT_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "'${BAT_MODULE_ID}'", - "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" - } - ] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "'${BAT_MODULE_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "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": "'${PROVIDER_EDC}'/api/public/data/'${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SingleLevelUsageAsBuilt", - "id": "'${BAT_MODULE_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", - "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": [] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "Battery module digital twin created with uuid : ${AAS_ID}" -} - -create_batteryCell_payload() { - - display_message - PAYLOAD='{ - "description": [ - { - "language": "en", - "text": "Battery Cell Digital Twin" - } - ], - "idShort": "BatteryCell_'${PASSPORT_ID}'", - "globalAssetId": "'${globalAssetIds[2]}'", - "id": "'${AAS_ID}'", - "specificAssetIds": [ - { - "name": "partInstanceId", - "value": "'${PASSPORT_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - } - ] - } - }, - { - "name": "manufacturerPartId", - "value": "'${MANUFACTURER_PART_ID}'", - "externalSubjectId": { - "type": "ExternalReference", - "keys": [ - { - "type": "GlobalReference", - "value": "'${BPN}'" - }, - { - "type": "GlobalReference", - "value": "PUBLIC_READABLE" - } - ] - } - } - ], - "submodelDescriptors": [ - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_ASPECT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "digitalProductPass", - "id": "'${BAT_CELL_ASPECT_ID}'", - "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" - } - ] - }, - { - "endpoints": [ - { - "interface": "SUBMODEL-3.0", - "protocolInformation": { - "href": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "singleLevelBomAsBuilt", - "id": "'${BAT_CELL_SINGLE_LEVEL_BOM_AS_BUILT_ID}'", - "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": "'${PROVIDER_EDC}'/api/public/data/'${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", - "endpointProtocol": "HTTP", - "endpointProtocolVersion": [ - "1.1" - ], - "subprotocol": "DSP", - "subprotocolBody": "id='${ASSET_ID}';dspEndpoint='${PROVIDER_EDC}'", - "subprotocolBodyEncoding": "plain", - "securityAttributes": [ - { - "type": "NONE", - "key": "NONE", - "value": "NONE" - } - ] - } - } - ], - "idShort": "SingleLevelUsageAsBuilt", - "id": "'${BAT_CELL_SINGLE_LEVEL_USAGE_AS_BUILT_ID}'", - "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": [] - } - ] - }' - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' -s --data "${PAYLOAD}" -o /dev/null -w "%{http_code}\n" $REGISTRY_URL/shell-descriptors) - check_status_code - echo "Battery cell digital twin created with uuid : ${AAS_ID}" -} - -create_aas3_shell () { - - # create and register battery digital twin - generate_UUID - AAS_ID=${UUID} - PASSPORT_ID=${passports[0]} - create_battery_payload - - # create and register battery module digital twin - generate_UUID - AAS_ID=${UUID} - PASSPORT_ID=${passports[1]} - create_batteryModule_payload - - # create and register battery cell digital twin - generate_UUID - AAS_ID=${UUID} - PASSPORT_ID=${passports[2]} - create_batteryCell_payload -} - -# generate submodel uuids to be used in digital twin aspect models and to create submodel payloads -generate_submodel_id - -# create edc assets, policies and contracts for the registry (DTR) -create_registry_asset -create_default_policy -create_default_contractdefinition - -#create dpp asset, policy and contract -create_edc_asset -create_policy -create_contractdefinition -create_aas3_shell -create_submodel_payload - -echo 'DPP test data upload complete...' -echo 'Done' diff --git a/deployment/infrastructure/upload-smc-data.sh b/deployment/infrastructure/upload-smc-data.sh deleted file mode 100644 index 77296700f..000000000 --- a/deployment/infrastructure/upload-smc-data.sh +++ /dev/null @@ -1,90 +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 - -# script parameters -export SUBMODEL_SERVER=$1 -export PROVIDER_EDC=$2 -export REGISTRY_URL=$3 -export API_KEY=$4 -export BPN=$5 -export REGISTRY_ASSET_ID='registry-asset' -export MANUFACTURER_PART_ID='XYZ78901' -export SUBMODEL_ID='' -export SERIAL_PART_ASPECT_ID='' -export PASSPORT_TYPE="secondarymaterialcontent" - -source ./functions.sh - -# script global variables -UUID='' -MATERIAL_ID='' - - -# declare an array variable -declare -a smc_orders=("KLZ-90-8564-96") - -create_submodel_payload () { - - generate_UUID - SUBMODEL_ID=${UUID} - echo "Create sample data for SMC KLZ-90-8564-96..." - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' --data "@testing/testdata/smc/smc_manual_payload.json" ${SUBMODEL_SERVER}/data/${SUBMODEL_ID}) - check_status_code - - generate_UUID - SERIAL_PART_ASPECT_ID=${UUID} - echo "Create BomAsBuilt sample data of SMC serialized part..." - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' --data "@testing/testdata/smc/smc_payload_partAsPlanned.json" ${SUBMODEL_SERVER}/data/${SERIAL_PART_ASPECT_ID}) - check_status_code - - echo "[SecondaryMaterialContent] - Created submodel data" -} - -# create edc assets, policies and contracts for the registry (DTR) -create_registry_asset -create_default_policy -create_default_contractdefinition - - -## loop through the above array -for item in "${smc_orders[@]}" -do - ORDER_ID=$item - echo - echo "++++++++++++++++++ SMC Order ID: " ${ORDER_ID} "++++++++++++++++++++++" - echo - create_submodel_payload - create_edc_asset - create_policy - create_contractdefinition - create_aas3_shell ${ORDER_ID} ${PASSPORT_TYPE} - echo -done - -echo 'Secondary Material Content SMC test data upload complete...' -echo 'Done' diff --git a/deployment/infrastructure/upload-transmissionpass-data.sh b/deployment/infrastructure/upload-transmissionpass-data.sh deleted file mode 100644 index 49f8ae832..000000000 --- a/deployment/infrastructure/upload-transmissionpass-data.sh +++ /dev/null @@ -1,83 +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 - -# script parameters -export SUBMODEL_SERVER=$1 -export PROVIDER_EDC=$2 -export REGISTRY_URL=$3 -export API_KEY=$4 -export BPN=$5 -export REGISTRY_ASSET_ID='registry-asset' -export MANUFACTURER_PART_ID='XYZ78901' -export SUBMODEL_ID='' -export PASSPORT_TYPE="transmissionpass" - -source ./functions.sh - -# script global variables -UUID='' -GEARBOX_ID='' - - -# declare an array variable -declare -a gearboxes=("SNJ-4654-76") - -create_submodel_payload () { - - generate_UUID - SUBMODEL_ID=${UUID} - - curl -X POST -H 'Content-Type: application/json' -s --data "@testing/testdata/dpp/${GEARBOX_ID}_payload.json" $SUBMODEL_SERVER/data/${SUBMODEL_ID} - echo "[TransmissionPass] - Created submodel data with uuid: " ${SUBMODEL_ID} -} - -# create edc assets, policies and contracts for the registry (DTR) -create_registry_asset -create_default_policy -create_default_contractdefinition - - -## now loop through the above array -for gearbox in "${gearboxes[@]}" -do - GEARBOX_ID=$gearbox - echo - echo "++++++++++++++++++ Gearbox ID: " ${GEARBOX_ID} "++++++++++++++++++++++" - echo - create_submodel_payload - create_edc_asset - create_policy - create_contractdefinition - create_aas3_shell ${GEARBOX_ID} ${PASSPORT_TYPE} - echo -done - -# You can access them using echo "${arr[0]}", "${arr[1]}" also - -echo 'Transmission pass test data upload complete...' -echo 'Done' From a95fa3a99b52189492a875358ff20e28e39c7604 Mon Sep 17 00:00:00 2001 From: Muhammad Saud Khan Date: Mon, 20 Nov 2023 18:06:34 +0100 Subject: [PATCH 6/6] chore: fix issues and update readme --- deployment/infrastructure/README.md | 40 +- .../infrastructure/testing/functions.sh | 12 +- .../testing/testdata/testdata-payload.json | 1609 ++++++++++++++++- 3 files changed, 1600 insertions(+), 61 deletions(-) diff --git a/deployment/infrastructure/README.md b/deployment/infrastructure/README.md index 2681ea08d..6864c69e1 100644 --- a/deployment/infrastructure/README.md +++ b/deployment/infrastructure/README.md @@ -23,48 +23,24 @@ # Test data Uploader ## TL;DR -Use the following script to upload test data to the provider edc and registry: +- 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 -s -e -a -k -b +./upload-testdata.sh ``` #### Script Parameters: | Parameter | Description | Example value | Required/Optionl | | :---: | :--- | :--- | :---: | -| -s | Submodel server URL | https://materialpass.int.demo.catena-x.net/provider_backend | Required | -| -e | Provider control plane URL | https://materialpass.int.demo.catena-x.net/BPNL000000000000 | Required | -| -a | AAS registry URL | https://materialpass.int.demo.catena-x.net/semantics/registry/api/v3.0 | Required | +| -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 | -| -b | BPN number | BPNL00000000CBA5 | Required | +| -f | input JSON testdata file | ./testdata/testdata-payload.json | Required | | | | | | -Use the following script to upload specific test data file - -### Digital Product Pass (DPP) - -```bash -./upload-dpp-data.sh -``` - -### Battery Pass - -```bash -./upload-batterypass-data.sh -``` - -### Transmission Pass - -```bash -./upload-transmissionpass-data.sh -``` - -### Secondary Material Content (SMC) - -```bash -./upload-smc-data.sh -``` - ### Delete test data Use the following script to remove all test data from the provider edc and registry: diff --git a/deployment/infrastructure/testing/functions.sh b/deployment/infrastructure/testing/functions.sh index 1d8a8fd0e..f3cecaa12 100644 --- a/deployment/infrastructure/testing/functions.sh +++ b/deployment/infrastructure/testing/functions.sh @@ -180,26 +180,22 @@ create_contractdefinition () { } }' - HTTP_RESPONSE=$(curl -X POST -H 'Content-Type: application/json' --data "${payload}" --header 'X-Api-Key: '${API_KEY} -o /dev/null -w "%{http_code}\n" ${PROVIDER_EDC}/management/v2/contractdefinitions) + 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 (){ - declare -a arraySubmodels=() submodels=$1 type=$2 noOfSubmodels=$(echo ${submodels} | jq -r '. | length') - # # -- for testing purposes - # generate_UUID - # ASSET_ID=${UUID} - + 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}) @@ -330,7 +326,7 @@ create_aas3_shell (){ local globalAssetId=$(echo ${shell} | jq -r ".catenaXId") local type=$(echo ${shell} | jq -r ".type") local shellDescription=$(echo ${shell} | jq -r ".description") - + create_submodel_payload "${submodels}" "${type}" submodelDescriptors=$ARRAY_SUBMODELS generate_UUID diff --git a/deployment/infrastructure/testing/testdata/testdata-payload.json b/deployment/infrastructure/testing/testdata/testdata-payload.json index 4c8abf409..a8e246432 100644 --- a/deployment/infrastructure/testing/testdata/testdata-payload.json +++ b/deployment/infrastructure/testing/testdata/testdata-payload.json @@ -29,22 +29,17 @@ }, "shells": [ { - "catenaXId": "urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d", + "catenaXId": "urn:uuid:541ec5a5-9215-12f4-0803-94f456c947df", "specificAssetIds": [ { "name": "partInstanceId", - "value": "IMR1231", + "value": "IMR18650V1", "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] }, { "name": "manufacturerPartId", - "value": "XYW1231", - "allowedBpns": ["bpn1", "BPNL00000000CBA5", "BPNL00000003CRHL"] - }, - { - "name": "manufacturerId", - "value": "123", - "allowedBpns": ["BPNL00000003CRHL", "BPNL00000000CBA5"] + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] } ], "type": "Battery", @@ -56,7 +51,7 @@ ], "submodels": [ { - "name": "batterypass", + "name": "batteryPass", "data": { "electrochemicalProperties": { "ratedCapacity": 94, @@ -346,17 +341,1589 @@ ] }, { - "catenaXId": "urn:uuid:95f1ddf0-f795-dc9c-6440-13af29059907", + "catenaXId": "urn:uuid:95e3140c-be01-ba3b-b60d-f0a4d42b4b9a", "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "NCR186850B", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, { "name": "manufacturerPartId", "value": "XYZ78901", - "allowedBpns": ["bpn1", "bpn2", "BPNL00000003CRHL", "BPNL00000000CBA5"] - }, + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "Battery", + "description": [ + { + "language": "en", + "text": "Battery Passport shell descriptor" + } + ], + "submodels": [ + { + "name": "batteryPass", + "data": { + "electrochemicalProperties": { + "ratedCapacity": 56, + "batteryEnergy": { + "energyRoundtripEfficiencyChange": 45, + "maximumAllowedBatteryEnergy": 75000.0, + "energyRoundtripEfficiency": 80 + }, + "ratioMaximumAllowedBatteryPowerAndMaximumAllowedBatteryEnergy": 0.666, + "batteryVoltage": { + "nominalVoltage": 3.6, + "maxVoltage": 4.2, + "minVoltage": 2.5 + }, + "internalResistance": { + "cellinternalResistance": 3.0, + "packinternalResistanceIncrease": 2, + "packinternalResistance": 80 + }, + "capacityThresholdExhaustion": 23, + "batteryPower": { + "powerFade": 23, + "originalPowerCapability": -1.7976931348623157e308, + "originalPowerCapabilityLimits": -1.7976931348623157e308, + "maximumAllowedBatteryPower": -1.7976931348623157e308, + "powerCapabilityAt20Charge": -1.7976931348623157e308, + "powerCapabilityAt80Charge": -1.7976931348623157e308 + }, + "capacityFade": 2.0 + }, + "document": { + "responsibleSourcing": [ + { + "title": "Sustainability Report 2021", + "fileLocation": "telnet://192.0.2.16:80/" + } + ], + "packagingInstructions": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "telnet://192.0.2.16:80/" + } + ], + "transportationInstructions": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1808.txt" + } + ], + "vehicleDismantlingProcedure": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "http://www.ietf.org/rfc/rfc2396.txt" + } + ], + "testReportsResults": [ + { + "title": "Certificates of Testing battery", + "fileLocation": "" + } + ], + "batteryDismantlingProcedure": [ + { + "title": "Certificates of Testing battery", + "fileLocation": "http://www.wikipedia.org" + } + ], + "safetyMeasures": [ + { + "title": "Battery user safety precautions", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1808.txt" + } + ], + "declarationOfConformity": [ + { + "title": "Declaration of Conformity No. 2", + "fileLocation": "" + } + ] + }, + "datePlacedOnMarket": "27.03.2022", + "cellChemistry": { + "electrolyteComposition": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "LiPF6" + } + ], + "anodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Styren butadien" + } + ], + "recyclateContentActiveMaterials": [ + { + "materialPercentageMassFraction": 4, + "materialWeight": null, + "materialName": "Ni/2022/PlantC" + }, + { + "materialPercentageMassFraction": 5, + "materialWeight": null, + "materialName": "Li/2021/PlantC" + }, + { + "materialPercentageMassFraction": 0, + "materialWeight": null, + "materialName": "Pb(battery model does not contain Pb)" + }, + { + "materialPercentageMassFraction": 15, + "materialWeight": null, + "materialName": "Co/2021/PlantC" + } + ], + "anodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "SiO2-C" + } + ], + "cathodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "NCA (Lithium nickel cobalt aluminum oxide)" + } + ], + "cathodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "carbon black" + } + ] + }, + "physicalDimensions": { + "length": 1800, + "width": 1000, + "weight": 2000, + "diameter": null, + "height": 150 + }, + "temperatureRangeIdleState": { + "temperatureRangeIdleStateUpperLimit": 40, + "temperatureRangeIdleStateLowerLimit": -20 + }, + "batteryCycleLife": { + "cycleLifeTestCRate": 2, + "cycleLifeTestDepthOfDischarge": 1.5, + "expectedLifetime": 3000 + }, + "manufacturer": { + "name": "Company C", + "contact": { + "faxNumber": "+49 89 0987654323", + "website": "http://www.CompanyC.com", + "phoneNumber": "+49 89 1234567892", + "email": "companyC@company.com" + }, + "address": { + "locality": { + "value": "CityC", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250A", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetA", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "", + "technicalKey": "CEDEX" + }, + "postalDeliveryPoint": { + "value": "Tor 1", + "technicalKey": "intERURBAN_DELIVERY_POint" + } + } + }, + "warrantyPeriod": "120", + "composition": { + "compositionOfBattery": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Co -hazardous, Current collector: Aluminum, LiPF6 - ( conducting lithium salt - toxic, in combination with moisture nad elevated temp. Decompose to HF) . Casing: iron, aluminum laminated plastic" + } + ], + "criticalRawMaterials": "Lithium, Cobalt, Natural graphite", + "components": { + "componentsPartNumber": "Casing Tray: Model C", + "componentsSupplier": [ + { + "componentsSupplierName": "XY Corporation", + "address": { + "locality": { + "value": "CityD", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250B", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetD", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "PlantD", + "technicalKey": "BUILDING" + }, + "postalDeliveryPoint": { + "value": "GateD", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + }, + "contact": { + "faxNumber": "+49 89 0987654322", + "website": "https://www.companyD.com", + "phoneNumber": "+49 89 1234567890", + "email": "companyD@company.com" + } + } + ] + } + }, + "manufacturing": { + "dateOfManufacturing": "2022-01-24", + "address": { + "locality": { + "value": "CityC", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250A", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetC", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "PlantC", + "technicalKey": "BUILDING" + }, + "postalDeliveryPoint": { + "value": "GateC", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + } + }, + "batteryIdentification": { + "batteryType": "NCA", + "batteryIDDMCCode": "NCR186850B", + "batteryModel": "Li-ion S-model" + }, + "stateOfBattery": { + "stateOfHealth": 50, + "statusBattery": "first life/ waste/ repaired/ repurposed/ recycled", + "stateOfCharge": 33 + }, + "cO2FootprintTotal": 124.0 + }, + "description": "Battery Passport Submodel", + "semanticId": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" + } + ] + }, + { + "catenaXId": "urn:uuid:acabbb94-2073-c949-fae3-0abe7e952c33", + "specificAssetIds": [ { "name": "partInstanceId", - "value": "KLZ-90-8564-96", - "allowedBpns": ["bpn3", "bpn4", "BPNL00000003CRHL", "BPNL00000000CBA5"] + "value": "X123456789012X12345678901234566", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "Battery", + "description": [ + { + "language": "en", + "text": "Battery Passport shell descriptor" + } + ], + "submodels": [ + { + "name": "batteryPass", + "data": { + "electrochemicalProperties": { + "ratedCapacity": 56, + "batteryEnergy": { + "energyRoundtripEfficiencyChange": 45, + "maximumAllowedBatteryEnergy": 75000.0, + "energyRoundtripEfficiency": 80 + }, + "ratioMaximumAllowedBatteryPowerAndMaximumAllowedBatteryEnergy": 0.666, + "batteryVoltage": { + "nominalVoltage": 3.6, + "maxVoltage": 4.2, + "minVoltage": 2.5 + }, + "internalResistance": { + "cellinternalResistance": 3.0, + "packinternalResistanceIncrease": 2, + "packinternalResistance": 80 + }, + "capacityThresholdExhaustion": 23, + "batteryPower": { + "powerFade": 23, + "originalPowerCapability": -1.7976931348623157e308, + "originalPowerCapabilityLimits": -1.7976931348623157e308, + "maximumAllowedBatteryPower": -1.7976931348623157e308, + "powerCapabilityAt20Charge": -1.7976931348623157e308, + "powerCapabilityAt80Charge": -1.7976931348623157e308 + }, + "capacityFade": 2.0 + }, + "document": { + "responsibleSourcing": [ + { + "title": "Sustainability Report 2021", + "fileLocation": "telnet://192.0.2.16:80/" + } + ], + "packagingInstructions": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "telnet://192.0.2.16:80/" + } + ], + "transportationInstructions": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1808.txt" + } + ], + "vehicleDismantlingProcedure": [ + { + "title": "Packaging and transport Instruction", + "fileLocation": "http://www.ietf.org/rfc/rfc2396.txt" + } + ], + "testReportsResults": [ + { + "title": "Certificates of Testing battery", + "fileLocation": "" + } + ], + "batteryDismantlingProcedure": [ + { + "title": "Certificates of Testing battery", + "fileLocation": "http://www.wikipedia.org" + } + ], + "safetyMeasures": [ + { + "title": "Battery user safety precautions", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1808.txt" + } + ], + "declarationOfConformity": [ + { + "title": "Declaration of Conformity No. 2", + "fileLocation": "" + } + ] + }, + "datePlacedOnMarket": "27.03.2022", + "cellChemistry": { + "electrolyteComposition": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "LiPF6" + } + ], + "anodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Styren butadien" + } + ], + "recyclateContentActiveMaterials": [ + { + "materialPercentageMassFraction": 4, + "materialWeight": null, + "materialName": "Ni/2022/PlantC" + }, + { + "materialPercentageMassFraction": 5, + "materialWeight": null, + "materialName": "Li/2021/PlantC" + }, + { + "materialPercentageMassFraction": 0, + "materialWeight": null, + "materialName": "Pb(battery model does not contain Pb)" + }, + { + "materialPercentageMassFraction": 15, + "materialWeight": null, + "materialName": "Co/2021/PlantC" + } + ], + "anodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "SiO2-C" + } + ], + "cathodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "NCA (Lithium nickel cobalt aluminum oxide)" + } + ], + "cathodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "carbon black" + } + ] + }, + "physicalDimensions": { + "length": 1800, + "width": 1000, + "weight": 2000, + "diameter": null, + "height": 150 + }, + "temperatureRangeIdleState": { + "temperatureRangeIdleStateUpperLimit": 40, + "temperatureRangeIdleStateLowerLimit": -20 + }, + "batteryCycleLife": { + "cycleLifeTestCRate": 2, + "cycleLifeTestDepthOfDischarge": 1.5, + "expectedLifetime": 3000 + }, + "manufacturer": { + "name": "Company C", + "contact": { + "faxNumber": "+49 89 0987654323", + "website": "http://www.CompanyC.com", + "phoneNumber": "+49 89 1234567892", + "email": "companyC@company.com" + }, + "address": { + "locality": { + "value": "CityC", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250A", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetA", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "", + "technicalKey": "CEDEX" + }, + "postalDeliveryPoint": { + "value": "Tor 1", + "technicalKey": "intERURBAN_DELIVERY_POint" + } + } + }, + "warrantyPeriod": "120", + "composition": { + "compositionOfBattery": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Co -hazardous, Current collector: Aluminum, LiPF6 - ( conducting lithium salt - toxic, in combination with moisture nad elevated temp. Decompose to HF) . Casing: iron, aluminum laminated plastic" + } + ], + "criticalRawMaterials": "Lithium, Cobalt, Natural graphite", + "components": { + "componentsPartNumber": "Casing Tray: Model C", + "componentsSupplier": [ + { + "componentsSupplierName": "XY Corporation", + "address": { + "locality": { + "value": "CityD", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250B", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetD", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "PlantD", + "technicalKey": "BUILDING" + }, + "postalDeliveryPoint": { + "value": "GateD", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + }, + "contact": { + "faxNumber": "+49 89 0987654322", + "website": "https://www.companyD.com", + "phoneNumber": "+49 89 1234567890", + "email": "companyD@company.com" + } + } + ] + } + }, + "manufacturing": { + "dateOfManufacturing": "2022-01-24", + "address": { + "locality": { + "value": "CityC", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250A", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetC", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "PlantC", + "technicalKey": "BUILDING" + }, + "postalDeliveryPoint": { + "value": "GateC", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + } + }, + "batteryIdentification": { + "batteryType": "NCA", + "batteryIDDMCCode": "X123456789012X12345678901234566", + "batteryModel": "Li-ion S-model" + }, + "stateOfBattery": { + "stateOfHealth": 50, + "statusBattery": "first life/ waste/ repaired/ repurposed/ recycled", + "stateOfCharge": 33 + }, + "cO2FootprintTotal": 124.0 + }, + "description": "Battery Passport Submodel", + "semanticId": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" + } + ] + }, + { + "catenaXId": "urn:uuid:d3c93fc6-4548-84d7-d1ff-033aa505231f", + "specificAssetIds": [ + { + "name": "partInstanceId", + "value": "Y792927456954B81677903848654570", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "Battery", + "description": [ + { + "language": "en", + "text": "Battery Passport shell descriptor" + } + ], + "submodels": [ + { + "name": "batteryPass", + "data": { + "electrochemicalProperties": { + "ratedCapacity": "103", + "batteryEnergy": { + "energyRoundtripEfficiencyChange": "0.2", + "maximumAllowedBatteryEnergy": "105", + "energyRoundtripEfficiency": "86" + }, + "ratioMaximumAllowedBatteryPowerAndMaximumAllowedBatteryEnergy": "5", + "batteryVoltage": { + "nominalVoltage": "376.4", + "maxVoltage": "438.6", + "minVoltage": "285.6" + }, + "internalResistance": { + "cellinternalResistance": "45", + "packinternalResistanceIncrease": "1.3", + "packinternalResistance": "3" + }, + "capacityThresholdExhaustion": "3", + "batteryPower": { + "powerFade": "0.3", + "originalPowerCapability": "395", + "originalPowerCapabilityLimits": "320", + "maximumAllowedBatteryPower": "420", + "powerCapabilityAt20Charge": "78", + "powerCapabilityAt80Charge": "97" + }, + "capacityFade": "1.43" + }, + "document": { + "responsibleSourcing": [ + { + "title": "Responsible sourcing report 2023", + "fileLocation": "telnet://192.0.2.16:84/" + } + ], + "packagingInstructions": [ + { + "title": "Packaging instruction for HVB B", + "fileLocation": "telnet://192.0.2.16:11/" + } + ], + "transportationInstructions": [ + { + "title": "Shipping guidelines", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1808.txt" + } + ], + "vehicleDismantlingProcedure": [ + { + "title": "Dismantling procedure of HVB B from vehicle", + "fileLocation": "http://www.ietf.org/rfc/rfc2396.txt" + } + ], + "testReportsResults": [ + { + "title": "Laboratory test results HVB B", + "fileLocation": "telnet://192.0.2.16:81/" + } + ], + "batteryDismantlingProcedure": [ + { + "title": "Dismantling procedure of HVB B", + "fileLocation": "http://www.ietf.org/rfc/rfc2390.txt" + } + ], + "safetyMeasures": [ + { + "title": "HVB B safety document", + "fileLocation": "ftp://ftp.is.co.za/rfc/rfc1819.txt " + } + ], + "declarationOfConformity": [ + { + "title": "Declaration of conformity 3", + "fileLocation": "telnet://192.0.2.16:94/" + } + ] + }, + "cellChemistry": { + "electrolyteComposition": [ + { + "materialName": "electrolyte", + "materialWeight": 138.7, + "materialPercentageMassFraction": 23.3 + }, + { + "materialName": "others", + "materialWeight": 450.46, + "materialPercentageMassFraction": 56.2 + }, + { + "materialName": "methylpropiophenon", + "materialWeight": 444.03, + "materialPercentageMassFraction": 20.5 + } + ], + "anodeCompositionOther": [ + { + "materialName": "glass fibers", + "materialWeight": 122.98, + "materialPercentageMassFraction": 43.2 + }, + { + "materialName": "ferrum", + "materialWeight": 490.74, + "materialPercentageMassFraction": 19.7 + }, + { + "materialName": "aluminium", + "materialWeight": 261.17, + "materialPercentageMassFraction": 28.9 + }, + { + "materialName": "isolation material", + "materialWeight": 141.68, + "materialPercentageMassFraction": 8.2 + } + ], + "recyclateContentActiveMaterials": [ + { + "materialName": "lithium cobalt oxide", + "materialWeight": 145.49, + "materialPercentageMassFraction": 75.5 + }, + { + "materialName": "manganese", + "materialWeight": 111.98, + "materialPercentageMassFraction": 24.5 + } + ], + "anodeActiveMaterials": [ + { + "materialName": "graphite", + "materialWeight": 239.55, + "materialPercentageMassFraction": 0.6 + }, + { + "materialName": "copper foil", + "materialWeight": 492.93, + "materialPercentageMassFraction": 99.4 + } + ], + "cathodeActiveMaterials": [ + { + "materialName": "lithium cobalt oxide", + "materialWeight": 101.12, + "materialPercentageMassFraction": 15.9 + }, + { + "materialName": "lithium nickel manganese cobalt oxide", + "materialWeight": 337.73, + "materialPercentageMassFraction": 12.3 + }, + { + "materialName": "lithium nickel cobalt aluminium oxide", + "materialWeight": 437.02, + "materialPercentageMassFraction": 71.9 + } + ], + "cathodeCompositionOther": [ + { + "materialName": "aluminium", + "materialWeight": 326.06, + "materialPercentageMassFraction": 13 + }, + { + "materialName": "beryllium", + "materialWeight": 441.63, + "materialPercentageMassFraction": 5.5 + }, + { + "materialName": "styrene butadiene copolymer", + "materialWeight": 207.5, + "materialPercentageMassFraction": 47.8 + }, + { + "materialName": "cobalt nickel manganese", + "materialWeight": 471.56, + "materialPercentageMassFraction": 33.7 + } + ] + }, + "physicalDimensions": { + "length": "2573", + "width": "1740", + "weight": "684.2", + "diameter": "50", + "height": "280" + }, + "temperatureRangeIdleState": { + "temperatureRangeIdleStateUpperLimit": "45", + "temperatureRangeIdleStateLowerLimit": "-22" + }, + "batteryCycleLife": { + "cycleLifeTestCRate": "2", + "cycleLifeTestDepthOfDischarge": "43", + "expectedLifetime": "600" + }, + "manufacturer": { + "name": "BMW Group", + "contact": { + "faxNumber": "N/A", + "website": "https://www.bmwgroup.com/", + "phoneNumber": "+49893820", + "email": "werke@bmwgroup.com" + }, + "address": { + "locality": { + "value": "Munich", + "technicalKey": "CITY" + }, + "country": { + "shortName": "GER" + }, + "postCode": { + "value": "80809", + "technicalKey": "REGULAR" + }, + "thoroughfare": { + "value": "Am Olympiapark", + "number": "2", + "technicalKey": "STREET" + }, + "premise": { + "value": "PLANT 1", + "technicalKey": "OTHER" + }, + "postalDeliveryPoint": { + "value": "Gate 1", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + } + }, + "warrantyPeriod": "60", + "composition": { + "compositionOfBattery": [ + { + "materialName": "steel", + "materialWeight": 69883, + "materialPercentageMassFraction": 11 + }, + { + "materialName": "aluminium", + "materialWeight": 101648, + "materialPercentageMassFraction": 16 + }, + { + "materialName": "lithium", + "materialWeight": 6353, + "materialPercentageMassFraction": 1 + }, + { + "materialName": "cobalt", + "materialWeight": 19059, + "materialPercentageMassFraction": 3 + }, + { + "materialName": "nickel", + "materialWeight": 19059, + "materialPercentageMassFraction": 3 + }, + { + "materialName": "manganese", + "materialWeight": 19059, + "materialPercentageMassFraction": 3 + }, + { + "materialName": "sealant", + "materialWeight": 3176.5, + "materialPercentageMassFraction": 0.5 + }, + { + "materialName": "graphite", + "materialWeight": 50824, + "materialPercentageMassFraction": 8 + }, + { + "materialName": "insulator", + "materialWeight": 12706, + "materialPercentageMassFraction": 2 + }, + { + "materialName": "uv varnish", + "materialWeight": 1270.6, + "materialPercentageMassFraction": 0.2 + }, + { + "materialName": "copper", + "materialWeight": 76236, + "materialPercentageMassFraction": 12 + }, + { + "materialName": "polyamid", + "materialWeight": 69883, + "materialPercentageMassFraction": 11 + }, + { + "materialName": "others", + "materialWeight": 186142.9, + "materialPercentageMassFraction": 29.3 + } + ], + "criticalRawMaterials": "lithium, nickel, cobalt, graphite, manganese, copper, aluminium", + "components": { + "componentsPartNumber": ["5819826-01", "2389175-01"], + "componentsSupplier": [ + { + "componentsSupplierName": "Dräxlmaier", + "address": { + "locality": { + "value": "Vilsbiburg", + "technicalKey": "CITY" + }, + "country": { + "shortName": "GER" + }, + "postCode": { + "value": "84137", + "technicalKey": "REGULAR" + }, + "thoroughfare": { + "value": "Landshuter Straße", + "number": "100", + "technicalKey": "STREET" + }, + "premise": { + "value": "Headquarters", + "technicalKey": "OTHER" + }, + "postalDeliveryPoint": { + "value": "GATE 2", + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } + }, + "contact": { + "faxNumber": "+498741471940", + "website": "https://www.draexlmaier.com/", + "phoneNumber": "+498741470", + "email": "info@draexlmaier.com" + } + } + ] + } + }, + "manufacturing": { + "dateOfManufacturing": "2022-11-22", + "address": { + "locality": { + "value": "Munich", + "technicalKey": "CITY" + }, + "country": { + "shortName": "GER" + }, + "postCode": { + "value": "80809", + "technicalKey": "REGULAR" + }, + "thoroughfare": { + "value": "Am Olympiapark", + "number": "2", + "technicalKey": "STREET" + }, + "premise": { + "value": "PLANT 1", + "technicalKey": "OTHER" + }, + "postalDeliveryPoint": { + "value": "Gate 1", + "technicalKey": "intERURBAN_DELIVERY_POint" + } + } + }, + "batteryIdentification": { + "batteryType": "Lithium-ion", + "batteryIDDMCCode": "Y792927456954B81677903848654570", + "batteryModel": "SE30H" + }, + "stateOfBattery": { + "stateOfHealth": "99", + "statusBattery": "first life", + "stateOfCharge": "54" + }, + "cO2FootprintTotal": "110" + }, + "description": "Battery Passport Submodel", + "semanticId": "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" + } + ] + }, + { + "catenaXId": "urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d", + "specificAssetIds": [ + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, + { + "name": "partInstanceId", + "value": "BAT-XYZ789", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "Battery", + "description": [ + { + "language": "en", + "text": "Battery Digital Twin" + } + ], + "submodels": [ + { + "name": "singleLevelBomAsBuilt", + "data": { + "catenaXId": "urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d", + "childItems": [ + { + "catenaXId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552", + "quantity": { + "quantityNumber": 5.0, + "measurementUnit": "piece" + }, + "businessPartner": "BPNL00000000CBA5", + "createdOn": "2023-01-09T17:26:54.709Z", + "lastModifiedOn": "2023-01-09T17:26:54.709Z" + } + ] + }, + "description": "single level Bom As Built Submodel", + "semanticId": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" + }, + { + "name": "digitalProductPass", + "data": { + "serialization": { + "manufacturingInformation": { + "date": "2023-08-30T10:30:00", + "country": "USA" + }, + "registration": { + "customerPartId": "PRT-67890", + "manufacturerPartId": "HV-SPORT-123" + }, + "quantity": { + "value": 1.0, + "unit": "unit:piece" + } + }, + "typology": { + "name": "High Voltage Battery for Sports Car", + "description": "High performance battery for electric sports cars", + "class": { + "definition": "High Voltage Battery", + "code": "33-06-01-01" + }, + "nameAtManufacturer": "Performance Battery Pack", + "nameAtCustomer": "High-Performance Energy Source" + }, + "metadata": { + "issueDate": "2023-08-30", + "version": "2.0.0", + "validityDate": "2023-08-30", + "economicOperator": { + "eori": "US987654321000", + "id": "BPNL000000000000" + }, + "status": "Approved" + }, + "characteristics": { + "physicalDimensionsProperty": { + "width": 800.0, + "length": 1200.0, + "weight": 300.5, + "height": 150.0 + }, + "energyCapacity": { + "value": 85.0, + "unit": "unit:kWh" + }, + "voltage": { + "value": 400.0, + "unit": "unit:V" + } + }, + "commercial": { + "placedOnMarket": "2023-09-01", + "warranty": 72 + }, + "identification": { + "localIdentifiers": [ + { + "value": "BAT-XYZ789", + "key": "PartInstanceID" + } + ], + "gtin": "12345678901234", + "additionalCode": [ + { + "name": "TARIC", + "value": "8507 80 00 00" + } + ] + }, + "sources": { + "mandatory": { + "safetyInformation": { + "header": "Safety Datasheet for High Voltage Battery", + "category": "Safety", + "type": "link", + "content": "www.example.com/safety_datasheet.pdf" + }, + "environmentalImpact": { + "header": "Environmental Impact Assessment", + "category": "Environment", + "type": "link", + "content": "www.example.com/environmental_impact.pdf" + } + }, + "optional": [ + { + "name": "userManual", + "document": { + "header": "User Manual for High Voltage Battery", + "category": "User Manual", + "type": "link", + "content": "www.example.com/user_manual.pdf" + } + } + ] + }, + "sustainability": { + "state": "first life", + "material": [ + { + "name": "Lithium-Ion", + "recycled": false, + "renewable": false, + "percentage": 80.0 + } + ], + "critical": ["Lithium", "Cobalt"], + "carbonFootprint": { + "carbonContentTotal": 10.2, + "crossSectoralStandard": "ISO 14040", + "productOrSectorSpecificRules": [ + { + "ruleName": "ISO 14067" + } + ] + } + }, + "operation": { + "importer": "BPNL000000000000", + "manufacturer": { + "manufacturerId": "BPNL000000000000", + "facilityId": "BPNL000000000123" + } + } + }, + "description": "Digital Product Pass Submodel", + "semanticId": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + } + ] + }, + { + "catenaXId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552", + "specificAssetIds": [ + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, + { + "name": "partInstanceId", + "value": "EVMODULE-TRJ712", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "BatteryModule", + "description": [ + { + "language": "en", + "text": "Battery Module Digital Twin" + } + ], + "submodels": [ + { + "name": "singleLevelBomAsBuilt", + "data": { + "catenaXId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552", + "childItems": [ + { + "catenaXId": "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1", + "quantity": { + "quantityNumber": 100.0, + "measurementUnit": "piece" + }, + "businessPartner": "BPNL00000000CBA5", + "createdOn": "2023-01-09T17:26:54.709Z", + "lastModifiedOn": "2023-01-09T17:26:54.709Z" + } + ] + }, + "description": "Single level Bom As Built Submodel", + "semanticId": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" + }, + { + "name": "SingleLevelUsageAsBuilt", + "data": { + "parentParts": [ + { + "parentCatenaXId": "urn:uuid:efcb5f8d-f31c-4b1f-b090-9c878054554d", + "quantity": { + "quantityNumber": 100.0, + "measurementUnit": "piece" + }, + "createdOn": "2023-01-09T17:26:54.709Z", + "lastModifiedOn": "2023-01-09T17:26:54.709Z" + } + ], + "catenaXId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552" + }, + "description": "Single level usage As Built Submodel", + "semanticId": "urn:bamm:io.catenax.single_level_usage_as_built:1.0.1#SingleLevelUsageAsBuilt" + }, + { + "name": "digitalProductPass", + "data": { + "serialization": { + "manufacturingInformation": { + "date": "2023-08-30T14:30:00", + "country": "GER" + }, + "registration": { + "customerPartId": "MODULE-78901", + "manufacturerPartId": "BP-GER-45678" + }, + "quantity": { + "value": 100.0, + "unit": "unit:piece" + } + }, + "typology": { + "name": "High-Capacity Battery Module", + "description": "Large Battery Module for electric vehicles", + "class": { + "definition": "Battery Module", + "code": "33-06-01-03" + }, + "nameAtManufacturer": "EVModule 45678", + "nameAtCustomer": "High-Capacity Power Source" + }, + "metadata": { + "issueDate": "2023-08-30", + "version": "1.0.0", + "validityDate": "2023-08-30", + "economicOperator": { + "eori": "DE987654321000", + "id": "BPNL000000000000" + }, + "status": "Approved" + }, + "characteristics": { + "physicalDimensionsProperty": { + "width": 800.0, + "length": 1000.0, + "weight": 700.5, + "height": 200.0 + }, + "energyCapacity": { + "value": 300.0, + "unit": "unit:kWh" + }, + "voltage": { + "value": 800.0, + "unit": "unit:V" + } + }, + "identification": { + "localIdentifiers": [ + { + "value": "EVMODULE-TRJ712", + "key": "PartInstanceID" + } + ], + "gtin": "12345678901234", + "additionalCode": [ + { + "name": "TARIC", + "value": "8507 80 00 00" + } + ] + }, + "sources": { + "mandatory": { + "safetyInformation": { + "header": "Safety Datasheet for Battery Module", + "category": "Safety", + "type": "link", + "content": "www.example.com/module_safety_datasheet.pdf" + } + }, + "optional": [ + { + "name": "userManual", + "document": { + "header": "User Manual for Battery Module", + "category": "User Manual", + "type": "link", + "content": "www.example.com/module_user_manual.pdf" + } + } + ] + }, + "sustainability": { + "state": "first life", + "material": [ + { + "name": "Lithium-Nickel-Cobalt-Manganese-Oxide", + "recycled": false, + "renewable": false, + "percentage": 35.0 + } + ], + "critical": ["Lithium", "Cobalt"], + "carbonFootprint": { + "carbonContentTotal": 1.2, + "crossSectoralStandard": "ISO 14040", + "productOrSectorSpecificRules": [ + { + "ruleName": "ISO 14067" + } + ] + } + }, + "operation": { + "importer": "BPN1234567890ZZ", + "manufacturer": { + "manufacturerId": "BPN1234567890ZZ", + "facilityId": "BPN1234567890ZZ" + } + } + }, + "description": "Digital Product Pass Submodel", + "semanticId": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + } + ] + }, + { + "catenaXId": "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1", + "specificAssetIds": [ + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + }, + { + "name": "partInstanceId", + "value": "CTA-13123", + "allowedBpns": ["BPNL00000000CBA5", "BPNL00000003CRHL"] + } + ], + "type": "BatteryCell", + "description": [ + { + "language": "en", + "text": "Battery Cell Digital Twin" + } + ], + "submodels": [ + { + "name": "singleLevelBomAsBuilt", + "data": { + "catenaXId": "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1", + "childItems": [] + }, + "description": "Single level Bom As Built Submodel", + "semanticId": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt" + }, + { + "name": "SingleLevelUsageAsBuilt", + "data": { + "parentParts": [ + { + "parentCatenaXId": "urn:uuid:d8ec6acc-1ad7-47b4-bc7e-612122d9d552", + "quantity": { + "quantityNumber": 10.0, + "measurementUnit": "piece" + }, + "createdOn": "2023-01-09T17:26:54.709Z", + "lastModifiedOn": "2023-01-09T17:26:54.709Z" + } + ], + "catenaXId": "urn:uuid:63b95496-86ed-4762-b248-491d5c1242e1" + }, + "description": "Single level usage As Built Submodel", + "semanticId": "urn:bamm:io.catenax.single_level_usage_as_built:1.0.1#SingleLevelUsageAsBuilt" + }, + { + "name": "digitalProductPass", + "data": { + "serialization": { + "manufacturingInformation": { + "date": "2023-08-30T11:45:00", + "country": "JPN" + }, + "registration": { + "customerPartId": "CELL-45678", + "manufacturerPartId": "BC-JPN-12345" + }, + "quantity": { + "value": 1000.0, + "unit": "unit:piece" + } + }, + "typology": { + "name": "Lithium-Ion Battery Cell", + "description": "High-capacity lithium-ion battery cell", + "class": { + "definition": "Battery Cell", + "code": "33-06-01-02" + }, + "nameAtManufacturer": "Li-Ion Cell 12345", + "nameAtCustomer": "High-Capacity Battery Cell" + }, + "metadata": { + "issueDate": "2023-08-30", + "version": "1.1.0", + "validityDate": "2023-08-30", + "economicOperator": { + "eori": "JP123456789000", + "id": "BPN1234567890ZZ" + }, + "status": "Approved" + }, + "characteristics": { + "physicalDimensionsProperty": { + "width": 30.0, + "length": 60.0, + "weight": 50.2, + "height": 10.0 + }, + "energyCapacity": { + "value": 2.5, + "unit": "unit:Ah" + }, + "voltage": { + "value": 3.7, + "unit": "unit:V" + } + }, + "identification": { + "localIdentifiers": [ + { + "value": "CTA-13123", + "key": "PartInstanceID" + } + ], + "gtin": "12345678901234", + "additionalCode": [ + { + "name": "TARIC", + "value": "8507 60 00 00" + } + ] + }, + "sources": { + "mandatory": { + "safetyInformation": { + "header": "Safety Datasheet for Lithium-Ion Battery Cell", + "category": "Safety", + "type": "link", + "content": "www.example.com/cell_safety_datasheet.pdf" + } + }, + "optional": [ + { + "name": "userManual", + "document": { + "header": "User Manual for Battery Cell", + "category": "User Manual", + "type": "link", + "content": "www.example.com/cell_user_manual.pdf" + } + } + ] + }, + "sustainability": { + "state": "first life", + "material": [ + { + "name": "Lithium-Cobalt Oxide", + "recycled": false, + "renewable": false, + "percentage": 40.0 + } + ], + "critical": ["Lithium", "Cobalt"], + "carbonFootprint": { + "carbonContentTotal": 0.8, + "crossSectoralStandard": "ISO 14044", + "productOrSectorSpecificRules": [ + { + "ruleName": "ISO 14067" + } + ] + } + }, + "operation": { + "importer": "BPN1234567890ZZ", + "manufacturer": { + "manufacturerId": "BPN1234567890ZZ", + "facilityId": "BPN1234567890ZZ" + } + } + }, + "description": "Digital Product Pass Submodel", + "semanticId": "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + } + ] + }, + { + "catenaXId": "urn:uuid:95f1ddf0-f795-dc9c-6440-13af29059907", + "specificAssetIds": [ + { + "name": "manufacturerPartId", + "value": "XYZ78901", + "allowedBpns": ["BPNL00000003CRHL", "BPNL00000000CBA5"] + }, + { + "name": "partInstanceId", + "value": "KLZ-90-8564-96", + "allowedBpns": ["BPNL00000003CRHL", "BPNL00000000CBA5"] } ], "type": "SecondaryMaterialContent", @@ -610,8 +2177,8 @@ "driveType": "Combustion Engine", "oilType": "ZF Lifeguard Hybrid 2", "spreading": 6.79, - "torque": 500, - "power": 300, + "torque": 500.0, + "power": 300.0, "standardGearRatio": { "gear": "1", "ratio": 4.1567 @@ -660,7 +2227,7 @@ "localIdentifiers": [ { "value": "SNJ-4654-76", - "key": "partInstanceId" + "key": "PartInstanceID" } ], "dataMatrixCode": "ABCDEF1234567890" @@ -688,13 +2255,13 @@ "generalInformation": { "additionalInformation": "This is a test product with realistic data.", "physicalDimensionsProperty": { - "width": 1000, + "width": 1000.0, "length": 20000.1, "weight": 100.7, "diameter": 0.03, "height": 0.1 }, - "warrantyPeriod": 60, + "warrantyPeriod": 60.0, "productDescription": "Manual Transmission", "productType": "8HP60MH" }, @@ -724,7 +2291,7 @@ "crossSectoralStandard": "GHG Protocol Product Standard" } ], - "co2FootprintTotal": 200, + "co2FootprintTotal": 200.0, "productOrSectorSpecificRules": [ { "operator": "PEF",