docs: added examples for configuring services for python/grpc
This commit is contained in:
parent
4538675c90
commit
7fdb114375
2 changed files with 78 additions and 4 deletions
43
docs/grpc.md
43
docs/grpc.md
|
@ -382,11 +382,50 @@ core.set_emane_model_config(session_id, node_id, EmaneIeee80211abgModel.name, {
|
|||
|
||||
## Configuring a Service
|
||||
|
||||
TBD
|
||||
Services help generate and run bash scripts on nodes for a given purpose.
|
||||
|
||||
Configuring the files of a service results in a specific hard coded script being
|
||||
generated, instead of the default scripts, that may leverage dynamic generation.
|
||||
|
||||
Editing service properties:
|
||||
```python
|
||||
# configure a service, for a node, for a given session
|
||||
# modify any of the following features
|
||||
# the files and the names that will be generated
|
||||
# the directories that will be mounted unique to the node
|
||||
# startup commands to run
|
||||
# validation commands to run
|
||||
# shutdown commands to run
|
||||
core.set_node_service(
|
||||
session_id,
|
||||
node_id,
|
||||
service_name,
|
||||
files=["file1.sh", "file2.sh"],
|
||||
directories=["/etc/node"],
|
||||
startup=["bash file1.sh"],
|
||||
validate=[],
|
||||
shutdown=[],
|
||||
)
|
||||
```
|
||||
|
||||
Editing a service file:
|
||||
```python
|
||||
# to edit the contents of a generated file you can specify
|
||||
# the service, the file name, and its contents
|
||||
# the file name must map to one of the files the service
|
||||
# supports by default or one added from a command above
|
||||
core.set_node_service_file(
|
||||
session_id,
|
||||
node_id,
|
||||
service_name,
|
||||
file_name,
|
||||
"echo hello",
|
||||
)
|
||||
```
|
||||
|
||||
## File Examples
|
||||
|
||||
File versions of these examples can be found
|
||||
File versions of the network examples can be found
|
||||
[here](https://github.com/coreemu/core/tree/master/daemon/examples/grpc).
|
||||
These examples will create a session using the gRPC API when the core-daemon is running.
|
||||
|
||||
|
|
|
@ -359,11 +359,46 @@ session.emane.set_model_config(config_id, EmaneIeee80211abgModel.name, {
|
|||
|
||||
## Configuring a Service
|
||||
|
||||
TBD
|
||||
Services help generate and run bash scripts on nodes for a given purpose.
|
||||
|
||||
Configuring the files of a service results in a specific hard coded script being
|
||||
generated, instead of the default scripts, that may leverage dynamic generation.
|
||||
|
||||
Editing service properties:
|
||||
```python
|
||||
# configure a service, for a node, for a given session
|
||||
# modify any of the following features
|
||||
# the files and the names that will be generated, called configs here
|
||||
# the directories that will be mounted unique to the node
|
||||
# startup commands to run
|
||||
# validation commands to run
|
||||
# shutdown commands to run
|
||||
session.services.set_service(node_id, service_name)
|
||||
service = session.services.get_service(node_id, service_name)
|
||||
service.configs = ("file1.sh", "file2.sh")
|
||||
service.dirs = ("/etc/node",)
|
||||
service.startup = ("bash file1.sh",)
|
||||
service.validate = ()
|
||||
service.shutdown = ()
|
||||
```
|
||||
|
||||
Editing a service file:
|
||||
```python
|
||||
# to edit the contents of a generated file you can specify
|
||||
# the service, the file name, and its contents
|
||||
# the file name must map to one of the files the service
|
||||
# supports by default or one added from a command above
|
||||
session.services.set_service_file(
|
||||
node_id,
|
||||
service_name,
|
||||
file_name,
|
||||
"echo hello",
|
||||
)
|
||||
```
|
||||
|
||||
## File Examples
|
||||
|
||||
File versions of these examples can be found
|
||||
File versions of the network examples can be found
|
||||
[here](https://github.com/coreemu/core/tree/master/daemon/examples/python).
|
||||
|
||||
## Executing Scripts from GUI
|
||||
|
|
Loading…
Reference in a new issue