Skip to content

Commit de0c470

Browse files
authored
Merge pull request #27 from network-analytics/feature/add-yang-push
Feature/add yang push
2 parents 57abd2f + f660567 commit de0c470

37 files changed

+999
-520
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ dmypy.json
138138
cython_debug/
139139

140140
# own custom files
141-
captured_udp_notif.pcap
141+
*.pcap
142142
pids
143143
.DS_Store
144+
yangs

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

33
Copyright (c) 2023 Unyte Project members
4-
Authors Axel Rosensthiel, Alex Huang Feng, Pierre Francois
4+
Authors Axel Rosensthiel, Tom Sampic, Alex Huang Feng, Pierre Francois
55
WIRED Team
66
Telecommunications Department
77
INSA Lyon

README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,43 @@ $ sudo python3 src/main.py <src_ipv4> <dst_ipv4> <port_src> <port_dst>
2222

2323
### Optional arguments
2424

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

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

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

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

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

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

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

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

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

43-
- `--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`
44-
45-
- `--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`
43+
- `--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
4644

4745
## Examples
4846

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

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

59-
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
60-
```shell
61-
$ 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
62-
```
57+
## NETCONF configuration XML examples
58+
59+
As defined in [RFC8641](https://www.rfc-editor.org/rfc/rfc8641), configured subscriptions are configured via Netconf RPC `<edit-config>`.
60+
61+
Examples of configuration files can be found in [configurations](./src/resources/xml/subscription/).
6362

6463
## Docker container
6564
See [Docker docs](docker)

src/main.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
from unyte_generator.unyte_argparser import Unyte_argparser
33
from unyte_generator.unyte_generator import UDP_notif_generator
44
from unyte_generator.unyte_generator_legacy_proto import UDP_notif_generator_legacy
5+
from unyte_generator.unyte_generator_draft_08 import UDP_notif_generator_draft_08
56

67

78
if __name__ == "__main__":
89
parser = Unyte_argparser()
910
args = parser.parse_args()
1011

12+
mock_generator: UDP_notif_generator = None
13+
1114
# use old udp-notif headers: draft-ietf-netconf-udp-pub-channel-05
12-
if args.legacy == 1:
13-
generator_legacy = UDP_notif_generator_legacy(args)
14-
generator_legacy.send_udp_notif()
15+
if args.legacy:
16+
mock_generator = UDP_notif_generator_legacy(args=args)
1517
else: # draft-ietf-netconf-udp-notif-08
16-
generator = UDP_notif_generator(args)
17-
generator.send_udp_notif()
18+
mock_generator = UDP_notif_generator_draft_08(args=args)
19+
20+
mock_generator.send_udp_notif()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ietf-notification:notification": {
3+
"eventTime": "2023-03-25T08:30:11.22Z",
4+
"ietf-subscribed-notification:subscription-started": {
5+
"id": 1011,
6+
"target": {
7+
"ietf-yang-push:datastore": "operational"
8+
},
9+
"transport": "ietf-udp-notif-transport:udp-notif",
10+
"encoding": "ietf-udp-notif-transport:encode-cbor",
11+
"ietf-yang-push:periodic": {
12+
"ietf-yang-push:period": 100
13+
}
14+
}
15+
}
16+
}

src/resources/json/big.json

Lines changed: 0 additions & 227 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"ietf-notification:notification": {
3+
"eventTime": "2023-03-25T08:30:11.22Z",
4+
"ietf-yang-push:push-change-update": {
5+
"id": 2222,
6+
"datastore-contents": {
7+
"yang-patch": {
8+
"patch-id": "patch_54",
9+
"comment": "Changing encoding to JSON and increasing the period to 10 minutes",
10+
"edit": [
11+
{
12+
"edit-id": "id_change_1",
13+
"operation": "merge",
14+
"target": "/ietf-subscribed-notifications:subscriptions/subscription[id=2222]",
15+
"value": {
16+
"ietf-subscribed-notifications:encoding": "ietf-subscribed-notifications:encode-json",
17+
"ietf-yang-push:periodic": {
18+
"period": 60000
19+
}
20+
}
21+
}
22+
]
23+
}
24+
}
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)