Skip to content

Commit

Permalink
Merge pull request #142 from catenax-ng/release/v1.3.0-irs-tree-compo…
Browse files Browse the repository at this point in the history
…nent

[3°] - Release/v1.3.0 irs tree component: Enable IRS tree component in frontend
  • Loading branch information
matbmoser authored Nov 3, 2023
2 parents 32fb75e + a63cd97 commit 540ba25
Show file tree
Hide file tree
Showing 27 changed files with 697 additions and 87 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
- Added process to refresh the cache when the transfer has failed
- Added timestamp to every known DTR in the cache for refreshing the contract id every time it is reached.
- Added a mechanism to parse/update file system json files by specific properties, avoiding conflicts
- Enabled irs search in frontend
- Added info bar in component search
- Create visual tree of components
- Enabled drill down in tree of components
- Add IRS configuration to the helm values

## Issues Fixed
- Fix IRS tree component bugs related to the Digital Twin parsing
- Fix IRS job tracker to one single job.
- Fix bug related to the broadcast search of digital twin registry
- Fix minor bugs related to the digital twin search and the caching mechanism
- Implemented check for transfer complete and passport received fixing bug related to the passport retrieval


## [released]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ spec:
- name: "API_MAX_RETRIES"
value: "{{ .Values.frontend.productpass.api.max_retries }}"

- name: "IRS_DELAY"
value: "{{ .Values.frontend.productpass.irs.requestDelay }}"

- name: "IRS_MAX_WAITING_TIME"
value: "{{ .Values.frontend.productpass.irs.maxWaitingTime }}"

- name: "API_DELAY"
value: "{{ .Values.frontend.productpass.api.delay }}"

Expand Down
4 changes: 2 additions & 2 deletions charts/digital-product-pass/templates/secret-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ metadata:
namespace: {{ .Values.namespace }}
type: Opaque
stringData:
clientId: {{ .Values.backend.avp.helm.clientId }}
clientSecret: {{ .Values.backend.avp.helm.clientSecret }}
clientId: {{ .Values.backend.edc.clientId }}
clientSecret: {{ .Values.backend.edc.clientSecret }}
---

apiVersion: v1
Expand Down
12 changes: 6 additions & 6 deletions charts/digital-product-pass/values-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ frontend:
hosts:
- materialpass.beta.demo.catena-x.net

avp:
helm:
clientId: <path:material-pass/data/beta/aasregistry#client.id>
clientSecret: <path:material-pass/data/beta/aasregistry#client.secret>
xApiKey: <path:material-pass/data/beta/edc/oauth#api.key>
edc:
clientId: <path:material-pass/data/beta/aasregistry#client.id>
clientSecret: <path:material-pass/data/beta/aasregistry#client.secret>
xApiKey: <path:material-pass/data/beta/edc/oauth#api.key>

# Product Passport UI Configuration
productpass:
Expand All @@ -56,6 +55,8 @@ frontend:
clientId: "Cl13-CX-Battery"
realm: "CX-Central"
onLoad: "login-required"
irsDelay: ""
irsMaxWaitingTime: ""

backend:
ingress:
Expand Down Expand Up @@ -141,7 +142,6 @@ backend:
assetType: 'data.core.digitalTwinRegistry'
endpointInterface: 'SUBMODEL-3.0'
dspEndpointKey: 'dspEndpoint'
internalDtr: "https://materialpass.beta.demo.catena-x.net/BPNL000000000000" # -- If there is an internal DTR available it can be referenced here and will be injected in the list of DTRs
decentralApis:
search: "/lookup/shells/query"
digitalTwin: "/shell-descriptors"
Expand Down
12 changes: 6 additions & 6 deletions charts/digital-product-pass/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ frontend:
hosts:
- materialpass.dev.demo.catena-x.net

avp:
helm:
clientId: <path:material-pass/data/dev/aasregistry#client.id>
clientSecret: <path:material-pass/data/dev/aasregistry#client.secret>
xApiKey: <path:material-pass/data/dev/edc/oauth#api.key>
edc:
clientId: <path:material-pass/data/dev/aasregistry#client.id>
clientSecret: <path:material-pass/data/dev/aasregistry#client.secret>
xApiKey: <path:material-pass/data/dev/edc/oauth#api.key>

# Product Passport UI Configuration
productpass:
Expand All @@ -56,6 +55,8 @@ frontend:
clientId: "Cl13-CX-Battery"
realm: "CX-Central"
onLoad: "login-required"
irsDelay: ""
irsMaxWaitingTime: ""

