Skip to content

Commit

Permalink
Merge pull request #512 from catenax-ng/chore/fix-testdata-script
Browse files Browse the repository at this point in the history
Chore/fix testdata script
  • Loading branch information
ds-jhartmann authored Aug 31, 2023
2 parents ea4a805 + 659d154 commit 13f94c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
11 changes: 10 additions & 1 deletion local/testing/testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ twin with this BPN will be created with an invalid endpointAddress.
the testdata file and pass the id with this parameter. If nothing is provided, the default policy will be empty with the
id "default-policy".

**-bpns, --bpns <[BPNS ...] >**
**-bpns, --bpns <[BPN ...] >**
(Optional) A list of BPNs Filter upload to upload only specific BPNs

**-d, --dataplane <[URL ...] >**
(Optional) If specified, these public dataplane URLs will be displayed in the digital twin in attribute 'href'

**--aas3 <[BPN ...] >**
(Optional) Flag to create AAS assets according to version 3.0.1

**--allowedBPNs <[BPN ...] >**
(Optional) (Required for --aas3) A list of allowed BPNs which will be added to the specificAssetIds when creating DTR assets

**-h, --help**
Usage help. This lists all current command line options with a short description.
26 changes: 16 additions & 10 deletions local/testing/testdata/transform-and-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
parser.add_argument("--aas3", help="Create AAS assets in version 3.0", action='store_true', required=False)
parser.add_argument("-d", "--dataplane", type=str, nargs="*", help="EDC provider data plane display URLs",
required=False)
parser.add_argument("--allowedBPNs", type=str, nargs="*",
help="The allowed BPNs for digital twin registration in the registry.", required=False)

args = parser.parse_args()
config = vars(args)
Expand All @@ -346,6 +348,7 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
bpns_list = config.get("bpns")
is_aas3 = config.get("aas3")
dataplane_urls = config.get("dataplane")
allowedBPNs = config.get("allowedBPNs")

if is_aas3 and dataplane_urls is None:
raise ArgumentException("Dataplane URLs have to be specified with -d or --dataplane if --aas flag is set!")
Expand All @@ -361,6 +364,9 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
if aas_upload_url is None:
aas_upload_url = aas_url

if allowedBPNs is None:
allowedBPNs = []

registry_path = "/registry/shell-descriptors"
if is_aas3:
registry_path = "/shell-descriptors"
Expand Down Expand Up @@ -462,18 +468,18 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
"value": tmp_data["bpnl"]
})
if is_aas3:
keys = [{
"type": "GlobalReference",
"value": "PUBLIC_READABLE"
}]
for bpn in allowedBPNs:
keys.append({
"type": "GlobalReference",
"value": bpn
})
externalSubjectId = {
"type": "ExternalReference",
"keys": [
{
"type": "GlobalReference",
"value": "BPNL00000001CRHK"
},
{
"type": "GlobalReference",
"value": "PUBLIC_READABLE"
}
]
"keys": keys
}
for asset in specific_asset_ids_temp:
specific_asset_ids.append({
Expand Down

0 comments on commit 13f94c4

Please sign in to comment.