Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/trx 96 adapt edc discovery flow #879

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7dd3c59
chore: Initial repository setup
bmunguli Jun 17, 2024
049c46e
chore: [TRX-19] migrate upstream GitHub workflows and configs (#2)
ds-jhartmann Aug 28, 2024
af45bca
chore: [TRX-50] create docker image build workflow for cofinity image
ds-jhartmann Sep 4, 2024
77f0d8b
chore: [TRX-50] remove trivy scan
ds-jhartmann Sep 4, 2024
8afe72e
chore: [TRX-50] add concurrency restriction
ds-jhartmann Sep 5, 2024
09e3c62
chore: [TRX-50] add correct env to publish image pipeline
ds-mwesener Sep 11, 2024
6fdfc96
Merge pull request #8 from Cofinity-X/chore/TRX-50-cofinity-docker-im…
ds-mwesener Sep 11, 2024
9b361cc
chore: [TRX-50] add auto dispatcher for irs-a and irs-b trace-x chart…
ds-mwesener Sep 23, 2024
d781c18
chore : [TRX-96] Adapt-Discovery-flow (bpnl)
pathaniaaviX Sep 23, 2024
883b57a
Merge branch 'main' into chore/TRX-96-Adapt-EDC-Discovery-flow
pathaniaaviX Sep 23, 2024
f781e29
[TRX-96]: fixed small changes in values.yaml, deployment.yaml, Defaul…
pathaniaaviX Sep 23, 2024
2e02dad
Merge remote-tracking branch 'origin/chore/TRX-96-Adapt-EDC-Discovery…
pathaniaaviX Sep 23, 2024
70ba967
chore: Fix image tag overrides of dispatch (#13)
ds-mwesener Sep 24, 2024
eece859
Merge branch 'main' into chore/TRX-96-Adapt-EDC-Discovery-flow
pathaniaaviX Sep 24, 2024
d87218d
[TRX-96]: updated the chnageLogs
pathaniaaviX Sep 24, 2024
32f95b2
Merge remote-tracking branch 'origin/chore/TRX-96-Adapt-EDC-Discovery…
pathaniaaviX Sep 24, 2024
5e8c9b1
chore: [TRX-XX] revert for upstream sync
ds-mwesener Oct 2, 2024
3c690f8
Merge branch 'main' into chore/TRX-96-Adapt-EDC-Discovery-flow
ds-mwesener Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

### Changed

- Added the discovery type configurable, with a default value of bpnl in (ConnectorEndpointsService) (#12)

## [5.4.1] - 2024-08-19

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions charts/item-relationship-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Added the discovery type configurable (discovery.type) default value as bpnl. (#12).

## [7.4.1] - 2024-08-19

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "irs.fullname" . }}-configmap

Check warning on line 26 in charts/item-relationship-service/templates/configmap-spring-app-config.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
namespace: {{ .Values.namespace }}
data:
application.yaml: |-
Expand Down Expand Up @@ -80,6 +80,7 @@
discovery:
oAuthClientId: {{ .Values.discovery.oAuthClientId | default "discovery" }} # ID of the OAuth2 client registration to use, see config spring.security.oauth2.client
discoveryFinderUrl: {{ tpl (.Values.discovery.discoveryFinderUrl | default "") . | quote }} # The endpoint to discover EDC endpoints to a particular BPN.
type: {{ .Values.discovery.type | default "bpnl" }} # Type to discover EDC of type "bpnl".

semanticshub:
url: {{ tpl (.Values.semanticshub.url | default "") . | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/item-relationship-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ digitalTwinRegistry:
discovery:
oAuthClientId: discovery # ID of the OAuth2 client registration to use, see config spring.security.oauth2.client
discoveryFinderUrl: # "https://<discovery-finder-url>
type: "bpnl" # discovery type to find bpnl type in EDC discovery

semanticshub:
url: # https://<semantics-hub-url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ public DecentralDigitalTwinRegistryService decentralDigitalTwinRegistryService(
@Bean
public ConnectorEndpointsService connectorEndpointsService(
@Qualifier(RestTemplateConfig.DTR_REST_TEMPLATE) final RestTemplate dtrRestTemplate,
@Value("${digitalTwinRegistry.discovery.discoveryFinderUrl:}") final String finderUrl) {
return new ConnectorEndpointsService(discoveryFinderClient(dtrRestTemplate, finderUrl));
@Value("${digitalTwinRegistry.discovery.discoveryFinderUrl:}") final String finderUrl,
@Value("${digitalTwinRegistry.discovery.type:}") final String discoveryType) {
return new ConnectorEndpointsService(discoveryFinderClient(dtrRestTemplate, finderUrl), discoveryType);
}


@Bean
public DiscoveryFinderClient discoveryFinderClient(
@Qualifier(RestTemplateConfig.DTR_REST_TEMPLATE) final RestTemplate dtrRestTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ public DiscoveryFinderClient discoveryFinderClient(

@Bean
@ConditionalOnProperty(prefix = CONFIG_PREFIX, name = CONFIG_FIELD_TYPE, havingValue = CONFIG_VALUE_DECENTRAL)
public ConnectorEndpointsService connectorEndpointsService(final DiscoveryFinderClient discoveryFinderClient) {
return new ConnectorEndpointsService(discoveryFinderClient);
public ConnectorEndpointsService connectorEndpointsService(final DiscoveryFinderClient discoveryFinderClient,
@Value("${digitalTwinRegistryClient.discovery.type:}") final String discoveryType) {
return new ConnectorEndpointsService(discoveryFinderClient, discoveryType);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ConnectorEndpointsService {

private final DiscoveryFinderClient discoveryFinderClient;
private static final String CONNECTOR_ENDPOINT_SERVICE_CACHE_NAME = "connector_endpoint_service_cache";
private final String discoveryType;

/**
* Get EDCs for BPN.
Expand All @@ -60,7 +61,7 @@ public List<String> fetchConnectorEndpoints(final String bpn) {

log.info("Requesting connector endpoints for BPN {}", bpn);

final var onlyBpn = new DiscoveryFinderRequest(List.of("bpn"));
final var onlyBpn = new DiscoveryFinderRequest(List.of(discoveryType));
final var discoveryEndpoints = discoveryFinderClient.findDiscoveryEndpoints(onlyBpn).endpoints();
final var endpoints = discoveryEndpoints.stream()
.flatMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void centralDigitalTwinRegistryService() {
void decentralDigitalTwinRegistryService() {
final EdcSubmodelFacade facadeMock = mock(EdcSubmodelFacade.class);
final var service = testee.decentralDigitalTwinRegistryService(
testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder")),
testee.connectorEndpointsService(testee.discoveryFinderClient(new RestTemplate(), "finder"), "bpnl"),
testee.endpointDataForConnectorsService(facadeMock),
testee.decentralDigitalTwinRegistryClient(new RestTemplate(), descriptorTemplate, shellLookupTemplate),
edcConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void setUp(WireMockRuntimeInfo wireMockRuntimeInfo) {
final RestTemplate restTemplate = restTemplateProxy(PROXY_SERVER_HOST, wireMockRuntimeInfo.getHttpPort());

final var discoveryFinderClient = new DiscoveryFinderClientImpl(DISCOVERY_FINDER_URL, restTemplate);
final var connectorEndpointsService = new ConnectorEndpointsService(discoveryFinderClient);
final var connectorEndpointsService = new ConnectorEndpointsService(discoveryFinderClient, "bpnl");
final var endpointDataForConnectorsService = new EndpointDataForConnectorsService(
edcEndpointReferenceRetrieverMock);
final var decentralDigitalTwinRegistryClient = new DecentralDigitalTwinRegistryClient(restTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class ConnectorEndpointsServiceTest {

private final DiscoveryFinderClient essDiscoveryFinderClient = Mockito.mock(DiscoveryFinderClient.class);
private final ConnectorEndpointsService service = new ConnectorEndpointsService(essDiscoveryFinderClient);
private final ConnectorEndpointsService service = new ConnectorEndpointsService(essDiscoveryFinderClient, "bpnl" );

@Test
void shouldFindConnectorEndpoints() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void findDiscoveryEndpoints_shouldReturnResponseFromRestRequest() {
final DiscoveryResponse mockResponse = new DiscoveryResponse(
List.of(new DiscoveryEndpoint("test-endpoint", "desc", "test-endpoint-addr", "docs", "resId")));

final var request = new DiscoveryFinderRequest(List.of("bpn"));
final var request = new DiscoveryFinderRequest(List.of("bpnl"));
when(restTemplate.postForObject(DISCOVERY_FINDER_URL, request, DiscoveryResponse.class)).thenReturn(
mockResponse);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ data:
bpn_discovery_service_response.json: |-
{
"bpns": [
{"type": "bpn","key": ".*","value": "BPNL00000000BJTL","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003AVTH","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003AXS3","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003AYRE","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003AZQP","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003B0Q0","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003B2OM","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003B3NX","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpn","key": ".*","value": "BPNL00000003CSGV","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}
{"type": "bpnl","key": ".*","value": "BPNL00000000BJTL","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003AVTH","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003AXS3","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003AYRE","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003AZQP","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003B0Q0","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003B2OM","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003B3NX","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003B5MJ","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"},
{"type": "bpnl","key": ".*","value": "BPNL00000003CSGV","resourceId": "1ca6f9b5-8e1d-422a-8541-9bb2cf5fe485"}
]
}
Loading