Skip to content

Commit 4b6e747

Browse files
committed
.github/workflows/pre_aas.py: Create script to be executed before running test engines
1 parent 28aff0b commit 4b6e747

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.github/workflows/pre_aas.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import aas_core3.types as aas
2+
import aas_core3.jsonization as jsonization
3+
import requests
4+
5+
property = aas.Property(
6+
id_short="temperature",
7+
value_type=aas.DataTypeDefXSD.DOUBLE,
8+
value="22.3"
9+
)
10+
11+
submodel = aas.Submodel(
12+
id="urn:example:submodel:test",
13+
id_short="TestSubmodel",
14+
submodel_elements=[property]
15+
)
16+
17+
aas_obj = aas.AssetAdministrationShell(
18+
id="urn:example:aas:test",
19+
id_short="TestAAS",
20+
asset_information=aas.AssetInformation(
21+
asset_kind=aas.AssetKind.INSTANCE
22+
),
23+
submodels=[aas.Reference(
24+
type=aas.ReferenceTypes.EXTERNAL_REFERENCE,
25+
keys=[aas.Key(
26+
type=aas.KeyTypes.SUBMODEL,
27+
value=submodel.id
28+
)]
29+
)]
30+
)
31+
32+
submodel_json = jsonization.to_jsonable(submodel)
33+
aas_json = jsonization.to_jsonable(aas_obj)
34+
35+
BASE = "http://localhost:8000/shells"
36+
37+
resp1 = requests.post(BASE, json=aas_json)
38+
print(f"AAS upload: {resp1.status_code}")

0 commit comments

Comments
 (0)