Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

network-analytics/udp-notif-scapy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

116 Commits

Repository files navigation

Scapy generator for UDP-notif

This repository implements a mock generator for YANG-push notifications using UDP-notif transport as defined in draft-ietf-netconf-udp-notif-11. This mock generator supports IPv4.

Supported IETF RFCs/drafts

The mock YANG-push notifications uses the following IETF RFCs and drafts. The supported variant is Configured Subscriptions defined in RFC8641.

Dependencies (Tested in Python 3.9.16)

Required libraries are specified in src/requirements.txt

$ pip install -r src/requirements.txt

Usage

4 required arguments:

$ sudo python3 src/main.py <src_ipv4> <dst_ipv4> <port_src> <port_dst>
  • : valid source IPv4 address
  • : valid destination IPv4 address
  • : source port to be used
  • : destination port to be used

Optional arguments

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

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

  • --message-amount or -n : (Integer) amount of notification messages to send, >= 1, Default: 1

  • --encoding or -e : (String) encoding of the UDP-notif payload. Options: [json, xml, cbor]. Default: json.

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

  • --waiting-time or -w : (Float) waiting time (in seconds) between two messages, > 0, Default: 0

  • --probability-of-loss or -p : (Float) segment loss probability, 0 <= < 1, Default: 0

  • --logging-level or -l : (String) logging level, = none or = warning or = info or = debug, Default: info

  • --capture or -c : (String) Save a wireshark capture of the forwarded packets in the . Default: None (disabled).

  • --legacy or -leg : Generate legacy headers as defined in draft-ietf-netconf-udp-pub-channel-05, No segmentation is possible. Default: Disabled.

  • --update-yang or -upd: Simulate a YANG module update to a backward compatible YANG module. Default: Disabled.

Examples

One YANG-push message RFC8641 using UDP-notif as transport.

$ sudo python3 src/main.py 192.0.2.65 192.0.2.66 10001 10010

Continuous stream of YANG-push messages RFC8641 using UDP-notif as transport.

$ sudo python3 src/main.py 192.0.2.66 192.0.2.66 10001 10010 -n 0

Simulating a YANG subscription update

This generator can also simulate a YANG module update in YANG-push.

$ sudo python3 src/main.py 192.0.2.65 192.0.2.66 10001 10010 -upd

Used YANG modules

The YANG modules used in yang/interfaces.

The mock generator emulates a subscription to the Xpath /if:interfaces of ietf-interfaces@2018-02-20.yang

module: ietf-interfaces
+--rw interfaces
+--rw interface* [name]
+--rw name string
+--rw description? string
+--rw type identityref
+--rw enabled? boolean
+--rw link-up-down-trap-enable? enumeration {if-mib}?
+--ro admin-status enumeration {if-mib}?
+--ro oper-status enumeration
+--ro last-change? yang:date-and-time
+--ro if-index int32 {if-mib}?
+--ro phys-address? yang:phys-address
+--ro higher-layer-if* interface-ref
+--ro lower-layer-if* interface-ref
+--ro speed? yang:gauge64
+--ro statistics
+--ro discontinuity-time yang:date-and-time
+--ro in-octets? yang:counter64
+--ro in-unicast-pkts? yang:counter64
+--ro in-broadcast-pkts? yang:counter64
+--ro in-multicast-pkts? yang:counter64
+--ro in-discards? yang:counter32
+--ro in-errors? yang:counter32
+--ro in-unknown-protos? yang:counter32
+--ro out-octets? yang:counter64
+--ro out-unicast-pkts? yang:counter64
+--ro out-broadcast-pkts? yang:counter64
+--ro out-multicast-pkts? yang:counter64
+--ro out-discards? yang:counter32
+--ro out-errors? yang:counter32

After the update of the subscription, the generator emulates pushing a new versioned of the same YANG module with a new leaf mtu. This new YANG module is defined in ietf-interfaces@2023-04-30.yang. Note that this new YANG module is defined for test purposes and is not part of any IETF standard RFC.

module: ietf-interfaces
+--rw interfaces
+--rw interface* [name]
+--rw name string
+--rw description? string
+--rw mtu uint32
+--rw type identityref
+--rw enabled? boolean
+--rw link-up-down-trap-enable? enumeration {if-mib}?
+--ro admin-status enumeration {if-mib}?
+--ro oper-status enumeration
+--ro last-change? yang:date-and-time
+--ro if-index int32 {if-mib}?
+--ro phys-address? yang:phys-address
+--ro higher-layer-if* interface-ref
+--ro lower-layer-if* interface-ref
+--ro speed? yang:gauge64
+--ro statistics
+--ro discontinuity-time yang:date-and-time
+--ro in-octets? yang:counter64
+--ro in-unicast-pkts? yang:counter64
+--ro in-broadcast-pkts? yang:counter64
+--ro in-multicast-pkts? yang:counter64
+--ro in-discards? yang:counter32
+--ro in-errors? yang:counter32
+--ro in-unknown-protos? yang:counter32
+--ro out-octets? yang:counter64
+--ro out-unicast-pkts? yang:counter64
+--ro out-broadcast-pkts? yang:counter64
+--ro out-multicast-pkts? yang:counter64
+--ro out-discards? yang:counter32
+--ro out-errors? yang:counter32

NETCONF configuration XML examples

As defined in RFC8641, configured subscriptions are configured via Netconf RPC .

Examples of configuration files can be found in configurations.

YANG push notifications workflow

Please find more information about YANG push here.

Docker container

See Docker docs

About

UDP-notif Scapy Mock generator

Topics

Resources

Readme

License

View license

Stars

Watchers

Forks

Packages

Contributors