Skip to content

Commit

Permalink
Merge pull request #660 from catenax-ng/feature/#243-ESS-demo-script
Browse files Browse the repository at this point in the history
Feature/#243 ess demo script
  • Loading branch information
ds-jhartmann authored Nov 27, 2023
2 parents cb92327 + cec48bc commit 0de2ef1
Show file tree
Hide file tree
Showing 6 changed files with 928 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ESS
- Added 'hops' parameter to SupplyChainImpacted Aspect model - contains relative distance in the supply chain
- Added `impactedSuppliersOnFirstTier` parameter to Supply SupplyChainImpacted Aspect model - contains information of first level supply chain impacted
### Fixed
- Fixed incorrect passing of incidentBPNS for ESS Orders

### Known knowns
- [#253] Cancelation of order jobs is not working stable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private RegisterBpnInvestigationJob createRegisterBpnInvestigationBatchOrder(fin
.key(identificationKey)
.bomLifecycle(batchOrder.getBomLifecycle())
.callbackUrl(batchOrder.getCallbackUrl())
.incidentBPNSs(List.of())
.incidentBPNSs(batchOrder.getIncidentBPNSs())
.build();
}

Expand Down
85 changes: 85 additions & 0 deletions local/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# ess-demo.py

## Prerequisites

- Python 3.10 or higher
- Requirements need to be installed
```shell
pip install -r requirements.txt
```

## Usage

```shell
python ess-demo.py [ options ]
```

## Description

This script showcases the IRS ESS top-down investigation use-case.

The demo consists of four steps:

1. Request all digital twins of the provided Digital Twin Registry for the requested company.
2. Filter these Twins for the lifecycle asPlanned and collect their BPN and globalAssetId
3. Start an ESS Batch investigation with these twins
4. Wait for completion and print the result of the investigation

## Demo cases for IRS ESS INT environment

### Case 1 (incident and no issues in tree)

searchBPN: BPNL00ARBITRARY4
incidentBPNS: BPNS00ARBITRARY6

### Case 2 (no incident and no issues in tree)

searchBPN: BPNL00ARBITRARY4
incidentBPNS: BPNS00ARBITRARY8

### Case 3 (incident and not resolvable path in tree)

searchBPN: BPNL00ARBITRARY8
incidentBPNS: BPNS0ARBITRARY10

### Case 4 (no incident and not resolvable path in tree)

searchBPN: BPNL00ARBITRARY8
incidentBPNS: BPNS0ARBITRARY12

## Example usage

```shell
python ess-demo.py \
--aas "https://registry.example/api/v3.0/shell-descriptors" \
--ownBPN "BPNL0000000XYZ00" \
--searchBPN "BPNL0000000XYZ11" \
--incidentBPNS "BPNS0000000XYZ22" "BPNS0000000XYZ33" \
--irs "https://irs.example" \
--tokenurl "https://oauth2.example/auth/EXAMPLE/openid-connect/token" \
--clientid "exampleuser" \
--clientsecret "examplepass"
```

### Authentication

IRS is secured by OAuth2. This requires the user of this demo script to provide the token URL of the OAuth2 provider which is used by the IRS as well as a valid clientId and clientSecret.

For more information regarding IRS authentication, see: [Safety and security concepts](https://eclipse-tractusx.github.io/item-relationship-service/docs/arc42/full.html#_safety_and_security_concepts)

## Parameters

| Parameter | Example | Description |
|----------------|----------------------------------------------------------|--------------------------------------------------------------------|
| -h, --help | | show help message |
| --aas | https://registry.example/api/v3.0/shell-descriptors | AAS registry URL |
| --ownBPN | BPNL0000000XYZ00 | BPN of the requesting Company |
| --searchBPN | BPNL0000000XYZ11 | BPN of the Company to search for |
| --incidentBPNS | BPNS0000000XYZ22 BPNS0000000XYZ33 | List of BPNS of the Companies where the incidents occurred |
| --irs | https://irs.example | IRS base URL |
| --tokenurl | https://oauth2.example/auth/EXAMPLE/openid-connect/token | OAuth2 token URL |
| --clientid | exampleuser | Client ID |
| --clientsecret | examplepass | Client Secret |
| --batchsize | 10 | The batch size for a ESS investigation. Must be mod 10. Default 10 |
| --debug | | debug logging (optional) |

Loading

0 comments on commit 0de2ef1

Please sign in to comment.