2023-03-29 05:51:27 +01:00
|
|
|
* Table of Contents
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2023-03-08 05:49:50 +00:00
|
|
|
## Overview
|
2020-06-05 19:20:23 +01:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
[gRPC](https://grpc.io/) is a client/server API for interfacing with CORE
|
|
|
|
and used by the python GUI for driving all functionality. It is dependent
|
|
|
|
on having a running `core-daemon` instance to be leveraged.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
A python client can be created from the raw generated grpc files included
|
|
|
|
with CORE or one can leverage a provided gRPC client that helps encapsulate
|
2023-03-08 05:49:50 +00:00
|
|
|
some functionality to try and help make things easier.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
|
|
|
## Python Client
|
|
|
|
|
2020-06-05 19:20:23 +01:00
|
|
|
A python client wrapper is provided at
|
2020-07-16 01:09:32 +01:00
|
|
|
[CoreGrpcClient](https://github.com/coreemu/core/blob/master/daemon/core/api/grpc/client.py)
|
|
|
|
to help provide some conveniences when using the API.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
### Client HTTP Proxy
|
|
|
|
|
2023-03-29 05:51:27 +01:00
|
|
|
Since gRPC is HTTP2 based, proxy configurations can cause issues. By default,
|
2020-09-12 07:49:26 +01:00
|
|
|
the client disables proxy support to avoid issues when a proxy is present.
|
|
|
|
You can enable and properly account for this issue when needed.
|
|
|
|
|
2020-06-05 19:20:23 +01:00
|
|
|
## Proto Files
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-06-05 19:20:23 +01:00
|
|
|
Proto files are used to define the API and protobuf messages that are used for
|
|
|
|
interfaces with this API.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-07-16 01:09:32 +01:00
|
|
|
They can be found
|
|
|
|
[here](https://github.com/coreemu/core/tree/master/daemon/proto/core/api/grpc)
|
|
|
|
to see the specifics of
|
2020-06-05 19:20:23 +01:00
|
|
|
what is going on and response message values that would be returned.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-06-05 19:20:23 +01:00
|
|
|
## Examples
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
### Node Models
|
|
|
|
|
|
|
|
When creating nodes of type `NodeType.DEFAULT` these are the default models
|
|
|
|
and the services they map to.
|
|
|
|
|
|
|
|
* mdr
|
2023-03-08 05:49:50 +00:00
|
|
|
* zebra, OSPFv3MDR, IPForward
|
2020-09-12 07:49:26 +01:00
|
|
|
* PC
|
2023-03-08 05:49:50 +00:00
|
|
|
* DefaultRoute
|
2020-09-12 07:49:26 +01:00
|
|
|
* router
|
2023-03-08 05:49:50 +00:00
|
|
|
* zebra, OSPFv2, OSPFv3, IPForward
|
2020-09-12 07:49:26 +01:00
|
|
|
* host
|
2023-03-08 05:49:50 +00:00
|
|
|
* DefaultRoute, SSH
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
### Interface Helper
|
|
|
|
|
|
|
|
There is an interface helper class that can be leveraged for convenience
|
|
|
|
when creating interface data for nodes. Alternatively one can manually create
|
2021-05-04 21:29:22 +01:00
|
|
|
a `core.api.grpc.wrappers.Interface` class instead with appropriate information.
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
Manually creating gRPC client interface:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc.wrappers import Interface
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
# id is optional and will set to the next available id
|
|
|
|
# name is optional and will default to eth<id>
|
|
|
|
# mac is optional and will result in a randomly generated mac
|
2021-05-04 21:29:22 +01:00
|
|
|
iface = Interface(
|
2020-09-12 07:49:26 +01:00
|
|
|
id=0,
|
|
|
|
name="eth0",
|
|
|
|
ip4="10.0.0.1",
|
|
|
|
ip4_mask=24,
|
|
|
|
ip6="2001::",
|
|
|
|
ip6_mask=64,
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
Leveraging the interface helper class:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
|
|
|
from core.api.grpc import client
|
|
|
|
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
# node_id is used to get an ip4/ip6 address indexed from within the above prefixes
|
2020-09-12 19:22:58 +01:00
|
|
|
# iface_id is required and used exactly for that
|
2020-09-12 07:49:26 +01:00
|
|
|
# name is optional and would default to eth<id>
|
|
|
|
# mac is optional and will result in a randomly generated mac
|
|
|
|
iface_data = iface_helper.create_iface(
|
|
|
|
node_id=1, iface_id=0, name="eth0", mac="00:00:00:00:aa:00"
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
### Listening to Events
|
|
|
|
|
2020-09-13 17:26:48 +01:00
|
|
|
Various events that can occur within a session can be listened to.
|
|
|
|
|
|
|
|
Event types:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-13 17:26:48 +01:00
|
|
|
* session - events for changes in session state and mobility start/stop/pause
|
|
|
|
* node - events for node movements and icon changes
|
|
|
|
* link - events for link configuration changes and wireless link add/delete
|
|
|
|
* config - configuration events when legacy gui joins a session
|
|
|
|
* exception - alert/error events
|
|
|
|
* file - file events when the legacy gui joins a session
|
|
|
|
|
|
|
|
```python
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc import client
|
|
|
|
from core.api.grpc.wrappers import EventType
|
2020-09-13 17:26:48 +01:00
|
|
|
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-13 17:26:48 +01:00
|
|
|
def event_listener(event):
|
|
|
|
print(event)
|
|
|
|
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2021-05-04 21:29:22 +01:00
|
|
|
|
2020-09-13 17:26:48 +01:00
|
|
|
# provide no events to listen to all events
|
2021-05-04 21:29:22 +01:00
|
|
|
core.events(session.id, event_listener)
|
2020-09-13 17:26:48 +01:00
|
|
|
|
|
|
|
# provide events to listen to specific events
|
2021-05-04 21:29:22 +01:00
|
|
|
core.events(session.id, event_listener, [EventType.NODE])
|
2020-09-13 17:26:48 +01:00
|
|
|
```
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
### Configuring Links
|
|
|
|
|
2020-09-13 17:16:30 +01:00
|
|
|
Links can be configured at the time of creation or during runtime.
|
|
|
|
|
2020-09-14 16:41:38 +01:00
|
|
|
Currently supported configuration options:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-14 16:41:38 +01:00
|
|
|
* bandwidth (bps)
|
|
|
|
* delay (us)
|
|
|
|
* duplicate (%)
|
|
|
|
* jitter (us)
|
|
|
|
* loss (%)
|
|
|
|
|
2020-09-13 17:16:30 +01:00
|
|
|
```python
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc import client
|
|
|
|
from core.api.grpc.wrappers import LinkOptions, Position
|
|
|
|
|
|
|
|
# interface helper
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
|
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2021-05-04 21:29:22 +01:00
|
|
|
|
|
|
|
# create nodes
|
|
|
|
position = Position(x=100, y=100)
|
|
|
|
node1 = session.add_node(1, position=position)
|
|
|
|
position = Position(x=300, y=100)
|
|
|
|
node2 = session.add_node(2, position=position)
|
2020-09-13 17:16:30 +01:00
|
|
|
|
|
|
|
# configuring when creating a link
|
2021-05-04 21:29:22 +01:00
|
|
|
options = LinkOptions(
|
2020-09-13 17:16:30 +01:00
|
|
|
bandwidth=54_000_000,
|
|
|
|
delay=5000,
|
|
|
|
dup=5,
|
|
|
|
loss=5.5,
|
|
|
|
jitter=0,
|
|
|
|
)
|
2021-05-04 21:29:22 +01:00
|
|
|
iface1 = iface_helper.create_iface(node1.id, 0)
|
|
|
|
iface2 = iface_helper.create_iface(node2.id, 0)
|
|
|
|
link = session.add_link(node1=node1, node2=node2, iface1=iface1, iface2=iface2)
|
2020-09-13 17:16:30 +01:00
|
|
|
|
|
|
|
# configuring during runtime
|
2021-05-04 21:29:22 +01:00
|
|
|
link.options.loss = 10.0
|
|
|
|
core.edit_link(session.id, link)
|
2020-09-13 17:16:30 +01:00
|
|
|
```
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
### Peer to Peer Example
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
|
|
|
# required imports
|
|
|
|
from core.api.grpc import client
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc.core_pb2 import Position
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
# interface helper
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
|
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create nodes
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=100, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node1 = session.add_node(1, position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=300, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node2 = session.add_node(2, position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create link
|
|
|
|
iface1 = iface_helper.create_iface(node1.id, 0)
|
|
|
|
iface2 = iface_helper.create_iface(node2.id, 0)
|
|
|
|
session.add_link(node1=node1, node2=node2, iface1=iface1, iface2=iface2)
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# start session
|
|
|
|
core.start_session(session)
|
2020-09-12 07:49:26 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### Switch/Hub Example
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
|
|
|
# required imports
|
|
|
|
from core.api.grpc import client
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc.core_pb2 import NodeType, Position
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
# interface helper
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
|
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create nodes
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=200, y=200)
|
2021-05-04 21:29:22 +01:00
|
|
|
switch = session.add_node(1, _type=NodeType.SWITCH, position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=100, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node1 = session.add_node(2, position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=300, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node2 = session.add_node(3, position=position)
|
|
|
|
|
|
|
|
# create links
|
|
|
|
iface1 = iface_helper.create_iface(node1.id, 0)
|
|
|
|
session.add_link(node1=node1, node2=switch, iface1=iface1)
|
|
|
|
iface1 = iface_helper.create_iface(node2.id, 0)
|
|
|
|
session.add_link(node1=node2, node2=switch, iface1=iface1)
|
|
|
|
|
|
|
|
# start session
|
|
|
|
core.start_session(session)
|
2020-09-12 07:49:26 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### WLAN Example
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
|
|
|
# required imports
|
|
|
|
from core.api.grpc import client
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc.core_pb2 import NodeType, Position
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
# interface helper
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
|
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create nodes
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=200, y=200)
|
2021-05-04 21:29:22 +01:00
|
|
|
wlan = session.add_node(1, _type=NodeType.WIRELESS_LAN, position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=100, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node1 = session.add_node(2, model="mdr", position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=300, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node2 = session.add_node(3, model="mdr", position=position)
|
|
|
|
|
|
|
|
# create links
|
|
|
|
iface1 = iface_helper.create_iface(node1.id, 0)
|
|
|
|
session.add_link(node1=node1, node2=wlan, iface1=iface1)
|
|
|
|
iface1 = iface_helper.create_iface(node2.id, 0)
|
|
|
|
session.add_link(node1=node2, node2=wlan, iface1=iface1)
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# set wlan config using a dict mapping currently
|
2020-09-12 07:49:26 +01:00
|
|
|
# support values as strings
|
2021-05-04 21:29:22 +01:00
|
|
|
wlan.set_wlan(
|
|
|
|
{
|
|
|
|
"range": "280",
|
|
|
|
"bandwidth": "55000000",
|
|
|
|
"delay": "6000",
|
|
|
|
"jitter": "5",
|
|
|
|
"error": "5",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# start session
|
|
|
|
core.start_session(session)
|
2020-09-12 07:49:26 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### EMANE Example
|
|
|
|
|
|
|
|
For EMANE you can import and use one of the existing models and
|
|
|
|
use its name for configuration.
|
|
|
|
|
|
|
|
Current models:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
* core.emane.ieee80211abg.EmaneIeee80211abgModel
|
|
|
|
* core.emane.rfpipe.EmaneRfPipeModel
|
|
|
|
* core.emane.tdma.EmaneTdmaModel
|
|
|
|
* core.emane.bypass.EmaneBypassModel
|
|
|
|
|
|
|
|
Their configurations options are driven dynamically from parsed EMANE manifest files
|
|
|
|
from the installed version of EMANE.
|
|
|
|
|
|
|
|
Options and their purpose can be found at the [EMANE Wiki](https://github.com/adjacentlink/emane/wiki).
|
|
|
|
|
|
|
|
If configuring EMANE global settings or model mac/phy specific settings, any value not provided
|
|
|
|
will use the defaults. When no configuration is used, the defaults are used.
|
|
|
|
|
|
|
|
```python
|
|
|
|
# required imports
|
|
|
|
from core.api.grpc import client
|
2021-05-04 21:29:22 +01:00
|
|
|
from core.api.grpc.core_pb2 import NodeType, Position
|
2021-05-07 18:40:18 +01:00
|
|
|
from core.emane.models.ieee80211abg import EmaneIeee80211abgModel
|
2020-09-12 07:49:26 +01:00
|
|
|
|
|
|
|
# interface helper
|
|
|
|
iface_helper = client.InterfaceHelper(ip4_prefix="10.0.0.0/24", ip6_prefix="2001::/64")
|
|
|
|
|
|
|
|
# create grpc client and connect
|
|
|
|
core = client.CoreGrpcClient()
|
|
|
|
core.connect()
|
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# add session
|
2021-05-06 23:06:16 +01:00
|
|
|
session = core.create_session()
|
2020-09-12 07:49:26 +01:00
|
|
|
|
2021-05-04 21:29:22 +01:00
|
|
|
# create nodes
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=200, y=200)
|
2021-05-04 21:29:22 +01:00
|
|
|
emane = session.add_node(
|
2023-03-08 05:49:50 +00:00
|
|
|
1, _type=NodeType.EMANE, position=position, emane=EmaneIeee80211abgModel.name
|
2021-05-04 21:29:22 +01:00
|
|
|
)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=100, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node1 = session.add_node(2, model="mdr", position=position)
|
2020-09-12 07:49:26 +01:00
|
|
|
position = Position(x=300, y=100)
|
2021-05-04 21:29:22 +01:00
|
|
|
node2 = session.add_node(3, model="mdr", position=position)
|
|
|
|
|
|
|
|
# create links
|
|
|
|
iface1 = iface_helper.create_iface(node1.id, 0)
|
|
|
|
session.add_link(node1=node1, node2=emane, iface1=iface1)
|
|
|
|
iface1 = iface_helper.create_iface(node2.id, 0)
|
|
|
|
session.add_link(node1=node2, node2=emane, iface1=iface1)
|
|
|
|
|
|
|
|
# setting emane specific emane model configuration
|
2021-05-20 04:44:00 +01:00
|
|
|
emane.set_emane_model(EmaneIeee80211abgModel.name, {
|
2023-03-08 05:49:50 +00:00
|
|
|
"eventservicettl": "2",
|
|
|
|
"unicastrate": "3",
|
2021-05-20 04:44:00 +01:00
|
|
|
})
|
2021-05-04 21:29:22 +01:00
|
|
|
|
|
|
|
# start session
|
|
|
|
core.start_session(session)
|
2020-09-12 07:49:26 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
EMANE Model Configuration:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
```python
|
2021-05-04 21:29:22 +01:00
|
|
|
# emane network specific config, set on an emane node
|
|
|
|
# this setting applies to all nodes connected
|
|
|
|
emane.set_emane_model(EmaneIeee80211abgModel.name, {"unicastrate": "3"})
|
|
|
|
|
|
|
|
# node specific config for an individual node connected to an emane network
|
|
|
|
node.set_emane_model(EmaneIeee80211abgModel.name, {"unicastrate": "3"})
|
|
|
|
|
|
|
|
# node interface specific config for an individual node connected to an emane network
|
|
|
|
node.set_emane_model(EmaneIeee80211abgModel.name, {"unicastrate": "3"}, iface_id=0)
|
2020-09-12 07:49:26 +01:00
|
|
|
```
|
|
|
|
|
2020-09-12 19:22:58 +01:00
|
|
|
## Configuring a Service
|
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
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.
|
|
|
|
|
2020-09-14 16:41:38 +01:00
|
|
|
The following features can be configured for a service:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-14 16:41:38 +01:00
|
|
|
* files - files that will be generated
|
|
|
|
* directories - directories that will be mounted unique to the node
|
|
|
|
* startup - commands to run start a service
|
|
|
|
* validate - commands to run to validate a service
|
|
|
|
* shutdown - commands to run to stop a service
|
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
Editing service properties:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
```python
|
|
|
|
# configure a service, for a node, for a given session
|
2021-05-04 21:29:22 +01:00
|
|
|
node.service_configs[service_name] = NodeServiceData(
|
|
|
|
configs=["file1.sh", "file2.sh"],
|
2020-09-13 20:08:29 +01:00
|
|
|
directories=["/etc/node"],
|
|
|
|
startup=["bash file1.sh"],
|
|
|
|
validate=[],
|
|
|
|
shutdown=[],
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
2020-09-14 16:41:38 +01:00
|
|
|
When editing a service file, it must be the name of `config`
|
|
|
|
file that the service will generate.
|
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
Editing a service file:
|
2023-03-08 05:49:50 +00:00
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
```python
|
|
|
|
# to edit the contents of a generated file you can specify
|
|
|
|
# the service, the file name, and its contents
|
2021-05-04 21:29:22 +01:00
|
|
|
file_configs = node.service_file_configs.setdefault(service_name, {})
|
|
|
|
file_configs[file_name] = "echo hello world"
|
2020-09-13 20:08:29 +01:00
|
|
|
```
|
2020-09-12 19:22:58 +01:00
|
|
|
|
2020-09-12 07:49:26 +01:00
|
|
|
## File Examples
|
|
|
|
|
2020-09-13 20:08:29 +01:00
|
|
|
File versions of the network examples can be found
|
2022-12-05 09:15:09 +00:00
|
|
|
[here](https://github.com/coreemu/core/tree/master/package/examples/grpc).
|
2020-07-16 01:09:32 +01:00
|
|
|
These examples will create a session using the gRPC API when the core-daemon is running.
|
2019-06-11 20:05:04 +01:00
|
|
|
|
2020-06-05 19:20:23 +01:00
|
|
|
You can then switch to and attach to these sessions using either of the CORE GUIs.
|