docs: added edit link examples for grpc/python

This commit is contained in:
Blake Harnden 2020-09-13 09:16:30 -07:00
parent 2b1b027a11
commit 4bdc454970
2 changed files with 48 additions and 2 deletions

View file

@ -91,7 +91,30 @@ TBD
### Configuring Links
TBD
Links can be configured at the time of creation or during runtime.
```python
from core.api.grpc import core_pb2
# configuring when creating a link
# below are the currently supported configuration options
# bandwidth in bps
# delay in us
# duplicate in %
# jitter in us
# loss in %
options = core_pb2.LinkOptions(
bandwidth=54_000_000,
delay=5000,
dup=5,
loss=5.5,
jitter=0,
)
core.add_link(session_id, n1_id, n2_id, iface1_data, iface2_data, options)
# configuring during runtime
core.edit_link(session_id, n1_id, n2_id, iface1_id, iface2_id, options)
```
### Peer to Peer Example
```python

View file

@ -70,7 +70,30 @@ TBD
### Configuring Links
TBD
Links can be configured at the time of creation or during runtime.
```python
from core.emulator.data import LinkOptions
# configuring when creating a link
# below are the currently supported configuration options
# bandwidth in bps
# delay in us
# duplicate in %
# jitter in us
# loss in %
options = LinkOptions(
bandwidth=54_000_000,
delay=5000,
dup=5,
loss=5.5,
jitter=0,
)
session.add_link(n1_id, n2_id, iface1_data, iface2_data, options)
# configuring during runtime
session.update_link(n1_id, n2_id, iface1_id, iface2_id, options)
```
### Peer to Peer Example
```python