diff --git a/board/netconf/rootfs/libexec/infix/ospf-status b/board/netconf/rootfs/libexec/infix/ospf-status new file mode 100755 index 00000000..4cc61ad7 --- /dev/null +++ b/board/netconf/rootfs/libexec/infix/ospf-status @@ -0,0 +1,13 @@ +#!/bin/sh +# This script is used to transform the output from the show ip ospf commands and order +# them to match the ietf-ospf YANG model. For example, interfaces is ordered under +# area but FRR has areas in interfaces. +# +# This makes the parsing for the operational parts of YANG model more easy +# + +tempfile=`mktemp` +vtysh -c "show ip ospf interface json" | jq '[.interfaces as $interfaces | $interfaces | to_entries | group_by(.value.area)[] | {(.[0].value.area): [.[] | {name: .key} + .value] }] | reduce .[] as $item ({}; . + $item)' > $tempfile +vtysh -c "show ip ospf json" | jq --slurpfile iface $tempfile '.areas |= with_entries(.value += {interfaces: (.key as $area | reduce $iface[] as $iface (null; if $iface[$area] then . + $iface[$area] else . end) | select(. != null))})' + +rm -f $tempfile diff --git a/board/netconf/rootfs/libexec/infix/yanger b/board/netconf/rootfs/libexec/infix/yanger index 14ab22f0..cce9631b 100755 --- a/board/netconf/rootfs/libexec/infix/yanger +++ b/board/netconf/rootfs/libexec/infix/yanger @@ -167,6 +167,31 @@ def add_ipv6_route(routes): data = run_json_cmd(cmd) get_routes(routes, "ipv6", data) +def add_ospf_area(ospf): + cmd = ['/libexec/infix/ospf-status'] + data = run_json_cmd(cmd) + areas=[] + for area_id,values in data["areas"].items(): + area={} + area["ietf-ospf:area-id"] = area_id + area["ietf-ospf:interfaces"] = {} + interfaces=[] + for iface in values["interfaces"]: + interface={} + interface["name"]=iface["name"] + if(iface.get("drId")): + interface["dr-router-id"]=iface["drId"] + if(iface.get("drAddress")): + interface["dr-ip-addr"]=iface["drAddress"] + if(iface.get("bdrId")): + interface["bdr-router-id"]=iface["bdrId"] + if(iface.get("bdrAddress")): + interface["bdr-ip-addr"]=iface["bdrAddress"] + interfaces.append(interface) + area["ietf-ospf:interfaces"]["ietf-ospf:interface"] = interfaces + areas.append(area) + insert(ospf, "area", areas) + def add_ip_link(ifname, iface_out, test): if test: cmd = ['cat', f"{test}/ip-link-show-dev-{ifname}.json"] @@ -435,6 +460,24 @@ if __name__ == "__main__": ipv6routes = yang_data['ietf-routing:routing']['ribs']['rib'][1] add_ipv4_route(ipv4routes) add_ipv6_route(ipv6routes) + elif (args.model == 'ietf-ospf'): + yang_data= { + "ietf-routing:routing": { + "control-plane-protocols": { + "control-plane-protocol": [ + { + "type": "ietf-ospf:ospfv2", + "name": "default", + "ietf-ospf:ospf": { + "ietf-ospf:areas": + { + } + } + }] + } + } + } + add_ospf_area(yang_data['ietf-routing:routing']['control-plane-protocols']['control-plane-protocol'][0]["ietf-ospf:ospf"]["ietf-ospf:areas"]) else: print(f"Unsupported model {args.model}", file=sys.stderr) sys.exit(1) diff --git a/doc/networking.md b/doc/networking.md index d7ef675a..3e9561dc 100644 --- a/doc/networking.md +++ b/doc/networking.md @@ -388,7 +388,8 @@ flag controls if the interface will be in host/router mode. |:--------------------------|:----------------------------------------------------------| | ietf-routing | Base routing model, required for all other routing models | | ietf-ipv4-unicast-routing | Static IPv4 unicast routing | - +| ietf-ospf | OSPF routing | +| infix-routing | Infix deviations | ### IPv4 Static routes Remember to enable [IPv4 forwarding](#IPv4-forwarding) for the interfaces. @@ -427,6 +428,18 @@ NETCONF or using the CLI: 192.168.200.0/24 192.168.1.1 20 static admin@example:/> +#### OSPFv2 Routing +Remember to enable [IPv4 forwarding](#IPv4-forwarding) for the +interfaces you want to run OSPFv2. + + admin@example:/config/> edit routing control-plane-protocol ietf-ospf:ospfv2 name default + admin@example:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/> set ospf area 0.0.0.0 interface e0 enabled true + admin@example:/config/routing/control-plane-protocol/static/name/default/> leave + admin@example:/> + +> **Note:** The only name allowed for a control-plane-protocol is currently +> *default*. Meaning, you can only have one instance per routing protocol. + #### IPv6 routing table admin@example:/> show routes ipv6 diff --git a/package/skeleton-init-finit/skeleton/etc/finit.d/available/frr/ospfd.conf b/package/skeleton-init-finit/skeleton/etc/finit.d/available/frr/ospfd.conf index acaa27fe..b7757581 100644 --- a/package/skeleton-init-finit/skeleton/etc/finit.d/available/frr/ospfd.conf +++ b/package/skeleton-init-finit/skeleton/etc/finit.d/available/frr/ospfd.conf @@ -1 +1 @@ -service [2345] log:null ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf-- OSPF daemon +service [2345] log:null ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf -- OSPF daemon diff --git a/src/confd/bin/bootstrap b/src/confd/bin/bootstrap index bc515b56..c0fffb75 100755 --- a/src/confd/bin/bootstrap +++ b/src/confd/bin/bootstrap @@ -205,6 +205,7 @@ sysrepoctl -s $SEARCH \ -i ietf-routing@2018-03-13.yang -g wheel -p 0660 \ -i ietf-ipv6-unicast-routing@2018-03-13.yang -g wheel -p 0660 \ -i ietf-ipv4-unicast-routing@2018-03-13.yang -g wheel -p 0660 \ + -i ietf-ospf@2022-10-19.yang -g wheel -p 0660 \ -i iana-if-type@2023-01-26.yang -g wheel -p 0660 \ -i ieee802-dot1q-types@2022-10-29.yang -g wheel -p 0660 \ -i infix-ip@2023-09-14.yang -g wheel -p 0660 \ diff --git a/src/confd/src/ietf-routing.c b/src/confd/src/ietf-routing.c index 0e3faa7d..cf22e7f3 100644 --- a/src/confd/src/ietf-routing.c +++ b/src/confd/src/ietf-routing.c @@ -7,17 +7,86 @@ #include "core.h" -#define XPATH_BASE_ "/ietf-routing:routing" -#define XPATH_STATIC_ROUTES_ XPATH_BASE_ "/control-plane-protocols/control-plane-protocol" +#define XPATH_BASE_ "/ietf-routing:routing/control-plane-protocols/control-plane-protocol" +#define XPATH_OSPF_ XPATH_BASE_ "/ietf-ospf:ospf" #define STATICD_CONF "/etc/frr/staticd.conf" #define STATICD_CONF_NEXT STATICD_CONF "+" #define STATICD_CONF_PREV STATICD_CONF "-" +#define OSPFD_CONF "/etc/frr/ospfd.conf" +#define OSPFD_CONF_NEXT OSPFD_CONF "+" +#define OSPFD_CONF_PREV OSPFD_CONF "-" #define FRR_STATIC_CONFIG "! Generated by Infix\n\ -frr defaults traditional\n \ -hostname Router \n\ -password zebra \n \ -enable password zebra \n \ -log syslog informational \n" +frr defaults traditional\n\ +hostname Router\n\ +password zebra \n\ +enable password zebra\n\ +log syslog informational\n" + +int parse_ospf_interfaces(sr_session_ctx_t *session, struct lyd_node *areas, FILE *fp) +{ + struct lyd_node *interface, *interfaces, *area; + int areas_enabled = 0; + LY_LIST_FOR(lyd_child(areas), area) { + interfaces = lydx_get_child(area, "interfaces"); + const char *area_id = lydx_get_cattr(area, "area-id"); + LY_LIST_FOR(lyd_child(interfaces), interface) { + const char *hello, *dead, *retransmit, *transmit; + if (lydx_get_cattr(interface, "enabled")) { + fprintf(fp, "interface %s\n", lydx_get_cattr(interface, "name")); + hello = lydx_get_cattr(interface, "hello-interval"); + dead = lydx_get_cattr(interface, "dead-interval"); + retransmit = lydx_get_cattr(interface, "retransmit-interval"); + transmit = lydx_get_cattr(interface, "transmit-delay"); + fprintf(fp, " ip ospf area %s\n", area_id); + if (dead) + fprintf(fp, " ip ospf dead-interval %s\n", dead); + if (hello) + fprintf(fp, " ip ospf hello-interval %s\n", hello); + if (retransmit) + fprintf(fp, " ip ospf retransmit-interval %s\n", retransmit); + if (transmit) + fprintf(fp, " ip ospf transmit-delay %s\n", transmit); + areas_enabled++; + } + } + } + return areas_enabled; +} + +int parse_redistribute(sr_session_ctx_t *session, struct lyd_node *redistributes, FILE *fp) +{ + struct lyd_node *tmp; + LY_LIST_FOR(lyd_child(redistributes), tmp) { + const char *protocol = lydx_get_cattr(tmp, "protocol"); + fprintf(fp, " redistribute %s\n", protocol); + } + + return 0; +} + +int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf) +{ + struct lyd_node *areas; + int num_areas = 0; + FILE *fp; + fp = fopen(OSPFD_CONF_NEXT, "w"); + if (!fp) { + ERROR("Failed to open %s", OSPFD_CONF_NEXT); + return SR_ERR_INTERNAL; + } + fputs(FRR_STATIC_CONFIG, fp); + areas = lydx_get_child(ospf, "areas"); + num_areas = parse_ospf_interfaces(session, areas, fp); + fputs("router ospf\n", fp); + parse_redistribute(session, lydx_get_child(ospf, "redistribute"), fp); + + fclose(fp); + + if (!num_areas) { + (void)remove(OSPFD_CONF_NEXT); + } + return 0; +} static int parse_route(struct lyd_node *parent, FILE *fp, char *ip) { @@ -75,8 +144,10 @@ static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *paren static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t sub_id, const char *module, const char *xpath, sr_event_t event, unsigned request_id, void *priv) { + int staticd_enabled = 0, ospfd_enabled = 0; + bool ospfd_running, staticd_running; struct lyd_node *cplane, *tmp; - int staticd_enabled = 0; + bool restart_zebra = false; int rc = SR_ERR_OK; sr_data_t *cfg; FILE *fp; @@ -99,8 +170,10 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su case SR_EV_DONE: /* Check if passed validation in previous event */ staticd_enabled = fexist(STATICD_CONF_NEXT); - - if (!staticd_enabled) { + ospfd_enabled = fexist(OSPFD_CONF_NEXT); + staticd_running = !systemf("initctl -bfq status staticd"); + ospfd_running = !systemf("initctl -bfq status ospfd"); + if (staticd_running && !staticd_enabled) { if (systemf("initctl -bfq disable staticd")) { ERROR("Failed to disable static routing daemon"); rc = SR_ERR_INTERNAL; @@ -108,23 +181,49 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su } /* Remove all generated files */ (void)remove(STATICD_CONF); - return SR_ERR_OK; } - - (void)remove(STATICD_CONF_PREV); - (void)rename(STATICD_CONF, STATICD_CONF_PREV); - (void)rename(STATICD_CONF_NEXT, STATICD_CONF); - if (systemf("initctl -bfq status staticd")) { - if (staticd_enabled) { + if (ospfd_running && !ospfd_enabled) { + if (systemf("initctl -bfq disable ospfd")) { + ERROR("Failed to disable OSPF routing daemon"); + rc = SR_ERR_INTERNAL; + goto err_abandon; + } + /* Remove all generated files */ + (void)remove(OSPFD_CONF); + } + if (ospfd_enabled) { + (void)remove(OSPFD_CONF_PREV); + (void)rename(OSPFD_CONF, OSPFD_CONF_PREV); + (void)rename(OSPFD_CONF_NEXT, OSPFD_CONF); + if (!ospfd_running) { + if (ospfd_enabled) { + if (systemf("initctl -bfq enable ospfd")) { + ERROR("Failed to enable OSPF routing daemon"); + rc = SR_ERR_INTERNAL; + goto err_abandon; + } + } + } else { + restart_zebra = true; + } + } + if (staticd_enabled) { + (void)remove(STATICD_CONF_PREV); + (void)rename(STATICD_CONF, STATICD_CONF_PREV); + (void)rename(STATICD_CONF_NEXT, STATICD_CONF); + if (!staticd_running) { if (systemf("initctl -bfq enable staticd")) { ERROR("Failed to enable static routing daemon"); rc = SR_ERR_INTERNAL; goto err_abandon; } + } else { + restart_zebra = true; } - } else { + } + if (restart_zebra) { if (systemf("initctl -bfq restart zebra")) { - ERROR("Failed to restart static routing daemon"); + ERROR("Failed to restart zebra routing daemon"); rc = SR_ERR_INTERNAL; goto err_abandon; } @@ -143,6 +242,8 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su type = lydx_get_cattr(cplane, "type"); if (!strcmp(type, "static")) { staticd_enabled = parse_static_routes(session, lydx_get_child(cplane, "static-routes"), fp); + } else if (!strcmp(type, "ietf-ospf:ospfv2")) { + parse_ospf(session, lydx_get_child(cplane, "ospf")); } } } diff --git a/src/confd/yang/iana-bfd-types@2021-10-21.yang b/src/confd/yang/iana-bfd-types@2021-10-21.yang new file mode 100644 index 00000000..3435578c --- /dev/null +++ b/src/confd/yang/iana-bfd-types@2021-10-21.yang @@ -0,0 +1,159 @@ +module iana-bfd-types { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:iana-bfd-types"; + prefix iana-bfd-types; + + organization + "IANA"; + contact + "Internet Assigned Numbers Authority + + Postal: ICANN + 12025 Waterfront Drive, Suite 300 + Los Angeles, CA 90094-2536 + United States of America + Tel: +1 310 301 5800 + "; + description + "This module defines YANG data types for IANA-registered + BFD parameters. + + This YANG module is maintained by IANA and reflects the + 'BFD Diagnostic Codes' and 'BFD Authentication Types' + registries. + + Copyright (c) 2021 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject to + the license terms contained in, the Simplified BSD License set + forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 9127; see the + RFC itself for full legal notices."; + reference + "RFC 9127: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + + revision 2021-10-21 { + description + "Initial revision."; + reference + "RFC 9127: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + } + + /* + * Type definitions + */ + + typedef diagnostic { + type enumeration { + enum none { + value 0; + description + "No Diagnostic."; + } + enum control-expiry { + value 1; + description + "Control Detection Time Expired."; + } + enum echo-failed { + value 2; + description + "Echo Function Failed."; + } + enum neighbor-down { + value 3; + description + "Neighbor Signaled Session Down."; + } + enum forwarding-reset { + value 4; + description + "Forwarding Plane Reset."; + } + enum path-down { + value 5; + description + "Path Down."; + } + enum concatenated-path-down { + value 6; + description + "Concatenated Path Down."; + } + enum admin-down { + value 7; + description + "Administratively Down."; + } + enum reverse-concatenated-path-down { + value 8; + description + "Reverse Concatenated Path Down."; + } + enum mis-connectivity-defect { + value 9; + description + "Mis-connectivity defect."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD) + RFC 6428: Proactive Connectivity Verification, Continuity + Check, and Remote Defect Indication for the MPLS Transport + Profile"; + } + } + description + "BFD diagnostic codes as defined in RFC 5880. Values are + maintained in the 'BFD Diagnostic Codes' IANA registry. + Range is 0 to 31."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD)"; + } + + typedef auth-type { + type enumeration { + enum reserved { + value 0; + description + "Reserved."; + } + enum simple-password { + value 1; + description + "Simple Password."; + } + enum keyed-md5 { + value 2; + description + "Keyed MD5."; + } + enum meticulous-keyed-md5 { + value 3; + description + "Meticulous Keyed MD5."; + } + enum keyed-sha1 { + value 4; + description + "Keyed SHA1."; + } + enum meticulous-keyed-sha1 { + value 5; + description + "Meticulous Keyed SHA1."; + } + } + description + "BFD authentication type as defined in RFC 5880. Values are + maintained in the 'BFD Authentication Types' IANA registry. + Range is 0 to 255."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD)"; + } +} diff --git a/src/confd/yang/iana-routing-types@2017-12-04.yang b/src/confd/yang/iana-routing-types@2017-12-04.yang new file mode 100644 index 00000000..a538179c --- /dev/null +++ b/src/confd/yang/iana-routing-types@2017-12-04.yang @@ -0,0 +1,471 @@ +module iana-routing-types { + namespace "urn:ietf:params:xml:ns:yang:iana-routing-types"; + prefix iana-rt-types; + + organization + "IANA"; + contact + "Internet Assigned Numbers Authority + + Postal: ICANN + 12025 Waterfront Drive, Suite 300 + Los Angeles, CA 90094-2536 + United States of America + Tel: +1 310 301 5800 + "; + + description + "This module contains a collection of YANG data types + considered defined by IANA and used for routing + protocols. + + Copyright (c) 2017 IETF Trust and the persons + identified as authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 8294; see + the RFC itself for full legal notices."; + + revision 2017-12-04 { + description "Initial revision."; + reference + "RFC 8294: Common YANG Data Types for the Routing Area. + Section 4."; + } + + /*** Collection of IANA types related to routing ***/ + /*** IANA Address Family enumeration ***/ + + typedef address-family { + type enumeration { + enum ipv4 { + value 1; + description + "IPv4 Address Family."; + } + + enum ipv6 { + value 2; + description + "IPv6 Address Family."; + } + + enum nsap { + value 3; + description + "OSI Network Service Access Point (NSAP) Address Family."; + } + + enum hdlc { + value 4; + description + "High-Level Data Link Control (HDLC) Address Family."; + } + + enum bbn1822 { + value 5; + description + "Bolt, Beranek, and Newman Report 1822 (BBN 1822) + Address Family."; + } + + enum ieee802 { + value 6; + description + "IEEE 802 Committee Address Family + (aka Media Access Control (MAC) address)."; + } + + enum e163 { + value 7; + description + "ITU-T E.163 Address Family."; + } + enum e164 { + value 8; + description + "ITU-T E.164 (Switched Multimegabit Data Service (SMDS), + Frame Relay, ATM) Address Family."; + } + + enum f69 { + value 9; + description + "ITU-T F.69 (Telex) Address Family."; + } + + enum x121 { + value 10; + description + "ITU-T X.121 (X.25, Frame Relay) Address Family."; + } + + enum ipx { + value 11; + description + "Novell Internetwork Packet Exchange (IPX) + Address Family."; + } + + enum appletalk { + value 12; + description + "Apple AppleTalk Address Family."; + } + + enum decnet-iv { + value 13; + description + "Digital Equipment DECnet Phase IV Address Family."; + } + + enum vines { + value 14; + description + "Banyan Vines Address Family."; + } + + enum e164-nsap { + value 15; + description + "ITU-T E.164 with NSAP sub-address Address Family."; + } + + enum dns { + value 16; + description + "Domain Name System (DNS) Address Family."; + } + + enum distinguished-name { + value 17; + description + "Distinguished Name Address Family."; + } + + enum as-num { + value 18; + description + "Autonomous System (AS) Number Address Family."; + } + + enum xtp-v4 { + value 19; + description + "Xpress Transport Protocol (XTP) over IPv4 + Address Family."; + } + + enum xtp-v6 { + value 20; + description + "XTP over IPv6 Address Family."; + } + + enum xtp-native { + value 21; + description + "XTP native mode Address Family."; + } + + enum fc-port { + value 22; + description + "Fibre Channel (FC) World-Wide Port Name Address Family."; + } + enum fc-node { + value 23; + description + "FC World-Wide Node Name Address Family."; + } + + enum gwid { + value 24; + description + "ATM Gateway Identifier (GWID) Number Address Family."; + } + + enum l2vpn { + value 25; + description + "Layer 2 VPN (L2VPN) Address Family."; + } + + enum mpls-tp-section-eid { + value 26; + description + "MPLS Transport Profile (MPLS-TP) Section Endpoint + Identifier Address Family."; + } + + enum mpls-tp-lsp-eid { + value 27; + description + "MPLS-TP Label Switched Path (LSP) Endpoint Identifier + Address Family."; + } + + enum mpls-tp-pwe-eid { + value 28; + description + "MPLS-TP Pseudowire Endpoint Identifier Address Family."; + } + + enum mt-v4 { + value 29; + description + "Multi-Topology IPv4 Address Family."; + } + + enum mt-v6 { + value 30; + description + "Multi-Topology IPv6 Address Family."; + } + + enum eigrp-common-sf { + value 16384; + description + "Enhanced Interior Gateway Routing Protocol (EIGRP) + Common Service Family Address Family."; + } + + enum eigrp-v4-sf { + value 16385; + description + "EIGRP IPv4 Service Family Address Family."; + } + + enum eigrp-v6-sf { + value 16386; + description + "EIGRP IPv6 Service Family Address Family."; + } + + enum lcaf { + value 16387; + description + "Locator/ID Separation Protocol (LISP) + Canonical Address Format (LCAF) Address Family."; + } + + enum bgp-ls { + value 16388; + description + "Border Gateway Protocol - Link State (BGP-LS) + Address Family."; + } + + enum mac-48 { + value 16389; + description + "IEEE 48-bit MAC Address Family."; + } + + enum mac-64 { + value 16390; + description + "IEEE 64-bit MAC Address Family."; + } + + enum trill-oui { + value 16391; + description + "Transparent Interconnection of Lots of Links (TRILL) + IEEE Organizationally Unique Identifier (OUI) + Address Family."; + } + + enum trill-mac-24 { + value 16392; + description + "TRILL final 3 octets of 48-bit MAC Address Family."; + } + + enum trill-mac-40 { + value 16393; + description + "TRILL final 5 octets of 64-bit MAC Address Family."; + } + + enum ipv6-64 { + value 16394; + description + "First 8 octets (64 bits) of IPv6 address + Address Family."; + } + + enum trill-rbridge-port-id { + value 16395; + description + "TRILL Routing Bridge (RBridge) Port ID Address Family."; + } + + enum trill-nickname { + value 16396; + description + "TRILL Nickname Address Family."; + } + } + + description + "Enumeration containing all the IANA-defined + Address Families."; + + } + + /*** Subsequent Address Family Identifiers (SAFIs) ***/ + /*** for multiprotocol BGP enumeration ***/ + + typedef bgp-safi { + type enumeration { + enum unicast-safi { + value 1; + description + "Unicast SAFI."; + } + + enum multicast-safi { + value 2; + description + "Multicast SAFI."; + } + + enum labeled-unicast-safi { + value 4; + description + "Labeled Unicast SAFI."; + } + + enum multicast-vpn-safi { + value 5; + description + "Multicast VPN SAFI."; + } + + enum pseudowire-safi { + value 6; + description + "Multi-segment Pseudowire VPN SAFI."; + } + + enum tunnel-encap-safi { + value 7; + description + "Tunnel Encap SAFI."; + } + + enum mcast-vpls-safi { + value 8; + description + "Multicast Virtual Private LAN Service (VPLS) SAFI."; + } + + enum tunnel-safi { + value 64; + description + "Tunnel SAFI."; + } + + enum vpls-safi { + value 65; + description + "VPLS SAFI."; + } + + enum mdt-safi { + value 66; + description + "Multicast Distribution Tree (MDT) SAFI."; + } + + enum v4-over-v6-safi { + value 67; + description + "IPv4 over IPv6 SAFI."; + } + + enum v6-over-v4-safi { + value 68; + description + "IPv6 over IPv4 SAFI."; + } + + enum l1-vpn-auto-discovery-safi { + value 69; + description + "Layer 1 VPN Auto-Discovery SAFI."; + } + + enum evpn-safi { + value 70; + description + "Ethernet VPN (EVPN) SAFI."; + } + + enum bgp-ls-safi { + value 71; + description + "BGP-LS SAFI."; + } + + enum bgp-ls-vpn-safi { + value 72; + description + "BGP-LS VPN SAFI."; + } + + enum sr-te-safi { + value 73; + description + "Segment Routing - Traffic Engineering (SR-TE) SAFI."; + } + + enum labeled-vpn-safi { + value 128; + description + "MPLS Labeled VPN SAFI."; + } + + enum multicast-mpls-vpn-safi { + value 129; + description + "Multicast for BGP/MPLS IP VPN SAFI."; + } + + enum route-target-safi { + value 132; + description + "Route Target SAFI."; + } + + enum ipv4-flow-spec-safi { + value 133; + description + "IPv4 Flow Specification SAFI."; + } + + enum vpnv4-flow-spec-safi { + value 134; + description + "IPv4 VPN Flow Specification SAFI."; + } + + enum vpn-auto-discovery-safi { + value 140; + description + "VPN Auto-Discovery SAFI."; + } + } + description + "Enumeration for BGP SAFI."; + reference + "RFC 4760: Multiprotocol Extensions for BGP-4."; + } +} diff --git a/src/confd/yang/ietf-bfd-types@2022-09-22.yang b/src/confd/yang/ietf-bfd-types@2022-09-22.yang new file mode 100644 index 00000000..82799ea0 --- /dev/null +++ b/src/confd/yang/ietf-bfd-types@2022-09-22.yang @@ -0,0 +1,690 @@ +module ietf-bfd-types { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-bfd-types"; + prefix bfd-types; + + import iana-bfd-types { + prefix iana-bfd-types; + reference + "RFC 9127: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + } + import ietf-inet-types { + prefix inet; + reference + "RFC 6991: Common YANG Data Types"; + } + import ietf-yang-types { + prefix yang; + reference + "RFC 6991: Common YANG Data Types"; + } + import ietf-routing { + prefix rt; + reference + "RFC 8349: A YANG Data Model for Routing Management + (NMDA Version)"; + } + import ietf-key-chain { + prefix key-chain; + reference + "RFC 8177: YANG Data Model for Key Chains"; + } + + organization + "IETF BFD Working Group"; + contact + "WG Web: + WG List: + + Editor: Reshad Rahman + + + Editor: Lianshu Zheng + + + Editor: Mahesh Jethanandani + "; + description + "This module contains a collection of BFD-specific YANG data type + definitions, as per RFC 5880, and also groupings that are common + to other BFD YANG modules. + + Copyright (c) 2022 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Revised BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 9314; see the + RFC itself for full legal notices."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD) + RFC 9314: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + + revision 2022-09-22 { + description + "This revision is not backwards compatible with the + previous version of this model. + + This revision adds an 'if-feature' statement called + 'client-base-cfg-parms' for client configuration parameters. + Clients expecting to use those parameters now need to + verify that the server declares support of the feature + before depending on the presence of the parameters. + + The change was introduced for clients that do not need + them and have to deviate to prevent them from being + included."; + reference + "RFC 9314: YANG Data Model for Bidirectional Forwarding + Detection (BFD)."; + } + revision 2021-10-21 { + description + "Initial revision."; + reference + "RFC 9127: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + } + + /* + * Feature definitions + */ + + feature single-minimum-interval { + description + "This feature indicates that the server supports configuration + of one minimum interval value that is used for both transmit + and receive minimum intervals."; + } + + feature authentication { + description + "This feature indicates that the server supports BFD + authentication."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD), + Section 6.7"; + } + + feature demand-mode { + description + "This feature indicates that the server supports BFD Demand + mode."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD), + Section 6.6"; + } + + feature echo-mode { + description + "This feature indicates that the server supports BFD Echo + mode."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD), + Section 6.4"; + } + + feature client-base-cfg-parms { + description + "This feature allows protocol models to configure BFD client + session parameters."; + reference + "RFC 9314: YANG Data Model for Bidirectional Forwarding + Detection (BFD)."; + } + + /* + * Identity definitions + */ + + identity bfdv1 { + base rt:control-plane-protocol; + description + "BFD protocol version 1."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD)"; + } + + identity path-type { + description + "Base identity for the BFD path type. The path type indicates + the type of path on which BFD is running."; + } + + identity path-ip-sh { + base path-type; + description + "BFD on IP single-hop."; + reference + "RFC 5881: Bidirectional Forwarding Detection (BFD) + for IPv4 and IPv6 (Single Hop)"; + } + + identity path-ip-mh { + base path-type; + description + "BFD on IP multihop paths."; + reference + "RFC 5883: Bidirectional Forwarding Detection (BFD) for + Multihop Paths"; + } + + identity path-mpls-te { + base path-type; + description + "BFD on MPLS Traffic Engineering."; + reference + "RFC 5884: Bidirectional Forwarding Detection (BFD) + for MPLS Label Switched Paths (LSPs)"; + } + + identity path-mpls-lsp { + base path-type; + description + "BFD on an MPLS Label Switched Path."; + reference + "RFC 5884: Bidirectional Forwarding Detection (BFD) + for MPLS Label Switched Paths (LSPs)"; + } + + identity path-lag { + base path-type; + description + "Micro-BFD on LAG member links."; + reference + "RFC 7130: Bidirectional Forwarding Detection (BFD) on + Link Aggregation Group (LAG) Interfaces"; + } + + identity encap-type { + description + "Base identity for BFD encapsulation type."; + } + + identity encap-ip { + base encap-type; + description + "BFD with IP encapsulation."; + } + + /* + * Type definitions + */ + + typedef discriminator { + type uint32; + description + "BFD Discriminator as described in RFC 5880."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD)"; + } + + typedef state { + type enumeration { + enum adminDown { + value 0; + description + "'adminDown' state."; + } + enum down { + value 1; + description + "'Down' state."; + } + enum init { + value 2; + description + "'Init' state."; + } + enum up { + value 3; + description + "'Up' state."; + } + } + description + "BFD states as defined in RFC 5880."; + } + + typedef multiplier { + type uint8 { + range "1..255"; + } + description + "BFD multiplier as described in RFC 5880."; + } + + typedef hops { + type uint8 { + range "1..255"; + } + description + "This corresponds to Time To Live for IPv4 and corresponds to + the hop limit for IPv6."; + } + + /* + * Groupings + */ + + grouping auth-parms { + description + "Grouping for BFD authentication parameters + (see Section 6.7 of RFC 5880)."; + container authentication { + if-feature "authentication"; + presence "Enables BFD authentication (see Section 6.7 + of RFC 5880)."; + description + "Parameters for BFD authentication."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD), + Section 6.7"; + leaf key-chain { + type key-chain:key-chain-ref; + description + "Name of the 'key-chain' as per RFC 8177."; + } + leaf meticulous { + type boolean; + description + "Enables a meticulous mode as per Section 6.7 of + RFC 5880."; + } + } + } + + grouping base-cfg-parms { + description + "BFD grouping for base configuration parameters."; + leaf local-multiplier { + type multiplier; + default "3"; + description + "Multiplier transmitted by the local system."; + } + choice interval-config-type { + default "tx-rx-intervals"; + description + "Two interval values or one value used for both transmit and + receive."; + case tx-rx-intervals { + leaf desired-min-tx-interval { + type uint32; + units "microseconds"; + default "1000000"; + description + "Desired minimum transmit interval of control packets."; + } + leaf required-min-rx-interval { + type uint32; + units "microseconds"; + default "1000000"; + description + "Required minimum receive interval of control packets."; + } + } + case single-interval { + if-feature "single-minimum-interval"; + leaf min-interval { + type uint32; + units "microseconds"; + default "1000000"; + description + "Desired minimum transmit interval and required + minimum receive interval of control packets."; + } + } + } + } + + grouping client-cfg-parms { + description + "BFD grouping for configuration parameters + used by BFD clients, e.g., IGP or MPLS."; + leaf enabled { + type boolean; + default "false"; + description + "Indicates whether BFD is enabled."; + } + uses base-cfg-parms { + if-feature "client-base-cfg-parms"; + } + } + + grouping common-cfg-parms { + description + "BFD grouping for common configuration parameters."; + uses base-cfg-parms; + leaf demand-enabled { + if-feature "demand-mode"; + type boolean; + default "false"; + description + "To enable Demand mode."; + } + leaf admin-down { + type boolean; + default "false"; + description + "Indicates whether the BFD session is administratively + down."; + } + uses auth-parms; + } + + grouping all-session { + description + "BFD session operational information."; + leaf path-type { + type identityref { + base path-type; + } + config false; + description + "BFD path type. This indicates the path type that BFD is + running on."; + } + leaf ip-encapsulation { + type boolean; + config false; + description + "Indicates whether BFD encapsulation uses IP."; + } + leaf local-discriminator { + type discriminator; + config false; + description + "Local discriminator."; + } + leaf remote-discriminator { + type discriminator; + config false; + description + "Remote discriminator."; + } + leaf remote-multiplier { + type multiplier; + config false; + description + "Remote multiplier."; + } + leaf demand-capability { + if-feature "demand-mode"; + type boolean; + config false; + description + "Local Demand mode capability."; + } + leaf source-port { + when "../ip-encapsulation = 'true'" { + description + "Source port valid only when IP encapsulation is used."; + } + type inet:port-number; + config false; + description + "Source UDP port."; + } + leaf dest-port { + when "../ip-encapsulation = 'true'" { + description + "Destination port valid only when IP encapsulation + is used."; + } + type inet:port-number; + config false; + description + "Destination UDP port."; + } + container session-running { + config false; + description + "BFD 'session-running' information."; + leaf session-index { + type uint32; + description + "An index used to uniquely identify BFD sessions."; + } + leaf local-state { + type state; + description + "Local state."; + } + leaf remote-state { + type state; + description + "Remote state."; + } + leaf local-diagnostic { + type iana-bfd-types:diagnostic; + description + "Local diagnostic."; + } + leaf remote-diagnostic { + type iana-bfd-types:diagnostic; + description + "Remote diagnostic."; + } + leaf remote-authenticated { + type boolean; + description + "Indicates whether incoming BFD control packets are + authenticated."; + } + leaf remote-authentication-type { + when "../remote-authenticated = 'true'" { + description + "Only valid when incoming BFD control packets are + authenticated."; + } + if-feature "authentication"; + type iana-bfd-types:auth-type; + description + "Authentication type of incoming BFD control packets."; + } + leaf detection-mode { + type enumeration { + enum async-with-echo { + value 1; + description + "Async with echo."; + } + enum async-without-echo { + value 2; + description + "Async without echo."; + } + enum demand-with-echo { + value 3; + description + "Demand with echo."; + } + enum demand-without-echo { + value 4; + description + "Demand without echo."; + } + } + description + "Detection mode."; + } + leaf negotiated-tx-interval { + type uint32; + units "microseconds"; + description + "Negotiated transmit interval."; + } + leaf negotiated-rx-interval { + type uint32; + units "microseconds"; + description + "Negotiated receive interval."; + } + leaf detection-time { + type uint32; + units "microseconds"; + description + "Detection time."; + } + leaf echo-tx-interval-in-use { + when "../../path-type = 'bfd-types:path-ip-sh'" { + description + "Echo is supported for IP single-hop only."; + } + if-feature "echo-mode"; + type uint32; + units "microseconds"; + description + "Echo transmit interval in use."; + } + } + container session-statistics { + config false; + description + "BFD per-session statistics."; + leaf create-time { + type yang:date-and-time; + description + "Time and date when this session was created."; + } + leaf last-down-time { + type yang:date-and-time; + description + "Time and date of the last time this session went down."; + } + leaf last-up-time { + type yang:date-and-time; + description + "Time and date of the last time this session went up."; + } + leaf down-count { + type yang:counter32; + description + "The number of times this session has transitioned to the + 'down' state."; + } + leaf admin-down-count { + type yang:counter32; + description + "The number of times this session has transitioned to the + 'admin-down' state."; + } + leaf receive-packet-count { + type yang:counter64; + description + "Count of received packets in this session. This includes + valid and invalid received packets."; + } + leaf send-packet-count { + type yang:counter64; + description + "Count of sent packets in this session."; + } + leaf receive-invalid-packet-count { + type yang:counter64; + description + "Count of invalid received packets in this session."; + } + leaf send-failed-packet-count { + type yang:counter64; + description + "Count of packets that failed to be sent in this session."; + } + } + } + + grouping session-statistics-summary { + description + "Grouping for session statistics summary."; + container summary { + config false; + description + "BFD session statistics summary."; + leaf number-of-sessions { + type yang:gauge32; + description + "Number of BFD sessions."; + } + leaf number-of-sessions-up { + type yang:gauge32; + description + "Number of BFD sessions currently in the 'Up' state + (as defined in RFC 5880)."; + } + leaf number-of-sessions-down { + type yang:gauge32; + description + "Number of BFD sessions currently in the 'Down' or 'Init' + state but not 'adminDown' (as defined in RFC 5880)."; + } + leaf number-of-sessions-admin-down { + type yang:gauge32; + description + "Number of BFD sessions currently in the 'adminDown' state + (as defined in RFC 5880)."; + } + } + } + + grouping notification-parms { + description + "This group describes common parameters that will be sent + as part of BFD notifications."; + leaf local-discr { + type discriminator; + description + "BFD local discriminator."; + } + leaf remote-discr { + type discriminator; + description + "BFD remote discriminator."; + } + leaf new-state { + type state; + description + "Current BFD state."; + } + leaf state-change-reason { + type iana-bfd-types:diagnostic; + description + "Reason for the BFD state change."; + } + leaf time-of-last-state-change { + type yang:date-and-time; + description + "Calendar time of the most recent previous state change."; + } + leaf dest-addr { + type inet:ip-address; + description + "BFD peer address."; + } + leaf source-addr { + type inet:ip-address; + description + "BFD local address."; + } + leaf session-index { + type uint32; + description + "An index used to uniquely identify BFD sessions."; + } + leaf path-type { + type identityref { + base path-type; + } + description + "BFD path type."; + } + } +} diff --git a/src/confd/yang/ietf-key-chain@2017-06-15.yang b/src/confd/yang/ietf-key-chain@2017-06-15.yang new file mode 100644 index 00000000..445d1994 --- /dev/null +++ b/src/confd/yang/ietf-key-chain@2017-06-15.yang @@ -0,0 +1,382 @@ +module ietf-key-chain { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-key-chain"; + prefix key-chain; + + import ietf-yang-types { + prefix yang; + } + import ietf-netconf-acm { + prefix nacm; + } + + organization + "IETF RTGWG - Routing Area Working Group"; + contact + "WG Web: + WG List: + + Editor: Acee Lindem + + Yingzhen Qu + + Derek Yeung + + Ing-Wher Chen + + Jeffrey Zhang + "; + + description + "This YANG module defines the generic configuration + data for key chains. It is intended that the module + will be extended by vendors to define vendor-specific + key chain configuration parameters. + + Copyright (c) 2017 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 8177; + see the RFC itself for full legal notices."; + + reference "RFC 8177"; + + revision 2017-06-15 { + description + "Initial RFC Revision"; + reference "RFC 8177: YANG Data Model for Key Chains"; + } + + feature hex-key-string { + description + "Support hexadecimal key string."; + } + + feature accept-tolerance { + description + "Support the tolerance or acceptance limit."; + } + + feature independent-send-accept-lifetime { + description + "Support for independent send and accept key lifetimes."; + } + + feature crypto-hmac-sha-1-12 { + description + "Support for TCP HMAC-SHA-1 12-byte digest hack."; + } + + feature cleartext { + description + "Support for cleartext algorithm. Usage is + NOT RECOMMENDED."; + } + + feature aes-cmac-prf-128 { + description + "Support for AES Cipher-based Message Authentication + Code Pseudorandom Function."; + } + + feature aes-key-wrap { + description + "Support for Advanced Encryption Standard (AES) Key Wrap."; + } + + feature replay-protection-only { + description + "Provide replay protection without any authentication + as required by protocols such as Bidirectional + Forwarding Detection (BFD)."; + } + identity crypto-algorithm { + description + "Base identity of cryptographic algorithm options."; + } + + identity hmac-sha-1-12 { + base crypto-algorithm; + if-feature "crypto-hmac-sha-1-12"; + description + "The HMAC-SHA1-12 algorithm."; + } + + identity aes-cmac-prf-128 { + base crypto-algorithm; + if-feature "aes-cmac-prf-128"; + description + "The AES-CMAC-PRF-128 algorithm - required by + RFC 5926 for TCP-AO key derivation functions."; + } + + identity md5 { + base crypto-algorithm; + description + "The MD5 algorithm."; + } + + identity sha-1 { + base crypto-algorithm; + description + "The SHA-1 algorithm."; + } + + identity hmac-sha-1 { + base crypto-algorithm; + description + "HMAC-SHA-1 authentication algorithm."; + } + + identity hmac-sha-256 { + base crypto-algorithm; + description + "HMAC-SHA-256 authentication algorithm."; + } + + identity hmac-sha-384 { + base crypto-algorithm; + description + "HMAC-SHA-384 authentication algorithm."; + } + + identity hmac-sha-512 { + base crypto-algorithm; + description + "HMAC-SHA-512 authentication algorithm."; + } + + identity cleartext { + base crypto-algorithm; + if-feature "cleartext"; + description + "cleartext."; + } + + identity replay-protection-only { + base crypto-algorithm; + if-feature "replay-protection-only"; + description + "Provide replay protection without any authentication as + required by protocols such as Bidirectional Forwarding + Detection (BFD)."; + } + + typedef key-chain-ref { + type leafref { + path + "/key-chain:key-chains/key-chain:key-chain/key-chain:name"; + } + description + "This type is used by data models that need to reference + configured key chains."; + } + + grouping lifetime { + description + "Key lifetime specification."; + choice lifetime { + default "always"; + description + "Options for specifying key accept or send lifetimes"; + case always { + leaf always { + type empty; + description + "Indicates key lifetime is always valid."; + } + } + case start-end-time { + leaf start-date-time { + type yang:date-and-time; + description + "Start time."; + } + choice end-time { + default "infinite"; + description + "End-time setting."; + case infinite { + leaf no-end-time { + type empty; + description + "Indicates key lifetime end-time is infinite."; + } + } + case duration { + leaf duration { + type uint32 { + range "1..2147483646"; + } + units "seconds"; + description + "Key lifetime duration, in seconds"; + } + } + case end-date-time { + leaf end-date-time { + type yang:date-and-time; + description + "End time."; + } + } + } + } + } + } + + container key-chains { + description + "All configured key-chains on the device."; + list key-chain { + key "name"; + description + "List of key-chains."; + leaf name { + type string; + description + "Name of the key-chain."; + } + leaf description { + type string; + description + "A description of the key-chain"; + } + container accept-tolerance { + if-feature "accept-tolerance"; + description + "Tolerance for key lifetime acceptance (seconds)."; + leaf duration { + type uint32; + units "seconds"; + default "0"; + description + "Tolerance range, in seconds."; + } + } + leaf last-modified-timestamp { + type yang:date-and-time; + config false; + description + "Timestamp of the most recent update to the key-chain"; + } + list key { + key "key-id"; + description + "Single key in key chain."; + leaf key-id { + type uint64; + description + "Numeric value uniquely identifying the key"; + } + container lifetime { + description + "Specify a key's lifetime."; + choice lifetime { + description + "Options for specification of send and accept + lifetimes."; + case send-and-accept-lifetime { + description + "Send and accept key have the same lifetime."; + container send-accept-lifetime { + description + "Single lifetime specification for both + send and accept lifetimes."; + uses lifetime; + } + } + case independent-send-accept-lifetime { + if-feature "independent-send-accept-lifetime"; + description + "Independent send and accept key lifetimes."; + container send-lifetime { + description + "Separate lifetime specification for send + lifetime."; + uses lifetime; + } + container accept-lifetime { + description + "Separate lifetime specification for accept + lifetime."; + uses lifetime; + } + } + } + } + leaf crypto-algorithm { + type identityref { + base crypto-algorithm; + } + mandatory true; + description + "Cryptographic algorithm associated with key."; + } + container key-string { + description + "The key string."; + nacm:default-deny-all; + choice key-string-style { + description + "Key string styles"; + case keystring { + leaf keystring { + type string; + description + "Key string in ASCII format."; + } + } + case hexadecimal { + if-feature "hex-key-string"; + leaf hexadecimal-string { + type yang:hex-string; + description + "Key in hexadecimal string format. When compared + to ASCII, specification in hexadecimal affords + greater key entropy with the same number of + internal key-string octets. Additionally, it + discourages usage of well-known words or + numbers."; + } + } + } + } + leaf send-lifetime-active { + type boolean; + config false; + description + "Indicates if the send lifetime of the + key-chain key is currently active."; + } + leaf accept-lifetime-active { + type boolean; + config false; + description + "Indicates if the accept lifetime of the + key-chain key is currently active."; + } + } + } + container aes-key-wrap { + if-feature "aes-key-wrap"; + description + "AES Key Wrap encryption for key-chain key-strings. The + encrypted key-strings are encoded as hexadecimal key + strings using the hex-key-string leaf."; + leaf enable { + type boolean; + default "false"; + description + "Enable AES Key Wrap encryption."; + } + } + } +} diff --git a/src/confd/yang/ietf-ospf@2022-10-19.yang b/src/confd/yang/ietf-ospf@2022-10-19.yang new file mode 100644 index 00000000..8839563b --- /dev/null +++ b/src/confd/yang/ietf-ospf@2022-10-19.yang @@ -0,0 +1,5006 @@ +module ietf-ospf { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-ospf"; + + prefix ospf; + + import ietf-inet-types { + prefix inet; + reference + "RFC 6991: Common YANG Data Types"; + } + + import ietf-yang-types { + prefix yang; + reference + "RFC 6991: Common YANG Data Types"; + } + + import ietf-interfaces { + prefix if; + reference + "RFC 8343: A YANG Data Model for Interface Management"; + } + + import ietf-routing-types { + prefix rt-types; + reference + "RFC 8294: Common YANG Data Types for the Routing Area"; + } + + import iana-routing-types { + prefix iana-rt-types; + reference + "RFC 8294: Common YANG Data Types for the Routing Area"; + } + + import ietf-routing { + prefix rt; + reference + "RFC 8349: A YANG Data Model for Routing Management + (NMDA Version)"; + } + + import ietf-key-chain { + prefix key-chain; + reference + "RFC 8177: YANG Data Model for Key Chains"; + } + + import ietf-bfd-types { + prefix bfd-types; + reference + "RFC 9314: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + } + + organization + "IETF Link State Routing (lsr) Working Group"; + + contact + "WG Web: + WG List: + + Editor: Derek Yeung + + Author: Acee Lindem + + Author: Yingzhen Qu + + Author: Jeffrey Zhang + + Author: Ing-Wher Chen + "; + + description + "This YANG module defines the generic configuration and + operational state for the OSPF protocol common to all + vendor implementations. It is intended that the module + will be extended by vendors to define vendor-specific + OSPF configuration parameters and policies -- + for example, route maps or route policies. + + This YANG data model conforms to the Network Management + Datastore Architecture (NMDA) as described in RFC 8342. + + The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL + NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', + 'MAY', and 'OPTIONAL' in this document are to be interpreted as + described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, + they appear in all capitals, as shown here. + + Copyright (c) 2022 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject to + the license terms contained in, the Revised BSD License set + forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 9129; see the + RFC itself for full legal notices."; + + revision 2022-10-19 { + description + "Initial revision."; + reference + "RFC 9129: YANG Data Model for the OSPF Protocol"; + } + + feature multi-topology { + description + "Support for Multi-Topology (MT) routing."; + reference + "RFC 4915: Multi-Topology (MT) Routing in OSPF"; + } + + feature multi-area-adj { + description + "Support for OSPF multi-area adjacencies as described in + RFC 5185."; + reference + "RFC 5185: OSPF Multi-Area Adjacency"; + } + + feature explicit-router-id { + description + "Sets the Router ID per instance explicitly."; + } + + feature demand-circuit { + description + "Support for OSPF demand circuits as defined in RFC 1793."; + reference + "RFC 1793: Extending OSPF to Support Demand Circuits"; + } + + feature mtu-ignore { + description + "Disable OSPF Database Description packet MTU + mismatch checking as specified in the OSPFv2 + protocol specification (RFC 2328). This mismatch checking + also applies to OSPFv3 (RFC 5340)."; + reference + "RFC 2328: OSPF Version 2, Section 10.6 + RFC 5340: OSPF for IPv6"; + } + + feature lls { + description + "OSPF link-local signaling (LLS) as defined in RFC 5613."; + reference + "RFC 5613: OSPF Link-Local Signaling"; + } + + feature prefix-suppression { + description + "OSPF prefix suppression support as described in RFC 6860."; + reference + "RFC 6860: Hiding Transit-Only Networks in OSPF"; + } + + feature ttl-security { + description + "Support for OSPF Time to Live (TTL) security checking."; + reference + "RFC 5082: The Generalized TTL Security Mechanism (GTSM)"; + } + + feature nsr { + description + "Non-Stop-Routing (NSR) support. The OSPF NSR feature + allows a router with redundant control-plane capability + (e.g., dual Route Processor (RP) cards) to maintain its + state and adjacencies during planned and unplanned + OSPF instance restarts. It differs from graceful restart + or Non-Stop Forwarding (NSF) in that no protocol signaling + or assistance from adjacent OSPF neighbors is required to + recover control-plane state."; + } + + feature graceful-restart { + description + "Graceful OSPF restart as defined in RFCs 3623 and 5187."; + reference + "RFC 3623: Graceful OSPF Restart + RFC 5187: OSPFv3 Graceful Restart"; + } + + feature auto-cost { + description + "Calculates the OSPF interface cost according to + reference bandwidth."; + reference + "RFC 2328: OSPF Version 2"; + } + + feature max-ecmp { + description + "Sets the maximum number of ECMP paths."; + } + + feature max-lsa { + description + "Sets the maximum number of Link State Advertisements (LSAs) + the OSPF instance will accept."; + reference + "RFC 1765: OSPF Database Overflow"; + } + + feature te-rid { + description + "Support for configuration of the Traffic Engineering (TE) + Router ID, i.e., the Router Address TLV as described in + Section 2.4.1 of RFC 3630 or the Router IPv6 Address TLV + as described in Section 3 of RFC 5329."; + reference + "RFC 3630: Traffic Engineering (TE) Extensions to + OSPF Version 2, Section 2.4.1 + RFC 5329: Traffic Engineering Extensions to OSPF Version 3, + Section 3"; + } + + feature ldp-igp-sync { + description + "LDP IGP synchronization."; + reference + "RFC 5443: LDP IGP Synchronization"; + } + + feature ospfv2-authentication-trailer { + description + "Support for the OSPFv2 authentication trailer."; + reference + "RFC 5709: OSPFv2 HMAC-SHA Cryptographic Authentication + RFC 7474: Security Extension for OSPFv2 When + Using Manual Key Management"; + } + + feature ospfv3-authentication-ipsec { + description + "Support for IPsec for OSPFv3 authentication."; + reference + "RFC 4552: Authentication/Confidentiality for OSPFv3"; + } + + feature ospfv3-authentication-trailer { + description + "Support for the OSPFv3 authentication trailer."; + reference + "RFC 7166: Supporting Authentication Trailer for OSPFv3"; + } + + feature fast-reroute { + description + "Support for IP Fast Reroute (IP-FRR)."; + reference + "RFC 5714: IP Fast Reroute Framework"; + } + + feature key-chain { + description + "Support of key chains for authentication."; + reference + "RFC 8177: YANG Data Model for Key Chains"; + } + + feature node-flag { + description + "Support for node flags for OSPF prefixes."; + reference + "RFC 7684: OSPFv2 Prefix/Link Attribute Advertisement"; + } + + feature node-tag { + description + "Support for node administrative tags for OSPF routing + instances."; + reference + "RFC 7777: Advertising Node Administrative Tags in OSPF"; + } + + feature lfa { + description + "Support for Loop-Free Alternates (LFAs)."; + reference + "RFC 5286: Basic Specification for IP Fast Reroute: + Loop-Free Alternates"; + } + + feature remote-lfa { + description + "Support for Remote LFAs (R-LFAs)."; + reference + "RFC 7490: Remote Loop-Free Alternate (LFA) Fast Reroute + (FRR)"; + } + + feature stub-router { + description + "Support for OSPF stub router advertisement as defined in + RFC 6987."; + reference + "RFC 6987: OSPF Stub Router Advertisement"; + } + + feature pe-ce-protocol { + description + "Support for OSPF as a Provider Edge to Customer Edge (PE-CE) + protocol."; + reference + "RFC 4577: OSPF as the Provider/Customer Edge Protocol + for BGP/MPLS IP Virtual Private Networks (VPNs) + RFC 6565: OSPFv3 as a Provider Edge to Customer Edge (PE-CE) + Routing Protocol"; + } + + feature ietf-spf-delay { + description + "Support for the IETF Shortest Path First (SPF) delay + algorithm."; + reference + "RFC 8405: Shortest Path First (SPF) Back-Off Delay Algorithm + for Link-State IGPs"; + } + + feature bfd { + description + "Support for BFD to detect OSPF neighbor reachability."; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD) + RFC 5881: Bidirectional Forwarding Detection + (BFD) for IPv4 and IPv6 (Single Hop)"; + } + + feature hybrid-interface { + description + "Support for the OSPF hybrid interface type."; + reference + "RFC 6845: OSPF Hybrid Broadcast and + Point-to-Multipoint Interface Type"; + } + + identity ospf { + base rt:routing-protocol; + description + "Any OSPF protocol version."; + } + + identity ospfv2 { + base ospf; + description + "OSPFv2 protocol."; + } + + identity ospfv3 { + base ospf; + description + "OSPFv3 protocol."; + } + + identity area-type { + description + "Base identity for an OSPF area type."; + } + + identity normal-area { + base area-type; + description + "OSPF normal area."; + } + + identity stub-nssa-area { + base area-type; + description + "OSPF stub area or Not-So-Stubby Area (NSSA)."; + } + + identity stub-area { + base stub-nssa-area; + description + "OSPF stub area."; + } + + identity nssa-area { + base stub-nssa-area; + description + "OSPF NSSA."; + reference + "RFC 3101: The OSPF Not-So-Stubby Area (NSSA) Option"; + } + + identity ospf-lsa-type { + description + "Base identity for OSPFv2 and OSPFv3 + Link State Advertisement (LSA) types."; + } + + identity ospfv2-lsa-type { + base ospf-lsa-type; + description + "OSPFv2 LSA types."; + } + + identity ospfv2-router-lsa { + base ospfv2-lsa-type; + description + "OSPFv2 Router-LSA - Type 1."; + } + + identity ospfv2-network-lsa { + base ospfv2-lsa-type; + description + "OSPFv2 Network-LSA - Type 2."; + } + + identity ospfv2-summary-lsa-type { + base ospfv2-lsa-type; + description + "OSPFv2 summary LSA types."; + } + + identity ospfv2-network-summary-lsa { + base ospfv2-summary-lsa-type; + description + "OSPFv2 Network summary LSA - Type 3."; + } + + identity ospfv2-asbr-summary-lsa { + base ospfv2-summary-lsa-type; + description + "OSPFv2 Autonomous System Boundary Router (ASBR) summary LSA - + Type 4."; + } + + identity ospfv2-external-lsa-type { + base ospfv2-lsa-type; + description + "OSPFv2 External-LSA types."; + } + + identity ospfv2-as-external-lsa { + base ospfv2-external-lsa-type; + description + "OSPFv2 AS-External-LSA - Type 5."; + } + + identity ospfv2-nssa-lsa { + base ospfv2-external-lsa-type; + description + "OSPFv2 NSSA-LSA - Type 7."; + } + + identity ospfv2-opaque-lsa-type { + base ospfv2-lsa-type; + description + "OSPFv2 Opaque-LSA types."; + reference + "RFC 5250: The OSPF Opaque LSA Option"; + } + + identity ospfv2-link-scope-opaque-lsa { + base ospfv2-opaque-lsa-type; + description + "OSPFv2 Link-Scope Opaque-LSA - Type 9."; + } + + identity ospfv2-area-scope-opaque-lsa { + base ospfv2-opaque-lsa-type; + description + "OSPFv2 Area-Scope Opaque-LSA - Type 10."; + } + + identity ospfv2-as-scope-opaque-lsa { + base ospfv2-opaque-lsa-type; + description + "OSPFv2 AS-Scope Opaque-LSA - Type 11."; + } + + identity ospfv2-unknown-lsa-type { + base ospfv2-lsa-type; + description + "OSPFv2 unknown LSA type."; + } + + identity ospfv3-lsa-type { + base ospf-lsa-type; + description + "OSPFv3 LSA types."; + reference + "RFC 5340: OSPF for IPv6"; + } + + identity ospfv3-router-lsa { + base ospfv3-lsa-type; + description + "OSPFv3 Router-LSA - Type 0x2001."; + } + + identity ospfv3-network-lsa { + base ospfv3-lsa-type; + description + "OSPFv3 Network-LSA - Type 0x2002."; + } + + identity ospfv3-summary-lsa-type { + base ospfv3-lsa-type; + description + "OSPFv3 summary LSA types."; + } + + identity ospfv3-inter-area-prefix-lsa { + base ospfv3-summary-lsa-type; + description + "OSPFv3 Inter-Area-Prefix-LSA - Type 0x2003."; + } + + identity ospfv3-inter-area-router-lsa { + base ospfv3-summary-lsa-type; + description + "OSPFv3 Inter-Area-Router-LSA - Type 0x2004."; + } + + identity ospfv3-external-lsa-type { + base ospfv3-lsa-type; + description + "OSPFv3 External-LSA types."; + } + + identity ospfv3-as-external-lsa { + base ospfv3-external-lsa-type; + description + "OSPFv3 AS-External-LSA - Type 0x4005."; + } + + identity ospfv3-nssa-lsa { + base ospfv3-external-lsa-type; + description + "OSPFv3 NSSA-LSA - Type 0x2007."; + } + + identity ospfv3-link-lsa { + base ospfv3-lsa-type; + description + "OSPFv3 Link-LSA - Type 0x0008."; + } + + identity ospfv3-intra-area-prefix-lsa { + base ospfv3-lsa-type; + description + "OSPFv3 Intra-Area-Prefix-LSA - Type 0x2009."; + } + + identity ospfv3-router-information-lsa { + base ospfv3-lsa-type; + description + "OSPFv3 Router-Information-LSA - Types 0x800C, + 0xA00C, and 0xC00C."; + } + + identity ospfv3-unknown-lsa-type { + base ospfv3-lsa-type; + description + "OSPFv3 unknown LSA type."; + } + + identity lsa-log-reason { + description + "Base identity for an LSA log reason."; + } + + identity lsa-refresh { + base lsa-log-reason; + description + "Identity used when an LSA is logged + as a result of receiving a refresh LSA."; + } + + identity lsa-content-change { + base lsa-log-reason; + description + "Identity used when an LSA is logged + as a result of a change in the contents + of the LSA."; + } + + identity lsa-purge { + base lsa-log-reason; + description + "Identity used when an LSA is logged + as a result of being purged."; + } + + identity informational-capability { + description + "Base identity for router informational capabilities."; + } + + identity graceful-restart { + base informational-capability; + description + "When set, the router is capable of restarting + gracefully."; + reference + "RFC 3623: Graceful OSPF Restart + RFC 5187: OSPFv3 Graceful Restart"; + } + + identity graceful-restart-helper { + base informational-capability; + description + "When set, the router is capable of acting as + a graceful restart helper."; + reference + "RFC 3623: Graceful OSPF Restart + RFC 5187: OSPFv3 Graceful Restart"; + } + + identity stub-router { + base informational-capability; + description + "When set, the router is capable of acting as + an OSPF stub router."; + reference + "RFC 6987: OSPF Stub Router Advertisement"; + } + + identity traffic-engineering { + base informational-capability; + description + "When set, the router is capable of OSPF TE."; + reference + "RFC 3630: Traffic Engineering (TE) Extensions to + OSPF Version 2 + RFC 5329: Traffic Engineering Extensions to OSPF Version 3"; + } + + identity p2p-over-lan { + base informational-capability; + description + "When set, the router is capable of OSPF point-to-point + over a LAN."; + reference + "RFC 5309: Point-to-Point Operation over LAN in Link State + Routing Protocols"; + } + + identity experimental-te { + base informational-capability; + description + "When set, the router is capable of OSPF experimental TE."; + reference + "RFC 4973: OSPF-xTE: Experimental Extension to OSPF for + Traffic Engineering"; + } + + identity router-lsa-bit { + description + "Base identity for Router-LSA bits."; + } + + identity vlink-end-bit { + base router-lsa-bit; + description + "V-bit. When set, the router is an endpoint of one or + more virtual links."; + } + + identity asbr-bit { + base router-lsa-bit; + description + "E-bit. When set, the router is an Autonomous System + Boundary Router (ASBR)."; + } + + identity abr-bit { + base router-lsa-bit; + description + "B-bit. When set, the router is an Area Border + Router (ABR)."; + } + + identity nssa-bit { + base router-lsa-bit; + description + "Nt-bit. When set, the router is an NSSA border router + that is unconditionally translating NSSA-LSAs into + AS-External-LSAs."; + } + + identity ospfv3-lsa-option { + description + "Base identity for OSPF LSA Options."; + } + + identity af-bit { + base ospfv3-lsa-option; + description + "AF-bit. When set, the router supports OSPFv3 Address + Families (AFs) as described in RFC 5838."; + reference + "RFC 5838: Support of Address Families in OSPFv3"; + } + + identity dc-bit { + base ospfv3-lsa-option; + description + "DC-bit. When set, the router supports demand circuits."; + } + + identity r-bit { + base ospfv3-lsa-option; + description + "R-bit. When set, the originator is an active router."; + } + + identity n-bit { + base ospfv3-lsa-option; + description + "N-bit. When set, the router is attached to an NSSA."; + } + + identity e-bit { + base ospfv3-lsa-option; + description + "E-bit. This bit describes the way AS-External-LSAs + are flooded."; + } + + identity v6-bit { + base ospfv3-lsa-option; + description + "V6-bit. If clear, the router/link should be excluded + from IPv6 routing calculations."; + } + + identity ospfv3-prefix-option { + description + "Base identity for OSPFv3 prefix options."; + } + + identity nu-bit { + base ospfv3-prefix-option; + description + "NU-bit. When set, the prefix should be excluded + from IPv6 unicast calculations."; + } + + identity la-bit { + base ospfv3-prefix-option; + description + "LA-bit. When set, the prefix is actually an IPv6 + interface address of the advertising router."; + } + + identity p-bit { + base ospfv3-prefix-option; + description + "P-bit. When set, the NSSA prefix should be + translated to an AS-External-LSA and advertised + by the translating NSSA border router."; + } + + identity dn-bit { + base ospfv3-prefix-option; + description + "DN-bit. When set, the Inter-Area-Prefix-LSA or + AS-External-LSA prefix has been advertised as an + L3VPN prefix."; + } + + identity ospfv2-lsa-option { + description + "Base identity for OSPFv2 LSA Options."; + } + + identity mt-bit { + base ospfv2-lsa-option; + description + "MT-bit. When set, the router supports multi-topology as + described in RFC 4915."; + reference + "RFC 4915: Multi-Topology (MT) Routing in OSPF"; + } + + identity v2-dc-bit { + base ospfv2-lsa-option; + description + "DC-bit. When set, the router supports demand circuits."; + } + + identity v2-p-bit { + base ospfv2-lsa-option; + description + "P-bit. Only used in type-7 LSAs. When set, an NSSA + border router should translate the type-7 LSA + to a type-5 LSA."; + } + + identity mc-bit { + base ospfv2-lsa-option; + description + "MC-bit. When set, the router supports + Multicast Extensions to OSPF (MOSPF)."; + } + + identity v2-e-bit { + base ospfv2-lsa-option; + description + "E-bit. This bit describes the way AS-External-LSAs + are flooded."; + } + + identity o-bit { + base ospfv2-lsa-option; + description + "O-bit. When set, the router is opaque capable as described + in RFC 5250."; + reference + "RFC 5250: The OSPF Opaque LSA Option"; + } + + identity v2-dn-bit { + base ospfv2-lsa-option; + description + "DN-bit. When a type 3, type 5, or type 7 LSA is sent from a + PE to a CE, the DN-bit must be set. See RFC 4576."; + reference + "RFC 4576: Using a Link State Advertisement (LSA) Options Bit + to Prevent Looping in BGP/MPLS IP Virtual Private Networks + (VPNs)"; + } + + identity ospfv2-extended-prefix-flag { + description + "Base identity for the Extended Prefix TLV flag."; + } + + identity a-flag { + base ospfv2-extended-prefix-flag; + description + "Attach flag. When set, it indicates that the prefix + corresponds to a route that is directly connected to + the advertising router."; + } + + identity node-flag { + base ospfv2-extended-prefix-flag; + description + "Node flag. When set, it indicates that the prefix is + used to represent the advertising node, e.g., a loopback + address."; + } + + typedef ospf-metric { + type uint32 { + range "0 .. 16777215"; + } + description + "OSPF metric. 24-bit unsigned integer."; + } + + typedef ospf-link-metric { + type uint16 { + range "0 .. 65535"; + } + description + "OSPF link metric. 16-bit unsigned integer."; + } + + typedef opaque-id { + type uint32 { + range "0 .. 16777215"; + } + description + "Opaque-LSA ID. 24-bit unsigned integer."; + } + + typedef area-id-type { + type yang:dotted-quad; + description + "Area ID type."; + } + + typedef route-type { + type enumeration { + enum intra-area { + description + "OSPF intra-area route."; + } + enum inter-area { + description + "OSPF inter-area route."; + } + enum external-1 { + description + "OSPF type 1 external route."; + } + enum external-2 { + description + "OSPF type 2 external route."; + } + enum nssa-1 { + description + "OSPF type 1 NSSA route."; + } + enum nssa-2 { + description + "OSPF type 2 NSSA route."; + } + } + description + "OSPF route type."; + } + + typedef if-state-type { + type enumeration { + enum down { + value 1; + description + "Interface is in the 'Down' state."; + } + enum loopback { + value 2; + description + "Interface is in the 'Loopback' state."; + } + enum waiting { + value 3; + description + "Interface is in the 'Waiting' state."; + } + enum point-to-point { + value 4; + description + "Interface is in the 'Point-to-point' state."; + } + enum dr { + value 5; + description + "Interface is in the 'DR' (Designated Router) state."; + } + enum bdr { + value 6; + description + "Interface is in the 'Backup' (Backup Designated Router + (BDR)) state."; + } + enum dr-other { + value 7; + description + "Interface is in the 'DR Other' state."; + } + } + description + "OSPF interface state type."; + reference + "RFC 2328: OSPF Version 2"; + } + + typedef router-link-type { + type enumeration { + enum point-to-point-link { + value 1; + description + "Point-to-point link to another router."; + } + enum transit-network-link { + value 2; + description + "Link to a transit network, identified by the DR."; + } + enum stub-network-link { + value 3; + description + "Link to a stub network, identified by the subnet."; + } + enum virtual-link { + value 4; + description + "Virtual link across a transit area."; + } + } + description + "OSPF router link type."; + } + + typedef nbr-state-type { + type enumeration { + enum down { + value 1; + description + "Neighbor is in the 'Down' state."; + } + enum attempt { + value 2; + description + "Neighbor is in the 'Attempt' state."; + } + enum init { + value 3; + description + "Neighbor is in the 'Init' state."; + } + enum 2-way { + value 4; + description + "Neighbor is in the '2-Way' state."; + } + enum exstart { + value 5; + description + "Neighbor is in the 'ExStart' (exchange start) state."; + } + enum exchange { + value 6; + description + "Neighbor is in the 'Exchange' state."; + } + enum loading { + value 7; + description + "Neighbor is in the 'Loading' state."; + } + enum full { + value 8; + description + "Neighbor is in the 'Full' state."; + } + } + description + "OSPF neighbor state type."; + reference + "RFC 2328: OSPF Version 2"; + } + + typedef restart-helper-status-type { + type enumeration { + enum not-helping { + value 1; + description + "Restart helper status of 'not-helping'."; + } + enum helping { + value 2; + description + "Restart helper status of 'helping'."; + } + } + description + "Restart helper status type."; + } + + typedef restart-exit-reason-type { + type enumeration { + enum none { + value 1; + description + "Restart not attempted."; + } + enum in-progress { + value 2; + description + "Restart in progress."; + } + enum completed { + value 3; + description + "Restart successfully completed."; + } + enum timed-out { + value 4; + description + "Restart timed out."; + } + enum topology-changed { + value 5; + description + "Restart aborted due to a topology change."; + } + } + description + "Describes the outcome of the last graceful restart attempt. + The local router is being restarted or acting as a helper."; + } + + typedef packet-type { + type enumeration { + enum hello { + value 1; + description + "OSPF Hello packet."; + } + enum database-description { + value 2; + description + "OSPF Database Description packet."; + } + enum link-state-request { + value 3; + description + "OSPF Link State Request packet."; + } + enum link-state-update { + value 4; + description + "OSPF Link State Update packet."; + } + enum link-state-ack { + value 5; + description + "OSPF Link State Acknowledgment packet."; + } + } + description + "OSPF packet type."; + } + + typedef nssa-translator-state-type { + type enumeration { + enum enabled { + value 1; + description + "NSSATranslatorState is 'enabled'."; + } + enum elected { + value 2; + description + "NSSATranslatorState is 'elected'."; + } + enum disabled { + value 3; + description + "NSSATranslatorState is 'disabled'."; + } + } + description + "OSPF NSSA translator state type."; + reference + "RFC 3101: The OSPF Not-So-Stubby Area (NSSA) Option"; + } + + typedef restart-status-type { + type enumeration { + enum not-restarting { + value 1; + description + "The router is not restarting."; + } + enum planned-restart { + value 2; + description + "The router is going through a planned restart."; + } + enum unplanned-restart { + value 3; + description + "The router is going through an unplanned restart."; + } + } + description + "OSPF graceful restart status type."; + } + + typedef fletcher-checksum16-type { + type string { + pattern '(0x)?[0-9a-fA-F]{4}'; + } + description + "Fletcher 16-bit checksum in hex-string format 0xXXXX."; + reference + "RFC 905: ISO Transport Protocol Specification ISO DP 8073"; + } + + typedef ospfv2-auth-trailer-rfc-version { + type enumeration { + enum rfc5709 { + description + "Support for the OSPF authentication trailer as + described in RFC 5709."; + reference + "RFC 5709: OSPFv2 HMAC-SHA Cryptographic Authentication"; + } + enum rfc7474 { + description + "Support for the OSPF authentication trailer as + described in RFC 7474."; + reference + "RFC 7474: Security Extension for OSPFv2 + When Using Manual Key Management"; + } + } + description + "OSPFv2 authentication trailer support."; + } + + grouping tlv { + description + "Type-Length-Value (TLV)."; + leaf type { + type uint16; + description + "TLV type."; + } + leaf length { + type uint16; + description + "TLV length (octets)."; + } + leaf value { + type yang:hex-string; + description + "TLV value."; + } + } + + grouping unknown-tlvs { + description + "Grouping used for unknown TLVs or unknown sub-TLVs."; + container unknown-tlvs { + description + "All unknown TLVs."; + list unknown-tlv { + description + "Unknown TLV."; + uses tlv; + } + } + } + + grouping node-tag-tlv { + description + "OSPF Node Admin Tag TLV grouping."; + list node-tag { + leaf tag { + type uint32; + description + "Value of the node administrative tag."; + } + description + "List of tags."; + } + } + + grouping router-capabilities-tlv { + description + "Grouping for OSPF router capabilities TLV types."; + reference + "RFC 7770: Extensions to OSPF for Advertising Optional + Router Capabilities"; + container router-informational-capabilities { + leaf-list informational-capabilities { + type identityref { + base informational-capability; + } + description + "List of informational capabilities. This list will + contain the identities for the informational + capabilities supported by the router."; + } + description + "OSPF Router Informational Flag definitions."; + } + list informational-capabilities-flags { + leaf informational-flag { + type uint32; + description + "Individual informational capability flag."; + } + description + "List of informational capability flags. This will + return all the 32-bit informational flags, irrespective + of whether or not they are known to the device."; + } + list functional-capabilities { + leaf functional-flag { + type uint32; + description + "Individual functional capability flag."; + } + description + "List of functional capability flags. This will + return all the 32-bit functional flags, irrespective + of whether or not they are known to the device."; + } + } + + grouping dynamic-hostname-tlv { + description + "Dynamic Hostname TLV."; + reference + "RFC 5642: Dynamic Hostname Exchange Mechanism for OSPF"; + leaf hostname { + type string { + length "1..255"; + } + description + "Dynamic hostname."; + } + } + + grouping sbfd-discriminator-tlv { + description + "S-BFD Discriminator TLV."; + reference + "RFC 7884: OSPF Extensions to Advertise Seamless Bidirectional + Forwarding Detection (S-BFD) Target Discriminators"; + list sbfd-discriminators { + leaf sbfd-discriminator { + type uint32; + description + "Individual S-BFD Discriminator."; + } + description + "List of S-BFD Discriminators."; + } + } + + grouping maximum-sid-depth-tlv { + description + "Node MSD TLV (TLV for Maximum SID Depth)."; + reference + "RFC 8476: Signaling Maximum SID Depth (MSD) Using OSPF"; + list msd-type { + leaf msd-type { + type uint8; + description + "Maximum SID Depth (MSD) type."; + } + leaf msd-value { + type uint8; + description + "MSD value for the type."; + } + description + "List of MSD tuples."; + } + } + + grouping ospf-router-lsa-bits { + container router-bits { + leaf-list rtr-lsa-bits { + type identityref { + base router-lsa-bit; + } + description + "List of Router-LSA bits. This list will contain + identities for the bits; these identities are set + in the Router-LSA bits."; + } + description + "Router-LSA bits."; + } + description + "Router-LSA bits. Currently common to both OSPFv2 and + OSPFv3 but may diverge with future augmentations."; + } + + grouping ospfv2-router-link { + description + "OSPFv2 router link."; + leaf link-id { + type union { + type inet:ipv4-address; + type yang:dotted-quad; + } + description + "Router-LSA Link ID."; + } + leaf link-data { + type union { + type inet:ipv4-address; + type uint32; + } + description + "Router-LSA link data."; + } + leaf type { + type router-link-type; + description + "Router-LSA link type."; + } + } + + grouping ospfv2-lsa-body { + description + "OSPFv2 LSA body."; + container router { + when "derived-from-or-self(../../header/type, " + + "'ospfv2-router-lsa')" { + description + "Only applies to Router-LSAs."; + } + description + "Router-LSA."; + uses ospf-router-lsa-bits; + leaf num-of-links { + type uint16; + description + "Number of links in the Router-LSA."; + } + container links { + description + "All router links."; + list link { + description + "Router-LSA link."; + uses ospfv2-router-link; + container topologies { + description + "All topologies for the link."; + list topology { + description + "Topology-specific information."; + leaf mt-id { + type uint8; + description + "The MT-ID for the topology enabled on the link."; + } + leaf metric { + type uint16; + description + "Metric for the topology."; + } + } + } + } + } + } + container network { + when "derived-from-or-self(../../header/type, " + + "'ospfv2-network-lsa')" { + description + "Only applies to Network-LSAs."; + } + description + "Network-LSA."; + leaf network-mask { + type yang:dotted-quad; + description + "The IP address mask for the network."; + } + container attached-routers { + description + "All attached routers."; + leaf-list attached-router { + type inet:ipv4-address; + description + "List of the routers attached to the network."; + } + } + } + container summary { + when "derived-from(../../header/type, " + + "'ospfv2-summary-lsa-type')" { + description + "Only applies to summary LSAs."; + } + description + "Summary LSA."; + leaf network-mask { + type inet:ipv4-address; + description + "The IP address mask for the network."; + } + container topologies { + description + "All topologies for the summary LSA."; + list topology { + description + "Topology-specific information."; + leaf mt-id { + type uint8; + description + "The MT-ID for the topology enabled for the summary."; + } + leaf metric { + type ospf-metric; + description + "Metric for the topology."; + } + } + } + } + container external { + when "derived-from(../../header/type, " + + "'ospfv2-external-lsa-type')" { + description + "Only applies to AS-External-LSAs and NSSA-LSAs."; + } + description + "External-LSA."; + leaf network-mask { + type inet:ipv4-address; + description + "The IP address mask for the network."; + } + container topologies { + description + "All topologies for the External-LSA."; + list topology { + description + "Topology-specific information."; + leaf mt-id { + type uint8; + description + "The MT-ID for the topology enabled for the + external or NSSA prefix."; + } + leaf flags { + type bits { + bit E { + description + "When set, the metric specified is a Type 2 + external metric."; + } + } + description + "Topology flags."; + } + leaf metric { + type ospf-metric; + description + "Metric for the topology."; + } + leaf forwarding-address { + type inet:ipv4-address; + description + "IPv4 Forwarding address."; + } + leaf external-route-tag { + type uint32; + description + "Route tag for the topology."; + } + } + } + } + container opaque { + when "derived-from(../../header/type, " + + "'ospfv2-opaque-lsa-type')" { + description + "Only applies to Opaque-LSAs."; + } + description + "Opaque-LSA."; + + container ri-opaque { + description + "OSPF Router-Information-Opaque-LSA."; + reference + "RFC 7770: Extensions to OSPF for Advertising Optional + Router Capabilities"; + + container router-capabilities-tlv { + description + "Informational and functional router capabilities."; + uses router-capabilities-tlv; + } + + container node-tag-tlvs { + description + "All Node Admin Tag TLVs."; + list node-tag-tlv { + description + "Node Admin Tag TLV."; + uses node-tag-tlv; + } + } + + container dynamic-hostname-tlv { + description + "OSPF Dynamic Hostname TLV."; + uses dynamic-hostname-tlv; + } + + container sbfd-discriminator-tlv { + description + "OSPF S-BFD Discriminator TLV."; + uses sbfd-discriminator-tlv; + } + + container maximum-sid-depth-tlv { + description + "OSPF Node MSD TLV."; + uses maximum-sid-depth-tlv; + } + uses unknown-tlvs; + } + + container te-opaque { + description + "OSPFv2 TE Opaque-LSA."; + reference + "RFC 3630: Traffic Engineering (TE) Extensions to + OSPF Version 2"; + + container router-address-tlv { + description + "Router address TLV."; + leaf router-address { + type inet:ipv4-address; + description + "Router address."; + } + } + + container link-tlv { + description + "Describes a single link. It is constructed + from a set of sub-TLVs."; + leaf link-type { + type router-link-type; + mandatory true; + description + "Link type."; + } + leaf link-id { + type union { + type inet:ipv4-address; + type yang:dotted-quad; + } + mandatory true; + description + "Link ID."; + } + container local-if-ipv4-addrs { + description + "All local interface IPv4 addresses."; + leaf-list local-if-ipv4-addr { + type inet:ipv4-address; + description + "List of local interface IPv4 addresses."; + } + } + container remote-if-ipv4-addrs { + description + "All remote interface IPv4 addresses."; + leaf-list remote-if-ipv4-addr { + type inet:ipv4-address; + description + "List of remote interface IPv4 addresses."; + } + } + leaf te-metric { + type uint32; + description + "TE metric."; + } + leaf max-bandwidth { + type rt-types:bandwidth-ieee-float32; + description + "Maximum bandwidth."; + } + leaf max-reservable-bandwidth { + type rt-types:bandwidth-ieee-float32; + description + "Maximum reservable bandwidth."; + } + container unreserved-bandwidths { + description + "All unreserved bandwidths."; + list unreserved-bandwidth { + leaf priority { + type uint8 { + range "0 .. 7"; + } + description + "Priority from 0 to 7."; + } + leaf unreserved-bandwidth { + type rt-types:bandwidth-ieee-float32; + description + "Unreserved bandwidth."; + } + description + "List of unreserved bandwidths for different + priorities."; + } + } + leaf admin-group { + type uint32; + description + "Administrative Group / Resource Class/Color."; + } + uses unknown-tlvs; + } + } + + container extended-prefix-opaque { + description + "All Extended Prefix TLVs in the LSA."; + list extended-prefix-tlv { + description + "Extended Prefix TLV."; + leaf route-type { + type enumeration { + enum unspecified { + value 0; + description + "Unspecified."; + } + enum intra-area { + value 1; + description + "OSPF intra-area route."; + } + enum inter-area { + value 3; + description + "OSPF inter-area route."; + } + enum external { + value 5; + description + "OSPF external route."; + } + enum nssa { + value 7; + description + "OSPF NSSA external route."; + } + } + description + "Route type."; + } + container flags { + leaf-list extended-prefix-flags { + type identityref { + base ospfv2-extended-prefix-flag; + } + description + "List of Extended Prefix TLV flags. This list will + contain identities for the prefix flags; these + identities are set in the extended prefix flags."; + } + description + "Prefix flags."; + } + leaf prefix { + type inet:ip-prefix; + description + "Address prefix."; + } + uses unknown-tlvs; + } + } + + container extended-link-opaque { + description + "All Extended Link TLVs in the LSA."; + reference + "RFC 7684: OSPFv2 Prefix/Link Attribute Advertisement"; + container extended-link-tlv { + description + "Extended Link TLV."; + uses ospfv2-router-link; + container maximum-sid-depth-tlv { + description + "OSPF Node MSD TLV."; + uses maximum-sid-depth-tlv; + } + uses unknown-tlvs; + } + } + } + } + + grouping ospfv3-lsa-options { + description + "OSPFv3 LSA Options."; + container lsa-options { + leaf-list lsa-options { + type identityref { + base ospfv3-lsa-option; + } + description + "List of OSPFv3 LSA Options. This list will contain + the identities for the OSPFv3 LSA Options that are + set for the LSA."; + } + description + "OSPFv3 LSA Options."; + } + } + + grouping ospfv3-lsa-prefix { + description + "OSPFv3 LSA prefix."; + + leaf prefix { + type inet:ip-prefix; + description + "LSA prefix."; + } + container prefix-options { + leaf-list prefix-options { + type identityref { + base ospfv3-prefix-option; + } + description + "List of OSPFv3 prefix Options. This list will + contain the identities for the OSPFv3 options + that are set for the OSPFv3 prefix."; + } + description + "Prefix options."; + } + } + + grouping ospfv3-lsa-external { + description + "AS-External-LSA or NSSA-LSA."; + leaf metric { + type ospf-metric; + description + "AS-External-LSA or NSSA-LSA Metric."; + } + leaf flags { + type bits { + bit E { + description + "When set, the metric specified is a Type 2 + external metric."; + } + bit F { + description + "When set, a forwarding address is included + in the LSA."; + } + bit T { + description + "When set, an external route tag is included + in the LSA."; + } + } + description + "AS-External-LSA or NSSA-LSA flags."; + } + + leaf referenced-ls-type { + type identityref { + base ospfv3-lsa-type; + } + description + "Referenced Link State (LS) Type."; + reference + "RFC 5340: OSPF for IPv6"; + } + leaf unknown-referenced-ls-type { + type uint16; + description + "Value for an unknown Referenced LS Type."; + } + + uses ospfv3-lsa-prefix; + + leaf forwarding-address { + type inet:ipv6-address; + description + "IPv6 Forwarding address."; + } + + leaf external-route-tag { + type uint32; + description + "Route tag."; + } + leaf referenced-link-state-id { + type uint32; + description + "Referenced Link State ID."; + reference + "RFC 5340: OSPF for IPv6"; + } + } + + grouping ospfv3-lsa-body { + description + "OSPFv3 LSA body."; + container router { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-router-lsa')" { + description + "Only applies to Router-LSAs."; + } + description + "Router-LSA."; + uses ospf-router-lsa-bits; + uses ospfv3-lsa-options; + + container links { + description + "All router links."; + list link { + description + "Router-LSA link."; + leaf interface-id { + type uint32; + description + "Interface ID for the link."; + } + leaf neighbor-interface-id { + type uint32; + description + "Neighbor's Interface ID for the link."; + } + leaf neighbor-router-id { + type rt-types:router-id; + description + "Neighbor's Router ID for the link."; + } + leaf type { + type router-link-type; + description + "Link type: 1 - Point-to-Point Link + 2 - Transit Network Link + 3 - Reserved for OSPFv3 Links + 4 - Virtual Link."; + } + leaf metric { + type uint16; + description + "Link metric."; + } + } + } + } + container network { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-network-lsa')" { + description + "Only applies to Network-LSAs."; + } + description + "Network-LSA."; + + uses ospfv3-lsa-options; + + container attached-routers { + description + "All attached routers."; + leaf-list attached-router { + type rt-types:router-id; + description + "List of the routers attached to the network."; + } + } + } + container inter-area-prefix { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-inter-area-prefix-lsa')" { + description + "Only applies to Inter-Area-Prefix-LSAs."; + } + leaf metric { + type ospf-metric; + description + "Inter-Area Prefix metric."; + } + uses ospfv3-lsa-prefix; + description + "Prefix-LSA."; + } + container inter-area-router { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-inter-area-router-lsa')" { + description + "Only applies to Inter-Area-Router-LSAs."; + } + uses ospfv3-lsa-options; + leaf metric { + type ospf-metric; + description + "Autonomous System Boundary Router (ASBR) metric."; + } + leaf destination-router-id { + type rt-types:router-id; + description + "The Router ID of the ASBR described by the LSA."; + } + description + "Inter-Area-Router-LSA."; + } + container as-external { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-as-external-lsa')" { + description + "Only applies to AS-External-LSAs."; + } + + uses ospfv3-lsa-external; + + description + "AS-External-LSA."; + } + container nssa { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-nssa-lsa')" { + description + "Only applies to NSSA-LSAs."; + } + uses ospfv3-lsa-external; + + description + "NSSA-LSA."; + } + container link { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-link-lsa')" { + description + "Only applies to Link-LSAs."; + } + leaf rtr-priority { + type uint8; + description + "Router priority for DR election. A router with a + higher priority will be preferred in the election. + A value of 0 indicates that the router is not eligible + to become the DR or BDR."; + } + uses ospfv3-lsa-options; + + leaf link-local-interface-address { + type inet:ipv6-address; + description + "The originating router's link-local + interface address for the link."; + } + + leaf num-of-prefixes { + type uint32; + description + "Number of prefixes."; + } + + container prefixes { + description + "All prefixes for the link."; + list prefix { + description + "List of prefixes associated with the link."; + uses ospfv3-lsa-prefix; + } + } + description + "Link-LSA."; + } + container intra-area-prefix { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-intra-area-prefix-lsa')" { + description + "Only applies to Intra-Area-Prefix-LSAs."; + } + description + "Intra-Area-Prefix-LSA."; + + leaf referenced-ls-type { + type identityref { + base ospfv3-lsa-type; + } + description + "Referenced LS Type."; + } + leaf unknown-referenced-ls-type { + type uint16; + description + "Value for an unknown Referenced LS Type."; + } + leaf referenced-link-state-id { + type uint32; + description + "Referenced Link State ID."; + } + leaf referenced-adv-router { + type rt-types:router-id; + description + "Referenced Advertising Router."; + reference + "RFC 5340: OSPF for IPv6"; + } + + leaf num-of-prefixes { + type uint16; + description + "Number of prefixes."; + } + container prefixes { + description + "All prefixes in this LSA."; + list prefix { + description + "List of prefixes in this LSA."; + uses ospfv3-lsa-prefix; + leaf metric { + type uint16; + description + "Prefix metric."; + } + } + } + } + container router-information { + when "derived-from-or-self(../../header/type, " + + "'ospfv3-router-information-lsa')" { + description + "Only applies to Router-Information-LSAs (RFC 7770)."; + reference + "RFC 7770: Extensions to OSPF for Advertising Optional + Router Capabilities"; + } + container router-capabilities-tlv { + description + "Informational and functional router capabilities."; + uses router-capabilities-tlv; + } + container node-tag-tlvs { + description + "All Node Admin Tag TLVs."; + list node-tag-tlv { + description + "Node Admin Tag TLV."; + uses node-tag-tlv; + } + } + container dynamic-hostname-tlv { + description + "OSPF Dynamic Hostname TLV."; + uses dynamic-hostname-tlv; + } + + container sbfd-discriminator-tlv { + description + "OSPF S-BFD Discriminator TLV."; + uses sbfd-discriminator-tlv; + } + + description + "Router-Information-LSA."; + reference + "RFC 7770: Extensions to OSPF for Advertising Optional + Router Capabilities"; + } + } + + grouping lsa-header { + description + "Common LSA for OSPFv2 and OSPFv3."; + leaf age { + type uint16; + mandatory true; + description + "LSA age."; + } + leaf type { + type identityref { + base ospf-lsa-type; + } + mandatory true; + description + "LSA type."; + } + leaf adv-router { + type rt-types:router-id; + mandatory true; + description + "LSA advertising router."; + } + leaf seq-num { + type uint32; + mandatory true; + description + "LSA sequence number."; + } + leaf checksum { + type fletcher-checksum16-type; + mandatory true; + description + "LSA checksum."; + } + leaf length { + type uint16; + mandatory true; + description + "LSA length, including the header."; + } + } + + grouping ospfv2-lsa { + description + "OSPFv2 LSA. LSAs are uniquely identified by + the + tuple, with the sequence number differentiating the + LSA instances."; + container header { + must "(derived-from(type, " + + "'ospfv2-opaque-lsa-type') and " + + "opaque-id and opaque-type) or " + + "(not(derived-from(type, " + + "'ospfv2-opaque-lsa-type')) " + + "and not(opaque-id) and not(opaque-type))" { + description + "The opaque-type and the opaque-id only apply to + Opaque-LSAs."; + } + description + "Decoded OSPFv2 LSA header data."; + + container lsa-options { + leaf-list lsa-options { + type identityref { + base ospfv2-lsa-option; + } + description + "List of LSA Options. This list will contain the + identities for the OSPFv2 LSA Options that are set."; + } + description + "LSA Options."; + } + + leaf lsa-id { + type yang:dotted-quad; + mandatory true; + description + "Link State ID."; + } + + leaf opaque-type { + type uint8; + description + "Opaque-LSA type."; + } + + leaf opaque-id { + type opaque-id; + description + "Opaque-LSA ID."; + } + + uses lsa-header; + } + container body { + description + "Decoded OSPFv2 LSA body data."; + uses ospfv2-lsa-body; + } + } + + grouping ospfv3-lsa { + description + "Decoded OSPFv3 LSA."; + container header { + description + "Decoded OSPFv3 LSA header data."; + leaf lsa-id { + type uint32; + mandatory true; + description + "OSPFv3 LSA ID."; + } + uses lsa-header; + } + container body { + description + "Decoded OSPF LSA body data."; + uses ospfv3-lsa-body; + } + } + grouping lsa-common { + description + "Common fields for OSPF LSA representation."; + leaf decode-completed { + type boolean; + description + "The OSPF LSA body was successfully decoded, except for + unknown TLVs. Unknown LSA types and OSPFv2 unknown + Opaque-LSA types are not decoded. Additionally, + malformed LSAs are generally not accepted and will + not be in the Link State Database (LSDB)."; + } + leaf raw-data { + type yang:hex-string; + description + "The hexadecimal representation of the complete LSA as + received or originated, in network byte order."; + } + } + + grouping lsa { + description + "OSPF LSA."; + uses lsa-common; + choice version { + description + "OSPFv2 or OSPFv3 LSA body."; + container ospfv2 { + description + "OSPFv2 LSA."; + uses ospfv2-lsa; + } + container ospfv3 { + description + "OSPFv3 LSA."; + uses ospfv3-lsa; + } + } + } + + grouping lsa-key { + description + "OSPF LSA key. The database key for each LSA of a given + type in the LSDB."; + leaf lsa-id { + type union { + type yang:dotted-quad; + type uint32; + } + description + "Link State ID."; + } + leaf adv-router { + type rt-types:router-id; + description + "Advertising router."; + } + } + + grouping instance-stat { + description + "Per-instance statistics."; + leaf discontinuity-time { + type yang:date-and-time; + description + "The time of the most recent occasion at which any one or + more of this OSPF instance's counters suffered a + discontinuity. If no such discontinuities have occurred + since the OSPF instance was last reinitialized, then + this node contains the time the OSPF instance was + reinitialized, which normally occurs when it was + created."; + } + leaf originate-new-lsa-count { + type yang:counter32; + description + "The number of new LSAs originated. Discontinuities in the + value of this counter can occur when the OSPF instance is + reinitialized."; + } + leaf rx-new-lsas-count { + type yang:counter32; + description + "The number of new LSAs received. Discontinuities in the + value of this counter can occur when the OSPF instance is + reinitialized."; + } + leaf as-scope-lsa-count { + type yang:gauge32; + description + "The number of AS-Scope LSAs."; + } + leaf as-scope-lsa-chksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for AS-Scope LSAs. The value should be treated as + unsigned when comparing two sums of checksums. While + differing checksums indicate a different combination + of LSAs, equivalent checksums don't guarantee that the + LSAs are the same, given that multiple combinations of + LSAs can result in the same checksum."; + } + container database { + description + "Container for per-AS-Scope LSA statistics."; + list as-scope-lsa-type { + description + "List of AS-Scope LSA statistics."; + leaf lsa-type { + type uint16; + description + "AS-Scope LSA type."; + } + leaf lsa-count { + type yang:gauge32; + description + "The number of LSAs of this LSA type."; + } + leaf lsa-cksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for LSAs of this type. The value should be + treated as unsigned when comparing two sums of + checksums. While differing checksums indicate a + different combination of LSAs, equivalent checksums + don't guarantee that the LSAs are the same, given that + multiple combinations of LSAs can result in the same + checksum."; + } + } + } + uses instance-fast-reroute-state; + } + + grouping area-stat { + description + "Per-area statistics."; + leaf discontinuity-time { + type yang:date-and-time; + description + "The time of the most recent occasion at which any one or + more of this OSPF area's counters suffered a + discontinuity. If no such discontinuities have occurred + since the OSPF area was last reinitialized, then + this node contains the time the OSPF area was + reinitialized, which normally occurs when it was + created."; + } + leaf spf-runs-count { + type yang:counter32; + description + "The number of times the intra-area SPF has run. + Discontinuities in the value of this counter can occur + when the OSPF area is reinitialized."; + } + leaf abr-count { + type yang:gauge32; + description + "The total number of Area Border Routers (ABRs) + reachable within this area."; + } + leaf asbr-count { + type yang:gauge32; + description + "The total number of AS Boundary Routers (ASBRs) + reachable within this area."; + } + leaf ar-nssa-translator-event-count { + type yang:counter32; + description + "The number of NSSA translator-state changes. + Discontinuities in the value of this counter can occur + when the OSPF area is reinitialized."; + } + leaf area-scope-lsa-count { + type yang:gauge32; + description + "The number of area-scope LSAs in the area."; + } + leaf area-scope-lsa-cksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for area-scope LSAs. The value should be treated as + unsigned when comparing two sums of checksums. While + differing checksums indicate a different combination + of LSAs, equivalent checksums don't guarantee that the + LSAs are the same, given that multiple combinations of + LSAs can result in the same checksum."; + } + container database { + description + "Container for area-scope LSA type statistics."; + list area-scope-lsa-type { + description + "List of area-scope LSA statistics."; + leaf lsa-type { + type uint16; + description + "Area-scope LSA type."; + } + leaf lsa-count { + type yang:gauge32; + description + "The number of LSAs of this LSA type."; + } + leaf lsa-cksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for LSAs of this type. The value should be + treated as unsigned when comparing two sums of + checksums. While differing checksums indicate a + different combination of LSAs, equivalent checksums + don't guarantee that the LSAs are the same, given that + multiple combinations of LSAs can result in the same + checksum."; + } + } + } + } + + grouping interface-stat { + description + "Per-interface statistics."; + leaf discontinuity-time { + type yang:date-and-time; + description + "The time of the most recent occasion at which any one or + more of this OSPF interface's counters suffered a + discontinuity. If no such discontinuities have occurred + since the OSPF interface was last reinitialized, then + this node contains the time the OSPF interface was + reinitialized, which normally occurs when it was + created."; + } + leaf if-event-count { + type yang:counter32; + description + "The number of times this interface has changed its + state or an error has occurred. Discontinuities in the + value of this counter can occur when the OSPF interface + is reinitialized."; + } + leaf link-scope-lsa-count { + type yang:gauge32; + description + "The number of link-scope LSAs."; + } + leaf link-scope-lsa-cksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for link-scope LSAs. The value should be treated as + unsigned when comparing two sums of checksums. While + differing checksums indicate a different combination + of LSAs, equivalent checksums don't guarantee that the + LSAs are the same, given that multiple combinations of + LSAs can result in the same checksum."; + } + container database { + description + "Container for link-scope LSA type statistics."; + list link-scope-lsa-type { + description + "List of link-scope LSA statistics."; + leaf lsa-type { + type uint16; + description + "Link-scope LSA type."; + } + leaf lsa-count { + type yang:gauge32; + description + "The number of LSAs of this LSA type."; + } + leaf lsa-cksum-sum { + type uint32; + description + "The modulo 2^32 sum of the LSA checksums + for LSAs of this type. The value should be + treated as unsigned when comparing two sums of + checksums. While differing checksums indicate a + different combination of LSAs, equivalent checksums + don't guarantee that the LSAs are the same, given that + multiple combinations of LSAs can result in the same + checksum."; + } + } + } + } + + grouping neighbor-stat { + description + "Per-neighbor statistics."; + leaf discontinuity-time { + type yang:date-and-time; + description + "The time of the most recent occasion at which any one or + more of this OSPF neighbor's counters suffered a + discontinuity. If no such discontinuities have occurred + since the OSPF neighbor was last reinitialized, then + this node contains the time the OSPF neighbor was + reinitialized, which normally occurs when the neighbor + is dynamically discovered and created."; + } + leaf nbr-event-count { + type yang:counter32; + description + "The number of times this neighbor has changed + state or an error has occurred. Discontinuities in the + value of this counter can occur when the OSPF neighbor + is reinitialized."; + } + leaf nbr-retrans-qlen { + type yang:gauge32; + description + "The current length of the retransmission queue."; + } + } + + grouping instance-fast-reroute-config { + description + "This group defines the global configuration of + IP Fast Reroute (IP-FRR)."; + container fast-reroute { + if-feature "fast-reroute"; + description + "This container may be augmented with global + parameters for IP-FRR."; + container lfa { + if-feature "lfa"; + description + "This container may be augmented with + global parameters for Loop-Free Alternates (LFAs). + Container creation has no effect on LFA activation."; + } + } + } + + grouping instance-fast-reroute-state { + description + "IP-FRR state data grouping."; + + container protected-routes { + if-feature "fast-reroute"; + config false; + description + "Instance protection statistics."; + + list address-family-stats { + key "address-family prefix alternate"; + description + "Per-Address-Family (AF) protected prefix information."; + + leaf address-family { + type iana-rt-types:address-family; + description + "Address family."; + } + leaf prefix { + type inet:ip-prefix; + description + "Protected prefix."; + } + leaf alternate { + type inet:ip-address; + description + "Alternate next hop for the prefix."; + } + leaf alternate-type { + type enumeration { + enum equal-cost { + description + "ECMP-based alternate."; + } + enum lfa { + description + "LFA-based alternate."; + } + enum remote-lfa { + description + "Remote-LFA-based alternate."; + } + enum tunnel { + description + "Tunnel-based alternate (like RSVP-TE or GRE)."; + } + enum ti-lfa { + description + "An alternate based on Topology-Independent + Loop-Free Alternate (TI-LFA)."; + } + enum mrt { + description + "An alternate based on Maximally Redundant Trees + (MRTs)."; + } + enum other { + description + "Unknown alternate type."; + } + } + description + "Type of alternate."; + } + leaf best { + type boolean; + description + "Indicates that this alternate is preferred."; + } + leaf non-best-reason { + type string { + length "1..255"; + } + description + "Information field used to describe why the alternate + is not the best choice."; + } + leaf protection-available { + type bits { + bit node-protect { + position 0; + description + "Node protection available."; + } + bit link-protect { + position 1; + description + "Link protection available."; + } + bit srlg-protect { + position 2; + description + "Shared Risk Link Group (SRLG) protection + available."; + } + bit downstream-protect { + position 3; + description + "Downstream protection available."; + } + bit other { + position 4; + description + "Other protection available."; + } + } + description + "Protection provided by the alternate."; + } + leaf alternate-metric-1 { + type uint32; + description + "Metric from the Point of Local Repair (PLR) to + the destination through the alternate path."; + } + leaf alternate-metric-2 { + type uint32; + description + "Metric from the PLR to the alternate node."; + } + leaf alternate-metric-3 { + type uint32; + description + "Metric from the alternate node to the destination."; + } + } + } + + container unprotected-routes { + if-feature "fast-reroute"; + config false; + description + "List of prefixes that are not protected."; + + list address-family-stats { + key "address-family prefix"; + description + "Per-AF unprotected prefix statistics."; + + leaf address-family { + type iana-rt-types:address-family; + description + "Address family."; + } + leaf prefix { + type inet:ip-prefix; + description + "Unprotected prefix."; + } + } + } + + list protection-statistics { + key "frr-protection-method"; + config false; + description + "List of protection method statistics."; + + leaf frr-protection-method { + type string; + description + "Protection method used."; + } + list address-family-stats { + key "address-family"; + description + "Per-AF protection statistics."; + + leaf address-family { + type iana-rt-types:address-family; + description + "Address family."; + } + leaf total-routes { + type uint32; + description + "Total prefixes."; + } + leaf unprotected-routes { + type uint32; + description + "Total prefixes that are not protected."; + } + leaf protected-routes { + type uint32; + description + "Total prefixes that are protected."; + } + leaf linkprotected-routes { + type uint32; + description + "Total prefixes that are link protected."; + } + leaf nodeprotected-routes { + type uint32; + description + "Total prefixes that are node protected."; + } + } + } + } + + grouping interface-fast-reroute-config { + description + "This group defines interface configuration of IP-FRR."; + container fast-reroute { + if-feature "fast-reroute"; + container lfa { + if-feature "lfa"; + leaf candidate-enabled { + type boolean; + default "true"; + description + "Enables the interface to be used as a backup."; + } + leaf enabled { + type boolean; + default "false"; + description + "Activates an LFA. Per-prefix LFA computation + is assumed."; + } + container remote-lfa { + if-feature "remote-lfa"; + leaf enabled { + type boolean; + default "false"; + description + "Activates a Remote LFA (R-LFA)."; + } + description + "R-LFA configuration."; + } + description + "LFA configuration."; + } + description + "Interface IP-FRR configuration."; + } + } + + grouping interface-physical-link-config { + description + "Interface cost configuration that only applies to + physical interfaces (non-virtual) and sham links."; + leaf cost { + type ospf-link-metric; + description + "Interface's cost."; + } + leaf mtu-ignore { + if-feature "mtu-ignore"; + type boolean; + description + "Enables/disables bypassing the MTU mismatch check in + Database Description packets as specified in Section 10.6 + of RFC 2328."; + reference + "RFC 2328: OSPF Version 2, Section 10.6"; + } + leaf prefix-suppression { + if-feature "prefix-suppression"; + type boolean; + description + "Suppresses advertisement of the prefixes associated + with the interface."; + } + } + + grouping interface-common-config { + description + "Common configuration for all types of interfaces, + including virtual links and sham links."; + + leaf hello-interval { + type uint16; + units "seconds"; + description + "Interval between Hello packets (seconds). It must + be the same for all routers on the same network. + Different networks, implementations, and deployments + will use different Hello intervals. A sample value + for a LAN network would be 10 seconds."; + reference + "RFC 2328: OSPF Version 2, Appendix C.3"; + } + + leaf dead-interval { + type uint16; + units "seconds"; + must '../dead-interval > ../hello-interval' { + error-message "The dead interval must be " + + "larger than the Hello interval"; + description + "The value must be greater than 'hello-interval'."; + } + description + "Interval after which a neighbor is declared down + (seconds) if Hello packets are not received. It is + typically 3 or 4 times the 'hello-interval' period. + A typical value for LAN networks is 40 seconds."; + reference + "RFC 2328: OSPF Version 2, Appendix C.3"; + } + + leaf retransmit-interval { + type uint16 { + range "1..3600"; + } + units "seconds"; + description + "Interval between retransmitting unacknowledged Link + State Advertisements (LSAs) (seconds). This should + be well over the round-trip transmit delay for + any two routers on the network. A sample value + would be 5 seconds."; + reference + "RFC 2328: OSPF Version 2, Appendix C.3"; + } + + leaf transmit-delay { + type uint16; + units "seconds"; + description + "Estimated time needed to transmit Link State Update + (LSU) packets on the interface (seconds). LSAs have + their age incremented by this amount when advertised + on the interface. A sample value would be 1 second."; + reference + "RFC 2328: OSPF Version 2, Appendix C.3"; + } + + leaf lls { + if-feature "lls"; + type boolean; + description + "Enables/disables link-local signaling (LLS) support."; + } + + container ttl-security { + if-feature "ttl-security"; + description + "Time to Live (TTL) security checking."; + leaf enabled { + type boolean; + description + "Enables/disables TTL security checking."; + } + leaf hops { + type uint8 { + range "1..254"; + } + default "1"; + description + "Maximum number of hops that an OSPF packet may + have traversed before reception."; + } + } + leaf enabled { + type boolean; + default "true"; + description + "Enables/disables the OSPF protocol on the interface."; + } + + container authentication { + description + "Authentication configuration."; + choice auth-type-selection { + description + "Options for OSPFv2/OSPFv3 authentication + configuration."; + case ospfv2-auth { + when "derived-from-or-self(../../../../../../rt:type, " + + "'ospfv2')" { + description + "Applied to OSPFv2 only."; + } + leaf ospfv2-auth-trailer-rfc { + if-feature "ospfv2-authentication-trailer"; + type ospfv2-auth-trailer-rfc-version; + description + "Version of OSPFv2 authentication trailer support. + See RFCs 5709 and 7474."; + reference + "RFC 5709: OSPFv2 HMAC-SHA Cryptographic Authentication + RFC 7474: Security Extension for OSPFv2 When Using + Manual Key Management"; + } + choice ospfv2-auth-specification { + description + "Key chain or explicit key parameter specification."; + case auth-key-chain { + if-feature "key-chain"; + leaf ospfv2-key-chain { + type key-chain:key-chain-ref; + description + "Name of the key chain."; + } + } + case auth-key-explicit { + leaf ospfv2-key-id { + type uint32; + description + "Key identifier."; + } + leaf ospfv2-key { + type string; + description + "OSPFv2 authentication key. The + length of the key may be dependent on the + cryptographic algorithm."; + } + leaf ospfv2-crypto-algorithm { + type identityref { + base key-chain:crypto-algorithm; + } + description + "Cryptographic algorithm associated with the key."; + } + } + } + } + case ospfv3-auth-ipsec { + when "derived-from-or-self(../../../../../../rt:type, " + + "'ospfv3')" { + description + "Applied to OSPFv3 only."; + } + if-feature "ospfv3-authentication-ipsec"; + leaf sa { + type string; + description + "Name of the Security Association (SA)."; + } + } + case ospfv3-auth-trailer { + when "derived-from-or-self(../../../../../../rt:type, " + + "'ospfv3')" { + description + "Applied to OSPFv3 only."; + } + if-feature "ospfv3-authentication-trailer"; + choice ospfv3-auth-specification { + description + "Key chain or explicit key parameter specification."; + case auth-key-chain { + if-feature "key-chain"; + leaf ospfv3-key-chain { + type key-chain:key-chain-ref; + description + "Name of the key chain."; + } + } + case auth-key-explicit { + leaf ospfv3-sa-id { + type uint16; + description + "Security Association (SA) Identifier."; + } + leaf ospfv3-key { + type string; + description + "OSPFv3 authentication key. The + length of the key may be dependent on the + cryptographic algorithm."; + } + leaf ospfv3-crypto-algorithm { + type identityref { + base key-chain:crypto-algorithm; + } + description + "Cryptographic algorithm associated with the key."; + } + } + } + } + } + } + } + + grouping interface-config { + description + "Configuration for normal OSPF interfaces (not virtual + or sham interfaces)."; + + leaf interface-type { + type enumeration { + enum broadcast { + description + "Specifies an OSPF broadcast multi-access network."; + } + enum non-broadcast { + description + "Specifies an OSPF Non-Broadcast Multi-Access + (NBMA) network."; + } + enum point-to-multipoint { + description + "Specifies an OSPF point-to-multipoint network."; + } + enum point-to-point { + description + "Specifies an OSPF point-to-point network."; + } + enum hybrid { + if-feature "hybrid-interface"; + description + "Specifies an OSPF hybrid broadcast / + point-to-multipoint network."; + } + } + description + "Interface type."; + } + + leaf passive { + type boolean; + description + "Enables/disables a passive interface. A passive + interface's prefix will be advertised, but no neighbor + adjacencies will be formed on the interface."; + } + + leaf demand-circuit { + if-feature "demand-circuit"; + type boolean; + description + "Enables/disables a demand circuit."; + } + + leaf priority { + type uint8; + description + "Configures OSPF router priority. In a multi-access + network, this value is for Designated Router (DR) election. + The priority is ignored on other interface types. A router + with a higher priority will be preferred in the election. + A value of 0 indicates that the router is not eligible to + become the DR or Backup DR (BDR)."; + } + + container multi-areas { + if-feature "multi-area-adj"; + description + "Container for multi-area configuration."; + list multi-area { + key "multi-area-id"; + description + "Configures an OSPF multi-area adjacency."; + leaf multi-area-id { + type area-id-type; + description + "Multi-area adjacency area ID."; + } + leaf cost { + type ospf-link-metric; + description + "Interface cost for a multi-area adjacency."; + } + } + } + + container static-neighbors { + description + "Statically configured neighbors."; + + list neighbor { + key "identifier"; + description + "Specifies a static OSPF neighbor."; + + leaf identifier { + type inet:ip-address; + description + "Neighbor's Router ID, IPv4 address, or IPv6 address."; + } + + leaf cost { + type ospf-link-metric; + description + "Interface cost. Different implementations have + different default costs, with some defaulting to a + cost inversely proportional to the interface speed. + Others will default to 1, equating the cost to a + hop count."; + } + leaf poll-interval { + type uint16; + units "seconds"; + description + "Neighbor's poll interval (seconds) for sending OSPF + Hello packets to discover the neighbor on NBMA + networks. This interval dictates the granularity for + discovery of new neighbors. A sample would be + 120 seconds (2 minutes) for a legacy Packet Data + Network (PDN) X.25 network."; + reference + "RFC 2328: OSPF Version 2, Appendix C.5"; + } + leaf priority { + type uint8; + description + "Neighbor's priority for DR election. A router with a + higher priority will be preferred in the election. + A value of 0 indicates that the router is not + eligible to become the DR or BDR."; + } + } + } + + leaf node-flag { + if-feature "node-flag"; + type boolean; + default "false"; + description + "Sets the prefix as identifying the advertising router."; + reference + "RFC 7684: OSPFv2 Prefix/Link Attribute Advertisement"; + } + + container bfd { + if-feature "bfd"; + description + "BFD interface configuration."; + uses bfd-types:client-cfg-parms; + reference + "RFC 5880: Bidirectional Forwarding Detection (BFD) + RFC 5881: Bidirectional Forwarding Detection + (BFD) for IPv4 and IPv6 (Single Hop) + RFC 9314: YANG Data Model for Bidirectional Forwarding + Detection (BFD)"; + } + + uses interface-fast-reroute-config; + uses interface-common-config; + uses interface-physical-link-config; + } + + grouping neighbor-state { + description + "OSPF neighbor operational state."; + + leaf address { + type inet:ip-address; + config false; + description + "Neighbor's address."; + } + leaf dr-router-id { + type rt-types:router-id; + config false; + description + "Neighbor's DR Router ID."; + } + + leaf dr-ip-addr { + type inet:ip-address; + config false; + description + "Neighbor's DR IP address."; + } + + leaf bdr-router-id { + type rt-types:router-id; + config false; + description + "Neighbor's BDR Router ID."; + } + + leaf bdr-ip-addr { + type inet:ip-address; + config false; + description + "Neighbor's BDR IP address."; + } + leaf state { + type nbr-state-type; + config false; + description + "OSPF neighbor state."; + } + leaf cost { + type ospf-link-metric; + config false; + description + "Cost to reach the neighbor for point-to-multipoint + and Hybrid networks."; + } + leaf dead-timer { + type rt-types:timer-value-seconds16; + config false; + description + "This timer tracks the remaining time before + the neighbor is declared dead."; + } + container statistics { + config false; + description + "Per-neighbor statistics."; + uses neighbor-stat; + } + } + + grouping interface-common-state { + description + "OSPF interface common operational state."; + reference + "RFC 2328: OSPF Version 2, Section 9"; + + leaf state { + type if-state-type; + config false; + description + "Interface state."; + } + + leaf hello-timer { + type rt-types:timer-value-seconds16; + config false; + description + "This timer tracks the remaining time before the + next Hello packet is sent on the interface."; + } + + leaf wait-timer { + type rt-types:timer-value-seconds16; + config false; + description + "This timer tracks the remaining time before + the interface exits the 'Waiting' state."; + } + + leaf dr-router-id { + type rt-types:router-id; + config false; + description + "DR Router ID."; + } + + leaf dr-ip-addr { + type inet:ip-address; + config false; + description + "DR IP address."; + } + + leaf bdr-router-id { + type rt-types:router-id; + config false; + description + "BDR Router ID."; + } + + leaf bdr-ip-addr { + type inet:ip-address; + config false; + description + "BDR IP address."; + } + + container statistics { + config false; + description + "Per-interface statistics."; + uses interface-stat; + } + + container neighbors { + config false; + description + "All neighbors for the interface."; + list neighbor { + key "neighbor-router-id"; + description + "List of interface OSPF neighbors."; + leaf neighbor-router-id { + type rt-types:router-id; + description + "Neighbor's Router ID."; + } + uses neighbor-state; + } + } + container database { + config false; + description + "Link-scope LSDB."; + list link-scope-lsa-type { + key "lsa-type"; + description + "List of OSPF link-scope LSAs."; + leaf lsa-type { + type uint16; + description + "OSPF link-scope LSA type."; + } + container link-scope-lsas { + description + "All link-scope LSAs of this LSA type."; + list link-scope-lsa { + key "lsa-id adv-router"; + description + "List of OSPF link-scope LSAs."; + uses lsa-key; + uses lsa { + refine "version/ospfv2/ospfv2" { + must "derived-from-or-self( " + + "../../../../../../../../../../" + + "rt:type, 'ospfv2')" { + description + "OSPFv2 LSA."; + } + } + refine "version/ospfv3/ospfv3" { + must "derived-from-or-self( " + + "../../../../../../../../../../" + + "rt:type, 'ospfv3')" { + description + "OSPFv3 LSA."; + } + } + } + } + } + } + } + } + + grouping interface-state { + description + "OSPF interface operational state."; + reference + "RFC 2328: OSPF Version 2, Section 9"; + + uses interface-common-state; + } + + grouping virtual-link-config { + description + "OSPF virtual link configuration state."; + + uses interface-common-config; + } + + grouping virtual-link-state { + description + "OSPF virtual link operational state."; + + leaf cost { + type ospf-link-metric; + config false; + description + "Virtual link interface's cost."; + } + uses interface-common-state; + } + + grouping sham-link-config { + description + "OSPF sham link configuration state."; + + uses interface-common-config; + uses interface-physical-link-config; + } + + grouping sham-link-state { + description + "OSPF sham link operational state."; + uses interface-common-state; + } + + grouping address-family-area-config { + description + "OSPF address-family-specific area configuration state."; + + container ranges { + description + "Container for summary ranges."; + + list range { + key "prefix"; + description + "Summarizes routes matching the address/mask. + Applicable to Area Border Routers (ABRs) only."; + leaf prefix { + type inet:ip-prefix; + description + "IPv4 or IPv6 prefix."; + } + leaf advertise { + type boolean; + description + "Advertise or hide."; + } + leaf cost { + type ospf-metric; + description + "Advertised cost of a summary route."; + } + } + } + } + + grouping area-common-config { + description + "OSPF area common configuration state."; + + leaf summary { + when "derived-from(../area-type,'stub-nssa-area')" { + description + "Summary advertisement into the stub area or NSSA."; + } + type boolean; + description + "Enables/disables summary advertisement into the stub + area or NSSA."; + } + leaf default-cost { + when "derived-from(../area-type,'stub-nssa-area')" { + description + "Cost for the LSA default route advertised into the + stub area or NSSA."; + } + type ospf-metric; + description + "Sets the summary default route cost for a stub area + or NSSA."; + } + } + + grouping area-config { + description + "OSPF area configuration state."; + + leaf area-type { + type identityref { + base area-type; + } + default "normal-area"; + description + "Area type."; + } + + uses area-common-config; + uses address-family-area-config; + } + + grouping area-state { + description + "OSPF area operational state."; + + container statistics { + config false; + description + "Per-area statistics."; + uses area-stat; + } + + container database { + config false; + description + "Area-scope LSDB."; + list area-scope-lsa-type { + key "lsa-type"; + description + "List of OSPF area-scope LSAs."; + leaf lsa-type { + type uint16; + description + "OSPF area-scope LSA type."; + } + container area-scope-lsas { + description + "All area-scope LSAs."; + list area-scope-lsa { + key "lsa-id adv-router"; + description + "List of OSPF area-scope LSAs."; + uses lsa-key; + uses lsa { + refine "version/ospfv2/ospfv2" { + must "derived-from-or-self( " + + "../../../../../../../../" + + "rt:type, 'ospfv2')" { + description + "OSPFv2 LSA."; + } + } + refine "version/ospfv3/ospfv3" { + must "derived-from-or-self( " + + "../../../../../../../../" + + "rt:type, 'ospfv3')" { + description + "OSPFv3 LSA."; + } + } + } + } + } + } + } + } + + grouping local-rib { + description + "Local RIB. RIB for routes computed by the local + OSPF routing instance."; + container local-rib { + config false; + description + "Local RIB."; + list route { + key "prefix"; + description + "OSPF instance's Local Routes."; + leaf prefix { + type inet:ip-prefix; + description + "Destination prefix."; + } + container next-hops { + description + "Next hops for the route."; + list next-hop { + description + "List of next hops for the route."; + leaf outgoing-interface { + type if:interface-ref; + description + "Name of the outgoing interface."; + } + leaf next-hop { + type inet:ip-address; + description + "Address of the next hop."; + } + } + } + leaf metric { + type uint32; + description + "Metric for this route."; + } + leaf route-type { + type route-type; + description + "Route type for this route."; + } + leaf route-tag { + type uint32; + description + "Route tag for this route."; + } + } + } + } + + grouping ietf-spf-delay { + leaf initial-delay { + type uint32; + units "milliseconds"; + default "50"; + description + "Delay used while in the 'QUIET' state (milliseconds)."; + } + leaf short-delay { + type uint32; + units "milliseconds"; + default "200"; + description + "Delay used while in the 'SHORT_WAIT' state (milliseconds)."; + } + leaf long-delay { + type uint32; + units "milliseconds"; + default "5000"; + description + "Delay used while in the 'LONG_WAIT' state (milliseconds)."; + } + leaf hold-down { + type uint32; + units "milliseconds"; + default "10000"; + description + "This timer value defines the period without any changes + for the IGP to be considered stable (milliseconds)."; + } + leaf time-to-learn { + type uint32; + units "milliseconds"; + default "500"; + description + "Duration used to learn all the IGP events + related to a single network event (milliseconds)."; + } + leaf current-state { + type enumeration { + enum quiet { + description + "'QUIET' state."; + } + enum short-wait { + description + "'SHORT_WAIT' state."; + } + enum long-wait { + description + "'LONG_WAIT' state."; + } + } + config false; + description + "Current SPF back-off algorithm state."; + } + leaf remaining-time-to-learn { + type rt-types:timer-value-milliseconds; + config false; + description + "Remaining time until the time-to-learn timer fires."; + } + leaf remaining-hold-down { + type rt-types:timer-value-milliseconds; + config false; + description + "Remaining time until the hold-down timer fires."; + } + leaf last-event-received { + type yang:timestamp; + config false; + description + "Time of the last SPF triggering event."; + } + leaf next-spf-time { + type yang:timestamp; + config false; + description + "Time when the next SPF has been scheduled."; + } + leaf last-spf-time { + type yang:timestamp; + config false; + description + "Time of the last SPF computation."; + } + description + "Grouping for IETF SPF delay configuration and state."; + reference + "RFC 8405: Shortest Path First (SPF) Back-Off Delay Algorithm + for Link-State IGPs"; + } + + grouping node-tag-config { + description + "OSPF node tag configuration state."; + container node-tags { + if-feature "node-tag"; + list node-tag { + key "tag"; + leaf tag { + type uint32; + description + "Node tag value."; + } + description + "List of node tags."; + } + description + "Container for node administrative tags."; + } + } + + grouping instance-config { + description + "OSPF instance configuration state."; + + leaf enabled { + type boolean; + default "true"; + description + "Enables/disables the protocol."; + } + + leaf explicit-router-id { + if-feature "explicit-router-id"; + type rt-types:router-id; + description + "Defined in RFC 2328. A 32-bit number + that uniquely identifies the router."; + reference + "RFC 2328: OSPF Version 2"; + } + + container preference { + description + "Route preference configuration. In many + implementations, preference is referred to as + administrative distance."; + reference + "RFC 8349: A YANG Data Model for Routing Management + (NMDA Version)"; + choice scope { + description + "Options for expressing preference + as single or multiple values."; + case single-value { + leaf all { + type uint8; + description + "Preference for intra-area, inter-area, and + external routes."; + } + } + case multi-values { + choice granularity { + description + "Options for expressing preference + for intra-area and inter-area routes."; + case detail { + leaf intra-area { + type uint8; + description + "Preference for intra-area routes."; + } + leaf inter-area { + type uint8; + description + "Preference for inter-area routes."; + } + } + case coarse { + leaf internal { + type uint8; + description + "Preference for both intra-area and + inter-area routes."; + } + } + } + leaf external { + type uint8; + description + "Preference for AS external and NSSA routes."; + } + } + } + } + + container nsr { + if-feature "nsr"; + description + "Non-Stop Routing (NSR) configuration state."; + leaf enabled { + type boolean; + description + "Enables/disables NSR."; + } + } + + container graceful-restart { + if-feature "graceful-restart"; + description + "Graceful restart configuration state."; + reference + "RFC 3623: Graceful OSPF Restart + RFC 5187: OSPFv3 Graceful Restart"; + leaf enabled { + type boolean; + description + "Enables/disables graceful restart as defined in RFC 3623 + for OSPFv2 and RFC 5187 for OSPFv3."; + } + leaf helper-enabled { + type boolean; + description + "Enables graceful restart helper support for restarting + routers (Section 3 of RFC 3623)."; + reference + "RFC 3623: Graceful OSPF Restart, Section 3"; + } + leaf restart-interval { + type uint16 { + range "1..1800"; + } + units "seconds"; + default "120"; + description + "Interval during which to attempt graceful restart prior + to failing (seconds) (Appendix B.1 of RFC 3623)."; + reference + "RFC 3623: Graceful OSPF Restart, Appendix B.1"; + } + leaf helper-strict-lsa-checking { + type boolean; + description + "Terminates graceful restart when an LSA topology change + is detected (Appendix B.2 of RFC 3623)."; + reference + "RFC 3623: Graceful OSPF Restart, Appendix B.2"; + } + } + + container auto-cost { + if-feature "auto-cost"; + description + "Interface auto-cost configuration state."; + leaf enabled { + type boolean; + description + "Enables/disables interface auto-cost."; + } + leaf reference-bandwidth { + when "../enabled = 'true'" { + description + "Only when auto-cost is enabled."; + } + type uint32 { + range "1..4294967"; + } + units "Mbits"; + description + "Configures reference bandwidth used to automatically + determine interface cost (Mbits). The cost is the + reference bandwidth divided by the interface speed, + with 1 being the minimum cost."; + } + } + + container spf-control { + leaf paths { + if-feature "max-ecmp"; + type uint16 { + range "1..65535"; + } + description + "Maximum number of Equal-Cost Multi-Path (ECMP) paths."; + } + container ietf-spf-delay { + if-feature "ietf-spf-delay"; + uses ietf-spf-delay; + description + "IETF SPF delay algorithm configuration."; + } + description + "SPF calculation control."; + } + + container database-control { + leaf max-lsa { + if-feature "max-lsa"; + type uint32 { + range "1..4294967294"; + } + description + "Maximum number of OSPF LSAs the router will accept."; + } + description + "Database maintenance control."; + } + + container stub-router { + if-feature "stub-router"; + description + "Sets the maximum metric configuration."; + + choice trigger { + description + "Specific triggers that will enable stub router state."; + container always { + presence "Enables unconditional stub router support"; + description + "Unconditional stub router state (advertises + transit links with 'MaxLinkMetric')."; + reference + "RFC 6987: OSPF Stub Router Advertisement"; + } + } + } + + container mpls { + description + "OSPF MPLS configuration state."; + container te-rid { + if-feature "te-rid"; + description + "Stable OSPF Router IP address used for TE."; + leaf ipv4-router-id { + type inet:ipv4-address; + description + "Explicitly configures a TE IPv4 Router ID."; + } + leaf ipv6-router-id { + type inet:ipv6-address; + description + "Explicitly configures a TE IPv6 Router ID."; + } + } + container ldp { + description + "OSPF MPLS LDP configuration state."; + leaf igp-sync { + if-feature "ldp-igp-sync"; + type boolean; + description + "Enables LDP IGP synchronization."; + } + } + } + uses instance-fast-reroute-config; + uses node-tag-config; + } + + grouping instance-state { + description + "OSPF instance operational state."; + + leaf router-id { + type rt-types:router-id; + config false; + description + "Defined in RFC 2328. A 32-bit number + that uniquely identifies the router."; + reference + "RFC 2328: OSPF Version 2"; + } + + uses local-rib; + + container statistics { + config false; + description + "Per-instance statistics."; + uses instance-stat; + } + + container database { + config false; + description + "AS-Scope LSDB."; + list as-scope-lsa-type { + key "lsa-type"; + description + "List of OSPF AS-Scope LSAs."; + leaf lsa-type { + type uint16; + description + "OSPF AS-Scope LSA type."; + } + container as-scope-lsas { + description + "All AS-Scope LSAs of this LSA type."; + list as-scope-lsa { + key "lsa-id adv-router"; + description + "List of OSPF AS-Scope LSAs."; + uses lsa-key; + uses lsa { + refine "version/ospfv2/ospfv2" { + must "derived-from-or-self( " + + "../../../../../../" + + "rt:type, 'ospfv2')" { + description + "OSPFv2 LSA."; + } + } + refine "version/ospfv3/ospfv3" { + must "derived-from-or-self( " + + "../../../../../../" + + "rt:type, 'ospfv3')" { + description + "OSPFv3 LSA."; + } + } + } + } + } + } + } + uses spf-log; + uses lsa-log; + } + + grouping multi-topology-area-common-config { + description + "OSPF multi-topology area common configuration state."; + leaf summary { + when "derived-from(../../../area-type, 'stub-nssa-area')" { + description + "Summary advertisement into the stub area or NSSA."; + } + type boolean; + description + "Enables/disables a summary advertisement into the + topology in the stub area or NSSA."; + } + leaf default-cost { + when "derived-from(../../../area-type, 'stub-nssa-area')" { + description + "Cost for the LSA default route advertised into the + topology in the stub area or NSSA."; + } + type ospf-metric; + description + "Sets the summary default route cost for a + stub area or NSSA."; + } + } + + grouping multi-topology-area-config { + description + "OSPF multi-topology area configuration state."; + + uses multi-topology-area-common-config; + uses address-family-area-config; + } + + grouping multi-topology-state { + description + "OSPF multi-topology operational state."; + + uses local-rib; + } + + grouping multi-topology-interface-config { + description + "OSPF multi-topology configuration state."; + + leaf cost { + type ospf-link-metric; + description + "Interface cost for this topology."; + } + } + + grouping ospfv3-interface-config { + description + "OSPFv3 interface-specific configuration state."; + + leaf instance-id { + type uint8; + default "0"; + description + "OSPFv3 instance ID."; + } + } + + grouping ospfv3-interface-state { + description + "OSPFv3 interface-specific operational state."; + + leaf interface-id { + type uint32; + config false; + description + "OSPFv3 interface ID."; + } + } + + grouping lsa-identifiers { + description + "The parameters that uniquely identify an LSA."; + leaf area-id { + type area-id-type; + description + "Area ID."; + } + leaf type { + type uint16; + description + "LSA type."; + } + leaf lsa-id { + type union { + type inet:ipv4-address; + type yang:dotted-quad; + } + description + "Link State ID."; + } + leaf adv-router { + type rt-types:router-id; + description + "LSA advertising router."; + } + leaf seq-num { + type uint32; + description + "LSA sequence number."; + } + } + + grouping spf-log { + description + "Grouping for the SPF log."; + container spf-log { + config false; + description + "This container lists the SPF log entries."; + list event { + key "id"; + description + "List of SPF log entries represented + as a wrapping buffer in chronological + order, with the oldest entry returned + first."; + leaf id { + type uint32; + description + "Event identifier. A purely internal value."; + } + leaf spf-type { + type enumeration { + enum full { + description + "The SPF computation was for a full SPF."; + } + enum intra { + description + "The SPF computation was only for intra-area + routes."; + } + enum inter { + description + "The SPF computation was only for inter-area + summary routes."; + } + enum external { + description + "The SPF computation was only for AS external + and NSSA routes."; + } + } + description + "The SPF computation type for the SPF log entry."; + } + leaf schedule-timestamp { + type yang:timestamp; + description + "This is the timestamp when the computation was + scheduled."; + } + leaf start-timestamp { + type yang:timestamp; + description + "This is the timestamp when the computation was + started."; + } + leaf end-timestamp { + type yang:timestamp; + description + "This is the timestamp when the computation was + completed."; + } + list trigger-lsa { + description + "The list of LSAs that triggered the computation."; + uses lsa-identifiers; + } + } + } + } + + grouping lsa-log { + description + "Grouping for the LSA log."; + container lsa-log { + config false; + description + "This container lists the LSA log entries. + Local LSA modifications are also included + in the list."; + list event { + key "id"; + description + "List of LSA log entries represented + as a wrapping buffer in chronological order, + with the oldest entry returned first."; + leaf id { + type uint32; + description + "Event identifier. A purely internal value."; + } + container lsa { + description + "This container describes the LSA that was logged."; + uses lsa-identifiers; + } + leaf received-timestamp { + type yang:timestamp; + description + "This is the timestamp when the LSA was received. + In the case of a local LSA update, the timestamp + refers to the LSA origination time."; + } + leaf reason { + type identityref { + base lsa-log-reason; + } + description + "Reason for the LSA log entry."; + } + } + } + } + + augment "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol" { + when "derived-from(rt:type, 'ospf')" { + description + "This augmentation is only valid for a routing protocol + instance of OSPF (type 'ospfv2' or 'ospfv3')."; + } + description + "OSPF protocol 'ietf-routing' module 'control-plane-protocol' + augmentation."; + + container ospf { + description + "OSPF protocol instance."; + + leaf address-family { + when "derived-from-or-self(../../rt:type, 'ospfv3')" { + description + "Only applicable to OSPFv3."; + } + type iana-rt-types:address-family; + description + "Address family of the instance."; + } + + uses instance-config; + uses instance-state; + + container areas { + description + "All OSPF areas."; + list area { + key "area-id"; + description + "List of OSPF areas."; + leaf area-id { + type area-id-type; + description + "Area ID."; + } + + uses area-config; + uses area-state; + + container virtual-links { + when "derived-from-or-self(../area-type, 'normal-area') " + + "and ../area-id = '0.0.0.0'" { + description + "Virtual links must be in a backbone area."; + } + description + "All virtual links."; + list virtual-link { + key "transit-area-id router-id"; + description + "OSPF virtual link."; + leaf transit-area-id { + type leafref { + path "../../../../area/area-id"; + } + must "derived-from-or-self(" + + "../../../../area[area-id=current()]" + + "/area-type, 'normal-area') and " + + "../../../../area[area-id=current()]" + + "/area-id != '0.0.0.0'" { + error-message "The virtual link transit area must " + + "not be the backbone area."; + description + "The virtual link transit area must not be the + backbone area (0.0.0.0)."; + } + description + "Virtual link transit area ID."; + } + leaf router-id { + type rt-types:router-id; + description + "Virtual link remote endpoint Router ID."; + } + + uses virtual-link-config; + uses virtual-link-state; + } + } + container sham-links { + if-feature "pe-ce-protocol"; + description + "All sham links."; + list sham-link { + key "local-id remote-id"; + description + "OSPF sham link."; + leaf local-id { + type inet:ip-address; + description + "Address of the local sham link endpoint."; + } + leaf remote-id { + type inet:ip-address; + description + "Address of the remote sham link endpoint."; + } + uses sham-link-config; + uses sham-link-state; + } + } + container interfaces { + description + "All OSPF interfaces."; + list interface { + key "name"; + description + "List of OSPF interfaces."; + leaf name { + type if:interface-ref; + description + "Interface name reference."; + } + uses interface-config; + uses interface-state; + } + } + } + } + } + } + + augment "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/ospf" { + when "derived-from(../rt:type, 'ospf')" { + description + "This augmentation is only valid for OSPF + (type 'ospfv2' or 'ospfv3')."; + } + if-feature "multi-topology"; + description + "OSPF multi-topology instance configuration + state augmentation."; + container topologies { + description + "All topologies."; + list topology { + key "name"; + description + "OSPF topology. The OSPF topology address family + must coincide with the routing instance's + address family."; + leaf name { + type leafref { + path "../../../../../../rt:ribs/rt:rib/rt:name"; + } + description + "RIB name corresponding to the OSPF topology."; + } + + uses multi-topology-state; + } + } + } + + augment "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/ospf/" + + "areas/area" { + when "derived-from-or-self(../../../rt:type, " + + "'ospfv2')" { + description + "This augmentation is only valid for OSPFv2."; + } + if-feature "multi-topology"; + description + "OSPF multi-topology area configuration state + augmentation."; + container topologies { + description + "All topologies for the area."; + list topology { + key "name"; + description + "OSPF area topology."; + leaf name { + type leafref { + path "../../../../../../../../" + + "rt:ribs/rt:rib/rt:name"; + } + description + "Single topology enabled for this area."; + } + + uses multi-topology-area-config; + } + } + } + + augment "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/ospf/" + + "areas/area/interfaces/interface" { + when "derived-from-or-self(../../../../../rt:type, " + + "'ospfv2')" { + description + "This augmentation is only valid for OSPFv2."; + } + if-feature "multi-topology"; + description + "OSPF multi-topology interface configuration state + augmentation."; + container topologies { + description + "All topologies for the interface."; + list topology { + key "name"; + description + "OSPF interface topology."; + leaf name { + type leafref { + path "../../../../../../../../../../" + + "rt:ribs/rt:rib/rt:name"; + } + description + "Single topology enabled on this interface."; + } + + uses multi-topology-interface-config; + } + } + } + + augment "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/ospf/" + + "areas/area/interfaces/interface" { + when "derived-from-or-self(../../../../../rt:type, " + + "'ospfv3')" { + description + "This augmentation is only valid for OSPFv3."; + } + description + "OSPFv3 interface-specific configuration state + augmentation."; + uses ospfv3-interface-config; + uses ospfv3-interface-state; + } + + grouping route-content { + description + "This grouping defines OSPF-specific route attributes."; + leaf metric { + type uint32; + description + "OSPF route metric."; + } + leaf tag { + type uint32; + default "0"; + description + "OSPF route tag."; + } + leaf route-type { + type route-type; + description + "OSPF route type."; + } + } + + augment "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route" { + when "derived-from(rt:source-protocol, 'ospf')" { + description + "This augmentation is only valid for routes whose + source protocol is OSPF."; + } + description + "OSPF-specific route attributes."; + uses route-content; + } + + /* + * RPCs + */ + + rpc clear-neighbor { + description + "This RPC request clears a particular set of OSPF neighbors. + If the operation fails for an OSPF-internal reason, then + 'error-tag' and 'error-app-tag' should be set to values + indicating the error."; + input { + leaf routing-protocol-name { + type leafref { + path "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/rt:name"; + } + mandatory true; + description + "OSPF protocol instance for which information for neighbors + is to be cleared. + + If the referenced OSPF instance doesn't exist, then + this operation SHALL fail with an 'error-tag' setting of + 'data-missing' and an 'error-app-tag' setting of + 'routing-protocol-instance-not-found'."; + } + + leaf interface { + type if:interface-ref; + description + "Name of the OSPF interface for which neighbors are to + be cleared. + + If the referenced OSPF interface doesn't exist, then + this operation SHALL fail with an 'error-tag' setting + of 'data-missing' and an 'error-app-tag' setting of + 'ospf-interface-not-found'."; + } + } + } + + rpc clear-database { + description + "This RPC request clears a particular OSPF Link State + Database. Additionally, all neighbor adjacencies will + be forced to the DOWN state and self-originated LSAs + will be reoriginated. If the operation fails for an + OSPF-internal reason, then 'error-tag' and 'error-app-tag' + should be set to values indicating the error."; + input { + leaf routing-protocol-name { + type leafref { + path "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/rt:name"; + } + mandatory true; + description + "OSPF protocol instance whose LSDB is to be cleared. + + If the referenced OSPF instance doesn't exist, then + this operation SHALL fail with an 'error-tag' setting of + 'data-missing' and an 'error-app-tag' setting of + 'routing-protocol-instance-not-found'."; + } + } + } + + /* + * Notifications + */ + + grouping notification-instance-hdr { + description + "This grouping describes common instance-specific + data for OSPF notifications."; + + leaf routing-protocol-name { + type leafref { + path "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol/rt:name"; + } + must "derived-from( " + + "/rt:routing/rt:control-plane-protocols/" + + "rt:control-plane-protocol[rt:name=current()]/" + + "rt:type, 'ospf')"; + description + "Name of the OSPF routing protocol instance."; + } + + leaf address-family { + type leafref { + path "/rt:routing/" + + "rt:control-plane-protocols/rt:control-plane-protocol" + + "[rt:name=current()/../routing-protocol-name]/" + + "ospf/address-family"; + } + description + "Address family of the OSPF instance."; + } + } + + grouping notification-interface { + description + "This grouping provides interface information + for OSPF interface-specific notifications."; + + choice if-link-type-selection { + description + "Options for link types."; + container interface { + description + "Normal interface."; + leaf interface { + type if:interface-ref; + description + "Interface."; + } + } + container virtual-link { + description + "Virtual link."; + leaf transit-area-id { + type area-id-type; + description + "Area ID."; + } + leaf neighbor-router-id { + type rt-types:router-id; + description + "Neighbor's Router ID."; + } + } + container sham-link { + description + "Sham link."; + leaf area-id { + type area-id-type; + description + "Area ID."; + } + leaf local-ip-addr { + type inet:ip-address; + description + "Sham link's local address."; + } + leaf remote-ip-addr { + type inet:ip-address; + description + "Sham link's remote address."; + } + } + } + } + + grouping notification-neighbor { + description + "This grouping provides the neighbor information + for neighbor-specific notifications."; + + leaf neighbor-router-id { + type rt-types:router-id; + description + "Neighbor's Router ID."; + } + + leaf neighbor-ip-addr { + type inet:ip-address; + description + "Neighbor's address."; + } + } + + notification if-state-change { + uses notification-instance-hdr; + uses notification-interface; + + leaf state { + type if-state-type; + description + "Interface state."; + } + description + "This notification is sent when an interface + state change is detected."; + } + + notification if-config-error { + uses notification-instance-hdr; + uses notification-interface; + + leaf packet-source { + type inet:ip-address; + description + "Source address."; + } + + leaf packet-type { + type packet-type; + description + "OSPF packet type."; + } + + leaf error { + type enumeration { + enum bad-version { + description + "Bad version."; + } + enum area-mismatch { + description + "Area mismatch."; + } + enum unknown-nbma-nbr { + description + "Unknown NBMA neighbor."; + } + enum unknown-virtual-nbr { + description + "Unknown virtual link neighbor."; + } + enum auth-type-mismatch { + description + "Authentication type mismatch."; + } + enum auth-failure { + description + "Authentication failure."; + } + enum net-mask-mismatch { + description + "Network mask mismatch."; + } + enum hello-interval-mismatch { + description + "Hello interval mismatch."; + } + enum dead-interval-mismatch { + description + "Dead interval mismatch."; + } + enum option-mismatch { + description + "Option mismatch."; + } + enum mtu-mismatch { + description + "MTU mismatch."; + } + enum duplicate-router-id { + description + "Duplicate Router ID."; + } + enum no-error { + description + "No error."; + } + } + description + "Error codes."; + } + description + "This notification is sent when a packet is received indicating + an interface configuration error on the sending OSPF router."; + } + + notification nbr-state-change { + uses notification-instance-hdr; + uses notification-interface; + uses notification-neighbor; + + leaf state { + type nbr-state-type; + description + "Neighbor state."; + } + + description + "This notification is sent when a neighbor + state change is detected."; + } + + notification nbr-restart-helper-status-change { + uses notification-instance-hdr; + uses notification-interface; + uses notification-neighbor; + + leaf status { + type restart-helper-status-type; + description + "Restart helper status."; + } + + leaf age { + type rt-types:timer-value-seconds16; + description + "Remaining time in the current OSPF graceful restart + interval when the router is acting as a restart + helper for the neighbor."; + } + + leaf exit-reason { + type restart-exit-reason-type; + description + "Restart helper exit reason."; + } + description + "This notification is sent when a neighbor restart + helper status change is detected."; + } + + notification if-rx-bad-packet { + uses notification-instance-hdr; + uses notification-interface; + + leaf packet-source { + type inet:ip-address; + description + "Source address."; + } + + leaf packet-type { + type packet-type; + description + "OSPF packet type."; + } + + description + "This notification is sent when an OSPF packet that + cannot be parsed is received on an OSPF interface."; + } + + notification lsdb-approaching-overflow { + uses notification-instance-hdr; + + leaf ext-lsdb-limit { + type uint32; + description + "The maximum number of non-default AS-External-LSA + entries that can be stored in the LSDB."; + } + + description + "This notification is sent when the number of LSAs + in the router's LSDB has exceeded ninety percent of the + AS-External-LSA limit ('ext-lsdb-limit')."; + } + + notification lsdb-overflow { + uses notification-instance-hdr; + + leaf ext-lsdb-limit { + type uint32; + description + "The maximum number of non-default AS-External-LSA + entries that can be stored in the LSDB."; + } + + description + "This notification is sent when the number of LSAs + in the router's LSDB has exceeded the AS-External-LSA limit + ('ext-lsdb-limit')."; + } + + notification nssa-translator-status-change { + uses notification-instance-hdr; + + leaf area-id { + type area-id-type; + description + "Area ID."; + } + + leaf status { + type nssa-translator-state-type; + description + "NSSA translator status."; + } + + description + "This notification is sent when there is a change + in the router's role in translating OSPF NSSA-LSAs + to OSPF AS-External-LSAs."; + } + + notification restart-status-change { + uses notification-instance-hdr; + + leaf status { + type restart-status-type; + description + "Restart status."; + } + + leaf restart-interval { + type uint16 { + range "1..1800"; + } + units "seconds"; + default "120"; + description + "Restart interval."; + } + + leaf exit-reason { + type restart-exit-reason-type; + description + "Restart exit reason."; + } + + description + "This notification is sent when the graceful restart + state for the router has changed."; + } +} diff --git a/src/confd/yang/ietf-routing-types@2017-12-04.yang b/src/confd/yang/ietf-routing-types@2017-12-04.yang new file mode 100644 index 00000000..24319c15 --- /dev/null +++ b/src/confd/yang/ietf-routing-types@2017-12-04.yang @@ -0,0 +1,771 @@ +module ietf-routing-types { + namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types"; + prefix rt-types; + + import ietf-yang-types { + prefix yang; + } + import ietf-inet-types { + prefix inet; + } + + organization + "IETF RTGWG - Routing Area Working Group"; + contact + "WG Web: + WG List: + + Editors: Xufeng Liu + + Yingzhen Qu + + Acee Lindem + + Christian Hopps + + Lou Berger + "; + + description + "This module contains a collection of YANG data types + considered generally useful for routing protocols. + + Copyright (c) 2017 IETF Trust and the persons + identified as authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 8294; see + the RFC itself for full legal notices."; + revision 2017-12-04 { + description "Initial revision."; + reference + "RFC 8294: Common YANG Data Types for the Routing Area. + Section 3."; + } + + /*** Identities related to MPLS/GMPLS ***/ + + identity mpls-label-special-purpose-value { + description + "Base identity for deriving identities describing + special-purpose Multiprotocol Label Switching (MPLS) label + values."; + reference + "RFC 7274: Allocating and Retiring Special-Purpose MPLS + Labels."; + } + + identity ipv4-explicit-null-label { + base mpls-label-special-purpose-value; + description + "This identity represents the IPv4 Explicit NULL Label."; + reference + "RFC 3032: MPLS Label Stack Encoding. Section 2.1."; + } + + identity router-alert-label { + base mpls-label-special-purpose-value; + description + "This identity represents the Router Alert Label."; + reference + "RFC 3032: MPLS Label Stack Encoding. Section 2.1."; + } + + identity ipv6-explicit-null-label { + base mpls-label-special-purpose-value; + description + "This identity represents the IPv6 Explicit NULL Label."; + reference + "RFC 3032: MPLS Label Stack Encoding. Section 2.1."; + } + + identity implicit-null-label { + base mpls-label-special-purpose-value; + description + "This identity represents the Implicit NULL Label."; + reference + "RFC 3032: MPLS Label Stack Encoding. Section 2.1."; + } + + identity entropy-label-indicator { + base mpls-label-special-purpose-value; + description + "This identity represents the Entropy Label Indicator."; + reference + "RFC 6790: The Use of Entropy Labels in MPLS Forwarding. + Sections 3 and 10.1."; + } + + identity gal-label { + base mpls-label-special-purpose-value; + description + "This identity represents the Generic Associated Channel + (G-ACh) Label (GAL)."; + reference + "RFC 5586: MPLS Generic Associated Channel. + Sections 4 and 10."; + } + + identity oam-alert-label { + base mpls-label-special-purpose-value; + description + "This identity represents the OAM Alert Label."; + reference + "RFC 3429: Assignment of the 'OAM Alert Label' for + Multiprotocol Label Switching Architecture (MPLS) + Operation and Maintenance (OAM) Functions. + Sections 3 and 6."; + } + + identity extension-label { + base mpls-label-special-purpose-value; + description + "This identity represents the Extension Label."; + reference + "RFC 7274: Allocating and Retiring Special-Purpose MPLS + Labels. Sections 3.1 and 5."; + } + + /*** Collection of types related to routing ***/ + + typedef router-id { + type yang:dotted-quad; + description + "A 32-bit number in the dotted-quad format assigned to each + router. This number uniquely identifies the router within + an Autonomous System."; + } + + /*** Collection of types related to VPNs ***/ + + typedef route-target { + type string { + pattern + '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|' + + '42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|' + + '42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|' + + '42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|' + + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|' + + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|' + + '655[0-2][0-9]|' + + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(2:(429496729[0-5]|42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|' + + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(6(:[a-fA-F0-9]{2}){6})|' + + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):' + + '[0-9a-fA-F]{1,12})'; + } + + description + "A Route Target is an 8-octet BGP extended community + initially identifying a set of sites in a BGP VPN + (RFC 4364). However, it has since taken on a more general + role in BGP route filtering. A Route Target consists of two + or three fields: a 2-octet Type field, an administrator + field, and, optionally, an assigned number field. + + According to the data formats for types 0, 1, 2, and 6 as + defined in RFC 4360, RFC 5668, and RFC 7432, the encoding + pattern is defined as: + + 0:2-octet-asn:4-octet-number + 1:4-octet-ipv4addr:2-octet-number + 2:4-octet-asn:2-octet-number + 6:6-octet-mac-address + + Additionally, a generic pattern is defined for future + Route Target types: + + 2-octet-other-hex-number:6-octet-hex-number + + Some valid examples are 0:100:100, 1:1.1.1.1:100, + 2:1234567890:203, and 6:26:00:08:92:78:00."; + reference + "RFC 4360: BGP Extended Communities Attribute. + RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs). + RFC 5668: 4-Octet AS Specific BGP Extended Community. + RFC 7432: BGP MPLS-Based Ethernet VPN."; + } + + typedef ipv6-route-target { + type string { + pattern + '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))' + + ':' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)'; + pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))' + + ':' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)'; + } + description + "An IPv6 Route Target is a 20-octet BGP IPv6 Address + Specific Extended Community serving the same function + as a standard 8-octet Route Target, except that it only + allows an IPv6 address as the global administrator. + The format is . + + Two valid examples are 2001:db8::1:6544 and + 2001:db8::5eb1:791:6b37:17958."; + reference + "RFC 5701: IPv6 Address Specific BGP Extended Community + Attribute."; + } + + typedef route-target-type { + type enumeration { + enum import { + value 0; + description + "The Route Target applies to route import."; + } + enum export { + value 1; + description + "The Route Target applies to route export."; + } + + enum both { + value 2; + description + "The Route Target applies to both route import and + route export."; + } + } + description + "Indicates the role a Route Target takes in route filtering."; + reference + "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs)."; + } + + typedef route-distinguisher { + type string { + pattern + '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|' + + '42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|' + + '42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|' + + '42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|' + + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|' + + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|' + + '655[0-2][0-9]|' + + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(2:(429496729[0-5]|42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|' + + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(6(:[a-fA-F0-9]{2}){6})|' + + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):' + + '[0-9a-fA-F]{1,12})'; + } + + description + "A Route Distinguisher is an 8-octet value used to + distinguish routes from different BGP VPNs (RFC 4364). + A Route Distinguisher will have the same format as a + Route Target as per RFC 4360 and will consist of + two or three fields: a 2-octet Type field, an administrator + field, and, optionally, an assigned number field. + + According to the data formats for types 0, 1, 2, and 6 as + defined in RFC 4360, RFC 5668, and RFC 7432, the encoding + pattern is defined as: + + 0:2-octet-asn:4-octet-number + 1:4-octet-ipv4addr:2-octet-number + 2:4-octet-asn:2-octet-number + 6:6-octet-mac-address + + Additionally, a generic pattern is defined for future + route discriminator types: + + 2-octet-other-hex-number:6-octet-hex-number + + Some valid examples are 0:100:100, 1:1.1.1.1:100, + 2:1234567890:203, and 6:26:00:08:92:78:00."; + reference + "RFC 4360: BGP Extended Communities Attribute. + RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs). + RFC 5668: 4-Octet AS Specific BGP Extended Community. + RFC 7432: BGP MPLS-Based Ethernet VPN."; + } + + typedef route-origin { + type string { + pattern + '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|' + + '42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|' + + '42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|' + + '42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|' + + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|' + + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|' + + '655[0-2][0-9]|' + + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(2:(429496729[0-5]|42949672[0-8][0-9]|' + + '4294967[01][0-9]{2}|' + + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|' + + '4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|' + + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' + + '(6(:[a-fA-F0-9]{2}){6})|' + + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):' + + '[0-9a-fA-F]{1,12})'; + } + description + "A Route Origin is an 8-octet BGP extended community + identifying the set of sites where the BGP route + originated (RFC 4364). A Route Origin will have the same + format as a Route Target as per RFC 4360 and will consist + of two or three fields: a 2-octet Type field, an + administrator field, and, optionally, an assigned number + field. + + According to the data formats for types 0, 1, 2, and 6 as + defined in RFC 4360, RFC 5668, and RFC 7432, the encoding + pattern is defined as: + + 0:2-octet-asn:4-octet-number + 1:4-octet-ipv4addr:2-octet-number + 2:4-octet-asn:2-octet-number + 6:6-octet-mac-address + Additionally, a generic pattern is defined for future + Route Origin types: + + 2-octet-other-hex-number:6-octet-hex-number + + Some valid examples are 0:100:100, 1:1.1.1.1:100, + 2:1234567890:203, and 6:26:00:08:92:78:00."; + reference + "RFC 4360: BGP Extended Communities Attribute. + RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs). + RFC 5668: 4-Octet AS Specific BGP Extended Community. + RFC 7432: BGP MPLS-Based Ethernet VPN."; + } + + typedef ipv6-route-origin { + type string { + pattern + '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))' + + ':' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)'; + pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))' + + ':' + + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' + + '6[0-4][0-9]{3}|' + + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)'; + } + description + "An IPv6 Route Origin is a 20-octet BGP IPv6 Address + Specific Extended Community serving the same function + as a standard 8-octet route, except that it only allows + an IPv6 address as the global administrator. The format + is . + + Two valid examples are 2001:db8::1:6544 and + 2001:db8::5eb1:791:6b37:17958."; + reference + "RFC 5701: IPv6 Address Specific BGP Extended Community + Attribute."; + } + + /*** Collection of types common to multicast ***/ + + typedef ipv4-multicast-group-address { + type inet:ipv4-address { + pattern '(2((2[4-9])|(3[0-9]))\.).*'; + } + description + "This type represents an IPv4 multicast group address, + which is in the range of 224.0.0.0 to 239.255.255.255."; + reference + "RFC 1112: Host Extensions for IP Multicasting."; + } + + typedef ipv6-multicast-group-address { + type inet:ipv6-address { + pattern '(([fF]{2}[0-9a-fA-F]{2}):).*'; + } + description + "This type represents an IPv6 multicast group address, + which is in the range of ff00::/8."; + reference + "RFC 4291: IP Version 6 Addressing Architecture. Section 2.7. + RFC 7346: IPv6 Multicast Address Scopes."; + } + + typedef ip-multicast-group-address { + type union { + type ipv4-multicast-group-address; + type ipv6-multicast-group-address; + } + description + "This type represents a version-neutral IP multicast group + address. The format of the textual representation implies + the IP version."; + } + + typedef ipv4-multicast-source-address { + type union { + type enumeration { + enum * { + description + "Any source address."; + } + } + type inet:ipv4-address; + } + description + "Multicast source IPv4 address type."; + } + + typedef ipv6-multicast-source-address { + type union { + type enumeration { + enum * { + description + "Any source address."; + } + } + type inet:ipv6-address; + } + description + "Multicast source IPv6 address type."; + } + + /*** Collection of types common to protocols ***/ + + typedef bandwidth-ieee-float32 { + type string { + pattern + '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|' + + '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|' + + '1[01][0-9]|0?[0-9]?[0-9])?)'; + } + description + "Bandwidth in IEEE 754 floating-point 32-bit binary format: + (-1)**(S) * 2**(Exponent-127) * (1 + Fraction), + where Exponent uses 8 bits and Fraction uses 23 bits. + The units are octets per second. + The encoding format is the external hexadecimal-significant + character sequences specified in IEEE 754 and ISO/IEC C99. + The format is restricted to be normalized, non-negative, and + non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0, + where 'h' and 'H' are hexadecimal digits and 'd' and 'D' are + integers in the range of [0..127]. + When six hexadecimal digits are used for 'hhhhhh' or + 'HHHHHH', the least significant digit must be an even + number. 'x' and 'X' indicate hexadecimal; 'p' and 'P' + indicate a power of two. Some examples are 0x0p0, 0x1p10, + and 0x1.abcde2p+20."; + reference + "IEEE Std 754-2008: IEEE Standard for Floating-Point + Arithmetic. + ISO/IEC C99: Information technology - Programming + Languages - C."; + } + + typedef link-access-type { + type enumeration { + enum broadcast { + description + "Specify broadcast multi-access network."; + } + enum non-broadcast-multiaccess { + description + "Specify Non-Broadcast Multi-Access (NBMA) network."; + } + enum point-to-multipoint { + description + "Specify point-to-multipoint network."; + } + enum point-to-point { + description + "Specify point-to-point network."; + } + } + description + "Link access type."; + } + + typedef timer-multiplier { + type uint8; + description + "The number of timer value intervals that should be + interpreted as a failure."; + } + + typedef timer-value-seconds16 { + type union { + type uint16 { + range "1..65535"; + } + type enumeration { + enum infinity { + description + "The timer is set to infinity."; + } + enum not-set { + description + "The timer is not set."; + } + } + } + units "seconds"; + description + "Timer value type, in seconds (16-bit range)."; + } + + typedef timer-value-seconds32 { + type union { + type uint32 { + range "1..4294967295"; + } + type enumeration { + enum infinity { + description + "The timer is set to infinity."; + } + enum not-set { + description + "The timer is not set."; + } + } + } + units "seconds"; + description + "Timer value type, in seconds (32-bit range)."; + } + + typedef timer-value-milliseconds { + type union { + type uint32 { + range "1..4294967295"; + } + type enumeration { + enum infinity { + description + "The timer is set to infinity."; + } + enum not-set { + description + "The timer is not set."; + } + } + } + units "milliseconds"; + description + "Timer value type, in milliseconds."; + } + + typedef percentage { + type uint8 { + range "0..100"; + } + description + "Integer indicating a percentage value."; + } + + typedef timeticks64 { + type uint64; + description + "This type is based on the timeticks type defined in + RFC 6991, but with 64-bit width. It represents the time, + modulo 2^64, in hundredths of a second between two epochs."; + reference + "RFC 6991: Common YANG Data Types."; + } + + typedef uint24 { + type uint32 { + range "0..16777215"; + } + description + "24-bit unsigned integer."; + } + + /*** Collection of types related to MPLS/GMPLS ***/ + + typedef generalized-label { + type binary; + description + "Generalized Label. Nodes sending and receiving the + Generalized Label are aware of the link-specific + label context and type."; + reference + "RFC 3471: Generalized Multi-Protocol Label Switching (GMPLS) + Signaling Functional Description. Section 3.2."; + } + + typedef mpls-label-special-purpose { + type identityref { + base mpls-label-special-purpose-value; + } + description + "This type represents the special-purpose MPLS label values."; + reference + "RFC 3032: MPLS Label Stack Encoding. + RFC 7274: Allocating and Retiring Special-Purpose MPLS + Labels."; + } + + typedef mpls-label-general-use { + type uint32 { + range "16..1048575"; + } + description + "The 20-bit label value in an MPLS label stack as specified + in RFC 3032. This label value does not include the + encodings of Traffic Class and TTL (Time to Live). + The label range specified by this type is for general use, + with special-purpose MPLS label values excluded."; + reference + "RFC 3032: MPLS Label Stack Encoding."; + } + + typedef mpls-label { + type union { + type mpls-label-special-purpose; + type mpls-label-general-use; + } + description + "The 20-bit label value in an MPLS label stack as specified + in RFC 3032. This label value does not include the + encodings of Traffic Class and TTL."; + reference + "RFC 3032: MPLS Label Stack Encoding."; + } + + /*** Groupings **/ + + grouping mpls-label-stack { + description + "This grouping specifies an MPLS label stack. The label + stack is encoded as a list of label stack entries. The + list key is an identifier that indicates the relative + ordering of each entry, with the lowest-value identifier + corresponding to the top of the label stack."; + container mpls-label-stack { + description + "Container for a list of MPLS label stack entries."; + list entry { + key "id"; + description + "List of MPLS label stack entries."; + leaf id { + type uint8; + description + "Identifies the entry in a sequence of MPLS label + stack entries. An entry with a smaller identifier + value precedes an entry with a larger identifier + value in the label stack. The value of this ID has + no semantic meaning other than relative ordering + and referencing the entry."; + } + leaf label { + type rt-types:mpls-label; + description + "Label value."; + } + + leaf ttl { + type uint8; + description + "Time to Live (TTL)."; + reference + "RFC 3032: MPLS Label Stack Encoding."; + } + leaf traffic-class { + type uint8 { + range "0..7"; + } + description + "Traffic Class (TC)."; + reference + "RFC 5462: Multiprotocol Label Switching (MPLS) Label + Stack Entry: 'EXP' Field Renamed to 'Traffic Class' + Field."; + } + } + } + } + + grouping vpn-route-targets { + description + "A grouping that specifies Route Target import-export rules + used in BGP-enabled VPNs."; + reference + "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs). + RFC 4664: Framework for Layer 2 Virtual Private Networks + (L2VPNs)."; + list vpn-target { + key "route-target"; + description + "List of Route Targets."; + leaf route-target { + type rt-types:route-target; + description + "Route Target value."; + } + leaf route-target-type { + type rt-types:route-target-type; + mandatory true; + description + "Import/export type of the Route Target."; + } + } + } +} diff --git a/src/confd/yang/infix-routing@2023-11-23.yang b/src/confd/yang/infix-routing@2023-11-23.yang index ec60532c..166d99f6 100644 --- a/src/confd/yang/infix-routing@2023-11-23.yang +++ b/src/confd/yang/infix-routing@2023-11-23.yang @@ -9,14 +9,21 @@ module infix-routing { import ietf-ipv4-unicast-routing { prefix v4ur; } + import ietf-ipv6-unicast-routing { prefix v6ur; } - /* import ietf-ospf { prefix ospf; } - */ + + import ietf-interfaces { + prefix if; + } + + import ietf-routing-types { + prefix rt-types; + } revision 2023-11-23 { description "Limit to one instance per control plane protocol, and change to infix (iproute2) specific source protocol names @@ -72,6 +79,24 @@ module infix-routing { description "ZeroConf added route"; base infix-source-protocol; } + identity ra { + description "RA IPv6 route"; + base infix-source-protocol; + } + + typedef infix-distribute-protocol { + type enumeration { + enum ospf { + description "Redistribute Ospf"; + } + enum static { + description "Redistribute Static routes"; + } + enum connected { + description "Redistribute Connected routes"; + } + } + } deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ietf-r:name" { description "Limitation: Only one routing instance per protocol."; @@ -106,7 +131,29 @@ module infix-routing { } /* OSPF */ - /* + + augment "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf" { + description "ietf-ospf does not contain redistribution + 7. How should route redistribution be configured? I see ietf-rip.yang has a separate + container for that purpose, but ietf-ospf.yang (and other IGP modules) don't do the + same. I also noticed the BGP model is using definition from ietf-routing-policy.yang. + + Different vendors handle redistribution in different ways. This could be added with + an augmentation if there were agreement. + + https://marc.info/?l=ms-ospf&m=166258444409552&w=2"; + container redistribute { + list redistribute { + key "protocol"; + description "Redistribute protocols into OSPF"; + leaf protocol { + type infix-distribute-protocol; + description "Set protocol to redistribute"; + } + } + } + } + deviation "/ietf-r:routing/ietf-r:ribs/ietf-r:rib/ietf-r:routes/ietf-r:route/ospf:metric" { deviate not-supported; } @@ -116,6 +163,9 @@ module infix-routing { deviation "/ietf-r:routing/ietf-r:ribs/ietf-r:rib/ietf-r:routes/ietf-r:route/ospf:route-type" { deviate not-supported; } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:enabled" { + deviate not-supported; + } deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:spf-control" { deviate not-supported; @@ -157,19 +207,20 @@ module infix-routing { deviate not-supported; } - */ /* OSPF Area */ - /* deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:virtual-links" { deviate not-supported; } deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:sham-links" { deviate not-supported; } - - deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces" { + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:ranges" { deviate not-supported; } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:summary" { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:database" { deviate not-supported; } @@ -180,10 +231,140 @@ module infix-routing { deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:statistics" { deviate not-supported; } - */ - /* OSPF database */ + + /* OSPF Area Interface */ + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:multi-areas" { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:node-flag" { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:bfd" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:interface-type" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:priority" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:fast-reroute" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:authentication" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:statistics" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:neighbors" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:database" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:topologies" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:instance-id" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:interface-id" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:demand-circuit" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:static-neighbors" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:ttl-security" + { + deviate not-supported; + } /* + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:passive" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:hello-interval" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:dead-interval" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:retransmit-interval" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:transmit-delay" + { + deviate not-supported; + } + */ + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:lls" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:cost" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:mtu-ignore" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:prefix-suppression" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:state" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:hello-timer" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:wait-timer" + { + deviate not-supported; + } + /* + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:dr-router-id" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:dr-ip-addr" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:bdr-router-id" + { + deviate not-supported; + } + deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface/ospf:bdr-ip-addr" + { + deviate not-supported; + } + */ + /* OSPF database */ deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:database/ospf:as-scope-lsa-type/ospf:as-scope-lsas/ospf:as-scope-lsa/ospf:version/ospf:ospfv3" { deviate not-supported; } @@ -202,5 +383,4 @@ module infix-routing { deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:database/ospf:as-scope-lsa-type/ospf:as-scope-lsas/ospf:as-scope-lsa/ospf:version/ospf:ospfv2/ospf:ospfv2/ospf:header" { deviate not-supported; } - */ } diff --git a/src/klish-plugin-infix/xml/infix.xml b/src/klish-plugin-infix/xml/infix.xml index 937534aa..98b861fe 100644 --- a/src/klish-plugin-infix/xml/infix.xml +++ b/src/klish-plugin-infix/xml/infix.xml @@ -296,7 +296,7 @@ KLISH_PARAM_name=ipv4 fi fi - sysrepocfg -f json -X -d operational -m ietf-routing | \ + sysrepocfg -f json -X -d operational -x "/ietf-routing:routing/ribs" | \ /libexec/infix/cli-pretty "ietf-routing" -n "$KLISH_PARAM_name" diff --git a/src/statd/statd.c b/src/statd/statd.c index 3c6533d5..9a47c411 100644 --- a/src/statd/statd.c +++ b/src/statd/statd.c @@ -36,7 +36,9 @@ #define XPATH_MAX PATH_MAX #define XPATH_IFACE_BASE "/ietf-interfaces:interfaces" -#define XPATH_ROUTING_BASE "/ietf-routing:routing" +#define XPATH_ROUTING_BASE "/ietf-routing:routing/control-plane-protocols/control-plane-protocol" +#define XPATH_ROUTING_TABLE "/ietf-routing:routing/ribs" +#define XPATH_ROUTING_OSPF XPATH_ROUTING_BASE "/ospf" TAILQ_HEAD(sub_head, sub); @@ -256,6 +258,37 @@ static int sr_routes_cb(sr_session_ctx_t *session, uint32_t, const char *path, return err; } +static int sr_ospf_cb(sr_session_ctx_t *session, uint32_t, const char *path, + const char *, const char *, uint32_t, + struct lyd_node **parent, __attribute__((unused)) void *priv) +{ + const struct ly_ctx *ctx; + sr_conn_ctx_t *con; + sr_error_t err; + + DEBUG("Incoming query for xpath: %s", path); + + con = sr_session_get_connection(session); + if (!con) { + ERROR("Error, getting sr connection"); + return SR_ERR_INTERNAL; + } + + ctx = sr_acquire_context(con); + if (!ctx) { + ERROR("Error, acquiring context"); + return SR_ERR_INTERNAL; + } + + err = ly_add_yanger_data(ctx, parent, "ietf-ospf", NULL); + if (err) + ERROR("Error adding yanger data"); + + sr_release_context(con); + + return err; +} + static void sigint_cb(struct ev_loop *loop, struct ev_signal *, int) { ev_break(loop, EVBREAK_ALL); @@ -324,7 +357,7 @@ static int subscribe(struct statd *statd, char *model, char *xpath, const char * static int sub_to_routes(struct statd *statd) { - return subscribe(statd, "ietf-routing", XPATH_ROUTING_BASE, "routes", sr_routes_cb); + return subscribe(statd, "ietf-routing", XPATH_ROUTING_TABLE, "routes", sr_routes_cb); } static int sub_to_iface(struct statd *statd, const char *ifname) @@ -467,6 +500,10 @@ static int sub_to_ifaces(struct statd *statd) return SR_ERR_OK; } +static int sub_to_ospf(struct statd *statd) +{ + return subscribe(statd, "ietf-routing", XPATH_ROUTING_OSPF, "ospf", sr_ospf_cb); +} int main(int argc, char *argv[]) { struct ev_signal sigint_watcher, sigusr1_watcher; @@ -523,7 +560,12 @@ int main(int argc, char *argv[]) sr_disconnect(sr_conn); return EXIT_FAILURE; } - + err = sub_to_ospf(&statd); + if (err) { + ERROR("Error register for OSPF"); + sr_disconnect(sr_conn); + return EXIT_FAILURE; + } ev_signal_init(&sigint_watcher, sigint_cb, SIGINT); sigint_watcher.data = &statd; ev_signal_start(statd.ev_loop, &sigint_watcher); diff --git a/test/case/ietf_routing/all.yaml b/test/case/ietf_routing/all.yaml index 078ed01c..df2b033b 100644 --- a/test/case/ietf_routing/all.yaml +++ b/test/case/ietf_routing/all.yaml @@ -1,2 +1,3 @@ --- - case: static_routing.py +- case: ospf_basic.py diff --git a/test/case/ietf_routing/ospf_basic.py b/test/case/ietf_routing/ospf_basic.py new file mode 100755 index 00000000..0b2cb702 --- /dev/null +++ b/test/case/ietf_routing/ospf_basic.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python3 +import infamy + +import infamy.route as route +from infamy.util import until +def config_target1(target, data, link): + target.put_config_dict("ietf-interfaces", { + "interfaces": { + "interface": [ + { + "name": data, + "type": "infix-if-type:ethernet", + "enabled": True, + "ipv4": { + "forwarding": True, + "address": [{ + "ip": "192.168.10.1", + "prefix-length": 24 + }]} + }, + { + "name": link, + "type": "infix-if-type:ethernet", + "enabled": True, + "ipv4": { + "forwarding": True, + "address": [{ + "ip": "192.168.50.1", + "prefix-length": 24 + }] + } + }, + { + "name": "lo", + "type": "infix-if-type:ethernet", + "enabled": True, + "ipv4": { + "address": [{ + "ip": "192.168.100.1", + "prefix-length": 32 + }] + } + } + ] + } + }) + + target.put_config_dict("ietf-routing", { + "routing": { + "control-plane-protocols": { + "control-plane-protocol": [{ + "type": "ietf-ospf:ospfv2", + "name": "default", + "ospf": { + "redistribute": { + "redistribute": [{ + "protocol": "static" + }, + { + "protocol": "connected" + }] + }, + "areas": { + "area": [{ + "area-id": "0.0.0.0", + "interfaces": + { + "interface": [{ + "name": link, + "hello-interval": 1, + "dead-interval": 3 + }] + }, + }] + } + } + }] + } + } + }) + +def config_target2(target, link): + target.put_config_dict("ietf-interfaces", { + "interfaces": { + "interface": [ + { + "name": link, + "type": "infix-if-type:ethernet", + "enabled": True, + "ipv4": { + "forwarding": True, + "address": [{ + "ip": "192.168.50.2", + "prefix-length": 24 + }] + } + }, + { + "name": "lo", + "type": "infix-if-type:ethernet", + "enabled": True, + "forwarding": True, + "ipv4": { + "address": [{ + "ip": "192.168.200.1", + "prefix-length": 32 + }] + } + } + ] + } + }) + + target.put_config_dict("ietf-routing", { + "routing": { + "control-plane-protocols": { + "control-plane-protocol": [ + { + "type": "ietf-ospf:ospfv2", + "name": "default", + "ospf": { + "redistribute": { + "redistribute": [{ + "protocol": "static" + }, + { + "protocol": "connected" + }] + }, + "areas": { + "area": [{ + "area-id": "0.0.0.0", + "interfaces":{ + "interface": [{ + "name": link, + "hello-interval": 1, + "dead-interval": 3 + }] + } + }] + } + } + } + ] + } + } + }) + +with infamy.Test() as test: + with test.step("Initialize"): + env = infamy.Env(infamy.std_topology("2x2")) + target1 = env.attach("target1", "mgmt") + target2 = env.attach("target2", "mgmt") + + with test.step("Configure targets"): + _, target1data = env.ltop.xlate("target1", "data") + _, target2_to_target1 = env.ltop.xlate("target2", "target1") + _, target1_to_target2 = env.ltop.xlate("target1", "target2") + + config_target1(target1, target1data, target1_to_target2) + config_target2(target2, target2_to_target1) + with test.step("Wait for OSPF routes"): + print("Waiting for OSPF routes..") + until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32", source_protocol = "infix-routing:ospf"), attempts=100) + until(lambda: route.ipv4_route_exist(target2, "192.168.100.1/32", source_protocol = "infix-routing:ospf"), attempts=100) + + with test.step("Test connectivity"): + _, hport0 = env.ltop.xlate("host", "data1") + with infamy.IsolatedMacVlan(hport0) as ns0: + ns0.addip("192.168.10.2") + ns0.addroute("192.168.200.1/32", "192.168.10.1") + ns0.must_reach("192.168.200.1") + + test.succeed() diff --git a/test/infamy/route.py b/test/infamy/route.py index 0e713f0f..1adc1f9c 100644 --- a/test/infamy/route.py +++ b/test/infamy/route.py @@ -1,5 +1,5 @@ def _get_routes(target, protocol): - xpath=f"/ietf-routing:routing" + xpath="/ietf-routing:routing/ribs" rib = target.get_data(xpath)["routing"]["ribs"]["rib"] for r in rib: if r["name"] != protocol: @@ -7,19 +7,22 @@ def _get_routes(target, protocol): return r.get("routes", {}).get("route",{}) return {} -def _exist_route(target, prefix, nexthop, protocol): - routes = _get_routes(target, protocol) +def _exist_route(target, prefix, nexthop, version,source_protocol): + routes = _get_routes(target, version) for r in routes: if r["destination-prefix"] != prefix: continue + if source_protocol and r.get("source-protocol") != source_protocol: + continue + nh = r["next-hop"] if nexthop and nh["next-hop-address"] != nexthop: continue return True return False -def ipv4_route_exist(target, prefix, nexthop=None): - return _exist_route(target, prefix, nexthop, "ipv4") +def ipv4_route_exist(target, prefix, nexthop=None,source_protocol=None): + return _exist_route(target, prefix, nexthop, "ipv4",source_protocol) -def ipv6_route_exist(target, prefix, nexthop=None): - return _exist_route(target, prefix, nexthop, "ipv6") +def ipv6_route_exist(target, prefix, nexthop=None,source_protocol=None): + return _exist_route(target, prefix, nexthop, "ipv6",source_protocol)