From c588f24bb84a950b80f466d44484ca4f16bef5da Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 26 Jul 2018 22:16:48 +0200 Subject: [PATCH] Add RFC8294 models This adds ietf-routing-types and iana-routing-types. Change-Id: I5983462c00215c1cfaa1be7a6253b545cf9d5e8d Signed-off-by: Robert Varga --- model/artifacts/pom.xml | 24 + model/features/features-mdsal-model/pom.xml | 6 + .../features/odl-mdsal-model-rfc8294/pom.xml | 50 ++ model/features/pom.xml | 1 + model/iana/iana-routing-types/pom.xml | 27 + .../yang/iana-routing-types@2017-12-04.yang | 471 +++++++++++ model/iana/pom.xml | 3 + model/iana/src/main/yang/.gitignore | 8 - model/ietf/pom.xml | 4 + model/ietf/rfc8294-ietf-routing-types/pom.xml | 51 ++ .../IpMulticastGroupAddressBuilder.java | 41 + .../Ipv4MulticastSourceAddressBuilder.java | 45 + .../Ipv6MulticastSourceAddressBuilder.java | 45 + .../types/rev171204/MplsLabelBuilder.java | 86 ++ .../TimerValueMillisecondsBuilder.java | 44 + .../rev171204/TimerValueSeconds16Builder.java | 43 + .../rev171204/TimerValueSeconds32Builder.java | 44 + .../yang/ietf-routing-types@2017-12-04.yang | 771 ++++++++++++++++++ model/ietf/rfc8294/pom.xml | 49 ++ 19 files changed, 1805 insertions(+), 8 deletions(-) create mode 100644 model/features/odl-mdsal-model-rfc8294/pom.xml create mode 100644 model/iana/iana-routing-types/pom.xml create mode 100644 model/iana/iana-routing-types/src/main/yang/iana-routing-types@2017-12-04.yang delete mode 100644 model/iana/src/main/yang/.gitignore create mode 100644 model/ietf/rfc8294-ietf-routing-types/pom.xml create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/IpMulticastGroupAddressBuilder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv4MulticastSourceAddressBuilder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv6MulticastSourceAddressBuilder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/MplsLabelBuilder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueMillisecondsBuilder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds16Builder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds32Builder.java create mode 100644 model/ietf/rfc8294-ietf-routing-types/src/main/yang/ietf-routing-types@2017-12-04.yang create mode 100644 model/ietf/rfc8294/pom.xml diff --git a/model/artifacts/pom.xml b/model/artifacts/pom.xml index 5354b683c4..b5605c4c28 100644 --- a/model/artifacts/pom.xml +++ b/model/artifacts/pom.xml @@ -97,6 +97,23 @@ 1.0.0-SNAPSHOT + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294 + 1.0.0-SNAPSHOT + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294-ietf-routing-types + 1.0.0-SNAPSHOT + + + org.opendaylight.mdsal.binding.model.iana + iana-routing-types + 1.0.0-SNAPSHOT + + org.opendaylight.mdsal.binding.model.ietf @@ -276,6 +293,13 @@ features xml + + org.opendaylight.mdsal.model + odl-mdsal-model-rfc8294 + 1.0.0-SNAPSHOT + features + xml + org.opendaylight.mdsal.model odl-mdsal-model-rfc8342 diff --git a/model/features/features-mdsal-model/pom.xml b/model/features/features-mdsal-model/pom.xml index 86baa6b10c..e136a6463c 100644 --- a/model/features/features-mdsal-model/pom.xml +++ b/model/features/features-mdsal-model/pom.xml @@ -70,6 +70,12 @@ features xml + + org.opendaylight.mdsal.model + odl-mdsal-model-rfc8294 + features + xml + org.opendaylight.mdsal.model odl-mdsal-model-rfc8342 diff --git a/model/features/odl-mdsal-model-rfc8294/pom.xml b/model/features/odl-mdsal-model-rfc8294/pom.xml new file mode 100644 index 0000000000..46fe23b4d3 --- /dev/null +++ b/model/features/odl-mdsal-model-rfc8294/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + org.opendaylight.odlparent + single-feature-parent + 3.1.3 + + + + org.opendaylight.mdsal.model + odl-mdsal-model-rfc8294 + 1.0.0-SNAPSHOT + feature + + OpenDaylight :: MD-SAL :: Model :: RFC8294 + + + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + 0.13.0-SNAPSHOT + import + pom + + + + + + + org.opendaylight.mdsal.model + odl-mdsal-model-rfc6991 + features + xml + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294 + + + diff --git a/model/features/pom.xml b/model/features/pom.xml index be29c46371..3d67b9902e 100644 --- a/model/features/pom.xml +++ b/model/features/pom.xml @@ -31,6 +31,7 @@ odl-mdsal-model-rfc7277 odl-mdsal-model-rfc7895 odl-mdsal-model-rfc7952 + odl-mdsal-model-rfc8294 odl-mdsal-model-rfc8342 odl-mdsal-model-rfc8343 odl-mdsal-model-rfc8344 diff --git a/model/iana/iana-routing-types/pom.xml b/model/iana/iana-routing-types/pom.xml new file mode 100644 index 0000000000..3d2ca9aab1 --- /dev/null +++ b/model/iana/iana-routing-types/pom.xml @@ -0,0 +1,27 @@ + + + + + + + org.opendaylight.mdsal + binding-parent + 0.13.0-SNAPSHOT + ../../../binding/binding-parent + + + 4.0.0 + org.opendaylight.mdsal.binding.model.iana + iana-routing-types + 1.0.0-SNAPSHOT + bundle + + ${project.artifactId} + iana-routing-types@2017-12-04 + diff --git a/model/iana/iana-routing-types/src/main/yang/iana-routing-types@2017-12-04.yang b/model/iana/iana-routing-types/src/main/yang/iana-routing-types@2017-12-04.yang new file mode 100644 index 0000000000..a538179c94 --- /dev/null +++ b/model/iana/iana-routing-types/src/main/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/model/iana/pom.xml b/model/iana/pom.xml index 37a4c38ee0..12b34b1851 100644 --- a/model/iana/pom.xml +++ b/model/iana/pom.xml @@ -25,5 +25,8 @@ iana-afn-safi iana-if-type-2014-05-08 + + + iana-routing-types diff --git a/model/iana/src/main/yang/.gitignore b/model/iana/src/main/yang/.gitignore deleted file mode 100644 index e50f3cf32f..0000000000 --- a/model/iana/src/main/yang/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0 which accompanies this distribution, -# and is available at http://www.eclipse.org/legal/epl-v10.html -# - diff --git a/model/ietf/pom.xml b/model/ietf/pom.xml index 8e591c4aaa..a97231aad2 100644 --- a/model/ietf/pom.xml +++ b/model/ietf/pom.xml @@ -44,6 +44,10 @@ rfc7952 + + rfc8294 + rfc8294-ietf-routing-types + rfc8342 rfc8342-ietf-datastores diff --git a/model/ietf/rfc8294-ietf-routing-types/pom.xml b/model/ietf/rfc8294-ietf-routing-types/pom.xml new file mode 100644 index 0000000000..fb5d3a3246 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/pom.xml @@ -0,0 +1,51 @@ + + + + + 4.0.0 + + org.opendaylight.mdsal + binding-parent + 0.13.0-SNAPSHOT + ../../../binding/binding-parent + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294-ietf-routing-types + 1.0.0-SNAPSHOT + bundle + + ${project.artifactId} + RFC8294 ietf-routing-types + + + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + 0.13.0-SNAPSHOT + pom + import + + + + + + + org.opendaylight.mdsal.model + ietf-inet-types-2013-07-15 + + + org.opendaylight.mdsal.model + ietf-yang-types-20130715 + + + diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/IpMulticastGroupAddressBuilder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/IpMulticastGroupAddressBuilder.java new file mode 100644 index 0000000000..e92c3fb846 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/IpMulticastGroupAddressBuilder.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verify; + +import com.google.common.annotations.Beta; +import java.util.regex.Pattern; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; + +/** + * Builder for {@link IpMulticastGroupAddress} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class IpMulticastGroupAddressBuilder { + private static final Pattern IPV4_PATTERN; + + static { + verify(Ipv4Address.PATTERN_CONSTANTS.size() == 1); + IPV4_PATTERN = Pattern.compile(Ipv4MulticastGroupAddress.PATTERN_CONSTANTS.get(0)); + } + + private IpMulticastGroupAddressBuilder() { + //Exists only to defeat instantiation. + } + + public static IpMulticastGroupAddress getDefaultInstance(final String defaultValue) { + return IPV4_PATTERN.matcher(defaultValue).matches() + ? new IpMulticastGroupAddress(new Ipv4MulticastGroupAddress(defaultValue)) + : new IpMulticastGroupAddress(new Ipv6MulticastGroupAddress(defaultValue)); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv4MulticastSourceAddressBuilder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv4MulticastSourceAddressBuilder.java new file mode 100644 index 0000000000..a91c19521e --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv4MulticastSourceAddressBuilder.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verifyNotNull; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.Beta; +import com.google.common.base.Verify; +import com.google.common.collect.Maps; +import java.util.Arrays; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Ipv4MulticastSourceAddress.Enumeration; + +/** + * Builder for {@link IpMulticastGroupAddress} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class Ipv4MulticastSourceAddressBuilder { + private static final Map ENUMERATED = Arrays.stream(Enumeration.values()) + .collect(Maps.toImmutableEnumMap(Verify::verifyNotNull, Ipv4MulticastSourceAddress::new)); + + private Ipv4MulticastSourceAddressBuilder() { + //Exists only to defeat instantiation. + } + + public static Ipv4MulticastSourceAddress getDefaultInstance(final String defaultValue) { + return Enumeration.forName(defaultValue).map(ENUMERATED::get) + .orElse(new Ipv4MulticastSourceAddress(new Ipv4Address(defaultValue))); + } + + public static Ipv4MulticastSourceAddress forEnumeration(final Enumeration enumeration) { + return verifyNotNull(ENUMERATED.get(requireNonNull(enumeration))); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv6MulticastSourceAddressBuilder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv6MulticastSourceAddressBuilder.java new file mode 100644 index 0000000000..c8b257e9b7 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/Ipv6MulticastSourceAddressBuilder.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verifyNotNull; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.Beta; +import com.google.common.base.Verify; +import com.google.common.collect.Maps; +import java.util.Arrays; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Ipv6MulticastSourceAddress.Enumeration; + +/** + * Builder for {@link IpMulticastGroupAddress} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class Ipv6MulticastSourceAddressBuilder { + private static final Map ENUMERATED = Arrays.stream(Enumeration.values()) + .collect(Maps.toImmutableEnumMap(Verify::verifyNotNull, Ipv6MulticastSourceAddress::new)); + + private Ipv6MulticastSourceAddressBuilder() { + + } + + public static Ipv6MulticastSourceAddress getDefaultInstance(final String defaultValue) { + return Enumeration.forName(defaultValue).map(ENUMERATED::get) + .orElse(new Ipv6MulticastSourceAddress(new Ipv6Address(defaultValue))); + } + + public static Ipv6MulticastSourceAddress forEnumeration(final Enumeration enumeration) { + return verifyNotNull(ENUMERATED.get(requireNonNull(enumeration))); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/MplsLabelBuilder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/MplsLabelBuilder.java new file mode 100644 index 0000000000..ba69650bc7 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/MplsLabelBuilder.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import com.google.common.annotations.Beta; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import java.util.AbstractMap.SimpleImmutableEntry; +import java.util.Map.Entry; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yangtools.util.ClassLoaderUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Builder for {@link MplsLabel} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class MplsLabelBuilder { + private static final Logger LOG = LoggerFactory.getLogger(MplsLabelBuilder.class); + + @SuppressWarnings("null") + private static final LoadingCache, Optional> CLASS_CACHE = + CacheBuilder.newBuilder() + .weakKeys().build(new CacheLoader, Optional>() { + @Override + public Optional load(final Entry key) { + return loadClass(key.getKey(), key.getValue()); + } + }); + + private MplsLabelBuilder() { + + } + + public static MplsLabel getDefaultInstance(final String defaultValue) { + if (defaultValue.startsWith("interface ")) { + final Optional optStatic = CLASS_CACHE.getUnchecked( + new SimpleImmutableEntry<>(MplsLabelBuilder.class.getClassLoader(), defaultValue)); + if (optStatic.isPresent()) { + return optStatic.get(); + } + + final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + if (tccl != null) { + final Optional optThreadLocal = CLASS_CACHE.getUnchecked( + new SimpleImmutableEntry<>(tccl, defaultValue)); + if (optThreadLocal.isPresent()) { + return optThreadLocal.get(); + } + } + } + + return new MplsLabel(new MplsLabelGeneralUse(Long.valueOf(defaultValue))); + } + + static Optional loadClass(final ClassLoader loader, final String key) { + final Class cls; + try { + cls = ClassLoaderUtils.loadClass(loader, key); + } catch (ClassNotFoundException e) { + LOG.debug("%s not found in classloader of %s", key, loader); + return Optional.empty(); + } + + final Class cast; + try { + cast = cls.asSubclass(MplsLabelSpecialPurposeValue.class); + } catch (ClassCastException e) { + LOG.warn("%s does not implement %s", MplsLabelSpecialPurposeValue.class); + return Optional.empty(); + } + + return Optional.of(new MplsLabel(cast)); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueMillisecondsBuilder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueMillisecondsBuilder.java new file mode 100644 index 0000000000..fa454b0645 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueMillisecondsBuilder.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verifyNotNull; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.Beta; +import com.google.common.base.Verify; +import com.google.common.collect.Maps; +import java.util.Arrays; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.TimerValueMilliseconds.Enumeration; + +/** + * Builder for {@link TimerValueMilliseconds} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class TimerValueMillisecondsBuilder { + private static final Map ENUMERATED = Arrays.stream(Enumeration.values()) + .collect(Maps.toImmutableEnumMap(Verify::verifyNotNull, TimerValueMilliseconds::new)); + + private TimerValueMillisecondsBuilder() { + + } + + public static TimerValueMilliseconds getDefaultInstance(final String defaultValue) { + return Enumeration.forName(defaultValue).map(ENUMERATED::get) + .orElse(new TimerValueMilliseconds(Long.valueOf(defaultValue))); + } + + public static TimerValueMilliseconds forEnumeration(final Enumeration enumeration) { + return verifyNotNull(ENUMERATED.get(requireNonNull(enumeration))); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds16Builder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds16Builder.java new file mode 100644 index 0000000000..ee6de6703a --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds16Builder.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verifyNotNull; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.Beta; +import com.google.common.base.Verify; +import com.google.common.collect.Maps; +import java.util.Arrays; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.TimerValueSeconds16.Enumeration; + +/** + * Builder for {@link TimerValueSeconds16} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class TimerValueSeconds16Builder { + private static final Map ENUMERATED = Arrays.stream(Enumeration.values()) + .collect(Maps.toImmutableEnumMap(Verify::verifyNotNull, TimerValueSeconds16::new)); + + private TimerValueSeconds16Builder() { + + } + + public static TimerValueSeconds16 getDefaultInstance(final String defaultValue) { + return Enumeration.forName(defaultValue).map(ENUMERATED::get) + .orElse(new TimerValueSeconds16(Integer.valueOf(defaultValue))); + } + + public static TimerValueSeconds16 forEnumeration(final Enumeration enumeration) { + return verifyNotNull(ENUMERATED.get(requireNonNull(enumeration))); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds32Builder.java b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds32Builder.java new file mode 100644 index 0000000000..0a672d9c90 --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/TimerValueSeconds32Builder.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204; + +import static com.google.common.base.Verify.verifyNotNull; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.Beta; +import com.google.common.base.Verify; +import com.google.common.collect.Maps; +import java.util.Arrays; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.TimerValueSeconds32.Enumeration; + +/** + * Builder for {@link TimerValueSeconds32} instances. + * + * @author Robert Varga + */ +@Beta +@NonNullByDefault +public final class TimerValueSeconds32Builder { + private static final Map ENUMERATED = Arrays.stream(Enumeration.values()) + .collect(Maps.toImmutableEnumMap(Verify::verifyNotNull, TimerValueSeconds32::new)); + + private TimerValueSeconds32Builder() { + + } + + public static TimerValueSeconds32 getDefaultInstance(final String defaultValue) { + return Enumeration.forName(defaultValue).map(ENUMERATED::get) + .orElse(new TimerValueSeconds32(Long.valueOf(defaultValue))); + } + + public static TimerValueSeconds32 forEnumeration(final Enumeration enumeration) { + return verifyNotNull(ENUMERATED.get(requireNonNull(enumeration))); + } +} diff --git a/model/ietf/rfc8294-ietf-routing-types/src/main/yang/ietf-routing-types@2017-12-04.yang b/model/ietf/rfc8294-ietf-routing-types/src/main/yang/ietf-routing-types@2017-12-04.yang new file mode 100644 index 0000000000..24319c155f --- /dev/null +++ b/model/ietf/rfc8294-ietf-routing-types/src/main/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/model/ietf/rfc8294/pom.xml b/model/ietf/rfc8294/pom.xml new file mode 100644 index 0000000000..51a524f7cf --- /dev/null +++ b/model/ietf/rfc8294/pom.xml @@ -0,0 +1,49 @@ + + + + + 4.0.0 + + org.opendaylight.odlparent + bundle-parent + 3.1.3 + + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294 + 1.0.0-SNAPSHOT + bundle + + ${project.artifactId} + RFC8294 Common YANG Data Types for the Routing Area + + + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + 0.13.0-SNAPSHOT + pom + import + + + + + + + org.opendaylight.mdsal.binding.model.ietf + rfc8294-ietf-routing-types + + + org.opendaylight.mdsal.binding.model.iana + iana-routing-types + + + -- 2.36.6