Add OSPFv2 support

A very limited part of the YANG model is implemented so far, basicly it is OSPFv2 with multiple areas and you can change timers
for the interfaces. Limited operational support.

admin@infix-00-00-00:/config/> edit routing control-plane-protocol ietf-ospf:ospfv2 name default
admin@infix-00-00-00:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/> set ospf area 0.0.0.0 interface e0 enabled true
admin@infix-00-00-00:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/> leave
This commit is contained in:
Mattias Walström
2023-12-18 17:28:00 +01:00
committed by Joachim Wiberg
parent 95c3e5c67c
commit 4e7bdc58d4
18 changed files with 8092 additions and 42 deletions
+13
View File
@@ -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
+43
View File
@@ -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)
+14 -1
View File
@@ -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
@@ -1 +1 @@
service [2345] log:null <!pid/zebra> ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf-- OSPF daemon
service [2345] log:null <!pid/zebra> ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf -- OSPF daemon
+1
View File
@@ -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 \
+120 -19
View File
@@ -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"));
}
}
}
@@ -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
<mailto:iana@iana.org>";
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)";
}
}
@@ -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
<mailto:iana@iana.org>";
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.";
}
}
@@ -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: <https://datatracker.ietf.org/wg/bfd/>
WG List: <mailto:rtg-bfd@ietf.org>
Editor: Reshad Rahman
<mailto:reshad@yahoo.com>
Editor: Lianshu Zheng
<mailto:veronique_cheng@hotmail.com>
Editor: Mahesh Jethanandani
<mailto:mjethanandani@gmail.com>";
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.";
}
}
}
@@ -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: <https://datatracker.ietf.org/group/rtgwg>
WG List: <mailto:rtgwg@ietf.org>
Editor: Acee Lindem
<mailto:acee@cisco.com>
Yingzhen Qu
<mailto:yingzhen.qu@huawei.com>
Derek Yeung
<mailto:derek@arrcus.com>
Ing-Wher Chen
<mailto:Ing-Wher_Chen@jabail.com>
Jeffrey Zhang
<mailto:zzhang@juniper.net>";
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.";
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -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: <https://datatracker.ietf.org/wg/rtgwg/>
WG List: <mailto:rtgwg@ietf.org>
Editors: Xufeng Liu
<mailto:Xufeng_Liu@jabail.com>
Yingzhen Qu
<mailto:yingzhen.qu@huawei.com>
Acee Lindem
<mailto:acee@cisco.com>
Christian Hopps
<mailto:chopps@chopps.org>
Lou Berger
<mailto:lberger@labn.com>";
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 <ipv6-address:2-octet-number>.
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 <ipv6-address:2-octet-number>.
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.";
}
}
}
}
+190 -10
View File
@@ -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;
}
*/
}
+1 -1
View File
@@ -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"
</ACTION>
</COMMAND>
+45 -3
View File
@@ -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);
+1
View File
@@ -1,2 +1,3 @@
---
- case: static_routing.py
- case: ospf_basic.py
+174
View File
@@ -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()
+10 -7
View File
@@ -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)