This folder contains Jython scripts intended to run inside Modelio with the ToscaDesigner module loaded.
Script: create_tosca_service_topology_templates.py
What it creates:
- one
ToscaModelpackage - one
TServiceTemplatepackage - one
TTopologyTemplateclass - optional topology
inputsandoutputsasTParameter
How to use:
- Open Modelio with ToscaDesigner enabled.
- Select a target package in the model browser.
- Edit the
CONFIGdictionary in the script. - Run the script from Modelio's script runner.
Script: create_tosca_templates_from_json.py
Sample spec: tosca_template_spec.sample.json
How to use:
- Copy
tosca_template_spec.sample.jsonto a project-specific JSON file. - Edit names, inputs, and outputs in your JSON.
- In the script, set
SPEC_PATHto your JSON file. - Select a target package in Modelio and run the script.
Example JSON:
{
"tosca_model_name": "TrafficToscaModel",
"service_template_name": "TrafficServiceTemplate",
"topology_template_name": "TrafficTopologyTemplate",
"inputs": [
{ "name": "cameraStreamUrl", "type": "string", "required": true, "default": "" },
{ "name": "replicas", "type": "integer", "required": false, "default": "1" }
],
"outputs": [
{ "name": "inferenceEndpoint", "type": "string", "required": true, "default": "" }
]
}- These scripts are transaction-safe: they rollback on exceptions.
- They use ToscaDesigner API proxies for linking service and topology templates.
- Inputs/outputs are attached to
TTopologyTemplateonly (TOSCA v1.3 compliant).