This repository contains tooling to generate a ROS 2 Access Control Policy from the Node Interface Definition Language (NoDL) description of a ROS system (or that of a specific package), primarily to be used in conjunction with the SROS2
utilities.
- Clone this repository to a ROS workspace:
git clone [email protected]:osrf/nodl_to_policy.git <ws/src>/nodl_to_policy
- Install required dependencies:
rosdep install -yri --from-paths <ws/src> --rosdistro=galactic
- Build with:
colcon build --symlink-install
The nodl_to_policy
package extends the ROS 2 CLI by adding a nodl_to_policy
command, with an associated convert
verb.
The expected use is as follows:
ros2 nodl_to_policy convert <path-to-NoDL-file (*.nodl.xml)>
Invoking the convert
verb as above dumps the resulting access control policy in the console standard output.
If desired, this output can be redirected (>
) to <output>.policy.xml
.
The NoDL → policy conversion method simply takes a NoDL description (type: List[nodl.Node]
).
As such, the conversion API could be used programmatically as follows:
from nodl_to_python.policy import convert_to_policy
# obtain a NoDL description, either through `nodl.parse(<nodl_file_path>)` or otherwise
policy = convert_to_policy(nodl_description) # type(nodl_description) == List[nodl.Node]
# use policy, and/or output it using `nodl.dump_policy(policy, <output_stream>)`