diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea097c104..87e97f1883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ _**For better traceability add the corresponding GitHub issue number in each cha ## [Unreleased] +### Fixed + +- Fixed submodel request path by introducing configuration property `irs-edc-client.submodel.submodel-suffix` which will + be appended to the href URL. + ## [5.1.3] - 2024-05-17 ### Fixed diff --git a/charts/item-relationship-service/CHANGELOG.md b/charts/item-relationship-service/CHANGELOG.md index 6b31eaa411..a445f38c60 100644 --- a/charts/item-relationship-service/CHANGELOG.md +++ b/charts/item-relationship-service/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Added configuration property `edc.submodel.suffix`. + ## [7.1.3] - 2024-05-17 ### Changed diff --git a/charts/item-relationship-service/templates/configmap-spring-app-config.yaml b/charts/item-relationship-service/templates/configmap-spring-app-config.yaml index 1fbb9c2e46..92b09f6f6b 100644 --- a/charts/item-relationship-service/templates/configmap-spring-app-config.yaml +++ b/charts/item-relationship-service/templates/configmap-spring-app-config.yaml @@ -115,6 +115,7 @@ data: submodel: request-ttl: {{ tpl .Values.edc.submodel.request.ttl . | default "PT10M" | quote }} urn-prefix: {{ tpl (.Values.edc.submodel.urnprefix | default "/urn") . | quote }} + submodel-suffix: {{ tpl (.Values.edc.submodel.suffix | default "/$value") . | quote }} catalog: acceptedPolicies: diff --git a/charts/item-relationship-service/values.yaml b/charts/item-relationship-service/values.yaml index 4646065ffe..4d828a8670 100644 --- a/charts/item-relationship-service/values.yaml +++ b/charts/item-relationship-service/values.yaml @@ -185,6 +185,7 @@ edc: request: ttl: PT10M # Requests to dataplane will time out after this duration (see https://en.wikipedia.org/wiki/ISO_8601#Durations) urnprefix: /urn + suffix: /$value catalog: # IRS will only negotiate contracts for offers with a policy as defined in the allowedNames list. # If a requested asset does not provide one of these policies, a tombstone will be created and this node will not be processed. diff --git a/irs-api/src/main/resources/application.yml b/irs-api/src/main/resources/application.yml index 870775f826..93b9a76f7a 100644 --- a/irs-api/src/main/resources/application.yml +++ b/irs-api/src/main/resources/application.yml @@ -148,6 +148,7 @@ irs-edc-client: submodel: request-ttl: ${EDC_SUBMODEL_REQUEST_TTL:PT10M} # How long to wait for an async EDC submodel retrieval to finish, ISO 8601 Duration urn-prefix: ${EDC_SUBMODEL_URN_PREFIX:/urn} # A prefix used to identify URNs correctly in the submodel endpoint address + submodel-suffix: "/$value" timeout: read: PT90S # HTTP read timeout for the submodel client connect: PT90S # HTTP connect timeout for the submodel client diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/WiremockSupport.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/WiremockSupport.java index 47ce8f4fa1..00b0000a76 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/WiremockSupport.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/WiremockSupport.java @@ -55,6 +55,9 @@ import org.eclipse.tractusx.irs.testing.wiremock.SubmodelFacadeWiremockSupport; public class WiremockSupport { + + public static final String SUBMODEL_SUFFIX = "/\\$value"; + public static EndpointDataReference createEndpointDataReference(final String contractAgreementId) { final EDRAuthCode edrAuthCode = EDRAuthCode.builder() .cid(contractAgreementId) @@ -126,7 +129,7 @@ static void verifyNegotiationCalls(final int times) { } static void successfulDataRequests(final String assetId, final String fileName) { - stubFor(get(urlPathMatching(DtrWiremockSupport.DATAPLANE_PUBLIC_PATH + "/" + assetId)).willReturn( + stubFor(get(urlPathMatching(DtrWiremockSupport.DATAPLANE_PUBLIC_PATH + "/" + assetId+ SUBMODEL_SUFFIX)).willReturn( responseWithStatus(200).withBodyFile(fileName))); } diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcConfiguration.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcConfiguration.java index a5dc23d0ff..68c1b5f46e 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcConfiguration.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcConfiguration.java @@ -105,6 +105,7 @@ public static class SubmodelConfig { private Duration requestTtl; private String urnPrefix; + private String submodelSuffix; } } diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelFacade.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelFacade.java index 8913c52127..8a97831019 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelFacade.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelFacade.java @@ -56,7 +56,9 @@ public class EdcSubmodelFacade { public SubmodelDescriptor getSubmodelPayload(final String connectorEndpoint, final String submodelDataplaneUrl, final String assetId, final String bpn) throws EdcClientException { try { - return client.getSubmodelPayload(connectorEndpoint, submodelDataplaneUrl, assetId, bpn) + final String fullSubmodelDataplaneUrl = submodelDataplaneUrl + config.getSubmodel().getSubmodelSuffix(); + log.debug("Requesting Submodel for URL: '{}'", fullSubmodelDataplaneUrl); + return client.getSubmodelPayload(connectorEndpoint, fullSubmodelDataplaneUrl, assetId, bpn) .get(config.getAsyncTimeoutMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { log.debug("InterruptedException occurred.", e);