backend:
ingress:
Expand Down Expand Up @@ -141,7 +142,6 @@ backend:
assetType: 'data.core.digitalTwinRegistry'
dspEndpointKey: 'dspEndpoint'
endpointInterface: 'SUBMODEL-3.0'
internalDtr: "https://materialpass.dev.demo.catena-x.net/BPNL000000000000" # -- If there is an internal DTR available it can be referenced here and will be injected in the list of DTRs
decentralApis:
search: "/lookup/shells"
digitalTwin: "/shell-descriptors"
Expand Down
13 changes: 7 additions & 6 deletions charts/digital-product-pass/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,20 @@ frontend:
hosts:
- materialpass.int.demo.catena-x.net

avp:
helm:
clientId: <path:material-pass/data/int/aasregistry#client.id>
clientSecret: <path:material-pass/data/int/aasregistry#client.secret>
xApiKey: <path:material-pass/data/int/edc/oauth#api.key>
edc:
clientId: <path:material-pass/data/int/aasregistry#client.id>
clientSecret: <path:material-pass/data/int/aasregistry#client.secret>
xApiKey: <path:material-pass/data/int/edc/oauth#api.key>

productpass:
backend_url: "materialpass.int.demo.catena-x.net"
idp_url: "centralidp.int.demo.catena-x.net/auth/"
keycloak:
clientId: "Cl13-CX-Battery"
realm: "CX-Central"
onLoad: "login-required"
irsDelay: ""
irsMaxWaitingTime: ""

backend:
ingress:
Expand Down Expand Up @@ -139,7 +141,6 @@ backend:
assetType: 'data.core.digitalTwinRegistry'
dspEndpointKey: 'dspEndpoint'
endpointInterface: 'SUBMODEL-3.0'
internalDtr: "https://materialpass.int.demo.catena-x.net/BPNL000000000000" # -- If there is an internal DTR available it can be referenced here and will be injected in the list of DTRs
decentralApis:
search: "/lookup/shells"
digitalTwin: "/shell-descriptors"
Expand Down
33 changes: 20 additions & 13 deletions charts/digital-product-pass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,24 @@ frontend:
backend_url: ""
# -- url of the identity provider service
idp_url: ""

# -- api timeouts
api:
# -- max retries for getting status
max_retries: 30
# -- default timeout - 45 seconds in milliseconds
timeout: 60000
# -- default timeout - 90 seconds in milliseconds
timeout: 90000
# -- delay from getting status
delay: 1000
# -- keycloak specific configuration for frontend authentication

# -- irs api timeouts
irs:
# -- request timeout delay
requestDelay: 30000
# -- maximum waiting time to get the irs job status
maxWaitingTime: 30

keycloak:
clientId: ""
realm: ""
Expand All @@ -86,16 +95,15 @@ backend:
enabled: false

# -- in this section we configure the values that are inserted as secrets in the backend
avp:
helm:
# -- technical user keycloak central id credentials
# -- note: this credentials need to have access to the Discovery Finder, BPN Discovery and EDC Discovery
clientId: "<Add client id here>"
clientSecret: "<Add client secret here>"
# -- the secret for assesing the edc management API
xApiKey: "<Add API key here>"
# -- BPN Number
participantId: "<Add participant id here>"
edc:
# -- technical user keycloak central id credentials
# -- note: this credentials need to have access to the Discovery Finder, BPN Discovery and EDC Discovery
clientId: "<Add client id here>"
clientSecret: "<Add client secret here>"
# -- the secret for assesing the edc management API
xApiKey: "<Add API key here>"
# -- BPN Number
participantId: "<Add participant id here>"

