From c2194d653d065a4cbcf35404228b6fc5d6982ef2 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Thu, 18 Jul 2024 08:03:36 +0200 Subject: [PATCH] chore: update tx-edc 0.7.3 --- README.md | 2 +- .../edc/logic/service/EdcAdapterService.java | 28 +++++++++---------- .../config/customer/data-plane.properties | 2 ++ .../config/supplier/data-plane.properties | 2 ++ local/tractus-x-edc/docker-compose.yaml | 4 +-- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1d97a20f..543db7c4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Beside the dependencies provided in the Helm Chart, the following dependencies h | Application | App Version | Chart Version | |-------------------------------------------------------------------------------------------------------------------|-------------|---------------| -| [Tractus-X Connector](https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector) | 0.7.2 | 0.7.2 | +| [Tractus-X Connector](https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector) | 0.7.3 | 0.7.3 | | [Digital Twin Registry](https://github.com/eclipse-tractusx/sldt-digital-twin-registry/tree/main/charts/registry) | 0.5.0 | 0.5.0 | ## Known Knows diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java index 635ca97d..17e95222 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java @@ -34,8 +34,6 @@ import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.RequestEntity; -import org.springframework.http.RequestEntity.BodyBuilder; import org.springframework.stereotype.Service; import java.io.IOException; @@ -202,7 +200,7 @@ public boolean createPolicyAndContractDefForPartner(Partner partner) { private boolean createSubmodelContractDefinitionForPartner(String semanticId, String assetId, Partner partner) { var body = edcRequestBodyBuilder.buildSubmodelContractDefinitionWithBpnRestrictedPolicy(assetId, partner); - try (var response = sendPostRequest(body, List.of("v2", "contractdefinitions"))) { + try (var response = sendPostRequest(body, List.of("v3", "contractdefinitions"))) { if (!response.isSuccessful()) { log.warn("Contract definition registration failed for partner " + partner.getBpnl() + " and {} Submodel", semanticId); if (response.body() != null) { @@ -219,7 +217,7 @@ private boolean createSubmodelContractDefinitionForPartner(String semanticId, St private boolean createDtrContractDefinitionForPartner(Partner partner) { var body = edcRequestBodyBuilder.buildDtrContractDefinitionForPartner(partner); - try (var response = sendPostRequest(body, List.of("v2", "contractdefinitions"))) { + try (var response = sendPostRequest(body, List.of("v3", "contractdefinitions"))) { if (!response.isSuccessful()) { log.warn("Contract definition registration failed for partner " + partner.getBpnl() + " and DTR"); return false; @@ -241,7 +239,7 @@ private boolean createDtrContractDefinitionForPartner(Partner partner) { */ private boolean createBpnlAndMembershipPolicyDefinitionForPartner(Partner partner) { var body = edcRequestBodyBuilder.buildBpnAndMembershipRestrictedPolicy(partner); - try (var response = sendPostRequest(body, List.of("v2", "policydefinitions"))) { + try (var response = sendPostRequest(body, List.of("v3", "policydefinitions"))) { if (!response.isSuccessful()) { log.warn("Policy Registration failed"); if (response.body() != null) { @@ -263,7 +261,7 @@ private boolean createBpnlAndMembershipPolicyDefinitionForPartner(Partner partne */ private boolean createContractPolicy() { var body = edcRequestBodyBuilder.buildFrameworkPolicy(); - try (var response = sendPostRequest(body, List.of("v2", "policydefinitions"))) { + try (var response = sendPostRequest(body, List.of("v3", "policydefinitions"))) { if (!response.isSuccessful()) { log.warn("Framework Policy Registration failed"); if (response.body() != null) { @@ -325,7 +323,7 @@ private boolean sendAssetRegistrationRequest(JsonNode body, String assetId) { * @return The response containing the full catalog, if successful */ public Response getCatalogResponse(String dspUrl, String partnerBpnl, Map filter) throws IOException { - return sendPostRequest(edcRequestBodyBuilder.buildBasicCatalogRequestBody(dspUrl, partnerBpnl, filter), List.of("v2", "catalog", "request")); + return sendPostRequest(edcRequestBodyBuilder.buildBasicCatalogRequestBody(dspUrl, partnerBpnl, filter), List.of("v3", "catalog", "request")); } /** @@ -376,7 +374,7 @@ private JsonNode initiateNegotiation(Partner partner, JsonNode catalogItem, Stri // use dspUrl as provided, if set - else use partner dspUrl = dspUrl != null && !dspUrl.isEmpty() ? dspUrl : partner.getEdcUrl(); var requestBody = edcRequestBodyBuilder.buildAssetNegotiationBody(partner, catalogItem, dspUrl); - try (Response response = sendPostRequest(requestBody, List.of("v2", "contractnegotiations"))) { + try (Response response = sendPostRequest(requestBody, List.of("v3", "contractnegotiations"))) { JsonNode responseNode = objectMapper.readTree(response.body().string()); log.debug("Result from negotiation {}", responseNode.toPrettyString()); return responseNode; @@ -393,7 +391,7 @@ private JsonNode initiateNegotiation(Partner partner, JsonNode catalogItem, Stri * @throws IOException If the connection to your control plane fails */ public JsonNode getNegotiationState(String negotiationId) throws IOException { - try (var response = sendGetRequest(List.of("v2", "contractnegotiations", negotiationId))) { + try (var response = sendGetRequest(List.of("v3", "contractnegotiations", negotiationId))) { String stringData = response.body().string(); return objectMapper.readTree(stringData); } @@ -408,7 +406,7 @@ public JsonNode getNegotiationState(String negotiationId) throws IOException { */ public Response getAllNegotiations() throws IOException { var requestBody = edcRequestBodyBuilder.buildNegotiationsRequestBody(); - return sendPostRequest(requestBody, List.of("v2", "contractnegotiations", "request")); + return sendPostRequest(requestBody, List.of("v3", "contractnegotiations", "request")); } /** @@ -423,7 +421,7 @@ public Response getAllNegotiations() throws IOException { */ public JsonNode initiateProxyPullTransfer(Partner partner, String contractId, String assetId, String partnerEdcUrl) throws IOException { var body = edcRequestBodyBuilder.buildProxyPullRequestBody(partner, contractId, assetId, partnerEdcUrl); - try (var response = sendPostRequest(body, List.of("v2", "transferprocesses"))) { + try (var response = sendPostRequest(body, List.of("v3", "transferprocesses"))) { String data = response.body().string(); JsonNode result = objectMapper.readTree(data); log.debug("Got response from Proxy pull transfer init: {}", result.toPrettyString()); @@ -445,7 +443,7 @@ public JsonNode initiateProxyPullTransfer(Partner partner, String contractId, St * @throws IOException If the connection to your control plane fails */ public JsonNode getTransferState(String transferId) throws IOException { - try (var response = sendGetRequest(List.of("v2", "transferprocesses", transferId))) { + try (var response = sendGetRequest(List.of("v3", "transferprocesses", transferId))) { String data = response.body().string(); return objectMapper.readTree(data); } @@ -461,7 +459,7 @@ public JsonNode getTransferState(String transferId) throws IOException { public Response getAllTransfers() throws IOException { var requestBody = edcRequestBodyBuilder.buildTransfersRequestBody(); log.debug("GetAllTransfers Request: {}", requestBody.toPrettyString()); - return sendPostRequest(requestBody, List.of("v2", "transferprocesses", "request")); + return sendPostRequest(requestBody, List.of("v3", "transferprocesses", "request")); } /** @@ -473,7 +471,7 @@ public Response getAllTransfers() throws IOException { * @throws IOException If the connection to your control plane fails */ public String getContractAgreement(String contractAgreementId) throws IOException { - try (var response = sendGetRequest(List.of("v2", "contractagreements", contractAgreementId))) { + try (var response = sendGetRequest(List.of("v3", "contractagreements", contractAgreementId))) { return response.body().string(); } } @@ -987,7 +985,7 @@ private void terminateTransfer(String transferProcessId) { JsonNode body = edcRequestBodyBuilder.buildTransferProcessTerminationBody("Transfer done."); - try (Response response = sendPostRequest(body, List.of("v2", "transferprocesses", transferProcessId, "terminate"))) { + try (Response response = sendPostRequest(body, List.of("v3", "transferprocesses", transferProcessId, "terminate"))) { JsonNode resultNode = objectMapper.readTree(response.body().string()); if (!response.isSuccessful()) { diff --git a/local/tractus-x-edc/config/customer/data-plane.properties b/local/tractus-x-edc/config/customer/data-plane.properties index 12e44d77..2201bdc9 100644 --- a/local/tractus-x-edc/config/customer/data-plane.properties +++ b/local/tractus-x-edc/config/customer/data-plane.properties @@ -57,3 +57,5 @@ edc.iam.trusted-issuer.portal.id=did:web:mock-util-service/trusted-issuer tx.iam.credentialservice.url=http://mock-util-service:80 # don't use https during did resolving in catalog request edc.iam.did.web.use.https=false + +edc.dpf.selector.url=http://customer-control-plane:8183/api/controlplane/control/v1/dataplanes diff --git a/local/tractus-x-edc/config/supplier/data-plane.properties b/local/tractus-x-edc/config/supplier/data-plane.properties index a419f1b4..c9acc4bc 100644 --- a/local/tractus-x-edc/config/supplier/data-plane.properties +++ b/local/tractus-x-edc/config/supplier/data-plane.properties @@ -58,3 +58,5 @@ edc.iam.trusted-issuer.portal.id=did:web:mock-util-service/trusted-issuer tx.iam.credentialservice.url=http://mock-util-service:80 # don't use https during did resolving in catalog request edc.iam.did.web.use.https=false + +edc.dpf.selector.url=http://supplier-control-plane:9183/api/controlplane/control/v1/dataplanes diff --git a/local/tractus-x-edc/docker-compose.yaml b/local/tractus-x-edc/docker-compose.yaml index 9d4b1794..cbd9a5c2 100644 --- a/local/tractus-x-edc/docker-compose.yaml +++ b/local/tractus-x-edc/docker-compose.yaml @@ -21,13 +21,13 @@ version: "3" services: control-plane: - image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.2 + image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.3 volumes: - ./config/default/opentelemetry.properties:/app/opentelemetry.properties - ./config/default/logging.properties:/app/logging.properties data-plane: - image: tractusx/edc-dataplane-hashicorp-vault:0.7.2 + image: tractusx/edc-dataplane-hashicorp-vault:0.7.3 volumes: - ./config/default/opentelemetry.properties:/app/opentelemetry.properties - ./config/default/logging.properties:/app/logging.properties