diff --git a/.gitignore b/.gitignore
index 720bc090..bff2de7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,12 +24,6 @@ var/
.installed.cfg
*.egg
-# PyInstaller
-# Usually these files are written by a python script from a template
-# before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4475760d..c0f73bcd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,7 @@ It includes changes that are included in released version, but also changes plan
*This document only contain changes introduced in VSS-Tools 3.0 or later!*
-## Planned changes for VSS-Tools 6.0
+## Implemented changes for VSS-Tools 6.0
### Change in UUID handling.
@@ -16,6 +16,8 @@ the legacy uuid functionality.
* The parameters `--uuid`/`--no-uuid` are now removed.
+Columns (or similar) for UUID in generated output has also been removed.
+An exception is binary output which still contain a byte for UUID, however always 0.
## VSS-Tools 5.0
diff --git a/docs/ddsidl.md b/docs/ddsidl.md
index e4fd5845..344f4a77 100644
--- a/docs/ddsidl.md
+++ b/docs/ddsidl.md
@@ -48,12 +48,12 @@ Below elements are considered only if the switch `--all-idl-features` is supplie
### Input VSS block with "arraysize" attribute
| VSS | DDS-IDL |
|--------|----------------|
-|
Safety.SpeedLimit:
datatype : float[]
arraysize: 5
type: actuator
unit: m/s
description: Maximum allowed speed of the vehicle
| struct SpeedLimit{
string uuid;
sequence<float> value;
}
|
+| Safety.SpeedLimit:
datatype : float[]
arraysize: 5
type: actuator
unit: m/s
description: Maximum allowed speed of the vehicle
| struct SpeedLimit{
sequence<float> value;
}
|
### Input VSS block with "allowed" attribute
| VSS | DDS-IDL |
|--------|----------------|
-| Direction:
datatype:string
type: actuator
allowed: ['FORWARD','BACKWARD']
description: Driving direction of the vehicle
| module Direction_M {
enum DirectionValues{FORWARD,BACKWARD};
};
struct Direction
{
string uuid;
DirectionValues value;
};
+| Direction:
datatype:string
type: actuator
allowed: ['FORWARD','BACKWARD']
description: Driving direction of the vehicle
| module Direction_M {
enum DirectionValues{FORWARD,BACKWARD};
};
struct Direction
{
DirectionValues value;
};
To comply with DDS-IDL rules and limitations in IDL compilers VSS string literals that start with a digit will get a `d` as prefix.
diff --git a/docs/id.md b/docs/id.md
index c706fb15..0ce77a8d 100644
--- a/docs/id.md
+++ b/docs/id.md
@@ -25,7 +25,6 @@ identifiers.
│ [default: no-strict] │
│ --aborts -a [unknown-attribute|name-style] Abort on selected option. The '--strict' │
│ option enables all of them. │
-│ --uuid/--no-uuid Whether to add UUIDs. [default: no-uuid] │
│ --expand/--no-expand Whether to expand the tree. │
│ [default: expand] │
│ --overlays -l FILE Overlay files to apply on top of the vspec. │
diff --git a/docs/vspec.md b/docs/vspec.md
index 34c09275..b4761081 100644
--- a/docs/vspec.md
+++ b/docs/vspec.md
@@ -81,16 +81,6 @@ Terminates parsing, when the name of a signal does not follow [VSS Naming Conven
### --strict/--no-strict
Enables `--aborts unknown-attribute` and `--aborts name-style`
-### --uuid/--no-uuid
-Request the exporter to output UUIDs. The UUID generated is an RFC 4122 Version 5 UUID created from the qualified name
-of the node and the UUID of the namespace `vehicle_signal_specification`.
-
-Note that not all exporters support that arugment
-
-> [!WARNING]
-> The UUID feature is deprecated and will be removed in VSS-tools 6.0.
-> If you need identifiers consider using [vspec id exporter](id.md)
-
### --expand/--no-expand
By default all tools expand instance information so that instance information like "Row1" become a branch just like
@@ -359,7 +349,6 @@ Lets the exporter generate _all_ extended metadata attributes found in the model
| deprecation | x-deprecation |
| aggregate | x-aggregate |
| comment | x-comment |
-| uuid | x-uuid |
Not that strict JSON schema validators might not accept jsonschemas with such extra, non-standard entries.
@@ -382,12 +371,6 @@ If the paramter is set it will pretty-print the JSON output, otherwise you will
### --extended-all-attributes
Lets the exporter generate _all_ extended metadata attributes found in the model. By default the exporter is generating only those given by the `-e`/`--extended-attributes` parameter.
-## DDS-IDL exporter notes
-The DDS-IDL exporter never generates uuid, i.e. the `--uuid` option has no effect.
-
-## Graphql exporter notes
-The Graphql exporter never generates uuid, i.e. the `--uuid` option has no effect.
-
### --all-idl-features
Will also generate non-payload const attributes such as unit/datatype. Default is not to generate them/comment them out because at least Cyclone DDS and FastDDS do not support const. For more information check the [DDS-IDL exporter docs](ddsidl.md).
diff --git a/src/vss_tools/cli_options.py b/src/vss_tools/cli_options.py
index 4fd85d8d..554ca713 100644
--- a/src/vss_tools/cli_options.py
+++ b/src/vss_tools/cli_options.py
@@ -72,8 +72,6 @@ def validate_attribute(value):
show_choices=True,
)
-uuid_opt = option("--uuid/--no-uuid", help="Whether to add UUIDs.", show_default=True, default=False)
-
expand_opt = option(
"--expand/--no-expand",
default=True,
diff --git a/src/vss_tools/exporters/apigear.py b/src/vss_tools/exporters/apigear.py
index 1a7e4241..5f866ada 100644
--- a/src/vss_tools/exporters/apigear.py
+++ b/src/vss_tools/exporters/apigear.py
@@ -445,7 +445,6 @@ def export_apigear(
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
@@ -482,7 +481,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
@@ -502,7 +500,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
diff --git a/src/vss_tools/exporters/csv.py b/src/vss_tools/exporters/csv.py
index bd440734..3382ddbc 100644
--- a/src/vss_tools/exporters/csv.py
+++ b/src/vss_tools/exporters/csv.py
@@ -22,7 +22,7 @@
from vss_tools.utils.misc import getattr_nn
-def get_header(with_uuid: bool, entry_type: str, with_instance_column: bool) -> list[str]:
+def get_header(entry_type: str, with_instance_column: bool) -> list[str]:
row = [
entry_type,
"Type",
@@ -36,14 +36,12 @@ def get_header(with_uuid: bool, entry_type: str, with_instance_column: bool) ->
"Allowed",
"Default",
]
- if with_uuid:
- row.append("Id")
if with_instance_column:
row.append("Instances")
return row
-def add_rows(rows: list[list[Any]], root: VSSNode, with_uuid: bool, with_instance_column: bool) -> None:
+def add_rows(rows: list[list[Any]], root: VSSNode, with_instance_column: bool) -> None:
node: VSSNode
for node in PreOrderIter(root):
data = node.get_vss_data()
@@ -60,8 +58,6 @@ def add_rows(rows: list[list[Any]], root: VSSNode, with_uuid: bool, with_instanc
getattr_nn(data, "allowed", ""),
getattr_nn(data, "default", ""),
]
- if with_uuid:
- row.append(getattr_nn(node, "uuid", ""))
if with_instance_column:
row.append(getattr_nn(data, "instances", ""))
rows.append(row)
@@ -80,7 +76,6 @@ def write_csv(rows: list[list[Any]], output: Path):
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -94,7 +89,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -111,7 +105,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
@@ -124,13 +117,13 @@ def cli(
with_instance_column = not expand
entry_type = "Node" if generic_entry else "Signal"
- rows = [get_header(uuid, entry_type, with_instance_column)]
- add_rows(rows, tree, uuid, with_instance_column)
+ rows = [get_header(entry_type, with_instance_column)]
+ add_rows(rows, tree, with_instance_column)
if generic_entry and datatype_tree:
- add_rows(rows, datatype_tree, uuid, with_instance_column)
+ add_rows(rows, datatype_tree, with_instance_column)
write_csv(rows, output)
if not generic_entry and datatype_tree:
- rows = [get_header(uuid, "Node", with_instance_column)]
- add_rows(rows, datatype_tree, uuid, with_instance_column)
+ rows = [get_header("Node", with_instance_column)]
+ add_rows(rows, datatype_tree, with_instance_column)
write_csv(rows, types_output)
diff --git a/src/vss_tools/exporters/ddsidl.py b/src/vss_tools/exporters/ddsidl.py
index 263fe895..90728418 100644
--- a/src/vss_tools/exporters/ddsidl.py
+++ b/src/vss_tools/exporters/ddsidl.py
@@ -187,7 +187,7 @@ def get_allowed_enum_literal(name: str):
}
-def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: bool) -> None:
+def export_node(node: VSSNode, generate_all_idl_features: bool) -> None:
"""
This method is used to traverse VSS node and to create corresponding DDS IDL buffer string
"""
@@ -199,7 +199,7 @@ def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: b
idl_file_buffer.append("module " + getAllowedName(node.name))
idl_file_buffer.append("{")
for child in node.children:
- export_node(child, generate_uuid, generate_all_idl_features)
+ export_node(child, generate_all_idl_features)
idl_file_buffer.append("};")
idl_file_buffer.append("")
else:
@@ -233,8 +233,6 @@ def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: b
idl_file_buffer.append("struct " + getAllowedName(node.name))
idl_file_buffer.append("{")
- if generate_uuid:
- idl_file_buffer.append("string uuid;")
# fetching value of datatype and obtaining the equivalent DDS type
try:
if datatype:
@@ -372,11 +370,11 @@ def export_data_type_node(self, node: VSSNode):
self.str_buf += suffix
-def export_idl(file, root, generate_uuids=True, generate_all_idl_features=False):
+def export_idl(file, root, generate_all_idl_features=False):
"""This method is used to traverse through the root VSS node to build
-> DDS IDL equivalent string buffer and to serialize it acccordingly into a file
"""
- export_node(root, generate_uuids, generate_all_idl_features)
+ export_node(root, generate_all_idl_features)
file.write("\n".join(idl_file_buffer))
log.info("IDL file generated at location : " + file.name)
@@ -388,7 +386,6 @@ def export_idl(file, root, generate_uuids=True, generate_all_idl_features=False)
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
@@ -405,7 +402,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
@@ -421,7 +417,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
@@ -438,6 +433,5 @@ def cli(
export_idl(
idl_out,
tree,
- uuid,
all_idl_features,
)
diff --git a/src/vss_tools/exporters/franca.py b/src/vss_tools/exporters/franca.py
index 4fec6e50..14f8ec18 100644
--- a/src/vss_tools/exporters/franca.py
+++ b/src/vss_tools/exporters/franca.py
@@ -48,7 +48,7 @@ def print_franca_header(file, version="unknown"):
# Write the data lines
-def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) -> None:
+def print_franca_content(file: TextIOWrapper, root: VSSNode) -> None:
output = ""
node: VSSNode
for node in PreOrderIter(root):
@@ -64,8 +64,6 @@ def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) ->
datatype = getattr(data, "datatype", None)
if datatype:
output += f',\n\tdatatype: "{datatype}"'
- if with_uuid:
- output += f',\n\tuuid: "{node.uuid}"'
unit = getattr(data, "unit", None)
if unit:
output += f',\n\tunit: "{unit}"'
@@ -89,7 +87,6 @@ def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) ->
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
@@ -101,7 +98,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
@@ -117,12 +113,11 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
overlays=overlays,
)
with open(output, "w") as f:
print_franca_header(f, franca_vss_version)
- print_franca_content(f, tree, uuid)
+ print_franca_content(f, tree)
f.write("\n]")
diff --git a/src/vss_tools/exporters/id.py b/src/vss_tools/exporters/id.py
index 15494cc0..87af0454 100644
--- a/src/vss_tools/exporters/id.py
+++ b/src/vss_tools/exporters/id.py
@@ -140,7 +140,6 @@ def export_node(data: dict[str, Any], node: VSSNode, id_counter, strict_mode: bo
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -164,7 +163,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -183,7 +181,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
@@ -207,7 +204,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
diff --git a/src/vss_tools/exporters/json.py b/src/vss_tools/exporters/json.py
index f0b8e708..3911041a 100644
--- a/src/vss_tools/exporters/json.py
+++ b/src/vss_tools/exporters/json.py
@@ -22,8 +22,6 @@
def get_data(node: VSSNode, with_extra_attributes: bool = True, extended_attributes: tuple[str, ...] = ()):
data = node.data.as_dict(with_extra_attributes, extended_attributes=extended_attributes)
- if node.uuid:
- data["uuid"] = node.uuid
if len(node.children) > 0:
data["children"] = {}
for child in node.children:
@@ -38,7 +36,6 @@ def get_data(node: VSSNode, with_extra_attributes: bool = True, extended_attribu
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -54,7 +51,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -73,7 +69,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
diff --git a/src/vss_tools/exporters/jsonschema.py b/src/vss_tools/exporters/jsonschema.py
index d696eb65..d1974527 100644
--- a/src/vss_tools/exporters/jsonschema.py
+++ b/src/vss_tools/exporters/jsonschema.py
@@ -52,7 +52,6 @@
def export_node(
json_dict,
node: VSSNode,
- print_uuid: bool,
all_extended_attributes: bool,
no_additional_properties: bool,
require_all_properties: bool,
@@ -108,9 +107,6 @@ def export_node(
if data.comment:
json_dict[node.name]["x-comment"] = data.comment
- if print_uuid:
- json_dict[node.name]["x-uuid"] = node.uuid
-
for field in data.get_extra_attributes():
json_dict[node.name][field] = getattr(data, field)
@@ -125,7 +121,6 @@ def export_node(
export_node(
json_dict[node.name]["properties"],
child,
- print_uuid,
all_extended_attributes,
no_additional_properties,
require_all_properties,
@@ -139,7 +134,6 @@ def export_node(
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -164,7 +158,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -184,7 +177,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
@@ -201,7 +193,6 @@ def cli(
export_node(
signals_json_schema,
tree,
- uuid,
extend_all_attributes,
no_additional_properties,
require_all_properties,
@@ -213,7 +204,6 @@ def cli(
export_node(
data_types_json_schema,
datatype_tree,
- uuid,
extend_all_attributes,
no_additional_properties,
require_all_properties,
diff --git a/src/vss_tools/exporters/samm/__init__.py b/src/vss_tools/exporters/samm/__init__.py
index 7c93f24a..bdd0c4f4 100644
--- a/src/vss_tools/exporters/samm/__init__.py
+++ b/src/vss_tools/exporters/samm/__init__.py
@@ -36,13 +36,13 @@ def __setup_environment(output_namespace, vspec_version, split_depth: int) -> No
cfg.init(output_namespace, vspec_version, split_depth)
global VSSConcepts
- VSSConcepts = importlib.import_module("vss_tools.vspec.exporters.samm.helpers.samm_concepts").VSSConcepts
+ VSSConcepts = importlib.import_module("vss_tools.exporters.samm.helpers.samm_concepts").VSSConcepts
global vss_helper
- vss_helper = importlib.import_module("vss_tools.vspec.exporters.samm.helpers.vss_helper")
+ vss_helper = importlib.import_module("vss_tools.exporters.samm.helpers.vss_helper")
global ttl_helper
- ttl_helper = importlib.import_module("vss_tools.vspec.exporters.samm.helpers.ttl_helper")
+ ttl_helper = importlib.import_module("vss_tools.exporters.samm.helpers.ttl_helper")
# TODO: Currently this is a workaround to read the Vehicle.VersionVSS, which is provided from COVESA/VSS
@@ -153,7 +153,6 @@ def __get_version_vss(vss_tree: VSSNode) -> str:
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
@@ -166,7 +165,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
@@ -191,7 +189,7 @@ def cli(
# Just keep in mind that this might lead to some additional logic,
# to make sure that each case is handled correctly.
vss_tree, datatype_tree = get_trees(
- vspec, include_dirs, aborts, strict, extended_attributes, uuid, quantities, units, types, overlays, False
+ vspec, include_dirs, aborts, strict, extended_attributes, quantities, units, types, overlays, False
)
# Get the VSS version from the vss_tree::VersionVSS
diff --git a/src/vss_tools/exporters/tree.py b/src/vss_tools/exporters/tree.py
index 4f778376..08b74a34 100644
--- a/src/vss_tools/exporters/tree.py
+++ b/src/vss_tools/exporters/tree.py
@@ -39,7 +39,6 @@ def get_rendered_tree(tree: VSSNode, attributes: tuple[str]) -> str:
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -52,7 +51,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -70,7 +68,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
diff --git a/src/vss_tools/exporters/yaml.py b/src/vss_tools/exporters/yaml.py
index da436620..ba86cd5c 100644
--- a/src/vss_tools/exporters/yaml.py
+++ b/src/vss_tools/exporters/yaml.py
@@ -54,7 +54,6 @@ def write_line_break(self, data=None):
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
-@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
@@ -69,7 +68,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
- uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
@@ -87,7 +85,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
- uuid=uuid,
quantities=quantities,
units=units,
types=types,
diff --git a/src/vss_tools/main.py b/src/vss_tools/main.py
index 5a3b8faf..95e73125 100644
--- a/src/vss_tools/main.py
+++ b/src/vss_tools/main.py
@@ -188,7 +188,6 @@ def get_trees(
aborts: tuple[str, ...] = (),
strict: bool = False,
extended_attributes: tuple[str, ...] = (),
- uuid: bool = False,
quantities: tuple[Path, ...] = (),
units: tuple[Path, ...] = (),
types: tuple[Path, ...] = (),
@@ -228,10 +227,6 @@ def get_trees(
if expand:
root.expand_instances()
- if uuid:
- log.warning("UUID support is deprecated and will be removed in VSS-tools 6.0")
- root.add_uuids()
-
try:
root.resolve()
except ModelValidationException as e:
diff --git a/src/vss_tools/tree.py b/src/vss_tools/tree.py
index 69693279..02786fb6 100644
--- a/src/vss_tools/tree.py
+++ b/src/vss_tools/tree.py
@@ -8,7 +8,6 @@
from __future__ import annotations
import re
-import uuid
from copy import deepcopy
from typing import Any
@@ -63,7 +62,6 @@ class VSSNode(Node): # type: ignore[misc]
def __init__(self, name: str, fqn: str | None, data: dict[str, Any], **kwargs: Any) -> None:
super().__init__(name, **kwargs)
self.data = get_vss_raw(data, fqn)
- self.uuid: str | None = None
def copy(self) -> VSSNode:
node = VSSNode(
@@ -142,13 +140,6 @@ def merge(self, other: VSSNode) -> None:
else:
child.parent = self
- def add_uuids(self) -> None:
- VSS_NAMESPACE = "vehicle_signal_specification"
- namespace_uuid = uuid.uuid5(uuid.NAMESPACE_OID, VSS_NAMESPACE)
- node: VSSNode
- for node in PreOrderIter(self):
- node.uuid = uuid.uuid5(namespace_uuid, node.get_fqn()).hex
-
def get_instance_nodes(self) -> tuple[VSSNode, ...]:
return findall(
self,
@@ -317,8 +308,6 @@ def as_flat_dict(self, with_extra_attributes: bool, extended_attributes: tuple[s
for node in PreOrderIter(self):
key = node.get_fqn()
data[key] = node.data.as_dict(with_extra_attributes, extended_attributes=extended_attributes)
- if node.uuid:
- data[key]["uuid"] = node.uuid
return data
diff --git a/tests/vspec/test_datatypes/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl b/tests/vspec/test_datatypes/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
new file mode 100644
index 00000000..e6e93136
--- /dev/null
+++ b/tests/vspec/test_datatypes/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
@@ -0,0 +1,179 @@
+@prefix : .
+@prefix samm: .
+@prefix samm-c: .
+@prefix unit: .
+@prefix xsd: .
+
+:A a samm:Aspect ;
+ samm:events () ;
+ samm:operations () ;
+ samm:preferredName "A"@en ;
+ samm:properties ( :a ) .
+
+:a a samm:Property ;
+ samm:characteristic :ACharacteristic ;
+ samm:preferredName "A"@en .
+
+:double a samm:Property ;
+ samm:characteristic :DoubleCharacteristic ;
+ samm:preferredName "Double"@en .
+
+:float a samm:Property ;
+ samm:characteristic :FloatCharacteristic ;
+ samm:preferredName "Float"@en .
+
+:int16 a samm:Property ;
+ samm:characteristic :Int16Characteristic ;
+ samm:preferredName "Int16"@en .
+
+:int32 a samm:Property ;
+ samm:characteristic :Int32Characteristic ;
+ samm:preferredName "Int32"@en .
+
+:int64 a samm:Property ;
+ samm:characteristic :Int64Characteristic ;
+ samm:preferredName "Int64"@en .
+
+:int8 a samm:Property ;
+ samm:characteristic :Int8Characteristic ;
+ samm:preferredName "Int8"@en .
+
+:isBoolean a samm:Property ;
+ samm:characteristic :IsBooleanCharacteristic ;
+ samm:preferredName "Is Boolean"@en .
+
+:uInt16 a samm:Property ;
+ samm:characteristic :UInt16Characteristic ;
+ samm:preferredName "U Int16"@en .
+
+:uInt32 a samm:Property ;
+ samm:characteristic :UInt32Characteristic ;
+ samm:preferredName "U Int32"@en .
+
+:uInt64 a samm:Property ;
+ samm:characteristic :UInt64Characteristic ;
+ samm:preferredName "U Int64"@en .
+
+:uInt8 a samm:Property ;
+ samm:characteristic :UInt8Characteristic ;
+ samm:preferredName "U Int8"@en .
+
+:ACharacteristic a samm:Characteristic ;
+ samm:dataType :AEntity ;
+ samm:description """
+VSS path : A
+
+Description: Branch A."""@en ;
+ samm:name "ACharacteristic" .
+
+:AEntity a samm:Entity ;
+ samm:properties ( [ samm:property :uInt8; samm:payloadName "uInt8" ] [ samm:property :int8; samm:payloadName "int8" ] [ samm:property :uInt16; samm:payloadName "uInt16" ] [ samm:property :int16; samm:payloadName "int16" ] [ samm:property :uInt32; samm:payloadName "uInt32" ] [ samm:property :int32; samm:payloadName "int32" ] [ samm:property :uInt64; samm:payloadName "uInt64" ] [ samm:property :int64; samm:payloadName "int64" ] [ samm:property :isBoolean; samm:payloadName "isBoolean" ] [ samm:property :float; samm:payloadName "float" ] [ samm:property :double; samm:payloadName "double" ] ) .
+
+:DoubleCharacteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:double ;
+ samm:description """
+VSS path : A.Double
+
+Description: A double.
+
+Unit : km"""@en .
+
+:FloatCharacteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.Float
+
+Description: A float.
+
+Unit : km"""@en .
+
+:Int16Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:short ;
+ samm:description """
+VSS path : A.Int16
+
+Description: An int16.
+
+Unit : km"""@en .
+
+:Int32Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:int ;
+ samm:description """
+VSS path : A.Int32
+
+Description: An int32
+
+Unit : km"""@en .
+
+:Int64Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:long ;
+ samm:description """
+VSS path : A.Int64
+
+Description: An int64
+
+Unit : km"""@en .
+
+:Int8Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.Int8
+
+Description: An int8.
+
+Unit : km"""@en .
+
+:IsBooleanCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:boolean ;
+ samm:description """
+VSS path : A.IsBoolean
+
+Description: A boolean"""@en .
+
+:UInt16Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:unsignedShort ;
+ samm:description """
+VSS path : A.UInt16
+
+Description: A uint16.
+
+Unit : km"""@en .
+
+:UInt32Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:unsignedShort ;
+ samm:description """
+VSS path : A.UInt32
+
+Description: A uint32.
+
+Unit : km"""@en .
+
+:UInt64Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:unsignedLong ;
+ samm:description """
+VSS path : A.UInt64
+
+Description: A uint64.
+
+Unit : km"""@en .
+
+:UInt8Characteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:unsignedByte ;
+ samm:description """
+VSS path : A.UInt8
+
+Description: A uint8.
+
+Unit : km"""@en .
+
+
diff --git a/tests/vspec/test_generic.py b/tests/vspec/test_generic.py
index 2d6c80ed..121c7a40 100644
--- a/tests/vspec/test_generic.py
+++ b/tests/vspec/test_generic.py
@@ -16,13 +16,14 @@
HERE = Path(__file__).resolve().parent
TEST_UNITS = HERE / "test_units.yaml"
TEST_QUANT = HERE / "test_quantities.yaml"
+DEFAULT_TEST_FILE = "test.vspec"
def default_directories() -> list:
directories = []
for path in HERE.iterdir():
if path.is_dir():
- if list(path.rglob("*.vspec")):
+ if list(path.rglob(DEFAULT_TEST_FILE)):
# Exclude directories with custom made python file
if not list(path.rglob("*.py")):
directories.append(path)
@@ -35,21 +36,25 @@ def idfn(directory: pathlib.PosixPath):
def run_exporter(directory, exporter, tmp_path):
- vspec = directory / "test.vspec"
+ vspec = directory / DEFAULT_TEST_FILE
types = directory / "types.vspec"
output = tmp_path / f"out.{exporter}"
expected = directory / f"expected.{exporter}"
if not expected.exists():
+ # If you want find directory/exporter combinations not yet covered enable the assert
+ # assert False, f"Folder {expected} not found"
return
cmd = f"vspec export {exporter} -u {TEST_UNITS} -q {TEST_QUANT} --vspec {vspec} "
if types.exists():
cmd += f" --types {types}"
if exporter in ["apigear"]:
cmd += f" --output-dir {output}"
+ elif exporter in ["samm"]:
+ cmd += f" --target-folder {output}"
else:
cmd += f" --output {output}"
subprocess.run(cmd.split(), check=True)
- if exporter in ["apigear"]:
+ if exporter in ["apigear", "samm"]:
dcmp = filecmp.dircmp(output, expected)
assert not (dcmp.diff_files or dcmp.left_only or dcmp.right_only)
else:
@@ -60,7 +65,7 @@ def run_exporter(directory, exporter, tmp_path):
def test_exporters(directory, tmp_path):
# Run all "supported" exporters, i.e. not those in contrib
# Exception is "binary", as it is assumed output may vary depending on target
- exporters = ["apigear", "json", "jsonschema", "ddsidl", "csv", "yaml", "franca", "graphql", "go"]
+ exporters = ["apigear", "json", "jsonschema", "ddsidl", "csv", "yaml", "franca", "graphql", "go", "samm"]
for exporter in exporters:
run_exporter(directory, exporter, tmp_path)
diff --git a/tests/vspec/test_instances/expected.go b/tests/vspec/test_instances/expected.go
new file mode 100644
index 00000000..98dc3366
--- /dev/null
+++ b/tests/vspec/test_instances/expected.go
@@ -0,0 +1,16 @@
+package vss
+
+type A struct {
+ B B
+}
+type B struct {
+ Row1 BI1
+ Row2 BI1
+}
+type BI1 struct {
+ Left BI2
+ Right BI2
+}
+type BI2 struct {
+ C int8
+}
diff --git a/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl b/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
new file mode 100644
index 00000000..72a0f3d4
--- /dev/null
+++ b/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
@@ -0,0 +1,25 @@
+@prefix : .
+@prefix samm: .
+
+:A a samm:Aspect ;
+ samm:events () ;
+ samm:operations () ;
+ samm:preferredName "A"@en ;
+ samm:properties ( :a ) .
+
+:a a samm:Property ;
+ samm:characteristic :ACharacteristic ;
+ samm:preferredName "A"@en .
+
+:ACharacteristic a samm:Characteristic ;
+ samm:dataType :AEntity ;
+ samm:description """
+VSS path : A
+
+Description: Branch A."""@en ;
+ samm:name "ACharacteristic" .
+
+:AEntity a samm:Entity ;
+ samm:properties ( [ samm:property :b; samm:payloadName "b" ] ) .
+
+
diff --git a/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/B.ttl b/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/B.ttl
new file mode 100644
index 00000000..c25cca76
--- /dev/null
+++ b/tests/vspec/test_instances/expected.samm/com.covesa.vss.spec/1.0.0/B.ttl
@@ -0,0 +1,78 @@
+@prefix : .
+@prefix samm: .
+@prefix samm-c: .
+@prefix unit: .
+@prefix xsd: .
+
+:B a samm:Aspect ;
+ samm:events () ;
+ samm:operations () ;
+ samm:preferredName "B"@en ;
+ samm:properties ( :b ) .
+
+:b a samm:Property ;
+ samm:characteristic :BInstanceSingleEntity ;
+ samm:preferredName "B"@en .
+
+:bRow1 a samm:Property ;
+ samm:characteristic :BRowSingleEntity ;
+ samm:preferredName "B Row1"@en .
+
+:bRow2 a samm:Property ;
+ samm:characteristic :BRowSingleEntity ;
+ samm:preferredName "B Row2"@en .
+
+:bRowLeft a samm:Property ;
+ samm:characteristic :BCharacteristic ;
+ samm:preferredName "B Row Left"@en .
+
+:bRowRight a samm:Property ;
+ samm:characteristic :BCharacteristic ;
+ samm:preferredName "B Row Right"@en .
+
+:c a samm:Property ;
+ samm:characteristic :CCharacteristic ;
+ samm:preferredName "C"@en .
+
+:BEntity a samm:Entity ;
+ samm:properties ( [ samm:property :c; samm:payloadName "c" ] ) .
+
+:BInstanceEntity a samm:Entity ;
+ samm:properties ( [ samm:property :bRow1; samm:optional true; samm:payloadName "row1" ] [ samm:property :bRow2; samm:optional true; samm:payloadName "row2" ] ) .
+
+:BInstanceSingleEntity a samm-c:SingleEntity ;
+ samm:dataType :BInstanceEntity ;
+ samm:name "BInstance" ;
+ samm:preferredName "B Instance"@en .
+
+:BRowEntity a samm:Entity ;
+ samm:properties ( [ samm:property :bRowLeft; samm:optional true; samm:payloadName "left" ] [ samm:property :bRowRight; samm:optional true; samm:payloadName "right" ] ) .
+
+:CCharacteristic a samm-c:Measurement ;
+ samm-c:unit unit:kilometre ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.B.C
+
+Description: This description will also exist multiple times.
+
+Comment : As well as this comment.
+
+Unit : km"""@en .
+
+:BCharacteristic a samm:Characteristic ;
+ samm:dataType :BEntity ;
+ samm:description """
+VSS path : A.B
+
+Description: This description will be duplicated.
+
+Comment : This comment will be duplicated"""@en ;
+ samm:name "BCharacteristic" .
+
+:BRowSingleEntity a samm-c:SingleEntity ;
+ samm:dataType :BRowEntity ;
+ samm:name "BRow" ;
+ samm:preferredName "B Row"@en .
+
+
diff --git a/tests/vspec/test_min_max/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl b/tests/vspec/test_min_max/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
new file mode 100644
index 00000000..9449664c
--- /dev/null
+++ b/tests/vspec/test_min_max/expected.samm/com.covesa.vss.spec/1.0.0/A.ttl
@@ -0,0 +1,291 @@
+@prefix : .
+@prefix samm: .
+@prefix samm-c: .
+@prefix xsd: .
+
+:A a samm:Aspect ;
+ samm:events () ;
+ samm:operations () ;
+ samm:preferredName "A"@en ;
+ samm:properties ( :a ) .
+
+:a a samm:Property ;
+ samm:characteristic :ACharacteristic ;
+ samm:preferredName "A"@en .
+
+:floatMaxZero a samm:Property ;
+ samm:characteristic :FloatMaxZeroTrait ;
+ samm:preferredName "Float Max Zero"@en .
+
+:floatMaxZeroInt a samm:Property ;
+ samm:characteristic :FloatMaxZeroIntTrait ;
+ samm:preferredName "Float Max Zero Int"@en .
+
+:floatMinMax a samm:Property ;
+ samm:characteristic :FloatMinMaxTrait ;
+ samm:preferredName "Float Min Max"@en .
+
+:floatMinZero a samm:Property ;
+ samm:characteristic :FloatMinZeroTrait ;
+ samm:preferredName "Float Min Zero"@en .
+
+:floatMinZeroInt a samm:Property ;
+ samm:characteristic :FloatMinZeroIntTrait ;
+ samm:preferredName "Float Min Zero Int"@en .
+
+:floatNoMinMax a samm:Property ;
+ samm:characteristic :FloatNoMinMaxCharacteristic ;
+ samm:preferredName "Float No Min Max"@en .
+
+:floatOnlyMax a samm:Property ;
+ samm:characteristic :FloatOnlyMaxTrait ;
+ samm:preferredName "Float Only Max"@en .
+
+:floatOnlyMin a samm:Property ;
+ samm:characteristic :FloatOnlyMinTrait ;
+ samm:preferredName "Float Only Min"@en .
+
+:intMaxZero a samm:Property ;
+ samm:characteristic :IntMaxZeroTrait ;
+ samm:preferredName "Int Max Zero"@en .
+
+:intMinMax a samm:Property ;
+ samm:characteristic :IntMinMaxTrait ;
+ samm:preferredName "Int Min Max"@en .
+
+:intMinZero a samm:Property ;
+ samm:characteristic :IntMinZeroTrait ;
+ samm:preferredName "Int Min Zero"@en .
+
+:intNoMinMax a samm:Property ;
+ samm:characteristic :IntNoMinMaxCharacteristic ;
+ samm:preferredName "Int No Min Max"@en .
+
+:intOnlyMax a samm:Property ;
+ samm:characteristic :IntOnlyMaxTrait ;
+ samm:preferredName "Int Only Max"@en .
+
+:intOnlyMin a samm:Property ;
+ samm:characteristic :IntOnlyMinTrait ;
+ samm:preferredName "Int Only Min"@en .
+
+:ACharacteristic a samm:Characteristic ;
+ samm:dataType :AEntity ;
+ samm:description """
+VSS path : A
+
+Description: Branch A."""@en ;
+ samm:name "ACharacteristic" .
+
+:AEntity a samm:Entity ;
+ samm:properties ( [ samm:property :intNoMinMax; samm:payloadName "intNoMinMax" ] [ samm:property :intOnlyMax; samm:payloadName "intOnlyMax" ] [ samm:property :intOnlyMin; samm:payloadName "intOnlyMin" ] [ samm:property :intMinMax; samm:payloadName "intMinMax" ] [ samm:property :intMaxZero; samm:payloadName "intMaxZero" ] [ samm:property :intMinZero; samm:payloadName "intMinZero" ] [ samm:property :floatNoMinMax; samm:payloadName "floatNoMinMax" ] [ samm:property :floatOnlyMax; samm:payloadName "floatOnlyMax" ] [ samm:property :floatOnlyMin; samm:payloadName "floatOnlyMin" ] [ samm:property :floatMinMax; samm:payloadName "floatMinMax" ] [ samm:property :floatMaxZero; samm:payloadName "floatMaxZero" ] [ samm:property :floatMinZero; samm:payloadName "floatMinZero" ] [ samm:property :floatMaxZeroInt; samm:payloadName "floatMaxZeroInt" ] [ samm:property :floatMinZeroInt; samm:payloadName "floatMinZeroInt" ] ) .
+
+:FloatMaxZeroBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatMaxZero
+
+Description: Max Zero."""@en .
+
+:FloatMaxZeroConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "0.0"^^xsd:float ;
+ samm:name "FloatMaxZeroConstraint" .
+
+:FloatMaxZeroIntBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatMaxZeroInt
+
+Description: Max Zero."""@en .
+
+:FloatMaxZeroIntConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "0"^^xsd:float ;
+ samm:name "FloatMaxZeroIntConstraint" .
+
+:FloatMaxZeroIntTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatMaxZeroIntBaseCharacteristic ;
+ samm-c:constraint :FloatMaxZeroIntConstraint ;
+ samm:name "FloatMaxZeroIntTrait" .
+
+:FloatMaxZeroTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatMaxZeroBaseCharacteristic ;
+ samm-c:constraint :FloatMaxZeroConstraint ;
+ samm:name "FloatMaxZeroTrait" .
+
+:FloatMinMaxBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatMinMax
+
+Description: Min & Max."""@en .
+
+:FloatMinMaxConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "236723.4"^^xsd:float ;
+ samm-c:minValue "-165.56323"^^xsd:float ;
+ samm:name "FloatMinMaxConstraint" .
+
+:FloatMinMaxTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatMinMaxBaseCharacteristic ;
+ samm-c:constraint :FloatMinMaxConstraint ;
+ samm:name "FloatMinMaxTrait" .
+
+:FloatMinZeroBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatMinZero
+
+Description: Min Zero."""@en .
+
+:FloatMinZeroConstraint a samm-c:RangeConstraint ;
+ samm-c:minValue "0.0"^^xsd:float ;
+ samm:name "FloatMinZeroConstraint" .
+
+:FloatMinZeroIntBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatMinZeroInt
+
+Description: Min Zero."""@en .
+
+:FloatMinZeroIntConstraint a samm-c:RangeConstraint ;
+ samm-c:minValue "0"^^xsd:float ;
+ samm:name "FloatMinZeroIntConstraint" .
+
+:FloatMinZeroIntTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatMinZeroIntBaseCharacteristic ;
+ samm-c:constraint :FloatMinZeroIntConstraint ;
+ samm:name "FloatMinZeroIntTrait" .
+
+:FloatMinZeroTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatMinZeroBaseCharacteristic ;
+ samm-c:constraint :FloatMinZeroConstraint ;
+ samm:name "FloatMinZeroTrait" .
+
+:FloatNoMinMaxCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatNoMinMax
+
+Description: No Min Max."""@en .
+
+:FloatOnlyMaxBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatOnlyMax
+
+Description: Only Max."""@en .
+
+:FloatOnlyMaxConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "32.3"^^xsd:float ;
+ samm:name "FloatOnlyMaxConstraint" .
+
+:FloatOnlyMaxTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatOnlyMaxBaseCharacteristic ;
+ samm-c:constraint :FloatOnlyMaxConstraint ;
+ samm:name "FloatOnlyMaxTrait" .
+
+:FloatOnlyMinBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:float ;
+ samm:description """
+VSS path : A.FloatOnlyMin
+
+Description: Only Min."""@en .
+
+:FloatOnlyMinConstraint a samm-c:RangeConstraint ;
+ samm-c:minValue "-2.5"^^xsd:float ;
+ samm:name "FloatOnlyMinConstraint" .
+
+:FloatOnlyMinTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :FloatOnlyMinBaseCharacteristic ;
+ samm-c:constraint :FloatOnlyMinConstraint ;
+ samm:name "FloatOnlyMinTrait" .
+
+:IntMaxZeroBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntMaxZero
+
+Description: Max Zero."""@en .
+
+:IntMaxZeroConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "0"^^xsd:byte ;
+ samm:name "IntMaxZeroConstraint" .
+
+:IntMaxZeroTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :IntMaxZeroBaseCharacteristic ;
+ samm-c:constraint :IntMaxZeroConstraint ;
+ samm:name "IntMaxZeroTrait" .
+
+:IntMinMaxBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntMinMax
+
+Description: Min & Max."""@en .
+
+:IntMinMaxConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "6"^^xsd:byte ;
+ samm-c:minValue "3"^^xsd:byte ;
+ samm:name "IntMinMaxConstraint" .
+
+:IntMinMaxTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :IntMinMaxBaseCharacteristic ;
+ samm-c:constraint :IntMinMaxConstraint ;
+ samm:name "IntMinMaxTrait" .
+
+:IntMinZeroBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntMinZero
+
+Description: Min Zero."""@en .
+
+:IntMinZeroConstraint a samm-c:RangeConstraint ;
+ samm-c:minValue "0"^^xsd:byte ;
+ samm:name "IntMinZeroConstraint" .
+
+:IntMinZeroTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :IntMinZeroBaseCharacteristic ;
+ samm-c:constraint :IntMinZeroConstraint ;
+ samm:name "IntMinZeroTrait" .
+
+:IntNoMinMaxCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntNoMinMax
+
+Description: No Min Max."""@en .
+
+:IntOnlyMaxBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntOnlyMax
+
+Description: Only Max."""@en .
+
+:IntOnlyMaxConstraint a samm-c:RangeConstraint ;
+ samm-c:maxValue "32"^^xsd:byte ;
+ samm:name "IntOnlyMaxConstraint" .
+
+:IntOnlyMaxTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :IntOnlyMaxBaseCharacteristic ;
+ samm-c:constraint :IntOnlyMaxConstraint ;
+ samm:name "IntOnlyMaxTrait" .
+
+:IntOnlyMinBaseCharacteristic a samm:Characteristic ;
+ samm:dataType xsd:byte ;
+ samm:description """
+VSS path : A.IntOnlyMin
+
+Description: Only Min."""@en .
+
+:IntOnlyMinConstraint a samm-c:RangeConstraint ;
+ samm-c:minValue "3"^^xsd:byte ;
+ samm:name "IntOnlyMinConstraint" .
+
+:IntOnlyMinTrait a samm-c:Trait ;
+ samm-c:baseCharacteristic :IntOnlyMinBaseCharacteristic ;
+ samm-c:constraint :IntOnlyMinConstraint ;
+ samm:name "IntOnlyMinTrait" .
+
+
diff --git a/tests/vspec/test_types_with_uuid/test_uuid.py b/tests/vspec/test_types_with_uuid/test_uuid.py
index 16fb7195..0b8fb3f5 100644
--- a/tests/vspec/test_types_with_uuid/test_uuid.py
+++ b/tests/vspec/test_types_with_uuid/test_uuid.py
@@ -6,41 +6,20 @@
#
# SPDX-License-Identifier: MPL-2.0
-import filecmp
import subprocess
from pathlib import Path
+import pytest
+
HERE = Path(__file__).resolve().parent
TEST_UNITS = HERE / ".." / "test_units.yaml"
TEST_QUANT = HERE / ".." / "test_quantities.yaml"
-def run_exporter(exporter, argument, compare_suffix, tmp_path):
- vspec = HERE / "test.vspec"
- out = tmp_path / f"out.{exporter}"
- cmd = f"vspec export {exporter}{argument} -u {TEST_UNITS} -q {TEST_QUANT} --vspec {vspec} --output {out}"
- process = subprocess.run(cmd.split(), check=True)
- expected = HERE / f"expected_{compare_suffix}.{exporter}"
- assert filecmp.cmp(out, expected)
- if argument == "--uuid":
- assert "UUID support is deprecated" in process.stderr
-
-
-def test_uuid(tmp_path):
- # Run all "supported" exporters that supports uuid, i.e. not those in contrib
- # Exception is "binary", as it is assumed output may vary depending on
- # target
- exporters = ["json", "ddsidl", "csv", "yaml", "franca"]
- for exporter in exporters:
- run_exporter(exporter, " --uuid", "uuid", tmp_path)
- run_exporter(exporter, " --no-uuid", "no_uuid", tmp_path)
- run_exporter(exporter, "", "no_uuid", tmp_path)
-
-
-def run_error_test(tool, argument, arg_error_expected: bool, tmp_path):
+def run_error_test(tool, exporter, argument, arg_error_expected: bool, tmp_path):
vspec = HERE / "test.vspec"
out = tmp_path / "out.json"
- cmd = f"{tool} {argument} -u {TEST_UNITS} -q {TEST_QUANT} --vspec {vspec} --output {out}"
+ cmd = f"{tool} {exporter} {argument} -u {TEST_UNITS} -q {TEST_QUANT} --vspec {vspec} --output {out}"
process = subprocess.run(cmd.split(), capture_output=True, text=True)
if arg_error_expected:
assert process.returncode != 0
@@ -49,18 +28,14 @@ def run_error_test(tool, argument, arg_error_expected: bool, tmp_path):
assert process.returncode == 0
-# At the moment you do not get warning if using --no-uuid
-def test_obsolete_arg(tmp_path):
- """
- Check that obsolete argument --no-uuid results in error
- """
- run_error_test("vspec export json", "", False, tmp_path)
- run_error_test("vspec export json", "--uuid", False, tmp_path)
- run_error_test("vspec export json", "--no-uuid", False, tmp_path)
-
-
-def test_uuid_unsupported(tmp_path):
+@pytest.mark.parametrize(
+ "exporter",
+ ["binary", "csv", "ddsidl", "franca", "graphql", "id", "json", "jsonschema", "protobuf", "tree", "yaml"],
+)
+def test_obsolete_arg(exporter, tmp_path):
"""
- Test that we get an error if using --uuid for tools not supporting it
+ Check that you get errors for all
"""
- run_error_test("vspec export graphql", "--uuid", True, tmp_path)
+ run_error_test("vspec export ", exporter, "", False, tmp_path)
+ run_error_test("vspec export ", exporter, "--uuid", True, tmp_path)
+ run_error_test("vspec export ", exporter, "--no-uuid", True, tmp_path)