# -- specific backend and spring boot configurations
application:
Expand Down Expand Up @@ -161,7 +169,6 @@ backend:
endpointInterface: 'SUBMODEL-3.0'
# -- dsp endpoint key inside submodel body
dspEndpointKey: 'dspEndpoint'
internalDtr: "" # -- ff there is an internal DTR available it can be referenced here and will be injected in the list of DTRs
# -- decentral digital twin apis
decentralApis:
search: "/lookup/shells"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
public class DtrConfig {

/** ATTRIBUTES **/
String internalDtr;
Timeouts timeouts;
TemporaryStorage temporaryStorage;
DecentralApis decentralApis;
Expand All @@ -52,8 +51,7 @@ public class DtrConfig {
public DtrConfig() {
}

public DtrConfig(String internalDtr, Timeouts timeouts, TemporaryStorage temporaryStorage, DecentralApis decentralApis, String assetType, String endpointInterface, String dspEndpointKey, String semanticIdTypeKey) {
this.internalDtr = internalDtr;
public DtrConfig(Timeouts timeouts, TemporaryStorage temporaryStorage, DecentralApis decentralApis, String assetType, String endpointInterface, String dspEndpointKey, String semanticIdTypeKey) {
this.timeouts = timeouts;
this.temporaryStorage = temporaryStorage;
this.decentralApis = decentralApis;
Expand All @@ -71,12 +69,6 @@ public DecentralApis getDecentralApis() {
public void setDecentralApis(DecentralApis decentralApis) {
this.decentralApis = decentralApis;
}
public String getInternalDtr() {
return internalDtr;
}
public void setInternalDtr(String internalDtr) {
this.internalDtr = internalDtr;
}
public Timeouts getTimeouts() {
return timeouts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void started() {
} catch (Exception e) {
throw new IncompatibleConfigurationException(e.getMessage());
}
LogUtil.printMessage("========= [ PRE-CHECKS COMPLETED ] ================================");
} catch (Exception e) {
throw new IncompatibleConfigurationException(e.getMessage());
}
Expand All @@ -139,19 +140,24 @@ public void started() {

@EventListener(ApplicationReadyEvent.class)
public void onStartUp() {
LogUtil.printMessage("========= [ APPLICATION STARTED ] =================================");
String ascii = "\n" +
" ____ _ _ __ __ ____ __ __ ____ \n" +
" / __ \\(_)___ _(_) /_____ _/ / / __ \\_________ ____/ /_ _______/ /_ / __ \\____ ___________ \n" +
" / / / / / __ `/ / __/ __ `/ / / /_/ / ___/ __ \\/ __ / / / / ___/ __/ / /_/ / __ `/ ___/ ___/ \n" +
" / /_/ / / /_/ / / /_/ /_/ / / / ____/ / / /_/ / /_/ / /_/ / /__/ /_ / ____/ /_/ (__ |__ ) \n" +
"/_____/_/\\__, /_/\\__/\\__,_/_/ /_/ /_/ \\____/\\__,_/\\__,_/\\___/\\__/ /_/ \\__,_/____/____/ \n" +
" /____/ \n" +
" \\\\/ersion: v" + buildProperties.getVersion() + "\n\n";
System.out.print(ascii);
String serverStartUpMessage = "\n\n" +
"************************************************\n" +
buildProperties.getName() + "\n" +
"Copyright (c) 2022, 2023: BASF SE, BMW AG, Henkel AG & Co. KGaA\n" +
"Copyright (c) 2022, 2023: Contributors to the CatenaX (ng) GitHub Organisation.\n" +
"Version: " + buildProperties.getVersion() + "\n\n" +
"\n\n-------------> [ SERVER STARTED ] <-------------\n" +
"Listening to requests...\n\n";

LogUtil.printMessage(serverStartUpMessage);
LogUtil.printMessage("========= [ LOGGING STARTED ] ================================");
LogUtil.printMessage("Creating log file...");
"**********************************************************************\n\n" +
" "+buildProperties.getName() + "\n" +
" Copyright (c) 2022, 2023: BASF SE, BMW AG, Henkel AG & Co. KGaA\n" +
" Copyright (c) 2022, 2023: Contributors to the Eclipse Foundation.\n\n" +
"**********************************************************************\n\n";
System.out.print(serverStartUpMessage);
System.out.print("\n========= [ APPLICATION STARTED ] ====================================\n"+
"Listening to requests...\n\n");
Discovery discovery = catenaXService.start(); // Start the CatenaX service (we need the bpnDiscovery and edcDiscovery addresses)
if (discovery == null) {
LogUtil.printError("\n*************************************[CRITICAL ERROR]*************************************" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
package org.eclipse.tractusx.productpass.managers;

import com.fasterxml.jackson.core.type.TypeReference;
import org.apache.commons.logging.Log;
import org.eclipse.tractusx.productpass.config.DtrConfig;
import org.eclipse.tractusx.productpass.exceptions.DataModelException;
import org.eclipse.tractusx.productpass.exceptions.ManagerException;
Expand All @@ -43,6 +44,7 @@

import java.nio.file.Path;
import java.time.Duration;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -141,7 +143,10 @@ public void run() {
//Iterate the edcEndpoints
edcEndpointsToSearch.parallelStream().forEach(edcEndPoint -> {
//Iterate the connectionsURLs for each BPN
edcEndPoint.getConnectorEndpoint().parallelStream().forEach(connectionUrl -> searchEndpoint(processId, edcEndPoint.getBpn(),connectionUrl));
edcEndPoint.getConnectorEndpoint().parallelStream().forEach(connectionUrl -> {
searchEndpoint(processId, edcEndPoint.getBpn(), connectionUrl);
}
);
});
state = State.Finished;
} catch (Exception e) {
Expand Down Expand Up @@ -339,12 +344,13 @@ public void run() {
*
*/
public DtrSearchManager addConnectionToBpnEntry(String bpn, Dtr dtr) {
if (!(bpn.isEmpty() || bpn.isBlank() || dtr.getEndpoint().isEmpty() || dtr.getEndpoint().isBlank())) {
if (!(bpn == null || bpn.isEmpty() || bpn.isBlank() || dtr.getEndpoint().isEmpty() || dtr.getEndpoint().isBlank())) {
if (this.dtrDataModel.containsKey(bpn)) {
if (!this.dtrDataModel.get(bpn).contains(dtr))
if (!this.dtrDataModel.get(bpn).contains(dtr)){
this.dtrDataModel.get(bpn).add(dtr);
}
} else {
this.dtrDataModel.put(bpn, List.of(dtr));
this.dtrDataModel.put(bpn, new ArrayList<>(){{add(dtr);}});
}
}
return this;
Expand Down Expand Up @@ -420,13 +426,14 @@ private Runnable createAndSaveDtr(Dataset dataset, String bpn, String connection
public void run() {
try {
Offer offer = dataTransferService.buildOffer(dataset, 0);
IdResponse negotiationResponse = dataTransferService.doContractNegotiation(offer, bpn, CatenaXUtil.buildDataEndpoint(connectionUrl));
String builtDataEndpoint =CatenaXUtil.buildDataEndpoint(connectionUrl);
IdResponse negotiationResponse = dataTransferService.doContractNegotiation(offer, bpn, builtDataEndpoint);
if (negotiationResponse == null) {
return;
}
Negotiation negotiation = dataTransferService.seeNegotiation(negotiationResponse.getId());
if (negotiation == null) {
LogUtil.printWarning("Was not possible to do ContractNegotiation for URL: " + connectionUrl);
LogUtil.printWarning("It was not possible to do ContractNegotiation for URL: " + connectionUrl);
return;
}
Dtr dtr = new Dtr(negotiation.getContractAgreementId(), connectionUrl, offer.getAssetId(), bpn, DateTimeUtil.addHoursToCurrentTimestamp(dtrConfig.getTemporaryStorage().getLifetime()));
Expand All @@ -438,7 +445,7 @@ public void run() {
processManager.addSearchStatusDtr(processId, dtr);

} catch (Exception e) {
throw new ManagerException(this.getClass().getName() + ".createAndSaveDtr",e,"Was not possible to do ContractNegotiation for URL: " + connectionUrl);
throw new ManagerException(this.getClass().getName() + ".createAndSaveDtr",e,"Failed to save the dataModel for this connection url: " + connectionUrl);
}
}
};
Expand Down Expand Up @@ -511,7 +518,7 @@ private ConcurrentHashMap<String, List<Dtr>> loadDtrDataModel() {
LogUtil.printMessage("Loaded [" + result.size() + "] entries from DTR Data Model Json.");
return result;
} catch (Exception e) {
LogUtil.printException(e, "Was not possible to load Dtr Data Model!");
LogUtil.printException(e, "It was not possible to load Dtr Data Model!");
return new ConcurrentHashMap<String, List<Dtr>>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,6 @@ public void searchDTRs (List<String> bpnList, String processId) {
} catch (Exception e) {
throw new ServiceException(this.getClass().getName(), e, "Could not bind the reference type!");
}
if(this.dtrConfig.getInternalDtr() != null && !this.dtrConfig.getInternalDtr().isEmpty()) {
edcEndpointBinded.stream().filter(endpoint -> endpoint.getBpn().equals(vaultService.getLocalSecret("edc.participantId"))).forEach(endpoint -> {
endpoint.getConnectorEndpoint().add(this.dtrConfig.getInternalDtr());
});
}

Thread thread = ThreadUtil.runThread(dtrSearchManager.startProcess(edcEndpointBinded, processId), "ProcessDtrDataModel");
thread.join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ configuration:
centralUrl: 'https://semantics.int.demo.catena-x.net/registry'
endpointInterface: 'SUBMODEL-3.0'
dspEndpointKey: 'dspEndpoint'
internalDtr: "https://materialpass.int.demo.catena-x.net/BPNL000000000000" # -- If there is an internal DTR available it can be referenced here and will be injected in the list of DTRs
semanticIdTypeKey: 'Submodel'
decentralApis:
search: "/lookup/shells"
Expand Down
3 changes: 3 additions & 0 deletions deployment/helm/edc-consumer/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ irs-helm:
jwkSetUri: https://centralidp.int.demo.catena-x.net/auth/realms/CX-Central/protocol/openid-connect/certs

edc:
catalog:
policies:
allowedNames: "DPP, ID 3.0 Trace, ID 3.1 Trace, R2_Traceability, FrameworkAgreement.traceability, Membership"
controlplane:
endpoint:
data: https://materialpass.int.demo.catena-x.net/consumer/management
Expand Down
Loading

0 comments on commit 540ba25

Please sign in to comment.