From 4b709084ba01be7069414efa22b1775dc925e19a Mon Sep 17 00:00:00 2001 From: Dilip Dhankecha Date: Thu, 1 May 2025 15:39:21 +0530 Subject: [PATCH] feat: Update EDC version from 0.7.7 to 0.9.0 1. Comment EDC-Migration container because latest version supports automatic migration 2. Add opentelemetry configurations 3. Enable DEBUG log level 4. Update PublicUrlHandlerService to handle the public path --- .../env/catena-x/opentelemetry.properties | 5 + .../env/smartsense/opentelemetry.properties | 5 + docker-compose.yaml | 85 +- docs/postman_collection/EDC-collection.json | 1304 +++++++++++++++++ .../chat/edc/client/EDCConnectorClient.java | 25 +- .../operation/PublicUrlHandlerService.java | 9 +- 6 files changed, 1380 insertions(+), 53 deletions(-) create mode 100644 deployment/env/catena-x/opentelemetry.properties create mode 100644 deployment/env/smartsense/opentelemetry.properties create mode 100644 docs/postman_collection/EDC-collection.json diff --git a/deployment/env/catena-x/opentelemetry.properties b/deployment/env/catena-x/opentelemetry.properties new file mode 100644 index 0000000..cbe30c2 --- /dev/null +++ b/deployment/env/catena-x/opentelemetry.properties @@ -0,0 +1,5 @@ +# Disable all exporters +otel.traces.exporter=none +otel.metrics.exporter=none +otel.logs.exporter=none +edc.metrics.enabled=false diff --git a/deployment/env/smartsense/opentelemetry.properties b/deployment/env/smartsense/opentelemetry.properties new file mode 100644 index 0000000..cbe30c2 --- /dev/null +++ b/deployment/env/smartsense/opentelemetry.properties @@ -0,0 +1,5 @@ +# Disable all exporters +otel.traces.exporter=none +otel.metrics.exporter=none +otel.logs.exporter=none +edc.metrics.enabled=false diff --git a/docker-compose.yaml b/docker-compose.yaml index 3124d14..6476401 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ version: "3.8" services: # PostgreSQL database service postgres: - image: postgres:latest + image: postgres:16 container_name: postgres_multi_db environment: # Database credentials and configuration @@ -28,8 +28,9 @@ services: # Sender Control Plane service smartsense-controlplane: - image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.7 + image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.9.0 container_name: smartsense-controlplane + command: [ "--log-level=DEBUG" ] ports: # Expose Control Plane ports - "8191:8191" @@ -39,14 +40,16 @@ services: volumes: # Mount configuration file - ./deployment/env/smartsense/edc.properties:/app/configuration.properties + - ./deployment/env/smartsense/opentelemetry.properties:/app/opentelemetry.properties environment: # Specify the configuration file location - CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties + - OPENTELEMETRY_PROPERTIES_FILE=/app/opentelemetry.properties depends_on: postgres: condition: service_started - smartsense-edc-migration: - condition: service_completed_successfully + # smartsense-edc-migration: + # condition: service_completed_successfully # wallet-stub: # condition: service_healthy networks: @@ -60,22 +63,25 @@ services: # Sender Data Plane service smartsense-dataplane: - image: tractusx/edc-dataplane-hashicorp-vault:0.7.7 + image: tractusx/edc-dataplane-hashicorp-vault:0.9.0 container_name: smartsense-dataplane + command: [ "--log-level=DEBUG" ] ports: # Expose Data Plane port - "8196:8193" volumes: # Mount configuration file - ./deployment/env/smartsense/dataplane.properties:/app/configuration.properties + - ./deployment/env/smartsense/opentelemetry.properties:/app/opentelemetry.properties environment: # Specify the configuration file location - CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties + - OPENTELEMETRY_PROPERTIES_FILE=/app/opentelemetry.properties depends_on: postgres: condition: service_started - smartsense-edc-migration: - condition: service_completed_successfully + # smartsense-edc-migration: + # condition: service_completed_successfully # wallet-stub: # condition: service_healthy smartsense-controlplane: @@ -85,8 +91,9 @@ services: # Receiver Control Plane service catena-x-controlplane: - image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.7 + image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.9.0 container_name: catena-x-controlplane + command: [ "--log-level=DEBUG" ] ports: # Expose Control Plane ports - "9191:9191" @@ -96,14 +103,16 @@ services: volumes: # Mount configuration file - ./deployment/env/catena-x/edc.properties:/app/configuration.properties + - ./deployment/env/catena-x/opentelemetry.properties:/app/opentelemetry.properties environment: # Specify the configuration file location - CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties + - OPENTELEMETRY_PROPERTIES_FILE=/app/opentelemetry.properties depends_on: postgres: condition: service_started - catena-x-edc-migration: - condition: service_completed_successfully + # catena-x-edc-migration: + # condition: service_completed_successfully # wallet-stub: # condition: service_healthy networks: @@ -117,22 +126,25 @@ services: # Receiver Data Plane service catena-x-dataplane: - image: tractusx/edc-dataplane-hashicorp-vault:0.7.7 + image: tractusx/edc-dataplane-hashicorp-vault:0.9.0 container_name: catena-x-dataplane + command: [ "--log-level=DEBUG" ] ports: # Expose Data Plane port - "9196:8196" volumes: # Mount configuration file - ./deployment/env/catena-x/dataplane.properties:/app/configuration.properties + - ./deployment/env/catena-x/opentelemetry.properties:/app/opentelemetry.properties environment: # Specify the configuration file location - CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties + - OPENTELEMETRY_PROPERTIES_FILE=/app/opentelemetry.properties depends_on: postgres: condition: service_started - catena-x-edc-migration: - condition: service_completed_successfully + # catena-x-edc-migration: + # condition: service_completed_successfully # wallet-stub: # condition: service_started catena-x-controlplane: @@ -295,29 +307,30 @@ services: networks: - edc-network - smartsense-edc-migration: - image: flyway/flyway:latest - container_name: smartsense-edc-migration - command: -url=jdbc:postgresql://postgres:5432/smartsense-edc -schemas=public -user=root -password=root -connectRetries=10 migrate - volumes: - - ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql - depends_on: - postgres: - condition: service_started - networks: - - edc-network - - catena-x-edc-migration: - image: flyway/flyway:latest - container_name: catena-x-edc-migration - command: -url=jdbc:postgresql://postgres:5432/catena-x-edc -schemas=public -user=root -password=root -connectRetries=10 migrate - volumes: - - ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql - depends_on: - postgres: - condition: service_started - networks: - - edc-network +# Manual DB migration is not needed with the latest version of Tractus-x EDC. +# smartsense-edc-migration: +# image: flyway/flyway:latest +# container_name: smartsense-edc-migration +# command: -url=jdbc:postgresql://postgres:5432/smartsense-edc -schemas=public -user=root -password=root -connectRetries=10 migrate +# volumes: +# - ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql +# depends_on: +# postgres: +# condition: service_started +# networks: +# - edc-network +# +# catena-x-edc-migration: +# image: flyway/flyway:latest +# container_name: catena-x-edc-migration +# command: -url=jdbc:postgresql://postgres:5432/catena-x-edc -schemas=public -user=root -password=root -connectRetries=10 migrate +# volumes: +# - ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql +# depends_on: +# postgres: +# condition: service_started +# networks: +# - edc-network # Define custom network for inter-service communication networks: diff --git a/docs/postman_collection/EDC-collection.json b/docs/postman_collection/EDC-collection.json new file mode 100644 index 0000000..8aecce0 --- /dev/null +++ b/docs/postman_collection/EDC-collection.json @@ -0,0 +1,1304 @@ +{ + "info": { + "_postman_id": "e425c6ef-fd09-4ed5-9bf1-be620e98b3dd", + "name": "EDC-Operations", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "8599877" + }, + "item": [ + { + "name": "Provider-Operations", + "item": [ + { + "name": "Asset Operations", + "item": [ + { + "name": "Create Asset", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {\r\n \"edc\": \"https://w3id.org/edc/v0.0.1/ns/\",\r\n \"cx-common\": \"https://w3id.org/catenax/ontology/common#\",\r\n \"cx-taxo\": \"https://w3id.org/catenax/taxonomy#\",\r\n \"dct\": \"https://purl.org/dc/terms/\"\r\n },\r\n \"@id\": \"{{ASSET_ID}}\",\r\n \"properties\": {\r\n \"type\": {\r\n \"@id\": \"Asset\"\r\n }\r\n },\r\n \"dataAddress\": {\r\n \"@type\": \"DataAddress\",\r\n \"type\": \"HttpData\",\r\n \"baseUrl\": \"{{PROVIDER_BACKEND_URL}}\",\r\n \"proxyQueryParams\": \"true\",\r\n \"proxyPath\": \"true\",\r\n \"proxyMethod\": \"true\",\r\n \"proxyBody\": \"true\",\r\n \"method\": \"POST\"\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/assets", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "assets" + ] + } + }, + "response": [] + }, + { + "name": "Get Asset By ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/assets/{{ASSET_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "assets", + "{{ASSET_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "Get All Assets", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/assets/request", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "assets", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Delete Asset", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/assets/{{ASSET_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "assets", + "{{ASSET_ID}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Policy Operations", + "item": [ + { + "name": "Create Policy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": [\r\n \"https://w3id.org/tractusx/policy/v1.0.0\",\r\n \"http://www.w3.org/ns/odrl.jsonld\",\r\n {\r\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\",\r\n \"dct\": \"https://purl.org/dc/terms/\"\r\n }\r\n ],\r\n \"@type\": \"PolicyDefinitionRequestDto\",\r\n \"@id\": \"{{POLICY_ID}}\",\r\n \"policy\": {\r\n \"@type\": \"Set\",\r\n\r\n \"permission\": [\r\n {\r\n \"action\": \"use\"\r\n }\r\n ]\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/policydefinitions", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "policydefinitions" + ] + } + }, + "response": [] + }, + { + "name": "Get Policy By ID", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/policydefinitions/{{POLICY_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "policydefinitions", + "{{POLICY_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "Get All Policies", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/policydefinitions/request", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "policydefinitions", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Delete policy", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/policydefinitions/{{POLICY_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "policydefinitions", + "{{POLICY_ID}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Contract Definitions Operations", + "item": [ + { + "name": "Create Contract Definition", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {\r\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\"\r\n },\r\n \"@type\": \"ContractDefinition\",\r\n \"@id\": \"{{CONTRACT_ID}}\",\r\n \"accessPolicyId\": \"{{POLICY_ID}}\",\r\n \"contractPolicyId\": \"{{POLICY_ID}}\",\r\n \"assetsSelector\": \r\n {\r\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"{{ASSET_ID}}\"\r\n }\r\n \r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v3/contractdefinitions", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v3", + "contractdefinitions" + ] + } + }, + "response": [] + }, + { + "name": "Get Contract definition By ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/contractdefinitions/{{CONTRACT_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "contractdefinitions", + "{{CONTRACT_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "Get All Contract definitions", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/contractdefinitions/request", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "contractdefinitions", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Delete Contract Definition", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_MGMT_HOST}}/v2/contractdefinitions/{{CONTRACT_ID}}", + "host": [ + "{{PROVIDER_MGMT_HOST}}" + ], + "path": [ + "v2", + "contractdefinitions", + "{{CONTRACT_ID}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Call Public URL", + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{TRANSFER_TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"senderBpn\": \"{{PROVIDER_BPNL}}\",\n \"receiverBpn\":\"{{CONSUMER_BPNL}}\",\n \"message\": \"Replace your message here.\",\n \"messageId\": \"testing-message\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROVIDER_PUBLIC_URL}}", + "host": [ + "{{PROVIDER_PUBLIC_URL}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{PROVIDER_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-Api-Key", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Consumer-Operations", + "item": [ + { + "name": "Query Catalog", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var offerId = responseJson[\"dcat:dataset\"][\"odrl:hasPolicy\"][\"@id\"];", + "pm.collectionVariables.set(\"OFFER_ID\", offerId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {\r\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\"\r\n },\r\n \"@type\": \"CatalogRequest\",\r\n \"counterPartyAddress\": \"{{PROVIDER_DSP_HOST}}\",\r\n \"counterPartyId\": \"{{PROVIDER_BPNL}}\",\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 1,\r\n \"filterExpression\": [\r\n {\r\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"{{ASSET_ID}}\"\r\n }\r\n ]\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/catalog/request", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "catalog", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Initiate Negotiation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var negotiationId = responseJson[\"@id\"];", + "pm.collectionVariables.set(\"NEGOTIATION_ID\", negotiationId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"@context\": [\n \"https://w3id.org/tractusx/policy/v1.0.0\",\n \"http://www.w3.org/ns/odrl.jsonld\",\n {\n \"edc\": \"https://w3id.org/edc/v0.0.1/ns/\"\n }\n ],\n \"@type\": \"ContractRequest\",\n \"edc:counterPartyAddress\": \"{{PROVIDER_DSP_HOST}}\",\n \"edc:protocol\": \"dataspace-protocol-http\",\n \"edc:counterPartyId\": \"{{PROVIDER_BPNL}}\",\n \"edc:policy\": {\n \"@id\": \"{{OFFER_ID}}\",\n \"@type\": \"Offer\",\n \"permission\": [\n {\n \"action\": \"use\"\n }\n ],\n \"target\": \"{{ASSET_ID}}\",\n \"assigner\": \"{{PROVIDER_BPNL}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/edrs", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "edrs" + ] + } + }, + "response": [] + }, + { + "name": "Get Agreement", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest('https://postman-echo.com/delay/5');" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var agreementId = responseJson[\"contractAgreementId\"];", + "pm.collectionVariables.set(\"AGREEMENT_ID\", agreementId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/contractnegotiations/{{NEGOTIATION_ID}}", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "contractnegotiations", + "{{NEGOTIATION_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "Get Transferprocess", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var transferProcessId = responseJson[0][\"transferProcessId\"];", + "pm.collectionVariables.set(\"TRANSFER_ID\", transferProcessId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"@context\": {\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\"\n },\n \"@type\": \"QuerySpec\",\n \"offset\": 0,\n \"limit\": 1,\n \"filterExpression\": [\n {\n \"operandLeft\": \"agreementId\",\n \"operator\": \"=\",\n \"operandRight\": \"{{AGREEMENT_ID}}\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/edrs/request", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "edrs", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Get Authorization", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var transferToken = responseJson[\"authorization\"];", + "pm.collectionVariables.set(\"TRANSFER_TOKEN\", transferToken);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/edrs/{{TRANSFER_ID}}/dataaddress?auto_refresh=true", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "edrs", + "{{TRANSFER_ID}}", + "dataaddress" + ], + "query": [ + { + "key": "auto_refresh", + "value": "true" + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{CONSUMER_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-Api-Key", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Consumer-Operations-Without-EDR", + "item": [ + { + "name": "Query Catalog", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var offerId = responseJson[\"dcat:dataset\"][\"odrl:hasPolicy\"][\"@id\"];", + "pm.collectionVariables.set(\"OFFER_ID\", offerId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {\r\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\"\r\n },\r\n \"@type\": \"CatalogRequest\",\r\n \"counterPartyAddress\": \"{{PROVIDER_DSP_HOST}}\",\r\n \"counterPartyId\": \"{{PROVIDER_BPNL}}\",\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 1,\r\n \"filterExpression\": [\r\n {\r\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"{{ASSET_ID}}\"\r\n }\r\n ]\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/catalog/request", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "catalog", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Initiate Negotiation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var negotiationId = responseJson[\"@id\"];", + "pm.collectionVariables.set(\"NEGOTIATION_ID\", negotiationId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "x-api-key", + "value": "password" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"@context\": {\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\",\n \"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n },\n \"counterPartyAddress\": \"{{PROVIDER_DSP_HOST}}\",\n \"counterPartyId\": \"{{PROVIDER_BPNL}}\",\n \"protocol\": \"dataspace-protocol-http\",\n \"policy\": {\n \"@context\": \"http://www.w3.org/ns/odrl.jsonld\",\n \"@id\": \"{{OFFER_ID}}\",\n \"@type\": \"Offer\",\n \"assigner\": \"{{PROVIDER_BPNL}}\",\n \"target\": \"{{ASSET_ID}}\",\n \"odrl:permission\": [\n {\n \"action\": \"use\"\n }\n ]\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v3/contractnegotiations", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v3", + "contractnegotiations" + ] + } + }, + "response": [] + }, + { + "name": "Get Agreement", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest('https://postman-echo.com/delay/5');" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var agreementId = responseJson[\"contractAgreementId\"];", + "pm.collectionVariables.set(\"AGREEMENT_ID\", agreementId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v2/contractnegotiations/{{NEGOTIATION_ID}}", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v2", + "contractnegotiations", + "{{NEGOTIATION_ID}}" + ] + } + }, + "response": [] + }, + { + "name": "Initiate TrasferProces", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var transferProcessId = responseJson[\"@id\"];", + "pm.collectionVariables.set(\"TRANSFER_ID\", transferProcessId);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Api-Key", + "value": "sender-auth" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"@context\": {\n \"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n },\n \"assetId\": \"{{ASSET_ID}}\",\n \"counterPartyAddress\": \"{{PROVIDER_DSP_HOST}}\",\n \"connectorId\": \"{{PROVIDER_BPNL}}\",\n \"contractId\": \"{{AGREEMENT_ID}}\",\n \"managedResources\": false,\n \"protocol\": \"dataspace-protocol-http\",\n \"transferType\": \"HttpData-PULL\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v2/transferprocesses", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v2", + "transferprocesses" + ] + } + }, + "response": [] + }, + { + "name": "Get Authorization", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "var responseJson = pm.response.json();", + "var transferToken = responseJson[\"authorization\"];", + "pm.collectionVariables.set(\"TRANSFER_TOKEN\", transferToken);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CONSUMER_MGMT_HOST}}/v2/edrs/{{TRANSFER_ID}}/dataaddress?auto_refresh=true", + "host": [ + "{{CONSUMER_MGMT_HOST}}" + ], + "path": [ + "v2", + "edrs", + "{{TRANSFER_ID}}", + "dataaddress" + ], + "query": [ + { + "key": "auto_refresh", + "value": "true" + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{CONSUMER_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-Api-Key", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "PROVIDER_MGMT_HOST", + "value": "", + "type": "string" + }, + { + "key": "PROVIDER_CATALOG_HOST", + "value": "", + "type": "string" + }, + { + "key": "PROVIDER_DSP_HOST", + "value": "http://smartsense-controlplane:8195/api/v1/dsp", + "type": "string" + }, + { + "key": "PROVIDER_PUBLIC_URL", + "value": "", + "type": "string" + }, + { + "key": "PROVIDER_API_KEY", + "value": "", + "type": "string" + }, + { + "key": "PROVIDER_BPNL", + "value": "", + "type": "string" + }, + { + "key": "PROVIDER_BACKEND_URL", + "value": "", + "type": "string" + }, + { + "value": "", + "type": "string", + "disabled": true + }, + { + "key": "CONSUMER_MGMT_HOST", + "value": "", + "type": "string" + }, + { + "key": "CONSUMER_CATALOG_HOST", + "value": "", + "type": "string" + }, + { + "key": "CONSUMER_DSP_HOST", + "value": "", + "type": "string" + }, + { + "key": "CONSUMER_API_KEY", + "value": "", + "type": "string" + }, + { + "key": "CONSUMER_BPNL", + "value": "", + "type": "string" + }, + { + "value": "", + "type": "string", + "disabled": true + }, + { + "key": "ASSET_ID", + "value": "", + "type": "string" + }, + { + "key": "POLICY_ID", + "value": "", + "type": "string" + }, + { + "key": "CONTRACT_ID", + "value": "", + "type": "string" + }, + { + "value": "", + "type": "string", + "disabled": true + }, + { + "key": "OFFER_ID", + "value": "", + "type": "string" + }, + { + "key": "NEGOTIATION_ID", + "value": "", + "type": "string" + }, + { + "key": "AGREEMENT_ID", + "value": "", + "type": "string" + }, + { + "key": "TRANSFER_ID", + "value": "", + "type": "string" + }, + { + "key": "TRANSFER_TOKEN", + "value": "", + "type": "string" + }, + { + "value": "" + } + ] +} \ No newline at end of file diff --git a/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/client/EDCConnectorClient.java b/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/client/EDCConnectorClient.java index caa05b7..31e9c81 100644 --- a/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/client/EDCConnectorClient.java +++ b/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/client/EDCConnectorClient.java @@ -4,12 +4,7 @@ package com.smartsense.chat.edc.client; -import java.net.URI; -import java.util.List; -import java.util.Map; - import org.springframework.cloud.openfeign.FeignClient; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -17,6 +12,12 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; +import java.net.URI; +import java.util.List; +import java.util.Map; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + @FeignClient(name = "edc", url = "http://localhost:8182") public interface EDCConnectorClient { @@ -30,38 +31,38 @@ ResponseEntity getAsset(URI baseUri, @PathVariable("assetId") String assetId, @RequestHeader("X-Api-Key") String auth); - @PostMapping(value = "/management/v2/policydefinitions", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) + @PostMapping(value = "/management/v3/policydefinitions", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) void createPolicy(URI baseUri, @RequestBody Map request, @RequestHeader("X-Api-Key") String auth); - @PostMapping(value = "/management/v2/contractdefinitions", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) + @PostMapping(value = "/management/v3/contractdefinitions", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) void createContractDefinition(URI baseUri, @RequestBody Map request, @RequestHeader("X-Api-Key") String auth); - @PostMapping(value = "/management/v2/catalog/request", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) + @PostMapping(value = "/management/v3/catalog/request", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) Map queryCatalog(URI baseUri, @RequestBody Map request, @RequestHeader("X-Api-Key") String auth); - @PostMapping(value = "/management/v2/edrs", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) + @PostMapping(value = "/management/v3/edrs", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) Map initNegotiation(URI baseUri, @RequestBody Map request, @RequestHeader("X-Api-Key") String auth); - @GetMapping(value = "/management/v2/contractnegotiations/{negotiationId}", produces = APPLICATION_JSON_VALUE) + @GetMapping(value = "/management/v3/contractnegotiations/{negotiationId}", produces = APPLICATION_JSON_VALUE) Map getAgreement(URI baseUri, @PathVariable("negotiationId") String negotiationId, @RequestHeader("X-Api-Key") String auth); - @PostMapping(value = "/management/v2/edrs/request", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) + @PostMapping(value = "/management/v3/edrs/request", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) List> initTransferProcess(URI baseUri, @RequestBody Map request, @RequestHeader("X-Api-Key") String auth); - @GetMapping(value = "management/v2/edrs/{transferProcessId}/dataaddress", produces = APPLICATION_JSON_VALUE) + @GetMapping(value = "management/v3/edrs/{transferProcessId}/dataaddress", produces = APPLICATION_JSON_VALUE) Map getAuthCodeAndPublicUrl(URI baseUri, @PathVariable("transferProcessId") String transferProcessId, @RequestHeader("X-Api-Key") String auth); diff --git a/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/operation/PublicUrlHandlerService.java b/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/operation/PublicUrlHandlerService.java index fe312e9..25efa0c 100644 --- a/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/operation/PublicUrlHandlerService.java +++ b/edc-chat-app-backend/src/main/java/com/smartsense/chat/edc/operation/PublicUrlHandlerService.java @@ -10,14 +10,13 @@ import com.smartsense.chat.edc.settings.AppConfig; import com.smartsense.chat.service.ChatMessageService; import com.smartsense.chat.utils.request.ChatRequest; - -import java.net.URI; -import java.util.Map; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.net.URI; +import java.util.Map; + @Service @RequiredArgsConstructor @Slf4j @@ -35,7 +34,7 @@ public void getAuthCodeAndPublicUrl(String transferProcessId, ChatRequest messag log.info("Auth code and public url response -> {}", response); // Retrieve public path and authorization code - String publicPath = response.get("tx-auth:refreshEndpoint").toString(); + String publicPath = response.get("endpoint").toString(); String authorization = response.get("authorization").toString(); // Call the public path with authorization code