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.
- RFC5277: Netconf Event Notifications
- RFC8639: Subscription to YANG Notifications
- RFC8641: Subscription to YANG Notifications for Datastore Updates (Configured Subscriptions only)
- draft-ietf-netconf-udp-notif-11: UDP-based Transport for Configured Subscriptions
- draft-ietf-netconf-distributed-notif-08: Subscription to Distributed Notifications
- draft-ahuang-netconf-notif-yang-03: YANG model for NETCONF Event Notifications
- draft-tgraf-netconf-notif-sequencing-00: Support of Hostname and Sequencing in YANG Notifications
- draft-tgraf-yang-push-observation-time-00: Support of Network Observation Timestamping in YANG Notifications
- draft-ietf-netconf-yang-notifications-versioning-03: Support of Versioning in YANG Notifications Subscription
Dependencies (Tested in Python 3.9.16)
Required libraries are specified in src/requirements.txt
Usage
4 required arguments:
: valid source IPv4 address: valid destination IPv4 address: source port to be used: destination port to be used
Optional arguments
-
--initial-domainor-i: (Integer) initial observation domain id,>= 0, Default:0 -
--additional-domainsor-a: (Integer) amount of additional observation domains,>= 0, Default:0 -
--message-amountor-n: (Integer) amount of notification messages to send,>= 1, Default:1 -
--encodingor-e: (String) encoding of the UDP-notif payload. Options: [json,xml,cbor]. Default:json. -
--mtuor-m: (Integer) maximum transmission unit, 16 << 65535, Default:1500 -
--waiting-timeor-w: (Float) waiting time (in seconds) between two messages,> 0, Default:0 -
--probability-of-lossor-p: (Float) segment loss probability, 0 <=< 1, Default:0 -
--logging-levelor-l: (String) logging level,= none or= warning or= info or= debug, Default:info -
--captureor-c: (String) Save a wireshark capture of the forwarded packets in the. Default:None(disabled). -
--legacyor-leg: Generate legacy headers as defined in draft-ietf-netconf-udp-pub-channel-05,No segmentation is possible. Default: Disabled. -
--update-yangor-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.
Continuous stream of YANG-push messages RFC8641 using UDP-notif as transport.
Simulating a YANG subscription update
This generator can also simulate a YANG module update in YANG-push.
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
+--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.
+--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