Skip to content

Commit

Permalink
Merge pull request #27 from network-analytics/feature/add-yang-push
Browse files Browse the repository at this point in the history
Feature/add yang push
  • Loading branch information
ahuangfeng authored Feb 23, 2023
2 parents 57abd2f + f660567 commit de0c470
Show file tree
Hide file tree
Showing 37 changed files with 999 additions and 520 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ dmypy.json
cython_debug/

# own custom files
captured_udp_notif.pcap
*.pcap
pids
.DS_Store
yangs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIT License

Copyright (c) 2023 Unyte Project members
Authors Axel Rosensthiel, Alex Huang Feng, Pierre Francois
Authors Axel Rosensthiel, Tom Sampic, Alex Huang Feng, Pierre Francois
WIRED Team
Telecommunications Department
INSA Lyon
Expand Down
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,43 @@ $ sudo python3 src/main.py <src_ipv4> <dst_ipv4> <port_src> <port_dst>

### Optional arguments

- `--initial-domain x` or `-i x` : (INT) initial observation domain id, x >= 0, Default: `0`
- `--initial-domain x` or `-i x` : (Integer) initial observation domain id, x >= 0, Default: `0`

- `--additional-domains x` or `-a x` : (INT) amount of additional observation domains, x >= 0, Default: `0`
- `--additional-domains x` or `-a x` : (Integer) amount of additional observation domains, x >= 0, Default: `0`

- `--message-size s` or `-s s` : (STR) size of payload data, s = small or s = big, Default: `small`
- `--message-amount x` or `-n x` : (Integer) amount of messages to send, x >= 1, Default: `1`

- `--message-amount x` or `-n x` : (INT) amount of messages to send, x >= 1, Default: `1`
- `--encoding <encoding>` or `-e <encoding>`: (String) encoding of the UDP-notif payload. Options: [`json`, `xml`]. Default: `json`.

- `--mtu x` or `-m x` : (INT) maximum transmission unit, 16 < x < 65535, Default: `1500`
- `--mtu x` or `-m x` : (Integer) maximum transmission unit, 16 < x < 65535, Default: `1500`

- `--waiting-time f` or `-w f` : (FLOAT) waiting time (in seconds) between two messages, x > 0, Default: `0`
- `--waiting-time f` or `-w f` : (Float) waiting time (in seconds) between two messages, x > 0, Default: `0`

- `--probability-of-loss f` or `-p f` : (FLOAT) segment loss probability, 0 <= x < 1, Default: `0`
- `--probability-of-loss f` or `-p f` : (Float) segment loss probability, 0 <= x < 1, Default: `0`

- `--random-order x` or `-r x` : (INT) forward segments in random order, x = 0 or x = 1, Default: `0`
- `--logging-level s` or `-l s` : (String) logging level, s = none or s = warning or s = info or s = debug, Default: `info`

- `--logging-level s` or `-l s` : (STR) logging level, s = none or s = warning or s = info or s = debug, Default: `warning`
- `--capture <path>` or `-c <path>` : (String) Save a wireshark capture of the forwarded packets in the `<path>`. Default: `None` (disabled).

- `--capture x` or `-c x` : (INT) Set to 1 if you need a wireshark capture of the forwarded packets, x = 1 or x = 0, Default: `0`

