https://github.com/osrf/nodl_to_policy
https://github.com/osrf/nodl_to_policy
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/osrf/nodl_to_policy
- Owner: osrf
- License: apache-2.0
- Created: 2021-06-29T16:53:10.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-27T12:02:37.000Z (over 4 years ago)
- Last Synced: 2025-07-07T17:16:10.725Z (12 months ago)
- Language: Python
- Size: 93.8 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# nodl_to_policy
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/osrf/nodl_to_policy/actions/workflows/test.yml)
This repository contains tooling to generate a [ROS 2 Access Control Policy](https://design.ros2.org/articles/ros2_access_control_policies.html) from the [Node Interface Definition Language (NoDL)](https://github.com/ros2/design/pull/266) description of a ROS system (or that of a specific package), primarily to be used in conjunction with the `SROS2` utilities.
## Building
* Clone this repository to a ROS workspace: `git clone git@github.com:osrf/nodl_to_policy.git /nodl_to_policy`
* Install required dependencies: `rosdep install -yri --from-paths --rosdistro=galactic`
* Build with: `colcon build --symlink-install`
## Usage
### CLI
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:
```bash
ros2 nodl_to_policy convert
```
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 `.policy.xml`.
### API
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:
```python
from nodl_to_python.policy import convert_to_policy
# obtain a NoDL description, either through `nodl.parse()` 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, )`
```