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/update testdata script #416

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion local/testing/testdata/CX_Testdata_v1.5.0-AsPlanned.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
{
"@type": "Constraint",
"odrl:leftOperand": "idsc:PURPOSE",
"odrl:operator": "EQ",
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": "ID 3.0 Trace"
}
]
Expand Down
4 changes: 3 additions & 1 deletion local/testing/testdata/CX_Testdata_v1.5.0_AsBuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
{
"@type": "Constraint",
"odrl:leftOperand": "idsc:PURPOSE",
"odrl:operator": "EQ",
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": "ID 3.0 Trace"
}
]
Expand Down
18 changes: 8 additions & 10 deletions local/testing/testdata/transform-and-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,34 +465,32 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
submodel_name = tmp_key[tmp_key.index("#") + 1: len(tmp_key)]
submodel_identification = uuid.uuid4().urn
semantic_id = tmp_key
catenax_id_urn = catenax_id.replace('urn:uuid:', '')
submodel_identification_urn = submodel_identification.replace('urn:uuid:', '')
if is_ess and tmp_data["bpnl"] in bpnl_fail:
endpoint_address = f"http://idonotexist/{catenax_id_urn}-{submodel_identification_urn}/submodel?content=value&extent=withBlobValue"
endpoint_address = f"http://idonotexist/{catenax_id}-{submodel_identification}/submodel?content=value&extent=withBlobValue"
elif submodel_name == "EsrCertificateStateStatistic" and esr_url is not None:
endpoint_address = f"{esr_url}/{catenax_id_urn}/asBuilt/ISO14001/submodel"
endpoint_address = f"{esr_url}/{catenax_id}/asBuilt/ISO14001/submodel"
else:
endpoint_address = f"{edc_url}/{catenax_id_urn}-{submodel_identification_urn}/submodel?content=value&extent=withBlobValue"
endpoint_address = f"{edc_url}/{catenax_id}-{submodel_identification}/submodel?content=value&extent=withBlobValue"

if is_aas3:
endpoint_address = f"{edc_url}/shells/{catenax_id_urn}/submodels/{submodel_identification_urn}/submodel"
endpoint_address = f"{edc_url}/shells/{catenax_id}/submodels/{submodel_identification}/submodel"
descriptor = create_submodel_descriptor_3_0(submodel_name, submodel_identification, semantic_id,
endpoint_address,
f"{catenax_id_urn}-{submodel_identification_urn}",
f"{catenax_id}-{submodel_identification}",
edc_url)
submodel_descriptors.append(json.loads(descriptor))
else:
descriptor = create_submodel_descriptor(submodel_name, submodel_identification, semantic_id,
endpoint_address)
submodel_descriptors.append(json.loads(descriptor))

asset_prop_id = f"{catenax_id_urn}-{submodel_identification_urn}"
asset_prop_id = f"{catenax_id}-{submodel_identification}"

print("Create submodel on submodel server")
if tmp_data[tmp_key] != "":
payload = create_submodel_payload(tmp_data[tmp_key][0])
response = session.request(method="POST",
url=f"{submodel_upload_url}/data/{submodel_identification_urn}",
url=f"{submodel_upload_url}/data/{submodel_identification}",
headers=headers, data=payload)
print_response(response)

Expand All @@ -501,7 +499,7 @@ def create_registry_asset(edc_upload_urls_, edc_asset_path_, edc_contract_defini
if submodel_name == "EsrCertificateStateStatistic" and esr_url is not None:
payload = create_esr_edc_asset_payload(esr_url, asset_prop_id, catenax_id)
else:
payload = create_edc_asset_payload(submodel_url, asset_prop_id, submodel_identification_urn)
payload = create_edc_asset_payload(submodel_url, asset_prop_id, submodel_identification)
response = session.request(method="POST", url=asset_path, headers=headers_with_api_key,
data=payload)
print_response(response)
Expand Down