- `--legacy x` or `-e x` : (INT) Set to 1 if you generate legacy headers: [draft-ietf-netconf-udp-pub-channel-05](https://datatracker.ietf.org/doc/draft-ietf-netconf-udp-pub-channel/), /!\ No segmentation is possible. x = 1 or x = 0, Default: `0`
- `--legacy` or `-leg` : Generate legacy headers as defined in [draft-ietf-netconf-udp-pub-channel-05](https://datatracker.ietf.org/doc/draft-ietf-netconf-udp-pub-channel/), /!\ No segmentation is possible. Default: Disabled

## Examples

1 segment of size 12 + 716 (header + payload) with a json payload, from observation domain 0, with no loss probability, logging control messages only
One YANG-push message [RFC8641](https://www.rfc-editor.org/rfc/rfc8641) using UDP-notif as transport.
```shell
$ sudo python3 src/main.py 192.0.2.66 192.0.2.66 3456 3457
$ sudo python3 src/main.py 192.0.2.65 192.0.2.66 10001 10010
```

Continuous stream of messages like the previous one
Continuous stream of YANG-push messages [RFC8641](https://www.rfc-editor.org/rfc/rfc8641) using UDP-notif as transport.
```shell
$ sudo python3 src/main.py 192.0.2.66 192.0.2.66 3456 3457 -n 0
$ sudo python3 src/main.py 192.0.2.66 192.0.2.66 10001 10010 -n 0
```

2 messages of 5 shuffled segments of size 1500 with a json payload, from observation domains 10 and 11, with 0.1 loss probability and 0.1 second wait time between messages, logging control messages and segment headers
```shell
$ sudo python3 src/main.py 192.0.2.66 192.0.2.66 3456 3457 -n 2 -r 1 -s big -i 10 -a 1 -p 0.1 -w 0.1 -l info
```
## NETCONF configuration XML examples

As defined in [RFC8641](https://www.rfc-editor.org/rfc/rfc8641), configured subscriptions are configured via Netconf RPC `<edit-config>`.

Examples of configuration files can be found in [configurations](./src/resources/xml/subscription/).

## Docker container
See [Docker docs](docker)
Expand Down
13 changes: 8 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
from unyte_generator.unyte_argparser import Unyte_argparser
from unyte_generator.unyte_generator import UDP_notif_generator
from unyte_generator.unyte_generator_legacy_proto import UDP_notif_generator_legacy
from unyte_generator.unyte_generator_draft_08 import UDP_notif_generator_draft_08


if __name__ == "__main__":
parser = Unyte_argparser()
args = parser.parse_args()

mock_generator: UDP_notif_generator = None

# use old udp-notif headers: draft-ietf-netconf-udp-pub-channel-05
if args.legacy == 1:
generator_legacy = UDP_notif_generator_legacy(args)
generator_legacy.send_udp_notif()
if args.legacy:
mock_generator = UDP_notif_generator_legacy(args=args)
else: # draft-ietf-netconf-udp-notif-08
generator = UDP_notif_generator(args)
generator.send_udp_notif()
mock_generator = UDP_notif_generator_draft_08(args=args)

mock_generator.send_udp_notif()
16 changes: 16 additions & 0 deletions src/resources/cbor/subscription-started copy_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ietf-notification:notification": {
"eventTime": "2023-03-25T08:30:11.22Z",
"ietf-subscribed-notification:subscription-started": {
"id": 1011,
"target": {
"ietf-yang-push:datastore": "operational"
},
"transport": "ietf-udp-notif-transport:udp-notif",
"encoding": "ietf-udp-notif-transport:encode-cbor",
"ietf-yang-push:periodic": {
"ietf-yang-push:period": 100
}
}
}
}
227 changes: 0 additions & 227 deletions src/resources/json/big.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"ietf-notification:notification": {
"eventTime": "2023-03-25T08:30:11.22Z",
"ietf-yang-push:push-change-update": {
"id": 2222,
"datastore-contents": {
"yang-patch": {
"patch-id": "patch_54",
"comment": "Changing encoding to JSON and increasing the period to 10 minutes",
"edit": [
{
"edit-id": "id_change_1",
"operation": "merge",
"target": "/ietf-subscribed-notifications:subscriptions/subscription[id=2222]",
"value": {
"ietf-subscribed-notifications:encoding": "ietf-subscribed-notifications:encode-json",
"ietf-yang-push:periodic": {
"period": 60000
}
}
}
]
}
}
}
}
}
Loading

0 comments on commit de0c470

Please sign in to comment.