-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dsp): preparatory work for 0.4.0, i.e. the new DSP
* feat(Deps): updates to the EDC snapshot and implements a version catalog * pr remarks * pr remarks feat(ControlPlaneAdapter): callback integration for transfer process (#293) * feat(ControlPlaneAdapter): callback integration for transfer process * pr remarks * adds E2E test for opening a transfer * pr remarks * pr remarks * pr remarks + fix due snapshot upgrade * switched to EDC 0.0.1-20230509-preview-SNAPSHOT feat(ControlPlaneAdapter): edr cache integration on TransferProcessStarted event (#328) * feat(ControlPlaneAdapter): edr cache integration on TransferProcessStarted event * trigger CI * removed seed from file feat: Data Plane extensions that implement DSP/AAS integration (#357) * Add DPF extensions * Updates and improcvements based on Paul's review feat(EdrManagementApi): open transfer refactor (#347) * feat(EdrManagementApi): refactor open transfer + dsp protocol switch * feat(EdrManagementApi): updates EDC to 0.0.1-milestone-9
- Loading branch information
1 parent
ccb221a
commit 554ea71
Showing
151 changed files
with
8,081 additions
and
1,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ on: | |
- releases | ||
- release/** | ||
- main | ||
- previews/** | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
|
@@ -49,26 +50,20 @@ jobs: | |
############## | ||
### Set-Up ### | ||
############## | ||
- | ||
uses: actions/[email protected] | ||
- | ||
uses: ./.github/actions/setup-java | ||
- | ||
name: Cache ContainerD Image Layers | ||
- uses: actions/[email protected] | ||
- uses: ./.github/actions/setup-java | ||
- name: Cache ContainerD Image Layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs | ||
key: ${{ runner.os }}-io.containerd.snapshotter.v1.overlayfs | ||
- | ||
name: Set-Up Kubectl | ||
- name: Set-Up Kubectl | ||
uses: azure/[email protected] | ||
- | ||
name: Helm Set-Up | ||
- name: Helm Set-Up | ||
uses: azure/[email protected] | ||
with: | ||
version: v3.8.1 | ||
- | ||
name: Create k8s Kind Cluster configuration (kind.config.yaml) | ||
- name: Create k8s Kind Cluster configuration (kind.config.yaml) | ||
run: |- | ||
export MAVEN_REPOSITORY=${{ github.workspace }}/.m2/repository | ||
cat << EOF > kind.config.yaml | ||
|
@@ -85,31 +80,27 @@ jobs: | |
- hostPath: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs | ||
containerPath: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs | ||
EOF | ||
- | ||
name: Create k8s Kind Cluster | ||
- name: Create k8s Kind Cluster | ||
uses: helm/[email protected] | ||
with: | ||
config: kind.config.yaml | ||
|
||
############################################## | ||
### Build and load recent images into KinD ### | ||
############################################## | ||
- | ||
name: Build edc-controlplane-postgresql-hashicorp-vault | ||
- name: Build edc-controlplane-postgresql-hashicorp-vault | ||
run: |- | ||
./gradlew :edc-controlplane:edc-controlplane-postgresql-hashicorp-vault:dockerize | ||
./gradlew :edc-controlplane:edc-controlplane-postgresql-hashicorp-vault:dockerize | ||
env: | ||
GITHUB_PACKAGE_USERNAME: ${{ github.actor }} | ||
GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build edc-dataplane-hashicorp-vault | ||
- name: Build edc-dataplane-hashicorp-vault | ||
run: |- | ||
./gradlew :edc-dataplane:edc-dataplane-hashicorp-vault:dockerize | ||
./gradlew :edc-dataplane:edc-dataplane-hashicorp-vault:dockerize | ||
env: | ||
GITHUB_PACKAGE_USERNAME: ${{ github.actor }} | ||
GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Load images into KinD | ||
- name: Load images into KinD | ||
run: |- | ||
docker tag edc-controlplane-postgresql-hashicorp-vault:latest edc-controlplane-postgresql-hashicorp-vault:business-test | ||
docker tag edc-dataplane-hashicorp-vault:latest edc-dataplane-hashicorp-vault:business-test | ||
|
@@ -118,8 +109,7 @@ jobs: | |
############################################ | ||
### Prepare And Install Test Environment ### | ||
############################################ | ||
- | ||
name: Define test environment variables | ||
- name: Define test environment variables | ||
run: |- | ||
# Define endpoints | ||
echo "SOKRATES_DATA_MANAGEMENT_API_AUTH_KEY=password" | tee -a ${GITHUB_ENV} | ||
|
@@ -141,8 +131,7 @@ jobs: | |
echo "PLATO_AWS_ACCESS_KEY_ID=platoqwerty123" | tee -a ${GITHUB_ENV} | ||
echo "SOKRATES_AWS_SECRET_ACCESS_KEY=sokratesqwerty123" | tee -a ${GITHUB_ENV} | ||
echo "SOKRATES_AWS_ACCESS_KEY_ID=sokratesqwerty123" | tee -a ${GITHUB_ENV} | ||
- | ||
name: Install infrastructure components via Helm | ||
- name: Install infrastructure components via Helm | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 10 | ||
|
@@ -151,21 +140,21 @@ jobs: | |
command: |- | ||
# Update helm dependencies | ||
helm dependency update edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure | ||
# Install the all-in-one supporting infrastructure environment (daps, vault, pgsql, minio) | ||
helm install infrastructure edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure \ | ||
--wait-for-jobs --timeout=120s | ||
|
||
# GH pipelines constrained by cpu, so give helm some time to register all resources \w k8s | ||
sleep 5s | ||
|
||
# Wait for supporting infrastructure to become ready (control-/data-plane, backend service) | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=idsdaps --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=idsdaps --tail 500 && exit 1 ) | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=vault --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=vault --tail 500 && exit 1 ) | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=sokrates-postgresql --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=sokrates-postgresql --tail 500 && exit 1 ) | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=plato-postgresql --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=plato-postgresql --tail 500 && exit 1 ) | ||
kubectl wait --for=condition=ready pod -l app=minio --timeout=120s || ( kubectl logs -l app=minio --tail 500 && exit 1 ) | ||
|
||
# Install Plato | ||
helm install plato charts/tractusx-connector \ | ||
--set fullnameOverride=plato \ | ||
|
@@ -233,10 +222,10 @@ jobs: | |
--set dataplane.aws.accessKeyId=sokratesqwerty123 \ | ||
--set backendService.httpProxyTokenReceiverUrl=http://backend:8080 \ | ||
--wait-for-jobs --timeout=120s | ||
|
||
# GH pipelines constrained by cpu, so give helm some time to register all resources \w k8s | ||
sleep 5s | ||
|
||
# Wait for Control-/DataPlane and backend-service to become ready | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=sokrates-controlplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=sokrates-controlplane --tail 500 && exit 1 ) | ||
kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=sokrates-dataplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=sokrates-dataplane --tail 500 && exit 1 ) | ||
|
@@ -246,8 +235,8 @@ jobs: | |
############################################## | ||
### Run Business Tests inside kind cluster ### | ||
############################################## | ||
- | ||
name: Run Business Tests | ||
- name: Run Business Tests | ||
continue-on-error: true | ||
run: |- | ||
cat << EOF >> pod.json | ||
{ | ||
|
@@ -332,8 +321,7 @@ jobs: | |
################# | ||
### Tear Down ### | ||
################# | ||
- | ||
name: Destroy the kind cluster | ||
- name: Destroy the kind cluster | ||
if: always() | ||
run: >- | ||
kind get clusters | xargs -n1 kind delete cluster --name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,6 @@ on: | |
pull_request: | ||
paths-ignore: | ||
- 'charts/**' | ||
branches: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.edc.spi.core) | ||
implementation(libs.edc.config.filesystem) | ||
implementation(libs.edc.util) | ||
|
||
implementation(project(":spi:edr-cache-spi")) | ||
} | ||
|
46 changes: 46 additions & 0 deletions
46
...edr-cache-core/src/main/java/org/eclipse/tractusx/edc/edr/core/EdrCacheCoreExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.edr.core; | ||
|
||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Inject; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Provider; | ||
import org.eclipse.edc.spi.monitor.Monitor; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
import org.eclipse.tractusx.edc.edr.core.defaults.InMemoryEndpointDataReferenceCache; | ||
import org.eclipse.tractusx.edc.edr.spi.EndpointDataReferenceCache; | ||
|
||
/** | ||
* Registers default services for the EDR cache. | ||
*/ | ||
@Extension(value = EdrCacheCoreExtension.NAME) | ||
public class EdrCacheCoreExtension implements ServiceExtension { | ||
static final String NAME = "EDR Cache Core"; | ||
|
||
@Inject | ||
private Monitor monitor; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Provider(isDefault = true) | ||
public EndpointDataReferenceCache edrCache(ServiceExtensionContext context) { | ||
return new InMemoryEndpointDataReferenceCache(); | ||
} | ||
|
||
} |
99 changes: 99 additions & 0 deletions
99
...n/java/org/eclipse/tractusx/edc/edr/core/defaults/InMemoryEndpointDataReferenceCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.edr.core.defaults; | ||
|
||
import org.eclipse.edc.spi.result.StoreResult; | ||
import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; | ||
import org.eclipse.edc.util.concurrency.LockManager; | ||
import org.eclipse.tractusx.edc.edr.spi.EndpointDataReferenceCache; | ||
import org.eclipse.tractusx.edc.edr.spi.EndpointDataReferenceEntry; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.*; | ||
import java.util.concurrent.locks.ReentrantReadWriteLock; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static java.util.stream.Collectors.toList; | ||
import static org.eclipse.edc.spi.result.StoreResult.notFound; | ||
import static org.eclipse.edc.spi.result.StoreResult.success; | ||
|
||
/** | ||
* An in-memory, threadsafe implementation of the cache. | ||
*/ | ||
public class InMemoryEndpointDataReferenceCache implements EndpointDataReferenceCache { | ||
private final LockManager lockManager; | ||
|
||
private final Map<String, List<EndpointDataReferenceEntry>> entriesByAssetId; | ||
private final Map<String, EndpointDataReferenceEntry> entriesByEdrId; | ||
private final Map<String, EndpointDataReference> edrsByTransferProcessId; | ||
|
||
public InMemoryEndpointDataReferenceCache() { | ||
lockManager = new LockManager(new ReentrantReadWriteLock()); | ||
entriesByAssetId = new HashMap<>(); | ||
entriesByEdrId = new HashMap<>(); | ||
edrsByTransferProcessId = new HashMap<>(); | ||
} | ||
|
||
@Override | ||
public @Nullable EndpointDataReference resolveReference(String transferProcessId) { | ||
return lockManager.readLock(() -> edrsByTransferProcessId.get(transferProcessId)); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public List<EndpointDataReference> referencesForAsset(String assetId) { | ||
var entries = entriesByAssetId.get(assetId); | ||
if (entries == null) { | ||
return emptyList(); | ||
} | ||
return entries.stream().map(e -> resolveReference(e.getTransferProcessId())).filter(Objects::nonNull).collect(toList()); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public List<EndpointDataReferenceEntry> entriesForAsset(String assetId) { | ||
return lockManager.readLock(() -> entriesByAssetId.getOrDefault(assetId, emptyList())); | ||
} | ||
|
||
@Override | ||
public void save(EndpointDataReferenceEntry entry, EndpointDataReference edr) { | ||
lockManager.writeLock(() -> { | ||
entriesByEdrId.put(edr.getId(), entry); | ||
var list = entriesByAssetId.computeIfAbsent(entry.getAssetId(), k -> new ArrayList<>()); | ||
list.add(entry); | ||
|
||
edrsByTransferProcessId.put(entry.getTransferProcessId(), edr); | ||
return null; | ||
}); | ||
} | ||
|
||
@Override | ||
public StoreResult<EndpointDataReferenceEntry> deleteByTransferProcessId(String id) { | ||
return lockManager.writeLock(() -> { | ||
var edr = edrsByTransferProcessId.remove(id); | ||
if (edr == null) { | ||
return notFound("EDR entry not found for id: " + id); | ||
} | ||
var entry = entriesByEdrId.get(edr.getId()); | ||
var entries = entriesByAssetId.get(entry.getAssetId()); | ||
entries.remove(entry); | ||
if (entries.isEmpty()) { | ||
entriesByAssetId.remove(entry.getAssetId()); | ||
} | ||
return success(entry); | ||
}); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...e-core/src/main/java/org/eclipse/tractusx/edc/edr/core/defaults/PersistentCacheEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.edr.core.defaults; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; | ||
import org.eclipse.tractusx.edc.edr.spi.EndpointDataReferenceEntry; | ||
|
||
/** | ||
* A wrapper to persist {@link EndpointDataReferenceEntry}s and {@link EndpointDataReference}s. | ||
*/ | ||
public class PersistentCacheEntry { | ||
private EndpointDataReferenceEntry edrEntry; | ||
private EndpointDataReference edr; | ||
|
||
public PersistentCacheEntry(@JsonProperty("edrEntry") EndpointDataReferenceEntry edrEntry, @JsonProperty("edr") EndpointDataReference edr) { | ||
this.edrEntry = edrEntry; | ||
this.edr = edr; | ||
} | ||
|
||
public EndpointDataReferenceEntry getEdrEntry() { | ||
return edrEntry; | ||
} | ||
|
||
public EndpointDataReference getEdr() { | ||
return edr; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...che-core/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Contributors: | ||
# Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
# | ||
# | ||
|
||
org.eclipse.tractusx.edc.edr.core.EdrCacheCoreExtension |
Oops, something went wrong.