ajout export matrice routage | correction parsing route forcepoint/stormshield | modification main pour les output

This commit is contained in:
Chevallier
2026-01-15 15:37:47 +01:00
parent 0fd88fa934
commit 3e2820e54c
27 changed files with 308 additions and 13304 deletions

View File

@@ -5,6 +5,7 @@
Cet outil permet de **parser les configurations de différents types de firewalls** (Palo Alto, Stormshield, Forcepoint) et de **convertir ces informations en un format JSON normalisé basé sur des modèles OpenConfig en YANG**.
Il fournit également la possibilité de générer une **matrice de flux au format Excel** pour visualiser les communications et règles de trafic dans linfrastructure.
Il founit également la possibilité de générer une **matrice de routage au format Excel** pour visualiser les routes statiques dans linfrastructure.
## Fonctionnalités principales
@@ -41,6 +42,10 @@ Il fournit également la possibilité de générer une **matrice de flux au form
- les règles de sécurité
- les communications entre objets et groupes dadresses/services.
6. **Génération de matrices de routage**
- Script Python qui utilise le JSON normalisé pour générer automatiquement une matrice Excel détaillant :
- les routes statiques
## Utilisation
### Pré-requis
@@ -48,23 +53,22 @@ Il fournit également la possibilité de générer une **matrice de flux au form
python -m venv .venv
.\.venv\Scripts\activate
pip install -r .\src\requierements.txt
pip install -r .\src\requirements.txt
```
- Mettre le/les fichier(s) de configurations dans le dossier `/src/input/`
- Modifier le fichier `site.json` de données dans `/src/data/`
#### Commandes principales
```bash
python3 .\src\main.py stormshield .\src\input\backup\ -m
python3 .\src\main.py paloalto .\src\input\nomfichier -m
python3 .\src\main.py forcepoint .\src\input\nomfichier -m
python3 .\src\main.py stormshield .\src\input\backup\ -f -r
python3 .\src\main.py paloalto .\src\input\nomfichier -f -r
python3 .\src\main.py forcepoint .\src\input\nomfichier -f -r
```
#### Options
| Option | Description |
|--------|-------------|
| -o [nom_fichier] | Spécifie le nom du fichier JSON de sortie (optionnel)
| -m | Génère un rapport Excel de type matrice de flux (optionnel)
| -f | Génère un rapport Excel de type matrice de flux (optionnel)
| -r | Génère un rapport Excel de type matrice de routage (optionnel)
---
## Arborescence du projet

View File

@@ -4,21 +4,33 @@ import time
from scripts.json_PaloAlto import generate_json_paloalto
from scripts.json_Stormshield import generate_json_stormshield
from scripts.json_Forcepoint import generate_json_forcepoint
from scripts.export_excel import export_to_excel
from scripts.export_matrice_flux import export_to_excel as export_flux_to_excel
from scripts.export_matrice_routage import export_to_excel as export_routing_to_excel
def verify_if_file_exists(name):
base, ext = os.path.splitext(name)
counter = 1
new_name = name
while os.path.exists(new_name):
new_name = f"{base}_{counter}{ext}"
counter += 1
return new_name
def main():
if len(sys.argv) < 3:
print("Usage: python3 src/main.py <firewall_type>[paloalto|stormshield|forcepoint] <input_directory/file> [-o <output_file>] [-m]")
print("Usage: python3 src/main.py <firewall_type>[paloalto|stormshield|forcepoint] <input_directory/file> [-o <output_file>] [-f] [-r]")
print("Options:")
print(" <firewall_type> Type of firewall to process (paloalto|stormshield|forcepoint)")
print(" -o <output_file> Specify output JSON file name (optional)")
print(" -m Generate Excel report (optional)")
print(" -f Generate matrix flux report (optional)")
print(" -r Generate routing matrix report (optional)")
sys.exit(1)
firewall_type = sys.argv[1].lower()
input_data = sys.argv[2]
input_path = "src/input/"
output_path = "src/output/"
os.makedirs(output_path, exist_ok=True)
if "-o" in sys.argv:
o_index = sys.argv.index("-o")
if o_index + 1 < len(sys.argv):
@@ -29,7 +41,7 @@ def main():
else:
timestamp = time.strftime("%Y%m%d")
output_file_json = f"{output_path}{firewall_type}_{timestamp}.json"
os.makedirs(output_path, exist_ok=True)
output_file_json = verify_if_file_exists(output_file_json)
if firewall_type == "paloalto":
generate_json_paloalto(input_data, output_file_json)
@@ -41,20 +53,36 @@ def main():
print("Erreur: type de firewall inconnu. Utilisez 'paloalto', 'stormshield' ou 'forcepoint'.")
sys.exit(1)
if "-m" in sys.argv:
print(f"\nGénération de l'export Excel...")
if "-f" in sys.argv:
print(f"\nGénération de l'export la matrice flux...")
if "-o" in sys.argv:
o_index = sys.argv.index("-o")
if o_index + 1 < len(sys.argv):
output_file_excel = os.path.join(f"{output_path}matrice_{firewall_type}_{sys.argv[o_index + 1]}.xlsx")
output_file_excel = os.path.join(f"{output_path}matrice_flux_{firewall_type}_{sys.argv[o_index + 1]}.xlsx")
else:
print("Erreur: nom de fichier de sortie manquant après '-o'.")
sys.exit(1)
else:
timestamp = time.strftime("%Y%m%d")
output_file_excel = f"{output_path}matrice_{firewall_type}_{timestamp}.xlsx"
output_file_excel = f"{output_path}matrice_flux_{firewall_type}_{timestamp}.xlsx"
output_file_excel = verify_if_file_exists(output_file_excel)
excel_file = export_flux_to_excel(output_file_json, output_file_excel)
print(f"✓ Processus terminé. Fichiers générés:\n - JSON: {output_file_json}\n - Excel: {excel_file}")
excel_file = export_to_excel(output_file_json, output_file_excel)
if "-r" in sys.argv:
print(f"\nGénération de l'export la matrice routage...")
if "-o" in sys.argv:
o_index = sys.argv.index("-o")
if o_index + 1 < len(sys.argv):
output_file_excel = os.path.join(f"{output_path}matrice_routage_{firewall_type}_{sys.argv[o_index + 1]}.xlsx")
else:
print("Erreur: nom de fichier de sortie manquant après '-o'.")
sys.exit(1)
else:
timestamp = time.strftime("%Y%m%d")
output_file_excel = f"{output_path}matrice_routage_{firewall_type}_{timestamp}.xlsx"
output_file_excel = verify_if_file_exists(output_file_excel)
excel_file = export_routing_to_excel(output_file_json, output_file_excel)
print(f"✓ Processus terminé. Fichiers générés:\n - JSON: {output_file_json}\n - Excel: {excel_file}")
if __name__ == "__main__":

View File

@@ -1,108 +0,0 @@
module custom-firewall-objects {
yang-version 1.1;
namespace "urn:custom:firewall-objects";
prefix cfwobj;
import ietf-inet-types { prefix inet; }
import firewall-device { prefix fwd; }
organization "Custom Network Automation";
contact "Julien Chevalier <julien@example.com>";
description
"Custom firewall objects model depending on the firewall type.";
revision "2025-12-22" {
description "Initial version with conditional structure.";
reference "Internal reference FW-OBJ-001.";
}
container firewall-objects {
description
"Firewall object definitions depending on firewall type.";
choice vendor-type {
description "Different structures depending on the firewall device type.";
case palo-alto {
when "/fwd:firewall-device/fwd:type = 'palo-alto'";
description "Objects for Palo Alto firewalls.";
container palo-alto-objects {
description "Container for Palo Alto specific objects.";
list address {
key "name";
description "Palo Alto address objects.";
leaf name { type string; description "Object name."; }
leaf-list members { type string; description "Members list."; }
leaf description { type string; description "Description."; }
leaf tag { type string; description "Tag."; }
}
list address-group {
key "name";
description "Palo Alto address groups.";
leaf name { type string; description "Group name."; }
leaf-list ip_netmask { type string; description "IP/netmask list."; }
leaf description { type string; description "Description."; }
leaf tag { type string; description "Tag."; }
}
list service {
key "name";
description "Palo Alto service objects.";
leaf name { type string; description "Service name."; }
leaf protocol { type string; description "Protocol."; }
leaf port { type string; description "Port number or range."; }
leaf source_port { type string; description "Source port."; }
leaf description { type string; description "Description."; }
leaf tag { type string; description "Tag."; }
}
list service-group {
key "name";
description "Palo Alto service groups.";
leaf name { type string; description "Group name."; }
leaf-list members { type string; description "Members list."; }
leaf description { type string; description "Description."; }
leaf tag { type string; description "Tag."; }
}
}
}
case forcepoint {
when "/fwd:firewall-device/fwd:type = 'forcepoint'";
description "Objects for forcepoint firewalls.";
container forcepoint-objects {
description "Container for forcepoint specific objects.";
list address {
key "name";
description "forcepoint address objects.";
leaf name { type string; description "Object name."; }
leaf subnet { type inet:ipv4-prefix; description "IPv4 subnet."; }
leaf interface { type string; description "Associated interface."; }
leaf comment { type string; description "Description or comment."; }
}
list service {
key "name";
description "forcepoint service objects.";
leaf name { type string; description "Service name."; }
leaf protocol {
type enumeration {
enum TCP { description "TCP protocol."; }
enum UDP { description "UDP protocol."; }
}
description "Protocol type.";
}
leaf tcp_portrange { type string; description "TCP port range."; }
leaf udp_portrange { type string; description "UDP port range."; }
leaf comment { type string; description "Description or comment."; }
}
}
}
}
}
}

View File

@@ -1,34 +0,0 @@
module firewall-device {
yang-version 1.1;
namespace "urn:custom:firewall-device";
prefix fwd;
organization "Custom Network Automation";
contact "Julie Chevallier <julie@example.com>";
description
"Simple device info model exposing firewall vendor type.";
revision "2025-10-21" {
description
"Initial version of the firewall device type module.";
reference
"Internal reference FW-DEV-001.";
}
container firewall-device {
description
"Container representing the firewall vendor and type.";
leaf type {
type enumeration {
enum palo-alto {
description "Palo Alto Networks firewall.";
}
enum fortinet {
description "Fortinet firewall.";
}
}
description "Firewall vendor type.";
}
}
}

View File

@@ -1,669 +0,0 @@
module ietf-inet-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
prefix "inet";
organization
"IETF Network Modeling (NETMOD) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
Editor: Juergen Schoenwaelder
<mailto:jschoenwaelder@constructor.university>";
description
"This module contains a collection of generally useful derived
YANG data types for Internet addresses and related things.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.
Copyright (c) 2025 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 XXXX;
see the RFC itself for full legal notices.";
revision 2025-06-23 {
description
"This revision adds the following new data types:
- inet:ip-address-and-prefix
- inet:ipv4-address-and-prefix
- inet:ipv6-address-and-prefix
- inet:protocol-number
- inet:upper-layer-protocol-number
- inet:host-name
- inet:email-address
- inet:ip-address-link-local
- inet:ipv4-address-link-local
- inet:ipv6-address-link-local
The inet:host union was changed to use inet:host-name instead
of inet:domain-name. Several pattern statements have been
improved.";
reference
"RFC XXXX: Common YANG Data Types";
}
revision 2013-07-15 {
description
"This revision adds the following new data types:
- inet:ip-address-no-zone
- inet:ipv4-address-no-zone
- inet:ipv6-address-no-zone";
reference
"RFC 6991: Common YANG Data Types";
}
revision 2010-09-24 {
description
"Initial revision.";
reference
"RFC 6021: Common YANG Data Types";
}
/*** collection of types related to protocol fields ***/
typedef ip-version {
type enumeration {
enum unknown {
value "0";
description
"An unknown or unspecified version of the Internet
protocol.";
}
enum ipv4 {
value "1";
description
"The IPv4 protocol as defined in RFC 791.";
}
enum ipv6 {
value "2";
description
"The IPv6 protocol as defined in RFC 8200.";
}
}
description
"This value represents the version of the IP protocol.
In the value set and its semantics, this type is equivalent
to the InetVersion textual convention of the SMIv2.";
reference
"RFC 791: Internet Protocol
RFC 8200: Internet Protocol, Version 6 (IPv6) Specification
RFC 4001: Textual Conventions for Internet Network Addresses";
}
typedef dscp {
type uint8 {
range "0..63";
}
description
"The dscp type represents a Differentiated Services Code Point
that may be used for marking packets in a traffic stream.
In the value set and its semantics, this type is equivalent
to the Dscp textual convention of the SMIv2.";
reference
"RFC 3289: Management Information Base for the Differentiated
Services Architecture
RFC 2474: Definition of the Differentiated Services Field
(DS Field) in the IPv4 and IPv6 Headers
RFC 2780: IANA Allocation Guidelines For Values In
the Internet Protocol and Related Headers";
}
typedef ipv6-flow-label {
type uint32 {
range "0..1048575";
}
description
"The ipv6-flow-label type represents the flow identifier or
Flow Label in an IPv6 packet header that may be used to
discriminate traffic flows.
In the value set and its semantics, this type is equivalent
to the IPv6FlowLabel textual convention of the SMIv2.";
reference
"RFC 3595: Textual Conventions for IPv6 Flow Label
RFC 8200: Internet Protocol, Version 6 (IPv6) Specification";
}
typedef port-number {
type uint16 {
range "0..65535";
}
description
"The port-number type represents a 16-bit port number of an
Internet transport-layer protocol such as UDP, TCP, DCCP, or
SCTP.
Port numbers are assigned by IANA. The current list of
all assignments is available from <https://www.iana.org/>.
Note that the port number value zero is reserved by IANA. In
situations where the value zero does not make sense, it can
be excluded by subtyping the port-number type.
In the value set and its semantics, this type is equivalent
to the InetPortNumber textual convention of the SMIv2.";
reference
"RFC 768: User Datagram Protocol
RFC 9293: Transmission Control Protocol (TCP)
RFC 9260: Stream Control Transmission Protocol
RFC 4340: Datagram Congestion Control Protocol (DCCP)
RFC 4001: Textual Conventions for Internet Network Addresses";
}
typedef protocol-number {
type uint8;
description
"The protocol-number type represents an 8-bit Internet
protocol number, carried in the 'protocol' field of the
IPv4 header or in the 'next header' field of the IPv6
header.
Protocol numbers are assigned by IANA. The current list of
all assignments is available from <https://www.iana.org/>.";
reference
"RFC 791: Internet Protocol
RFC 8200: Internet Protocol, Version 6 (IPv6) Specification";
}
typedef upper-layer-protocol-number {
type protocol-number;
description
"The upper-layer-protocol-number represents the upper-layer
protocol number carried in an IP packet. For IPv6 packets
with extension headers, this is the protocol number carried
in the last 'next header' field of the chain of IPv6 extension
headers.";
reference
"RFC 791: Internet Protocol
RFC 8200: Internet Protocol, Version 6 (IPv6) Specification";
}
/*** collection of types related to autonomous systems ***/
typedef as-number {
type uint32;
description
"The as-number type represents autonomous system numbers
which identify an Autonomous System (AS). An AS is a set
of routers under a single technical administration, using
an interior gateway protocol and common metrics to route
packets within the AS, and using an exterior gateway
protocol to route packets to other ASes. IANA maintains
the AS number space and has delegated large parts to the
regional registries.
Autonomous system numbers were originally limited to 16
bits. BGP extensions have enlarged the autonomous system
number space to 32 bits. This type therefore uses an uint32
base type without a range restriction in order to support
a larger autonomous system number space.
In the value set and its semantics, this type is equivalent
to the InetAutonomousSystemNumber textual convention of
the SMIv2.";
reference
"RFC 1930: Guidelines for creation, selection, and registration
of an Autonomous System (AS)
RFC 4271: A Border Gateway Protocol 4 (BGP-4)
RFC 4001: Textual Conventions for Internet Network Addresses
RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
Number Space";
}
/*** collection of types related to IP addresses and hostnames ***/
typedef ip-address {
type union {
type ipv4-address;
type ipv6-address;
}
description
"The ip-address type represents an IP address and is IP
version neutral. The format of the textual representation
implies the IP version. This type supports scoped addresses
by allowing zone identifiers in the address format.";
reference
"RFC 4007: IPv6 Scoped Address Architecture";
}
typedef ipv4-address {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '(%.+)?';
}
description
"The ipv4-address type represents an IPv4 address in
dotted-quad notation. The IPv4 address may include a zone
index, separated by a % sign. If a system uses zone names
that are not represented in UTF-8, then an implementation
needs to use some mechanism to transform the local name
into UTF-8. The definition of such a mechanism is outside
the scope of this document.
The zone index is used to disambiguate identical address
values. For link-local addresses, the zone index will
typically be the interface index number or the name of an
interface. If the zone index is not present, the default
zone of the device will be used.
The canonical format for the zone index is the numerical
format";
}
typedef ipv6-address {
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]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(%[A-Za-z0-9][A-Za-z0-9\-\._~/]*)?';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(%.+)?';
}
description
"The ipv6-address type represents an IPv6 address in full,
mixed, shortened, and shortened-mixed notation. The IPv6
address may include a zone index, separated by a % sign.
If a system uses zone names that are not represented in
UTF-8, then an implementation needs to use some mechanism
to transform the local name into UTF-8. The definition of
such a mechanism is outside the scope of this document.
The zone index is used to disambiguate identical address
values. For link-local addresses, the zone index will
typically be the interface index number or the name of an
interface. If the zone index is not present, the default
zone of the device will be used.
The canonical format of IPv6 addresses uses the textual
representation defined in Section 4 of RFC 5952. The
canonical format for the zone index is the numerical
format as described in Section 11.2 of RFC 4007.";
reference
"RFC 4291: IP Version 6 Addressing Architecture
RFC 4007: IPv6 Scoped Address Architecture
RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
typedef ip-address-no-zone {
type union {
type ipv4-address-no-zone;
type ipv6-address-no-zone;
}
description
"The ip-address-no-zone type represents an IP address and is
IP version neutral. The format of the textual representation
implies the IP version. This type does not support scoped
addresses since it does not allow zone identifiers in the
address format.";
reference
"RFC 4007: IPv6 Scoped Address Architecture";
}
typedef ipv4-address-no-zone {
type ipv4-address {
pattern '[0-9\.]*';
}
description
"An IPv4 address without a zone index. This type, derived
from the type ipv4-address, may be used in situations where
the zone is known from the context and no zone index is
needed.";
}
typedef ipv6-address-no-zone {
type ipv6-address {
pattern '[0-9a-fA-F:\.]*';
}
description
"An IPv6 address without a zone index. This type, derived
from the type ipv6-address, may be used in situations where
the zone is known from the context and no zone index is
needed.";
reference
"RFC 4291: IP Version 6 Addressing Architecture
RFC 4007: IPv6 Scoped Address Architecture
RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
typedef ip-address-link-local {
type union {
type ipv4-address-link-local;
type ipv6-address-link-local;
}
description
"The ip-address-link-local type represents a link-local IP
address and is IP version neutral. The format of the textual
representation implies the IP version.";
}
typedef ipv4-address-link-local {
type ipv4-address {
pattern '169\.254\..*';
}
description
"A link-local IPv4 address in the prefix 169.254.0.0/16 as
defined in section 2.1. of RFC 3927.";
reference
"RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses";
}
typedef ipv6-address-link-local {
type ipv6-address {
pattern '[fF][eE]80:.*';
}
description
"A link-local IPv6 address in the prefix fe80::/10 as defined
in section 2.5.6. of RFC 4291.";
reference
"RFC 4291: IP Version 6 Addressing Architecture";
}
typedef ip-prefix {
type union {
type ipv4-prefix;
type ipv6-prefix;
}
description
"The ip-prefix type represents an IP prefix and is IP
version neutral. The format of the textual representations
implies the IP version.";
}
typedef ipv4-prefix {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '/(([0-9])|([1-2][0-9])|(3[0-2]))';
}
description
"The ipv4-prefix type represents an IPv4 prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 32.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The canonical format of an IPv4 prefix has all bits of
the IPv4 address set to zero that are not part of the
IPv4 prefix.
The definition of ipv4-prefix does not require that bits,
which are not part of the prefix, are set to zero. However,
implementations have to return values in canonical format,
which requires non-prefix bits to be set to zero. This means
that 192.0.2.1/24 must be accepted as a valid value but it
will be converted into the canonical format 192.0.2.0/24.";
}
typedef ipv6-prefix {
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]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(/.+)';
}
description
"The ipv6-prefix type represents an IPv6 prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 128.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The canonical format of an IPv6 prefix has all bits of
the IPv6 address set to zero that are not part of the
IPv6 prefix. Furthermore, the IPv6 address is represented
as defined in Section 4 of RFC 5952.
The definition of ipv6-prefix does not require that bits,
which are not part of the prefix, are set to zero. However,
implementations have to return values in canonical format,
which requires non-prefix bits to be set to zero. This means
that 2001:db8::1/64 must be accepted as a valid value but it
will be converted into the canonical format 2001:db8::/64.";
reference
"RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
typedef ip-address-and-prefix {
type union {
type ipv4-address-and-prefix;
type ipv6-address-and-prefix;
}
description
"The ip-address-and-prefix type represents an IP address and
prefix and is IP version neutral. The format of the textual
representations implies the IP version.";
}
typedef ipv4-address-and-prefix {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '/(([0-9])|([1-2][0-9])|(3[0-2]))';
}
description
"The ipv4-address-and-prefix type represents an IPv4
address and an associated IPv4 prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 32.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.";
}
typedef ipv6-address-and-prefix {
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]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(/.+)';
}
description
"The ipv6-address-and-prefix type represents an IPv6
address and an associated IPv6 prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 128.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The canonical format requires that the IPv6 address is
represented as defined in Section 4 of RFC 5952.";
reference
"RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
/*** collection of domain name and URI types ***/
typedef domain-name {
type string {
length "1..253";
pattern
'((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+ '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+ '|\.';
}
description
"The domain-name type represents a DNS domain name. The
name SHOULD be fully qualified whenever possible. This
type does not support wildcards (see RFC 4592) or
classless in-addr.arpa delegations (see RFC 2317).
Internet domain names are only loosely specified. Section
3.5 of RFC 1034 recommends a syntax (modified in Section
2.1 of RFC 1123). The pattern above is intended to allow
for current practice in domain name use, and some possible
future expansion. Note that Internet host names have a
stricter syntax (described in RFC 952) than the DNS
recommendations in RFCs 1034 and 1123. Schema nodes
representing host names should use the host-name type
instead of the domain-type.
The encoding of DNS names in the DNS protocol is limited
to 255 characters. Since the encoding consists of labels
prefixed by a length bytes and there is a trailing NULL
byte, only 253 characters can appear in the textual dotted
notation.
The description clause of schema nodes using the domain-name
type MUST describe when and how these names are resolved to
IP addresses. Note that the resolution of a domain-name value
may require to query multiple DNS records (e.g., A for IPv4
and AAAA for IPv6). The order of the resolution process and
which DNS record takes precedence can either be defined
explicitly or may depend on the configuration of the
resolver.
Domain-name values use the US-ASCII encoding. Their canonical
format uses lowercase US-ASCII characters. Internationalized
domain names MUST be A-labels as per RFC 5890.";
reference
"RFC 952: DoD Internet Host Table Specification
RFC 1034: Domain Names - Concepts and Facilities
RFC 1123: Requirements for Internet Hosts -- Application
and Support
RFC 2317: Classless IN-ADDR.ARPA delegation
RFC 2782: A DNS RR for specifying the location of services
(DNS SRV)
RFC 4592: The Role of Wildcards in the Domain Name System
RFC 5890: Internationalized Domain Names in Applications
(IDNA): Definitions and Document Framework
RFC 9499: DNS Terminology";
}
typedef host-name {
type domain-name {
length "2..max";
pattern '[a-zA-Z0-9\-\.]+';
}
description
"The host-name type represents (fully qualified) host names.
Host names must be at least two characters long (see RFC 952)
and they are restricted to labels consisting of letters, digits
and hyphens separated by dots (see RFC1123 and RFC 952).";
reference
"RFC 952: DoD Internet Host Table Specification
RFC 1123: Requirements for Internet Hosts -- Application
and Support";
}
typedef host {
type union {
type ip-address;
type host-name;
}
description
"The host type represents either an IP address or a (fully
qualified) host name.";
}
typedef uri {
type string {
pattern '[a-z][a-z0-9+.-]*:.*';
}
description
"The uri type represents a Uniform Resource Identifier
(URI) as defined by the rule 'URI' in RFC 3986.
Objects using the uri type MUST be in US-ASCII encoding,
and MUST be normalized as described by RFC 3986 Sections
6.2.1, 6.2.2.1, and 6.2.2.2. Characters that can be
represented without using percent-encoding are represented
as characters (without percent-encoding), and all
case-insensitive characters are set to lowercase except
for hexadecimal digits within a percent-encoded triplet,
which are normalized to uppercase as described in
Section 6.2.2.1 of RFC 3986.
The purpose of this normalization is to help provide
unique URIs. Note that this normalization is not
sufficient to provide uniqueness. Two URIs that are
textually distinct after this normalization may still be
equivalent.
Objects using the uri type may restrict the schemes that
they permit. For example, 'data:' and 'urn:' schemes
might not be appropriate.
A zero-length URI is not a valid URI. This can be used to
express 'URI absent' where required.
In the value set and its semantics, this type is equivalent
to the Uri SMIv2 textual convention defined in RFC 5017.";
reference
"RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
Group: Uniform Resource Identifiers (URIs), URLs,
and Uniform Resource Names (URNs): Clarifications
and Recommendations
RFC 5017: MIB Textual Conventions for Uniform Resource
Identifiers (URIs)";
}
typedef email-address {
type string {
pattern '.+@.+';
}
description
"The email-address type represents an internationalized
email address.
The email address format is defined by the addr-spec
ABNF rule in RFC 5322 section 3.4.1. This format has
been extended by RFC 6532 to support internationalized
email addresses. Implementations MUST support the
internationalization extensions of RFC 6532. Support
of the obsolete obs-local-part, obs-domain, and
obs-qtext parts of RFC 5322 is not required.
The domain part may use both A-labels and U-labels
(see RFC 5890). The canonical format of the domain part
uses lowercase characters and U-labels (RFC 5890) where
applicable.";
reference
"RFC 5322: Internet Message Format
RFC 5890: Internationalized Domain Names in Applications
(IDNA): Definitions and Document Framework
RFC 6531: SMTP Extension for Internationalized Email";
}
}

View File

@@ -1,725 +0,0 @@
module ietf-interfaces {
namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
prefix if;
import ietf-yang-types {
prefix yang;
}
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
WG Chair: Thomas Nadeau
<mailto:tnadeau@lucidvision.com>
WG Chair: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>
Editor: Martin Bjorklund
<mailto:mbj@tail-f.com>";
description
"This module contains a collection of YANG definitions for
managing network interfaces.
Copyright (c) 2014 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 7223; see
the RFC itself for full legal notices.";
revision 2014-05-08 {
description
"Initial revision.";
reference
"RFC 7223: A YANG Data Model for Interface Management";
}
/*
* Typedefs
*/
typedef interface-ref {
type leafref {
path "/if:interfaces/if:interface/if:name";
}
description
"This type is used by data models that need to reference
configured interfaces.";
}
typedef interface-state-ref {
type leafref {
path "/if:interfaces-state/if:interface/if:name";
}
description
"This type is used by data models that need to reference
the operationally present interfaces.";
}
/*
* Identities
*/
identity interface-type {
description
"Base identity from which specific interface types are
derived.";
}
/*
* Features
*/
feature arbitrary-names {
description
"This feature indicates that the device allows user-controlled
interfaces to be named arbitrarily.";
}
feature pre-provisioning {
description
"This feature indicates that the device supports
pre-provisioning of interface configuration, i.e., it is
possible to configure an interface whose physical interface
hardware is not present on the device.";
}
feature if-mib {
description
"This feature indicates that the device implements
the IF-MIB.";
reference
"RFC 2863: The Interfaces Group MIB";
}
/*
* Configuration data nodes
*/
container interfaces {
description
"Interface configuration parameters.";
list interface {
key "name";
description
"The list of configured interfaces on the device.
The operational state of an interface is available in the
/interfaces-state/interface list. If the configuration of a
system-controlled interface cannot be used by the system
(e.g., the interface hardware present does not match the
interface type), then the configuration is not applied to
the system-controlled interface shown in the
/interfaces-state/interface list. If the configuration
of a user-controlled interface cannot be used by the system,
the configured interface is not instantiated in the
/interfaces-state/interface list.";
leaf name {
type string;
description
"The name of the interface.
A device MAY restrict the allowed values for this leaf,
possibly depending on the type of the interface.
For system-controlled interfaces, this leaf is the
device-specific name of the interface. The 'config false'
list /interfaces-state/interface contains the currently
existing interfaces on the device.
If a client tries to create configuration for a
system-controlled interface that is not present in the
/interfaces-state/interface list, the server MAY reject
the request if the implementation does not support
pre-provisioning of interfaces or if the name refers to
an interface that can never exist in the system. A
NETCONF server MUST reply with an rpc-error with the
error-tag 'invalid-value' in this case.
If the device supports pre-provisioning of interface
configuration, the 'pre-provisioning' feature is
advertised.
If the device allows arbitrarily named user-controlled
interfaces, the 'arbitrary-names' feature is advertised.
When a configured user-controlled interface is created by
the system, it is instantiated with the same name in the
/interface-state/interface list.";
}
leaf description {
type string;
description
"A textual description of the interface.
A server implementation MAY map this leaf to the ifAlias
MIB object. Such an implementation needs to use some
mechanism to handle the differences in size and characters
allowed between this leaf and ifAlias. The definition of
such a mechanism is outside the scope of this document.
Since ifAlias is defined to be stored in non-volatile
storage, the MIB implementation MUST map ifAlias to the
value of 'description' in the persistently stored
datastore.
Specifically, if the device supports ':startup', when
ifAlias is read the device MUST return the value of
'description' in the 'startup' datastore, and when it is
written, it MUST be written to the 'running' and 'startup'
datastores. Note that it is up to the implementation to
decide whether to modify this single leaf in 'startup' or
perform an implicit copy-config from 'running' to
'startup'.
If the device does not support ':startup', ifAlias MUST
be mapped to the 'description' leaf in the 'running'
datastore.";
reference
"RFC 2863: The Interfaces Group MIB - ifAlias";
}
leaf type {
type identityref {
base interface-type;
}
mandatory true;
description
"The type of the interface.
When an interface entry is created, a server MAY
initialize the type leaf with a valid value, e.g., if it
is possible to derive the type from the name of the
interface.
If a client tries to set the type of an interface to a
value that can never be used by the system, e.g., if the
type is not supported or if the type does not match the
name of the interface, the server MUST reject the request.
A NETCONF server MUST reply with an rpc-error with the
error-tag 'invalid-value' in this case.";
reference
"RFC 2863: The Interfaces Group MIB - ifType";
}
leaf enabled {
type boolean;
default "true";
description
"This leaf contains the configured, desired state of the
interface.
Systems that implement the IF-MIB use the value of this
leaf in the 'running' datastore to set
IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
has been initialized, as described in RFC 2863.
Changes in this leaf in the 'running' datastore are
reflected in ifAdminStatus, but if ifAdminStatus is
changed over SNMP, this leaf is not affected.";
reference
"RFC 2863: The Interfaces Group MIB - ifAdminStatus";
}
leaf link-up-down-trap-enable {
if-feature if-mib;
type enumeration {
enum enabled {
value 1;
}
enum disabled {
value 2;
}
}
description
"Controls whether linkUp/linkDown SNMP notifications
should be generated for this interface.
If this node is not configured, the value 'enabled' is
operationally used by the server for interfaces that do
not operate on top of any other interface (i.e., there are
no 'lower-layer-if' entries), and 'disabled' otherwise.";
reference
"RFC 2863: The Interfaces Group MIB -
ifLinkUpDownTrapEnable";
}
}
}
/*
* Operational state data nodes
*/
container interfaces-state {
config false;
description
"Data nodes for the operational state of interfaces.";
list interface {
key "name";
description
"The list of interfaces on the device.
System-controlled interfaces created by the system are
always present in this list, whether they are configured or
not.";
leaf name {
type string;
description
"The name of the interface.
A server implementation MAY map this leaf to the ifName
MIB object. Such an implementation needs to use some
mechanism to handle the differences in size and characters
allowed between this leaf and ifName. The definition of
such a mechanism is outside the scope of this document.";
reference
"RFC 2863: The Interfaces Group MIB - ifName";
}
leaf type {
type identityref {
base interface-type;
}
mandatory true;
description
"The type of the interface.";
reference
"RFC 2863: The Interfaces Group MIB - ifType";
}
leaf admin-status {
if-feature if-mib;
type enumeration {
enum up {
value 1;
description
"Ready to pass packets.";
}
enum down {
value 2;
description
"Not ready to pass packets and not in some test mode.";
}
enum testing {
value 3;
description
"In some test mode.";
}
}
mandatory true;
description
"The desired state of the interface.
This leaf has the same read semantics as ifAdminStatus.";
reference
"RFC 2863: The Interfaces Group MIB - ifAdminStatus";
}
leaf oper-status {
type enumeration {
enum up {
value 1;
description
"Ready to pass packets.";
}
enum down {
value 2;
description
"The interface does not pass any packets.";
}
enum testing {
value 3;
description
"In some test mode. No operational packets can
be passed.";
}
enum unknown {
value 4;
description
"Status cannot be determined for some reason.";
}
enum dormant {
value 5;
description
"Waiting for some external event.";
}
enum not-present {
value 6;
description
"Some component (typically hardware) is missing.";
}
enum lower-layer-down {
value 7;
description
"Down due to state of lower-layer interface(s).";
}
}
mandatory true;
description
"The current operational state of the interface.
This leaf has the same semantics as ifOperStatus.";
reference
"RFC 2863: The Interfaces Group MIB - ifOperStatus";
}
leaf last-change {
type yang:date-and-time;
description
"The time the interface entered its current operational
state. If the current state was entered prior to the
last re-initialization of the local network management
subsystem, then this node is not present.";
reference
"RFC 2863: The Interfaces Group MIB - ifLastChange";
}
leaf if-index {
if-feature if-mib;
type int32 {
range "1..2147483647";
}
mandatory true;
description
"The ifIndex value for the ifEntry represented by this
interface.";
reference
"RFC 2863: The Interfaces Group MIB - ifIndex";
}
leaf phys-address {
type yang:phys-address;
description
"The interface's address at its protocol sub-layer. For
example, for an 802.x interface, this object normally
contains a Media Access Control (MAC) address. The
interface's media-specific modules must define the bit
and byte ordering and the format of the value of this
object. For interfaces that do not have such an address
(e.g., a serial line), this node is not present.";
reference
"RFC 2863: The Interfaces Group MIB - ifPhysAddress";
}
leaf-list higher-layer-if {
type interface-state-ref;
description
"A list of references to interfaces layered on top of this
interface.";
reference
"RFC 2863: The Interfaces Group MIB - ifStackTable";
}
leaf-list lower-layer-if {
type interface-state-ref;
description
"A list of references to interfaces layered underneath this
interface.";
reference
"RFC 2863: The Interfaces Group MIB - ifStackTable";
}
leaf speed {
type yang:gauge64;
units "bits/second";
description
"An estimate of the interface's current bandwidth in bits
per second. For interfaces that do not vary in
bandwidth or for those where no accurate estimation can
be made, this node should contain the nominal bandwidth.
For interfaces that have no concept of bandwidth, this
node is not present.";
reference
"RFC 2863: The Interfaces Group MIB -
ifSpeed, ifHighSpeed";
}
container statistics {
description
"A collection of interface-related statistics objects.";
leaf discontinuity-time {
type yang:date-and-time;
mandatory true;
description
"The time on the most recent occasion at which any one or
more of this interface's counters suffered a
discontinuity. If no such discontinuities have occurred
since the last re-initialization of the local management
subsystem, then this node contains the time the local
management subsystem re-initialized itself.";
}
leaf in-octets {
type yang:counter64;
description
"The total number of octets received on the interface,
including framing characters.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifHCInOctets";
}
leaf in-unicast-pkts {
type yang:counter64;
description
"The number of packets, delivered by this sub-layer to a
higher (sub-)layer, that were not addressed to a
multicast or broadcast address at this sub-layer.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
}
leaf in-broadcast-pkts {
type yang:counter64;
description
"The number of packets, delivered by this sub-layer to a
higher (sub-)layer, that were addressed to a broadcast
address at this sub-layer.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB -
ifHCInBroadcastPkts";
}
leaf in-multicast-pkts {
type yang:counter64;
description
"The number of packets, delivered by this sub-layer to a
higher (sub-)layer, that were addressed to a multicast
address at this sub-layer. For a MAC-layer protocol,
this includes both Group and Functional addresses.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB -
ifHCInMulticastPkts";
}
leaf in-discards {
type yang:counter32;
description
"The number of inbound packets that were chosen to be
discarded even though no errors had been detected to
prevent their being deliverable to a higher-layer
protocol. One possible reason for discarding such a
packet could be to free up buffer space.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifInDiscards";
}
leaf in-errors {
type yang:counter32;
description
"For packet-oriented interfaces, the number of inbound
packets that contained errors preventing them from being
deliverable to a higher-layer protocol. For character-
oriented or fixed-length interfaces, the number of
inbound transmission units that contained errors
preventing them from being deliverable to a higher-layer
protocol.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifInErrors";
}
leaf in-unknown-protos {
type yang:counter32;
description
"For packet-oriented interfaces, the number of packets
received via the interface that were discarded because
of an unknown or unsupported protocol. For
character-oriented or fixed-length interfaces that
support protocol multiplexing, the number of
transmission units received via the interface that were
discarded because of an unknown or unsupported protocol.
For any interface that does not support protocol
multiplexing, this counter is not present.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
}
leaf out-octets {
type yang:counter64;
description
"The total number of octets transmitted out of the
interface, including framing characters.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
}
leaf out-unicast-pkts {
type yang:counter64;
description
"The total number of packets that higher-level protocols
requested be transmitted, and that were not addressed
to a multicast or broadcast address at this sub-layer,
including those that were discarded or not sent.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
}
leaf out-broadcast-pkts {
type yang:counter64;
description
"The total number of packets that higher-level protocols
requested be transmitted, and that were addressed to a
broadcast address at this sub-layer, including those
that were discarded or not sent.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB -
ifHCOutBroadcastPkts";
}
leaf out-multicast-pkts {
type yang:counter64;
description
"The total number of packets that higher-level protocols
requested be transmitted, and that were addressed to a
multicast address at this sub-layer, including those
that were discarded or not sent. For a MAC-layer
protocol, this includes both Group and Functional
addresses.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB -
ifHCOutMulticastPkts";
}
leaf out-discards {
type yang:counter32;
description
"The number of outbound packets that were chosen to be
discarded even though no errors had been detected to
prevent their being transmitted. One possible reason
for discarding such a packet could be to free up buffer
space.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifOutDiscards";
}
leaf out-errors {
type yang:counter32;
description
"For packet-oriented interfaces, the number of outbound
packets that could not be transmitted because of errors.
For character-oriented or fixed-length interfaces, the
number of outbound transmission units that could not be
transmitted because of errors.
Discontinuities in the value of this counter can occur
at re-initialization of the management system, and at
other times as indicated by the value of
'discontinuity-time'.";
reference
"RFC 2863: The Interfaces Group MIB - ifOutErrors";
}
}
}
}
}

View File

@@ -1,480 +0,0 @@
module ietf-yang-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
prefix "yang";
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
WG Chair: David Kessens
<mailto:david.kessens@nsn.com>
WG Chair: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>
Editor: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>";
description
"This module contains a collection of generally useful derived
YANG data types.
Copyright (c) 2013 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 6991; see
the RFC itself for full legal notices.";
revision 2013-07-15 {
description
"This revision adds the following new data types:
- yang-identifier
- hex-string
- uuid
- dotted-quad";
reference
"RFC 6991: Common YANG Data Types";
}
revision 2010-09-24 {
description
"Initial revision.";
reference
"RFC 6021: Common YANG Data Types";
}
/*** collection of counter and gauge types ***/
typedef counter32 {
type uint32;
description
"The counter32 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter32 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter32 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter32.
In the value set and its semantics, this type is equivalent
to the Counter32 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter32 {
type yang:counter32;
default "0";
description
"The zero-based-counter32 type represents a counter32
that has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter32 textual convention of the SMIv2.";
reference
"RFC 4502: Remote Network Monitoring Management Information
Base Version 2";
}
typedef counter64 {
type uint64;
description
"The counter64 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter64 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter64 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter64.
In the value set and its semantics, this type is equivalent
to the Counter64 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter64 {
type yang:counter64;
default "0";
description
"The zero-based-counter64 type represents a counter64 that
has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter64 textual convention of the SMIv2.";
reference
"RFC 2856: Textual Conventions for Additional High Capacity
Data Types";
}
typedef gauge32 {
type uint32;
description
"The gauge32 type represents a non-negative integer, which
may increase or decrease, but shall never exceed a maximum
value, nor fall below a minimum value. The maximum value
cannot be greater than 2^32-1 (4294967295 decimal), and
the minimum value cannot be smaller than 0. The value of
a gauge32 has its maximum value whenever the information
being modeled is greater than or equal to its maximum
value, and has its minimum value whenever the information
being modeled is smaller than or equal to its minimum value.
If the information being modeled subsequently decreases
below (increases above) the maximum (minimum) value, the
gauge32 also decreases (increases).
In the value set and its semantics, this type is equivalent
to the Gauge32 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef gauge64 {
type uint64;
description
"The gauge64 type represents a non-negative integer, which
may increase or decrease, but shall never exceed a maximum
value, nor fall below a minimum value. The maximum value
cannot be greater than 2^64-1 (18446744073709551615), and
the minimum value cannot be smaller than 0. The value of
a gauge64 has its maximum value whenever the information
being modeled is greater than or equal to its maximum
value, and has its minimum value whenever the information
being modeled is smaller than or equal to its minimum value.
If the information being modeled subsequently decreases
below (increases above) the maximum (minimum) value, the
gauge64 also decreases (increases).
In the value set and its semantics, this type is equivalent
to the CounterBasedGauge64 SMIv2 textual convention defined
in RFC 2856";
reference
"RFC 2856: Textual Conventions for Additional High Capacity
Data Types";
}
/*** collection of identifier-related types ***/
typedef object-identifier {
type string {
pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
+ '(\.(0|([1-9]\d*)))*';
}
description
"The object-identifier type represents administratively
assigned names in a registration-hierarchical-name tree.
Values of this type are denoted as a sequence of numerical
non-negative sub-identifier values. Each sub-identifier
value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
are separated by single dots and without any intermediate
whitespace.
The ASN.1 standard restricts the value space of the first
sub-identifier to 0, 1, or 2. Furthermore, the value space
of the second sub-identifier is restricted to the range
0 to 39 if the first sub-identifier is 0 or 1. Finally,
the ASN.1 standard requires that an object identifier
has always at least two sub-identifiers. The pattern
captures these restrictions.
Although the number of sub-identifiers is not limited,
module designers should realize that there may be
implementations that stick with the SMIv2 limit of 128
sub-identifiers.
This type is a superset of the SMIv2 OBJECT IDENTIFIER type
since it is not restricted to 128 sub-identifiers. Hence,
this type SHOULD NOT be used to represent the SMIv2 OBJECT
IDENTIFIER type; the object-identifier-128 type SHOULD be
used instead.";
reference
"ISO9834-1: Information technology -- Open Systems
Interconnection -- Procedures for the operation of OSI
Registration Authorities: General procedures and top
arcs of the ASN.1 Object Identifier tree";
}
typedef object-identifier-128 {
type object-identifier {
pattern '\d*(\.\d*){1,127}';
}
description
"This type represents object-identifiers restricted to 128
sub-identifiers.
In the value set and its semantics, this type is equivalent
to the OBJECT IDENTIFIER type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef yang-identifier {
type string {
length "1..max";
pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
}
description
"A YANG identifier string as defined by the 'identifier'
rule in Section 12 of RFC 6020. An identifier must
start with an alphabetic character or an underscore
followed by an arbitrary sequence of alphabetic or
numeric characters, underscores, hyphens, or dots.
A YANG identifier MUST NOT start with any possible
combination of the lowercase or uppercase character
sequence 'xml'.";
reference
"RFC 6020: YANG - A Data Modeling Language for the Network
Configuration Protocol (NETCONF)";
}
/*** collection of types related to date and time***/
typedef date-and-time {
type string {
pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
+ '(Z|[\+\-]\d{2}:\d{2})';
}
description
"The date-and-time type is a profile of the ISO 8601
standard for representation of dates and times using the
Gregorian calendar. The profile is defined by the
date-time production in Section 5.6 of RFC 3339.
The date-and-time type is compatible with the dateTime XML
schema type with the following notable exceptions:
(a) The date-and-time type does not allow negative years.
(b) The date-and-time time-offset -00:00 indicates an unknown
time zone (see RFC 3339) while -00:00 and +00:00 and Z
all represent the same time zone in dateTime.
(c) The canonical format (see below) of data-and-time values
differs from the canonical format used by the dateTime XML
schema type, which requires all times to be in UTC using
the time-offset 'Z'.
This type is not equivalent to the DateAndTime textual
convention of the SMIv2 since RFC 3339 uses a different
separator between full-date and full-time and provides
higher resolution of time-secfrac.
The canonical format for date-and-time values with a known time
zone uses a numeric time zone offset that is calculated using
the device's configured known offset to UTC time. A change of
the device's offset to UTC time will cause date-and-time values
to change accordingly. Such changes might happen periodically
in case a server follows automatically daylight saving time
(DST) time zone offset changes. The canonical format for
date-and-time values with an unknown time zone (usually
referring to the notion of local time) uses the time-offset
-00:00.";
reference
"RFC 3339: Date and Time on the Internet: Timestamps
RFC 2579: Textual Conventions for SMIv2
XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
}
typedef timeticks {
type uint32;
description
"The timeticks type represents a non-negative integer that
represents the time, modulo 2^32 (4294967296 decimal), in
hundredths of a second between two epochs. When a schema
node is defined that uses this type, the description of
the schema node identifies both of the reference epochs.
In the value set and its semantics, this type is equivalent
to the TimeTicks type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef timestamp {
type yang:timeticks;
description
"The timestamp type represents the value of an associated
timeticks schema node at which a specific occurrence
happened. The specific occurrence must be defined in the
description of any schema node defined using this type. When
the specific occurrence occurred prior to the last time the
associated timeticks attribute was zero, then the timestamp
value is zero. Note that this requires all timestamp values
to be reset to zero when the value of the associated timeticks
attribute reaches 497+ days and wraps around to zero.
The associated timeticks schema node must be specified
in the description of any schema node using this type.
In the value set and its semantics, this type is equivalent
to the TimeStamp textual convention of the SMIv2.";
reference
"RFC 2579: Textual Conventions for SMIv2";
}
/*** collection of generic address types ***/
typedef phys-address {
type string {
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
}
description
"Represents media- or physical-level addresses represented
as a sequence octets, each octet represented by two hexadecimal
numbers. Octets are separated by colons. The canonical
representation uses lowercase characters.
In the value set and its semantics, this type is equivalent
to the PhysAddress textual convention of the SMIv2.";
reference
"RFC 2579: Textual Conventions for SMIv2";
}
typedef mac-address {
type string {
pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
}
description
"The mac-address type represents an IEEE 802 MAC address.
The canonical representation uses lowercase characters.
In the value set and its semantics, this type is equivalent
to the MacAddress textual convention of the SMIv2.";
reference
"IEEE 802: IEEE Standard for Local and Metropolitan Area
Networks: Overview and Architecture
RFC 2579: Textual Conventions for SMIv2";
}
/*** collection of XML-specific types ***/
typedef xpath1.0 {
type string;
description
"This type represents an XPATH 1.0 expression.
When a schema node is defined that uses this type, the
description of the schema node MUST specify the XPath
context in which the XPath expression is evaluated.";
reference
"XPATH: XML Path Language (XPath) Version 1.0";
}
/*** collection of string types ***/
typedef hex-string {
type string {
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
}
description
"A hexadecimal string with octets represented as hex digits
separated by colons. The canonical representation uses
lowercase characters.";
}
typedef uuid {
type string {
pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
+ '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
}
description
"A Universally Unique IDentifier in the string representation
defined in RFC 4122. The canonical representation uses
lowercase characters.
The following is an example of a UUID in string representation:
f81d4fae-7dec-11d0-a765-00a0c91e6bf6
";
reference
"RFC 4122: A Universally Unique IDentifier (UUID) URN
Namespace";
}
typedef dotted-quad {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
}
description
"An unsigned 32-bit number expressed in the dotted-quad
notation, i.e., four octets written as decimal numbers
and separated with the '.' (full stop) character.";
}
}

View File

@@ -1,935 +0,0 @@
module openconfig-acl {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/acl";
prefix "oc-acl";
import openconfig-packet-match { prefix oc-match; }
import openconfig-interfaces { prefix oc-if; }
import openconfig-yang-types { prefix oc-yang; }
import openconfig-extensions { prefix oc-ext; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module defines configuration and operational state
data for network access control lists (i.e., filters, rules,
etc.). ACLs are organized into ACL sets, with each set
containing one or more ACL entries. ACL sets are identified
by a unique name, while each entry within a set is assigned
a sequence-id that determines the order in which the ACL
rules are applied to a packet. Note that ACLs are evaluated
in ascending order based on the sequence-id (low to high).
Individual ACL rules specify match criteria based on fields in
the packet, along with an action that defines how matching
packets should be handled. Entries have a type that indicates
the type of match criteria, e.g., MAC layer, IPv4, IPv6, etc.";
oc-ext:openconfig-version "1.3.3";
revision "2023-02-06" {
description
"Add clarifying comments on use of interface-ref.";
reference "1.3.3";
}
revision "2023-01-29" {
description
"Update sequence-id reference to allow model to be re-used
outside of ACL context.";
reference "1.3.2";
}
revision "2022-12-20" {
description
"Remove unused openconfig-inet-types import";
reference "1.3.1";
}
revision "2022-06-01" {
description
"Add the management of prefix lists
that can be used in matches";
reference "1.3.0";
}
revision "2022-01-14" {
description
"Fix when statements for MIXED mode ACLs";
reference "1.2.2";
}
revision "2021-06-16" {
description
"Remove trailing whitespace";
reference "1.2.1";
}
revision "2021-03-17" {
description
"Add MPLS filter Support.";
reference "1.2.0";
}
revision "2019-11-27" {
description
"Fix xpaths in when statements.";
reference "1.1.1";
}
revision "2019-10-25" {
description
"Update when statements.";
reference "1.1.0";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "1.0.2";
}
revision "2018-04-24" {
description
"Clarified order of ACL evaluation";
reference "1.0.1";
}
revision "2017-05-26" {
description
"Separated ACL entries by type";
reference "1.0.0";
}
revision "2016-08-08" {
description
"OpenConfig public release";
reference "0.2.0";
}
revision "2016-01-22" {
description
"Initial revision";
reference "TBD";
}
// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
identity ACL_TYPE {
description
"Base identity for types of ACL sets";
}
identity ACL_IPV4 {
base ACL_TYPE;
description
"IP-layer ACLs with IPv4 addresses";
}
identity ACL_IPV6 {
base ACL_TYPE;
description
"IP-layer ACLs with IPv6 addresses";
}
identity ACL_L2 {
base ACL_TYPE;
description
"MAC-layer ACLs";
}
identity ACL_MIXED {
base ACL_TYPE;
description
"Mixed-mode ACL that specifies L2 and L3 protocol
fields. This ACL type is not implemented by many
routing/switching devices.";
}
identity ACL_MPLS {
base ACL_TYPE;
description
"An ACL that matches on fields from the MPLS header.";
}
// ACL action type
identity FORWARDING_ACTION {
description
"Base identity for actions in the forwarding category";
}
identity ACCEPT {
base FORWARDING_ACTION;
description
"Accept the packet";
}
identity DROP {
base FORWARDING_ACTION;
description
"Drop packet without sending any ICMP error message";
}
identity REJECT {
base FORWARDING_ACTION;
description
"Drop the packet and send an ICMP error message to the source";
}
identity LOG_ACTION {
description
"Base identity for defining the destination for logging
actions";
}
identity LOG_SYSLOG {
base LOG_ACTION;
description
"Log the packet in Syslog";
}
identity LOG_NONE {
base LOG_ACTION;
description
"No logging";
}
identity ACL_COUNTER_CAPABILITY {
description
"Base identity for system to indicate how it is able to report
counters";
}
identity INTERFACE_ONLY {
base ACL_COUNTER_CAPABILITY;
description
"ACL counters are available and reported only per interface";
}
identity AGGREGATE_ONLY {
base ACL_COUNTER_CAPABILITY;
description
"ACL counters are aggregated over all interfaces, and reported
only per ACL entry";
}
identity INTERFACE_AGGREGATE {
base ACL_COUNTER_CAPABILITY;
description
"ACL counters are reported per interface, and also aggregated
and reported per ACL entry.";
}
// grouping statements
// input interface
grouping input-interface-config {
description
"Config of interface";
}
grouping input-interface-state {
description
"State information of interface";
}
grouping input-interface-top {
description
"Input interface top level container";
container input-interface {
description
"Input interface container. The interface is resolved based
on the interface and subinterface leaves of the interface-ref
container, which are references to entries in the /interfaces
list.";
container config {
description
"Config data";
uses input-interface-config;
}
container state {
config false;
description
"State information";
uses input-interface-config;
uses input-interface-state;
}
uses oc-if:interface-ref;
}
}
// Action Type
grouping action-config {
description
"Config of action type";
leaf forwarding-action {
type identityref {
base FORWARDING_ACTION;
}
mandatory true;
description
"Specifies the forwarding action. One forwarding action
must be specified for each ACL entry";
}
leaf log-action {
type identityref {
base LOG_ACTION;
}
default LOG_NONE;
description
"Specifies the log action and destination for
matched packets. The default is not to log the
packet.";
}
}
grouping action-state {
description
"State information of action type";
}
grouping action-top {
description
"ACL action type top level container";
container actions {
description
"Enclosing container for list of ACL actions associated
with an entry";
container config {
description
"Config data for ACL actions";
uses action-config;
}
container state {
config false;
description
"State information for ACL actions";
uses action-config;
uses action-state;
}
}
}
grouping acl-counters-state {
description
"Common grouping for ACL counters";
leaf matched-packets {
type oc-yang:counter64;
description
"Count of the number of packets matching the current ACL
entry.
An implementation should provide this counter on a
per-interface per-ACL-entry if possible.
If an implementation only supports ACL counters per entry
(i.e., not broken out per interface), then the value
should be equal to the aggregate count across all interfaces.
An implementation that provides counters per entry per
interface is not required to also provide an aggregate count,
e.g., per entry -- the user is expected to be able implement
the required aggregation if such a count is needed.";
}
leaf matched-octets {
type oc-yang:counter64;
description
"Count of the number of octets (bytes) matching the current
ACL entry.
An implementation should provide this counter on a
per-interface per-ACL-entry if possible.
If an implementation only supports ACL counters per entry
(i.e., not broken out per interface), then the value
should be equal to the aggregate count across all interfaces.
An implementation that provides counters per entry per
interface is not required to also provide an aggregate count,
e.g., per entry -- the user is expected to be able implement
the required aggregation if such a count is needed.";
}
}
// Access List Entries
grouping access-list-entries-config {
description
"Access List Entries (ACE) config.";
leaf sequence-id {
type uint32;
description
"The sequence id determines the order in which ACL entries
are applied. The sequence id must be unique for each entry
in an ACL set. Target devices should apply the ACL entry
rules in ascending order determined by sequence id (low to
high), rather than the relying only on order in the list.";
}
leaf description {
type string;
description
"A user-defined description, or comment, for this Access List
Entry.";
}
}
grouping access-list-entries-state {
description
"Access List Entries state.";
uses acl-counters-state;
}
grouping access-list-entries-top {
description
"Access list entries to level container";
container acl-entries {
description
"Access list entries container";
list acl-entry {
key "sequence-id";
description
"List of ACL entries comprising an ACL set";
leaf sequence-id {
type leafref {
path "../config/sequence-id";
}
description
"references the list key";
}
container config {
description
"Access list entries config";
uses access-list-entries-config;
}
container state {
config false;
description
"State information for ACL entries";
uses access-list-entries-config;
uses access-list-entries-state;
}
uses oc-match:ethernet-header-top {
when "../../config/type='ACL_L2' or " +
"../../config/type='ACL_MIXED'" {
description
"MAC-layer fields are valid when the ACL type is L2 or
MIXED";
}
}
uses oc-match:ipv4-protocol-fields-top {
when "../../config/type='ACL_IPV4' or " +
"../../config/type='ACL_MIXED'" {
description
"IPv4-layer fields are valid when the ACL type is
IPv4 or MIXED";
}
}
uses oc-match:mpls-header-top {
when "../../config/type='ACL_MPLS' or " +
"../../config/type='ACL_MIXED'" {
description
"MPLS-layer fields are valid when the ACL type is
MPLS or MIXED";
}
}
uses oc-match:ipv6-protocol-fields-top {
when "../../config/type='ACL_IPV6' or " +
"../../config/type='ACL_MIXED'" {
description
"IPv6-layer fields are valid when the ACL type is
IPv6 or MIXED";
}
}
uses oc-match:transport-fields-top {
when "../../config/type='ACL_IPV6' or " +
"../../config/type='ACL_IPV4' or " +
"../../config/type='ACL_MIXED'" {
description
"Transport-layer fields are valid when specifying
L3 or MIXED ACL types";
}
}
uses input-interface-top;
uses action-top;
}
}
}
grouping acl-set-config {
description
"Access Control List config";
leaf name {
type string;
description
"The name of the access-list set";
}
leaf type {
type identityref {
base ACL_TYPE;
}
description
"The type determines the fields allowed in the ACL entries
belonging to the ACL set (e.g., IPv4, IPv6, etc.)";
}
leaf description {
type string;
description
"Description, or comment, for the ACL set";
}
}
grouping acl-set-state {
description
"Access Control List state";
}
grouping acl-set-top {
description
"Access list entries variables top level container";
container acl-sets {
description
"Access list entries variables enclosing container";
list acl-set {
key "name type";
description
"List of ACL sets, each comprising of a list of ACL
entries";
leaf name {
type leafref {
path "../config/name";
}
description
"Reference to the name list key";
}
leaf type {
type leafref {
path "../config/type";
}
description
"Reference to the type list key";
}
container config {
description
"Access list config";
uses acl-set-config;
}
container state {
config false;
description
"Access list state information";
uses acl-set-config;
uses acl-set-state;
}
uses access-list-entries-top;
}
}
}
grouping interface-acl-entries-config {
description
"Configuration data for per-interface ACLs";
}
grouping interface-acl-entries-state {
description
"Operational state data for per-interface ACL entries";
leaf sequence-id {
type leafref {
path "/oc-acl:acl/oc-acl:acl-sets/" +
"oc-acl:acl-set[oc-acl:name=current()/../../../../set-name]" +
"[oc-acl:type=current()/../../../../type]/" +
"oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:sequence-id";
}
description
"Reference to an entry in the ACL set applied to an
interface";
}
uses acl-counters-state;
}
grouping interface-acl-entries-top {
description
"Top-level grouping for per-interface ACL entries";
container acl-entries {
config false;
description
"Enclosing container for list of references to ACLs";
list acl-entry {
key "sequence-id";
description
"List of ACL entries assigned to an interface";
leaf sequence-id {
type leafref {
path "../state/sequence-id";
}
description
"Reference to per-interface acl entry key";
}
// no config container since the enclosing container is
// read-only
container state {
config false;
description
"Operational state data for per-interface ACL entries";
uses interface-acl-entries-config;
uses interface-acl-entries-state;
}
}
}
}
grouping interface-ingress-acl-config {
description
"Configuration data for per-interface ingress ACLs";
leaf set-name {
type leafref {
path "../../../../../../acl-sets/acl-set/config/name";
}
description
"Reference to the ACL set name applied on ingress";
}
leaf type {
type leafref {
path "../../../../../../acl-sets/acl-set[name=current()/../set-name]" +
"/config/type";
}
description
"Reference to the ACL set type applied on ingress";
}
}
grouping interface-ingress-acl-state {
description
"Operational state data for the per-interface ingress ACL";
}
grouping interface-ingress-acl-top {
description
"Top-level grouping for per-interface ingress ACL data";
container ingress-acl-sets {
description
"Enclosing container the list of ingress ACLs on the
interface";
list ingress-acl-set {
key "set-name type";
description
"List of ingress ACLs on the interface";
leaf set-name {
type leafref {
path "../config/set-name";
}
description
"Reference to set name list key";
}
leaf type {
type leafref {
path "../config/type";
}
description
"Reference to type list key";
}
container config {
description
"Configuration data ";
uses interface-ingress-acl-config;
}
container state {
config false;
description
"Operational state data for interface ingress ACLs";
uses interface-ingress-acl-config;
uses interface-ingress-acl-state;
}
uses interface-acl-entries-top;
}
}
}
grouping interface-egress-acl-config {
description
"Configuration data for per-interface egress ACLs";
leaf set-name {
type leafref {
path "../../../../../../acl-sets/acl-set/config/name";
}
description
"Reference to the ACL set name applied on egress";
}
leaf type {
type leafref {
path "../../../../../../acl-sets/acl-set[name=current()/../set-name]" +
"/config/type";
}
description
"Reference to the ACL set type applied on egress.";
}
}
grouping interface-egress-acl-state {
description
"Operational state data for the per-interface egress ACL";
}
grouping interface-egress-acl-top {
description
"Top-level grouping for per-interface egress ACL data";
container egress-acl-sets {
description
"Enclosing container the list of egress ACLs on the
interface";
list egress-acl-set {
key "set-name type";
description
"List of egress ACLs on the interface";
leaf set-name {
type leafref {
path "../config/set-name";
}
description
"Reference to set name list key";
}
leaf type {
type leafref {
path "../config/type";
}
description
"Reference to type list key";
}
container config {
description
"Configuration data ";
uses interface-egress-acl-config;
}
container state {
config false;
description
"Operational state data for interface egress ACLs";
uses interface-egress-acl-config;
uses interface-egress-acl-state;
}
uses interface-acl-entries-top;
}
}
}
grouping acl-interfaces-config {
description
"Configuration data for interface references";
leaf id {
type oc-if:interface-id;
description
"User-defined identifier for the interface -- a common
convention could be '<if name>.<subif index>'";
}
}
grouping acl-interfaces-state {
description
"Operational state data for interface references";
}
grouping acl-interfaces-top {
description
"Top-level grouping for interface-specific ACL data";
container interfaces {
description
"Enclosing container for the list of interfaces on which
ACLs are set";
list interface {
key "id";
description
"List of interfaces on which ACLs are set. The interface is resolved
based on the interface and subinterface leaves of the interface-ref
container, which are references to entries in the /interfaces
list. The key of the list is an arbitrary value that the
implementation should not use to resolve an interface name.";
leaf id {
type leafref {
path "../config/id";
}
description
"Reference to the interface id list key";
}
container config {
description
"Configuration for ACL per-interface data";
uses acl-interfaces-config;
}
container state {
config false;
description
"Operational state for ACL per-interface data";
uses acl-interfaces-config;
uses acl-interfaces-state;
}
uses oc-if:interface-ref;
uses interface-ingress-acl-top;
uses interface-egress-acl-top;
}
}
}
grouping acl-config {
description
"Global configuration data for ACLs";
}
grouping acl-state {
description
"Global operational state data for ACLs";
leaf counter-capability {
type identityref {
base ACL_COUNTER_CAPABILITY;
}
description
"System reported indication of how ACL counters are reported
by the target";
}
}
grouping acl-top {
description
"Top level grouping for ACL data and structure";
container acl {
description
"Top level enclosing container for ACL model config
and operational state data";
container config {
description
"Global config data for ACLs";
uses acl-config;
}
container state {
config false;
description
"Global operational state data for ACLs";
uses acl-config;
uses acl-state;
}
uses acl-set-top;
uses acl-interfaces-top;
}
}
// data definition statements
uses acl-top;
// augment statements
}

View File

@@ -1,227 +0,0 @@
module openconfig-defined-sets {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/defined-sets";
prefix "oc-sets";
import openconfig-extensions { prefix oc-ext; }
import openconfig-inet-types { prefix oc-inet; }
import openconfig-packet-match-types { prefix oc-pkt-match-types; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module defines configuration and operational state
data for defined sets (sets of IPv4 prefixes, sets of
IPv6 prefixes, sets of ports, etc). These sets are used,
for example, in network access control lists (i.e., filters,
rules, etc.) in the matching fields.";
oc-ext:openconfig-version "1.0.0";
revision "2022-12-14" {
description
"Initial version of the defined set model";
reference "1.0.0";
}
// OpenConfig specific extensions for module metadata.
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
grouping ipv4-prefix-sets-config {
description "Configuration parameters of IPv4 prefix sets.";
leaf name {
type string;
description
"A user defined name of the IPv4 prefix set.";
}
leaf description {
type string;
description "A user defined IPv4 prefix set description.";
}
leaf-list prefix {
type oc-inet:ipv4-prefix;
description
"A user defined list of IPv4 prefixes to be used in match
conditions. Each entry is a IPv4 + mask combination.";
}
}
grouping ipv6-prefix-sets-config {
description "Configuration parameters of IPv6 prefix sets.";
leaf name {
type string;
description
"Name of the IPv6 prefix set.";
}
leaf description {
type string;
description
"A user defined IPv6 prefix set description.";
}
leaf-list prefix {
type oc-inet:ipv6-prefix;
description
"A user defined list of IPv6 prefixes to be used in match
conditions. Each entry is a IPv6 + mask combination.";
}
}
grouping port-sets-config {
description
"Configuration parameters of port sets.";
leaf name {
type string;
description
"A user defined name of the port set.";
}
leaf description {
type string;
description
"A user defined description for the port set";
}
leaf-list port {
type oc-pkt-match-types:port-num-range;
description
"A user defined set of ports to be
used in the match conditions.";
}
}
grouping defined-sets {
description "Configuration of Defined Sets.";
container ipv4-prefix-sets {
description
"Container to hold the list of IPv4 prefix sets.";
list ipv4-prefix-set {
key "name";
description
"List of IPv4 prefix sets.";
leaf name {
type leafref {
path "../config/name";
}
description
"Reference to the name of the IPv4 prefix set.";
}
container config {
description
"Configuration data for IPv4 prefix sets.";
uses ipv4-prefix-sets-config;
}
container state {
config false;
description
"State data for IPv4 prefix sets.";
uses ipv4-prefix-sets-config;
}
}
}
container ipv6-prefix-sets {
description
"Container to hold the list of IPv4 prefix sets.";
list ipv6-prefix-set {
key "name";
description "List of IPv6 prefix sets. Each defined set
is uniquely identified by a name";
leaf name {
type leafref {
path "../config/name";
}
description
"Reference to the name of the IPv6 prefix set.";
}
container config {
description
"Configuration data for IPv6 prefix sets.";
uses ipv6-prefix-sets-config;
}
container state {
config false;
description
"State data for prefix lists.";
uses ipv6-prefix-sets-config;
}
}
}
container port-sets {
description
"Container to hold the list of port sets.";
list port-set {
key "name";
description
"List of port sets. Each por set is uniquely
identified by its name";
leaf name {
type leafref {
path "../config/name";
}
description
"Name of the port set. The name is used to
reference the set in match conditions.";
}
container config {
description
"Configuration data for port lists.";
uses port-sets-config;
}
container state {
config false;
description
"State data for port lists.";
uses port-sets-config;
}
}
}
}
grouping defined-sets-top {
description
"Top level grouping for defined-sets";
container defined-sets {
description
"Top level enclosing container for defined-set model
config and operational state data.";
uses defined-sets;
}
}
uses defined-sets-top;
}

View File

@@ -1,229 +0,0 @@
module openconfig-extensions {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/openconfig-ext";
prefix "oc-ext";
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module provides extensions to the YANG language to allow
OpenConfig specific functionality and meta-data to be defined.";
oc-ext:openconfig-version "0.6.0";
revision "2024-09-19" {
description
"Add telemetry-atomic-exempt annotation.";
reference "0.6.0";
}
revision "2022-10-05" {
description
"Add missing version statement.";
reference "0.5.1";
}
revision "2020-06-16" {
description
"Add extension for POSIX pattern statements.";
reference "0.5.0";
}
revision "2018-10-17" {
description
"Add extension for regular expression type.";
reference "0.4.0";
}
revision "2017-04-11" {
description
"rename password type to 'hashed' and clarify description";
reference "0.3.0";
}
revision "2017-01-29" {
description
"Added extension for annotating encrypted values.";
reference "0.2.0";
}
revision "2015-10-09" {
description
"Initial OpenConfig public release";
reference "0.1.0";
}
// extension statements
extension openconfig-version {
argument "semver" {
yin-element false;
}
description
"The OpenConfig version number for the module. This is
expressed as a semantic version number of the form:
x.y.z
where:
* x corresponds to the major version,
* y corresponds to a minor version,
* z corresponds to a patch version.
This version corresponds to the model file within which it is
defined, and does not cover the whole set of OpenConfig models.
Individual YANG modules are versioned independently -- the
semantic version is generally incremented only when there is a
change in the corresponding file. Submodules should always
have the same semantic version as their parent modules.
A major version number of 0 indicates that this model is still
in development (whether within OpenConfig or with industry
partners), and is potentially subject to change.
Following a release of major version 1, all modules will
increment major revision number where backwards incompatible
changes to the model are made.
The minor version is changed when features are added to the
model that do not impact current clients use of the model.
The patch-level version is incremented when non-feature changes
(such as bugfixes or clarifications to human-readable
descriptions that do not impact model functionality) are made
that maintain backwards compatibility.
The version number is stored in the module meta-data.";
}
extension openconfig-hashed-value {
description
"This extension provides an annotation on schema nodes to
indicate that the corresponding value should be stored and
reported in hashed form.
Hash algorithms are by definition not reversible. Clients
reading the configuration or applied configuration for the node
should expect to receive only the hashed value. Values written
in cleartext will be hashed. This annotation may be used on
nodes such as secure passwords in which the device never reports
a cleartext value, even if the input is provided as cleartext.";
}
extension regexp-posix {
description
"This extension indicates that the regular expressions included
within the YANG module specified are conformant with the POSIX
regular expression format rather than the W3C standard that is
specified by RFC6020 and RFC7950.";
}
extension posix-pattern {
argument "pattern" {
yin-element false;
}
description
"Provides a POSIX ERE regular expression pattern statement as an
alternative to YANG regular expresssions based on XML Schema Datatypes.
It is used the same way as the standard YANG pattern statement defined in
RFC6020 and RFC7950, but takes an argument that is a POSIX ERE regular
expression string.";
reference
"POSIX Extended Regular Expressions (ERE) Specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04";
}
extension telemetry-on-change {
description
"The telemetry-on-change annotation is specified in the context
of a particular subtree (container, or list) or leaf within the
YANG schema. Where specified, it indicates that the value stored
by the nodes within the context change their value only in response
to an event occurring. The event may be local to the target, for
example - a configuration change, or external - such as the failure
of a link.
When a telemetry subscription allows the target to determine whether
to export the value of a leaf in a periodic or event-based fashion
(e.g., TARGET_DEFINED mode in gNMI), leaves marked as
telemetry-on-change should only be exported when they change,
i.e., event-based.";
}
extension telemetry-atomic {
description
"The telemetry-atomic annotation is specified in the context of
a subtree (container, or list), and indicates that all nodes
within the subtree are always updated together within the data
model. For example, all elements under the subtree may be updated
as a result of a new alarm being raised, or the arrival of a new
protocol message.
Transport protocols may use the atomic specification to determine
optimisations for sending or storing the corresponding data.";
}
extension telemetry-atomic-exempt {
description
"The telemetry-atomic-exempt annotation is specified in the context
of a node or subtree (container, or list), and indicates that the node
or all nodes within the subtree are not always updated together within
the data model of the parent tree. All elements under the subtree may
not be updated as a result of a new alarm being raised, or the arrival
of a new protocol message that updates the parent tree.
This annotation allows parent tree containers with telemetry-atomic
annotation to not be updated when a more frequently updated node or
subtree. For example, a counters container is present.
This extension should only be used when there is a parent that
contains telemetry-atomic extension.";
}
extension operational {
description
"The operational annotation is specified in the context of a
grouping, leaf, or leaf-list within a YANG module. It indicates
that the nodes within the context are derived state on the device.
OpenConfig data models divide nodes into the following three categories:
- intended configuration - these are leaves within a container named
'config', and are the writable configuration of a target.
- applied configuration - these are leaves within a container named
'state' and are the currently running value of the intended configuration.
- derived state - these are the values within the 'state' container which
are not part of the applied configuration of the device. Typically, they
represent state values reflecting underlying operational counters, or
protocol statuses.";
}
extension catalog-organization {
argument "org" {
yin-element false;
}
description
"This extension specifies the organization name that should be used within
the module catalogue on the device for the specified YANG module. It stores
a pithy string where the YANG organization statement may contain more
details.";
}
extension origin {
argument "origin" {
yin-element false;
}
description
"This extension specifies the name of the origin that the YANG module
falls within. This allows multiple overlapping schema trees to be used
on a single network element without requiring module based prefixing
of paths.";
}
}

View File

@@ -1,540 +0,0 @@
module openconfig-icmpv4-types {
yang-version "1";
namespace "http://openconfig.net/yang/openconfig-icmpv4-types";
prefix "oc-icmpv4-types";
import openconfig-extensions { prefix oc-ext; }
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"OpenConfig module defining the types and coresponding codes for
ICMPv4.";
oc-ext:openconfig-version "0.1.0";
revision "2023-01-26" {
description
"Initial revision of ICMPv4 types module.";
reference "0.1.0";
}
identity TYPE {
description
"Base identity for ICMPv4 codes";
}
identity CODE {
description
"Base identity for ICMPv4 codes.";
}
identity ECHO_REPLY {
description
"ICMP echo reply, value 0.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE {
description
"ICMP destination unreachable, value 3.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity REDIRECT {
description
"ICMP redirect, value 5.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity ECHO {
description
"ICMP echo, value 8.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity ROUTER_ADVERTISEMENT {
description
"ICMP router advertisement, value 9.";
base TYPE;
reference "RFC1256: ICMP Router Discovery Messages";
}
identity ROUTER_SOLICITATION {
description
"ICMP Router Solicitation, value 10.";
base TYPE;
reference "RFC1256: ICMP Router Discovery Messages";
}
identity TIME_EXCEEDED {
description
"ICMP TTL exceede, value 11.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity PARAM_PROBLEM {
description
"ICMP parameter problem, value 12.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TIMESTAMP {
description
"ICMP timestamp, value 13.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TIMESTAMP_REPLY {
description
"ICMP timestamp reply, value 14.";
base TYPE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TRACEROUTE{
description
"Traceroute (deprecated), value 30.";
base TYPE;
reference "RFC1393: Traceroute Using an IP Option";
}
identity PHOTURIS {
description
"ICMP Photuris, value 40.";
base TYPE;
reference "RFC2521: CMP Security Failures Messages";
}
identity EXT_ECHO_REQUEST {
description
"ICMP extended echo request, value 42.";
base TYPE;
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY {
description
"ICMP extended echo reply, value 43.";
base TYPE;
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity ECHO_REPLY_CODE {
description
"CODE for ICMPv4 Echo Reply.";
base CODE;
}
identity ECHO_REPLY_NONE {
description
"No code, type 0 for Echo Reply.";
base ECHO_REPLY_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_CODE {
description
"Codes for ICMPv4 Destination Unreachable.";
base CODE;
}
identity DST_UNREACHABLE_NET {
description
"ICMPv4 destination network unreachable, code 0.";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_HOST {
description
"ICMPv4 destination host unreachable, code 1";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_PROTOCOL {
description
"ICMPv4 destination protocol unreachable, code 2.";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_PORT {
description
"ICMPv4 Port unreachable, code 3.";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_CANNOT_FRAGMENT {
description
"ICMPv4 destination unreachable due to inability to fragment. The df-bit
is set but the packet requires fragmentation, code 4.";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_SRC_ROUTE_FAILED {
description
"ICMPv4 destination is unreachable as source routing failed, code 5.";
base DST_UNREACHABLE_CODE;
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity DST_UNREACHABLE_DST_NET_UNKNOWN {
description
"ICMPv4 destination is unreachable as the destination network is
unknown, code 6.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_DST_HOST_UNKNOWN {
description
"ICMPv4 destination is unreachable as the destination host is unknown, code 7.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_SRC_HOST_ISOLATED {
description
"ICMPv4 destination unreachable as the source host is isolated, code 8.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_DST_NET_ADMIN_PROHIBITED {
description
"ICMPv4 destination is unreachable as communication with the destination
network is administratively prohibited, code 9.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_DST_HOST_ADMIN_PROHIBITED {
description
"ICMPv4 destination is unreachable as communication with the destination
host is adminstratively prohibited, code 10.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_NET_UNREACHABLE_FOR_TOS {
description
"ICMPv4 destination network is unreachable for the specified type of
service, code 11.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_HOST_UNREACHABLE_FOR_TOS {
description
"ICMPv4 destination host is unreachable for the specified type of
service, code 12.";
base DST_UNREACHABLE_CODE;
reference "RFC1122: Requirements for Internet Hosts --
Communication Layers";
}
identity DST_UNREACHABLE_ADMIN_PROHIBITED {
description
"ICMPv4 destination is unreacable as packets were adminstratively
filtered.";
base DST_UNREACHABLE_CODE;
reference "RFC1812: Requirements for IP Version 4 Routers";
}
identity DST_UNREACHABLE_HOST_PRECEDENCE_VIOLATION {
description
"ICMPv4 destination is unreachable as the first-hop router has determined
that the destination cannot be reached for the specified source/
destination host, network, upper-layer protocol and source/destination
port. Code 14";
base DST_UNREACHABLE_CODE;
}
identity DST_UNREACHABLE_PRECEDENCE_CUTOFF {
description
"ICMPv4 Precedence cutoff in effect. The network operators have imposed
a minimum level of precedence required for operation, the
datagram was sent with a precedence below this level.
Code 15.";
base DST_UNREACHABLE_CODE;
reference "RFC1812: Requirements for IP Version 4 Routers";
}
identity REDIRECT_CODE {
base CODE;
description
"Codes for the ICMPv4 Redirect type.";
}
identity REDIRECT_NETWORK {
base REDIRECT_CODE;
description
"ICMP redirect is being issued for the network or subnet,
code 0";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity REDIRECT_HOST {
base REDIRECT_CODE;
description
"ICMP redirect is being issued for the host, code 1.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity REDIRECT_TOS_NETWORK {
base REDIRECT_CODE;
description
"ICMP redirect is being issued for the network and type of service. code 2.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity REDIRECT_TOS_HOST {
base REDIRECT_CODE;
description
"ICMP redirect is being issued for the host and type of service,
code 3";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity ECHO_CODE {
base CODE;
description
"Codes for ICMPv4 echo messages.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity ECHO_NO_CODE {
base ECHO_CODE;
description
"No code.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity ROUTER_ADVERTISEMENT_CODE {
base CODE;
description
"Code for the ICMPv4 router advertisement message.";
}
identity ROUTER_ADVERTISEMENT_NORMAL {
base ROUTER_ADVERTISEMENT_CODE;
description
"Code 0: Normal router advertisement.";
reference "RFC3344: IP Mobility Support for IPv4";
}
identity ROUTER_ADVERTISEMENT_DOES_NOT_ROUTE_COMMON {
base ROUTER_ADVERTISEMENT_CODE;
description
"Code 16: Does not route common traffic.";
reference "RFC3344: IP Mobility Support for IPv4";
}
identity ROUTER_SELECTION_CODE {
base CODE;
description
"Codes for the ICMPv4 router selection message.";
}
identity ROUTER_SELECTION_NO_CODE {
base ROUTER_SELECTION_CODE;
description
"No code.";
reference "RFC1256: ICMP Router Discovery Messages";
}
identity TIME_EXCEEDED_CODE {
base CODE;
description
"Codes for the ICMPv4 time exceeded code.";
}
identity TIME_EXCEEDED_IN_TRANSIT {
base TIME_EXCEEDED_CODE;
description
"Code 0: Time to Live exceeded in Transit.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TIME_EXCEEDED_FRAGMENT_REASSEMBLY_IN_TRANSIT {
base TIME_EXCEEDED_CODE;
description
"Code 1: Fragment reassembly time exceeded.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity PARAM_PROBLEM_CODE {
base CODE;
description
"Codes for the ICMPv4 parameter problem message (Type 12).";
}
identity PARAM_PROBLEM_POINTER_INDICATES_ERR {
base PARAM_PROBLEM_CODE;
description
"Code 0: Pointer indicates the error.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity PARAM_PROBLEM_MISSING_REQ_OPTION {
base PARAM_PROBLEM_CODE;
description
"Code 1: Missing a required option.";
reference "RFC1108: U.S. Department of Defense
Security Options for the Internet Protocol";
}
identity PARAM_PROBLEM_BAD_LENGTH {
base PARAM_PROBLEM_CODE;
description
"Code 2: Bad Length.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TIMESTAMP_CODE {
base CODE;
description
"Codes of the ICMPv4 timestamp message (Type 13).";
}
identity TIMESTAMP_NO_CODE {
base TIMESTAMP_CODE;
description
"No code.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity TIMESTAMP_REPLY_CODE {
base CODE;
description
"Codes of the ICMPv4 timestamp reply message (Type 14).";
}
identity TIMESTAMP_REPLY_NO_CODE {
base TIMESTAMP_REPLY_CODE;
description
"No code.";
reference "RFC792: INTERNET CONTROL MESSAGE PROTOCOL";
}
identity PHOTURIS_CODE {
base CODE;
description
"Codes of the ICMPv4 Photuris message (type 40).";
}
identity PHOTURIS_BAD_SPI {
base PHOTURIS_CODE;
description
"Code 0: Bad SPI.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity PHOTURIS_AUTH_FAILED {
base PHOTURIS_CODE;
description
"Code 1: Authentication failed.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity PHOTURIS_DECOMPRESS_FAILED {
base PHOTURIS_CODE;
description
"Code 2: Decompression failed.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity PHOTURIS_DECRYPTION_FAILED {
base PHOTURIS_CODE;
description
"Code 3: Decryption failed.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity PHOTURIS_NEED_AUTHENTICATION {
base PHOTURIS_CODE;
description
"Code 4: Need authentication.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity PHOTURIS_NEED_AUTHORIZATION {
base PHOTURIS_CODE;
description
"Code 5: Need authorization.";
reference "RFC2521: ICMP Security Failures Messages";
}
identity EXT_ECHO_REQUEST_CODE {
description
"Codes of the extended echo request ICMP message.";
base CODE;
}
identity EXT_ECHO_REQUEST_NO_ERROR {
base EXT_ECHO_REQUEST_CODE;
description
"Code 0: No error.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY_CODE {
description
"Codes of the extended echo reply ICMP message (Type 43).";
base CODE;
}
identity EXT_ECHO_REPLY_NO_ERROR {
base EXT_ECHO_REPLY_CODE;
description
"Code 0: No error.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY_MALFORMED_QUERY {
base EXT_ECHO_REPLY_CODE;
description
"Code 1: Malformed query.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY_NO_SUCH_INTF {
base EXT_ECHO_REPLY_CODE;
description
"Code 2: No such interface.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY_NO_SUB_TABLE_ENTRY {
base EXT_ECHO_REPLY_CODE;
description
"Code 3: No such table entry.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
identity EXT_ECHO_REPLY_MULTIPLE_INTF_SATISFY_QUERY {
base EXT_ECHO_REPLY_CODE;
description
"Code 4: Multiple interfaces satisfy query.";
reference "RFC8335: PROBE: A Utility for Probing Interfaces";
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,485 +0,0 @@
module openconfig-inet-types {
yang-version "1";
namespace "http://openconfig.net/yang/types/inet";
prefix "oc-inet";
import openconfig-extensions { prefix "oc-ext"; }
organization
"OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module contains a set of Internet address related
types for use in OpenConfig modules.
Portions of this code were derived from IETF RFC 6021.
Please reproduce this note if possible.
IETF code is subject to the following copyright and license:
Copyright (c) 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).";
oc-ext:openconfig-version "0.7.0";
revision "2024-01-05" {
description
"Change ipv6-address-zoned typedef to conform to W3C standard
regex pattern.";
reference "0.7.0";
}
revision "2023-02-06" {
description
"Add ipv6-link-local and ipv6-address-type";
reference "0.6.0";
}
revision "2021-08-17" {
description
"Add ip-address-zoned typedef as a union between ipv4-address-zoned
and ipv6-address-zoned types.";
reference "0.5.0";
}
revision "2021-07-14" {
description
"Use auto-generated regex for ipv4 pattern statements:
- ipv4-address
- ipv4-address-zoned
- ipv4-prefix";
reference "0.4.1";
}
revision "2021-01-07" {
description
"Remove module extension oc-ext:regexp-posix by making pattern regexes
conform to RFC7950.
Types impacted:
- ipv4-address
- ipv4-address-zoned
- ipv6-address
- domain-name";
reference "0.4.0";
}
revision "2020-10-12" {
description
"Fix anchors for domain-name pattern.";
reference "0.3.5";
}
revision "2020-06-30" {
description
"Add OpenConfig POSIX pattern extensions and add anchors for domain-name
pattern.";
reference "0.3.4";
}
revision "2019-04-25" {
description
"Fix regex bug for ipv6-prefix type";
reference "0.3.3";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.3.2";
}
revision 2017-08-24 {
description
"Minor formatting fixes.";
reference "0.3.1";
}
revision 2017-07-06 {
description
"Add domain-name and host typedefs";
reference "0.3.0";
}
revision 2017-04-03 {
description
"Add ip-version typedef.";
reference "0.2.0";
}
revision 2017-04-03 {
description
"Update copyright notice.";
reference "0.1.1";
}
revision 2017-01-26 {
description
"Initial module for inet types";
reference "0.1.0";
}
// OpenConfig specific extensions for module metadata.
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
// IPv4 and IPv6 types.
typedef ipv4-address {
type string {
pattern
'([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}';
oc-ext:posix-pattern
'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3})$';
}
description
"An IPv4 address in dotted quad notation using the default
zone.";
}
typedef ipv4-address-zoned {
type string {
pattern
'([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}(%[a-zA-Z0-9_]+)';
oc-ext:posix-pattern
'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}(%[a-zA-Z0-9_]+))$';
}
description
"An IPv4 address in dotted quad notation. This type allows
specification of a zone index to disambiguate identical
address values. For link-local addresses, the index is
typically the interface index or interface name.";
}
typedef ipv6-address {
type string {
pattern
// Must support compression through different lengths
// therefore this regexp is complex.
'(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')';
oc-ext:posix-pattern
// Must support compression through different lengths
// therefore this regexp is complex.
'^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')$';
}
description
"An IPv6 address represented as either a full address; shortened
or mixed-shortened formats, using the default zone.";
}
typedef ipv6-address-zoned {
type string {
pattern
// Must support compression through different lengths
// therefore this regexp is complex.
'(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')(%[a-zA-Z0-9_]+)';
oc-ext:posix-pattern
// Must support compression through different lengths
// therefore this regexp is complex.
'^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')(%[a-zA-Z0-9_]+)$';
}
description
"An IPv6 address represented as either a full address; shortened
or mixed-shortened formats. This type allows specification of
a zone index to disambiguate identical address values. For
link-local addresses, the index is typically the interface
index or interface name.";
}
typedef ipv4-prefix {
type string {
pattern
'([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}/([0-9]|[12][0-9]|'
+ '3[0-2])';
oc-ext:posix-pattern
'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}/([0-9]|[12][0-9]|'
+ '3[0-2]))$';
}
description
"An IPv4 prefix represented in dotted quad notation followed by
a slash and a CIDR mask (0 <= mask <= 32).";
}
typedef ipv6-prefix {
type string {
pattern
'(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9])';
oc-ext:posix-pattern
'^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,7}:|' +
'([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' +
'([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' +
'([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' +
'([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' +
'([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' +
'[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' +
':((:[0-9a-fA-F]{1,4}){1,7}|:)' +
')/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9])$';
}
description
"An IPv6 prefix represented in full, shortened, or mixed
shortened format followed by a slash and CIDR mask
(0 <= mask <= 128).";
}
typedef ip-address {
type union {
type ipv4-address;
type ipv6-address;
}
description
"An IPv4 or IPv6 address with no prefix specified.";
}
typedef ip-address-zoned {
type union {
type ipv4-address-zoned;
type ipv6-address-zoned;
}
description
"An IPv4 or IPv6 address with no prefix specified and an optional
zone index.";
}
typedef ip-prefix {
type union {
type ipv4-prefix;
type ipv6-prefix;
}
description
"An IPv4 or IPv6 prefix.";
}
typedef ip-version {
type enumeration {
enum UNKNOWN {
value 0;
description
"An unknown or unspecified version of the Internet
protocol.";
}
enum IPV4 {
value 4;
description
"The IPv4 protocol as defined in RFC 791.";
}
enum IPV6 {
value 6;
description
"The IPv6 protocol as defined in RFC 2460.";
}
}
description
"This value represents the version of the IP protocol.
Note that integer representation of the enumerated values
are not specified, and are not required to follow the
InetVersion textual convention in SMIv2.";
reference
"RFC 791: Internet Protocol
RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
RFC 4001: Textual Conventions for Internet Network Addresses";
}
typedef ipv6-address-type {
type enumeration {
enum GLOBAL_UNICAST {
description
"The IPv6 address is a global unicast address type and must be in
the format defined in RFC 4291 section 2.4.";
}
enum LINK_LOCAL_UNICAST {
description
"The IPv6 address is a Link-Local unicast address type and must be
in the format defined in RFC 4291 section 2.4.";
}
}
description
"The value represents the type of IPv6 address";
reference
"RFC 4291: IP Version 6 Addressing Architecture
section 2.5";
}
typedef domain-name {
type string {
length "1..253";
pattern
'(((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' +
'([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' +
'|\.)';
oc-ext:posix-pattern
'^(((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' +
'([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' +
'|\.)$';
}
description
"The domain-name type represents a DNS domain name.
Fully quallified left to the models which utilize this type.
Internet domain names are only loosely specified. Section
3.5 of RFC 1034 recommends a syntax (modified in Section
2.1 of RFC 1123). The pattern above is intended to allow
for current practice in domain name use, and some possible
future expansion. It is designed to hold various types of
domain names, including names used for A or AAAA records
(host names) and other records, such as SRV records. Note
that Internet host names have a stricter syntax (described
in RFC 952) than the DNS recommendations in RFCs 1034 and
1123, and that systems that want to store host names in
schema nodes using the domain-name type are recommended to
adhere to this stricter standard to ensure interoperability.
The encoding of DNS names in the DNS protocol is limited
to 255 characters. Since the encoding consists of labels
prefixed by a length bytes and there is a trailing NULL
byte, only 253 characters can appear in the textual dotted
notation.
Domain-name values use the US-ASCII encoding. Their canonical
format uses lowercase US-ASCII characters. Internationalized
domain names MUST be encoded in punycode as described in RFC
3492";
}
typedef host {
type union {
type ip-address;
type domain-name;
}
description
"The host type represents either an unzoned IP address or a DNS
domain name.";
}
typedef as-number {
type uint32;
description
"A numeric identifier for an autonomous system (AS). An AS is a
single domain, under common administrative control, which forms
a unit of routing policy. Autonomous systems can be assigned a
2-byte identifier, or a 4-byte identifier which may have public
or private scope. Private ASNs are assigned from dedicated
ranges. Public ASNs are assigned from ranges allocated by IANA
to the regional internet registries (RIRs).";
reference
"RFC 1930 Guidelines for creation, selection, and registration
of an Autonomous System (AS)
RFC 4271 A Border Gateway Protocol 4 (BGP-4)";
}
typedef dscp {
type uint8 {
range "0..63";
}
description
"A differentiated services code point (DSCP) marking within the
IP header.";
reference
"RFC 2474 Definition of the Differentiated Services Field
(DS Field) in the IPv4 and IPv6 Headers";
}
typedef ipv6-flow-label {
type uint32 {
range "0..1048575";
}
description
"The IPv6 flow-label is a 20-bit value within the IPv6 header
which is optionally used by the source of the IPv6 packet to
label sets of packets for which special handling may be
required.";
reference
"RFC 2460 Internet Protocol, Version 6 (IPv6) Specification";
}
typedef port-number {
type uint16;
description
"A 16-bit port number used by a transport protocol such as TCP
or UDP.";
reference
"RFC 768 User Datagram Protocol
RFC 793 Transmission Control Protocol";
}
typedef uri {
type string;
description
"An ASCII-encoded Uniform Resource Identifier (URI) as defined
in RFC 3986.";
reference
"RFC 3986 Uniform Resource Identifier (URI): Generic Syntax";
}
typedef url {
type string;
description
"An ASCII-encoded Uniform Resource Locator (URL) as defined
in RFC 3986, section 1.1.3";
reference
"RFC 3986, paragraph 1.1.3";
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,548 +0,0 @@
module openconfig-mpls-types {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/mpls-types";
prefix "oc-mplst";
import openconfig-extensions { prefix oc-ext; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"General types for MPLS / TE data model";
oc-ext:openconfig-version "3.5.0";
revision "2023-12-14" {
description
"Added additional attributes oc-if:interface-ref
and metric attributes to static lsp";
reference "3.5.0";
}
revision "2021-12-01" {
description
"Add new identity for RSVP authentication types";
reference "3.4.0";
}
revision "2021-06-16" {
description
"Remove trailing whitespace";
reference "3.3.1";
}
revision "2021-03-23" {
description
"Add new identity for path metric types.";
reference "3.3.0";
}
revision "2020-02-04" {
description
"Consistent prefix for openconfig-mpls-types.";
reference "3.2.0";
}
revision "2019-03-26" {
description
"Add Pseudowire encapsulation.";
reference "3.1.0";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "3.0.1";
}
revision "2018-07-02" {
description
"Add new RSVP-TE statistics, remove associated-rsvp-session
leaf. Remove use of date-and-time.";
reference "3.0.0";
}
revision "2018-06-16" {
description
"Included attributes for base LDP configuration.";
reference "2.6.0";
}
revision "2018-06-13" {
description
"Add ttl-propagation to global MPLS config";
reference "2.5.0";
}
revision "2018-06-05" {
description
"Fixed bugs in when statements on RSVP-TE attributes";
reference "2.4.2";
}
revision "2017-08-24" {
description
"Minor formatting fixes.";
reference "2.4.1";
}
revision "2017-06-21" {
description
"Add TC bits typedef.";
reference "2.4.0";
}
revision "2017-03-22" {
description
"Add RSVP calculated-absolute-subscription-bw";
reference "2.3.0";
}
revision "2017-01-26" {
description
"Add RSVP Tspec, clarify units for RSVP, remove unused LDP";
reference "2.2.0";
}
revision "2016-12-15" {
description
"Add additional MPLS parameters";
reference "2.1.0";
}
revision "2016-09-01" {
description
"Revisions based on implementation feedback";
reference "2.0.0";
}
revision "2016-08-08" {
description
"Public release of MPLS models";
reference "1.0.1";
}
// identity statements
identity PATH_COMPUTATION_METHOD {
description
"base identity for supported path computation
mechanisms";
}
identity LOCALLY_COMPUTED {
base PATH_COMPUTATION_METHOD;
description
"indicates a constrained-path LSP in which the
path is computed by the local LER";
}
identity EXTERNALLY_QUERIED {
base PATH_COMPUTATION_METHOD;
description
"Constrained-path LSP in which the path is
obtained by querying an external source, such as a PCE server.
In the case that an LSP is defined to be externally queried, it may
also have associated explicit definitions (which are provided to the
external source to aid computation); and the path that is returned by
the external source is not required to provide a wholly resolved
path back to the originating system - that is to say, some local
computation may also be required";
}
identity EXPLICITLY_DEFINED {
base PATH_COMPUTATION_METHOD;
description
"constrained-path LSP in which the path is
explicitly specified as a collection of strict or/and loose
hops";
}
// using identities rather than enum types to simplify adding new
// signaling protocols as they are introduced and supported
identity PATH_SETUP_PROTOCOL {
description
"base identity for supported MPLS signaling
protocols";
}
identity PATH_SETUP_RSVP {
base PATH_SETUP_PROTOCOL;
description
"RSVP-TE signaling protocol";
}
identity PATH_SETUP_SR {
base PATH_SETUP_PROTOCOL;
description
"Segment routing";
}
identity PATH_SETUP_LDP {
base PATH_SETUP_PROTOCOL;
description
"LDP - RFC 5036";
}
identity PROTECTION_TYPE {
description
"base identity for protection type";
}
identity UNPROTECTED {
base PROTECTION_TYPE;
description
"no protection is desired";
}
identity LINK_PROTECTION_REQUIRED {
base PROTECTION_TYPE;
description
"link protection is desired";
}
identity LINK_NODE_PROTECTION_REQUESTED {
base PROTECTION_TYPE;
description
"node and link protection are both desired";
}
identity LSP_ROLE {
description
"Base identity for describing the role of
label switched path at the current node";
}
identity INGRESS {
base LSP_ROLE;
description
"Label switched path is an ingress (headend)
LSP";
}
identity EGRESS {
base LSP_ROLE;
description
"Label switched path is an egress (tailend)
LSP";
}
identity TRANSIT {
base LSP_ROLE;
description
"Label switched path is a transit LSP";
}
identity TUNNEL_TYPE {
description
"Base identity from which specific tunnel types are
derived.";
}
identity P2P {
base TUNNEL_TYPE;
description
"TE point-to-point tunnel type.";
}
identity P2MP {
base TUNNEL_TYPE;
description
"TE point-to-multipoint tunnel type.";
}
identity LSP_OPER_STATUS {
description
"Base identity for LSP operational status";
}
identity DOWN {
base LSP_OPER_STATUS;
description
"LSP is operationally down or out of service";
}
identity UP {
base LSP_OPER_STATUS;
description
"LSP is operationally active and available
for traffic.";
}
identity TUNNEL_ADMIN_STATUS {
description
"Base identity for tunnel administrative status";
}
identity ADMIN_DOWN {
base TUNNEL_ADMIN_STATUS;
description
"LSP is administratively down";
}
identity ADMIN_UP {
base TUNNEL_ADMIN_STATUS;
description
"LSP is administratively up";
}
identity NULL_LABEL_TYPE {
description
"Base identity from which specific null-label types are
derived.";
}
identity EXPLICIT {
base NULL_LABEL_TYPE;
description
"Explicit null label is used.";
}
identity IMPLICIT {
base NULL_LABEL_TYPE;
description
"Implicit null label is used.";
}
identity LSP_METRIC_TYPE {
description
"Base identity for types of LSP metric specification";
}
identity LSP_METRIC_RELATIVE {
base LSP_METRIC_TYPE;
description
"The metric specified for the LSPs to which this identity refers
is specified as a relative value to the IGP metric cost to the
LSP's tail-end.";
}
identity LSP_METRIC_ABSOLUTE {
base LSP_METRIC_TYPE;
description
"The metric specified for the LSPs to which this identity refers
is specified as an absolute value";
}
identity LSP_METRIC_INHERITED {
base LSP_METRIC_TYPE;
description
"The metric for for the LSPs to which this identity refers is
not specified explicitly - but rather inherited from the IGP
cost directly";
}
// Note: The IANA PWE3 Types Registry has several more values than these
identity PSEUDOWIRE_ENCAPSULATION {
description
"Sets the PDU type of the PSEUDOWIRE Example in RFC4448. This value
should be enumerated from the IANA Pseudowire types registry";
}
identity PWE_ETHERNET_TAGGED_MODE {
base PSEUDOWIRE_ENCAPSULATION;
description
"Ethernet Tagged Mode RFC4448";
reference "IANA PWE3 0x0004";
}
identity PWE_ETHERNET_RAW_MODE {
base PSEUDOWIRE_ENCAPSULATION;
description
"Ethernet Raw Mode RFC4448";
reference "IANA PWE3 0x0005";
}
identity PATH_METRIC_TYPE {
description
"Base identity for path metric type.";
}
identity TE_METRIC {
base PATH_METRIC_TYPE;
description
"TE path metric.";
reference
"RFC3785: Use of Interior Gateway Protocol (IGP) Metric as a
second MPLS Traffic Engineering (TE) Metric.
RFC5440: Path Computation Element (PCE) Communication Protocol (PCEP).";
}
identity IGP_METRIC {
base PATH_METRIC_TYPE;
description
"IGP path metric.";
reference
"RFC5440: Path Computation Element (PCE) Communication Protocol (PCEP).";
}
identity HOP_COUNT {
base PATH_METRIC_TYPE;
description
"Hop count path metric.";
reference
"RFC5440: Path Computation Element (PCE) Communication Protocol (PCEP).";
}
identity PATH_DELAY {
base PATH_METRIC_TYPE;
description
"Unidirectional average link delay.
It represents the sum of the Link Delay metric
of all links along a P2P path.";
reference
"RFC8570 IS-IS Traffic Engineering (TE) Metric Extensions.
RFC7471 OSPF Traffic Engineering (TE) Metric Extensions.
RFC 8233: Extensions to the Path Computation Element Communication Protocol (PCEP)
to Compute Service-Aware Label Switched Paths (LSPs) Path Computation Element (PCE)
Communication Protocol (PCEP).";
}
identity RSVP_AUTH_TYPE {
description
"Base identity for RSVP message authentication types";
reference
"RFC2747: RSVP Cryptographic Authentication";
}
identity RSVP_AUTH_MD5 {
base RSVP_AUTH_TYPE;
description
"HMAC-MD5 message authentication";
}
// typedef statements
typedef mpls-label {
type union {
type uint32 {
range 16..1048575;
}
type enumeration {
enum IPV4_EXPLICIT_NULL {
value 0;
description
"valid at the bottom of the label stack,
indicates that stack must be popped and packet forwarded
based on IPv4 header";
}
enum ROUTER_ALERT {
value 1;
description
"allowed anywhere in the label stack except
the bottom, local router delivers packet to the local CPU
when this label is at the top of the stack";
}
enum IPV6_EXPLICIT_NULL {
value 2;
description
"valid at the bottom of the label stack,
indicates that stack must be popped and packet forwarded
based on IPv6 header";
}
enum IMPLICIT_NULL {
value 3;
description
"assigned by local LSR but not carried in
packets";
}
enum ENTROPY_LABEL_INDICATOR {
value 7;
description
"Entropy label indicator, to allow an LSR
to distinguish between entropy label and applicaiton
labels RFC 6790";
}
enum NO_LABEL {
description
"This value is utilised to indicate that the packet that
is forwarded by the local system does not have an MPLS
header applied to it. Typically, this is used at the
egress of an LSP";
}
}
}
description
"type for MPLS label value encoding";
reference "RFC 3032 - MPLS Label Stack Encoding";
}
typedef tunnel-type {
type enumeration {
enum P2P {
description
"point-to-point label-switched-path";
}
enum P2MP {
description
"point-to-multipoint label-switched-path";
}
enum MP2MP {
description
"multipoint-to-multipoint label-switched-path";
}
}
description
"defines the tunnel type for the LSP";
reference
"RFC 6388 - Label Distribution Protocol Extensions for
Point-to-Multipoint and Multipoint-to-Multipoint Label Switched
Paths
RFC 4875 - Extensions to Resource Reservation Protocol
- Traffic Engineering (RSVP-TE) for Point-to-Multipoint TE
Label Switched Paths (LSPs)";
}
typedef bandwidth-kbps {
type uint64;
units "Kbps";
description
"Bandwidth values expressed in kilobits per second";
}
typedef bandwidth-mbps {
type uint64;
units "Mbps";
description
"Bandwidth values expressed in megabits per second";
}
typedef bandwidth-gbps {
type uint64;
units "Gbps";
description
"Bandwidth values expressed in gigabits per second";
}
typedef mpls-tc {
type uint8 {
range "0..7";
}
description
"Values of the MPLS Traffic Class (formerly known as
Experimental, EXP) bits";
}
// grouping statements
// data definition statements
// augment statements
// rpc statements
// notification statements
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,374 +0,0 @@
module openconfig-packet-match-types {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/packet-match-types";
prefix "oc-pkt-match-types";
// import some basic types
import openconfig-inet-types { prefix oc-inet; }
import openconfig-extensions { prefix oc-ext; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module defines common types for use in models requiring
data definitions related to packet matches.";
oc-ext:openconfig-version "1.3.3";
revision "2023-01-29" {
description
"Whitespace cleanup.";
reference "1.3.3";
}
revision "2021-07-14" {
description
"Use auto-generated regex for port-num-range pattern statements";
reference "1.3.2";
}
revision "2021-06-16" {
description
"Remove trailing whitespace.";
reference "1.3.1";
}
revision "2021-05-19" {
description
"Add IP-in-IP protocol.";
reference "1.3.0";
}
revision "2021-03-17" {
description
"Add MPLS filter Support.";
reference "1.2.0";
}
revision "2021-01-07" {
description
"Remove module extension oc-ext:regexp-posix by making pattern regexes
conform to RFC7950.
Types impacted:
- port-num-range";
reference "1.1.0";
}
revision "2020-10-20" {
description
"Fix pattern regex for port-num-range.";
reference "1.0.4";
}
revision "2020-06-30" {
description
"Add OpenConfig POSIX pattern extensions.";
reference "1.0.3";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "1.0.2";
}
revision "2018-04-15" {
description
"Corrected description and range for ethertype typedef";
reference "1.0.1";
}
revision "2017-05-26" {
description
"Separated IP matches into AFs";
reference "1.0.0";
}
revision "2016-08-08" {
description
"OpenConfig public release";
reference "0.2.0";
}
revision "2016-04-27" {
description
"Initial revision";
reference "TBD";
}
// OpenConfig specific extensions for module metadata.
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
// extension statements
// feature statements
// identity statements
//TODO: should replace this with an official IEEE module
// when available. Only a select number of types are
// defined in this identity.
identity ETHERTYPE {
description
"Base identity for commonly used Ethertype values used
in packet header matches on Ethernet frames. The Ethertype
indicates which protocol is encapsulated in the Ethernet
payload.";
reference
"IEEE 802.3";
}
identity ETHERTYPE_IPV4 {
base ETHERTYPE;
description
"IPv4 protocol (0x0800)";
}
identity ETHERTYPE_ARP {
base ETHERTYPE;
description
"Address resolution protocol (0x0806)";
}
identity ETHERTYPE_VLAN {
base ETHERTYPE;
description
"VLAN-tagged frame (as defined by IEEE 802.1q) (0x8100). Note
that this value is also used to represent Shortest Path
Bridging (IEEE 801.1aq) frames.";
}
identity ETHERTYPE_IPV6 {
base ETHERTYPE;
description
"IPv6 protocol (0x86DD)";
}
identity ETHERTYPE_MPLS {
base ETHERTYPE;
description
"MPLS unicast (0x8847)";
}
identity ETHERTYPE_LLDP {
base ETHERTYPE;
description
"Link Layer Discovery Protocol (0x88CC)";
}
identity ETHERTYPE_ROCE {
base ETHERTYPE;
description
"RDMA over Converged Ethernet (0x8915)";
}
//TODO: should replace this with an official IANA module when
//available. Only a select set of protocols are defined with
//this identity.
identity IP_PROTOCOL {
description
"Base identity for commonly used IP protocols used in
packet header matches";
reference
"IANA Assigned Internet Protocol Numbers";
}
identity IP_TCP {
base IP_PROTOCOL;
description
"Transmission Control Protocol (6)";
}
identity IP_UDP {
base IP_PROTOCOL;
description
"User Datagram Protocol (17)";
}
identity IP_ICMP {
base IP_PROTOCOL;
description
"Internet Control Message Protocol (1)";
}
identity IP_IGMP {
base IP_PROTOCOL;
description
"Internet Group Membership Protocol (2)";
}
identity IP_PIM {
base IP_PROTOCOL;
description
"Protocol Independent Multicast (103)";
}
identity IP_RSVP {
base IP_PROTOCOL;
description
"Resource Reservation Protocol (46)";
}
identity IP_GRE {
base IP_PROTOCOL;
description
"Generic Routing Encapsulation (47)";
}
identity IP_AUTH {
base IP_PROTOCOL;
description
"Authentication header, e.g., for IPSEC (51)";
}
identity IP_L2TP {
base IP_PROTOCOL;
description
"Layer Two Tunneling Protocol v.3 (115)";
}
identity IP_IN_IP {
base IP_PROTOCOL;
description
"IP-in-IP tunneling (4)";
reference
"RFC2003: IP Encapsulation within IP";
}
identity TCP_FLAGS {
description
"Common TCP flags used in packet header matches";
reference
"IETF RFC 793 - Transmission Control Protocol
IETF RFC 3168 - The Addition of Explicit Congestion
Notification (ECN) to IP";
}
identity TCP_SYN {
base TCP_FLAGS;
description
"TCP SYN flag";
}
identity TCP_FIN {
base TCP_FLAGS;
description
"TCP FIN flag";
}
identity TCP_RST {
base TCP_FLAGS;
description
"TCP RST flag";
}
identity TCP_PSH {
base TCP_FLAGS;
description
"TCP push flag";
}
identity TCP_ACK {
base TCP_FLAGS;
description
"TCP ACK flag";
}
identity TCP_URG {
base TCP_FLAGS;
description
"TCP urgent flag";
}
identity TCP_ECE {
base TCP_FLAGS;
description
"TCP ECN-Echo flag. If the SYN flag is set, indicates that
the TCP peer is ECN-capable, otherwise indicates that a
packet with Congestion Experienced flag in the IP header
is set";
}
identity TCP_CWR {
base TCP_FLAGS;
description
"TCP Congestion Window Reduced flag";
}
// typedef statements
typedef port-num-range {
type union {
type string {
pattern
'(0{0,4}[0-9]|0{0,3}[1-9][0-9]|0{0,2}[1-9][0-9]{2}|'
+ '0?[1-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|'
+ '655[0-2][0-9]|6553[0-5])\.\.(0{0,4}[0-9]|0{0,3}[1-9][0-9]|'
+ '0{0,2}[1-9][0-9]{2}|0?[1-9][0-9]{3}|[1-5][0-9]{4}|'
+ '6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])';
oc-ext:posix-pattern
'^((0{0,4}[0-9]|0{0,3}[1-9][0-9]|0{0,2}[1-9][0-9]{2}|'
+ '0?[1-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|'
+ '655[0-2][0-9]|6553[0-5])\.\.(0{0,4}[0-9]|0{0,3}[1-9][0-9]|'
+ '0{0,2}[1-9][0-9]{2}|0?[1-9][0-9]{3}|[1-5][0-9]{4}|'
+ '6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))$';
}
type oc-inet:port-number;
type enumeration {
enum ANY {
description
"Indicates any valid port number (e.g., wildcard)";
}
}
}
description
"Port numbers may be represented as a single value,
an inclusive range as <lower>..<higher>, or as ANY to
indicate a wildcard.";
}
typedef ip-protocol-type {
type union {
type uint8 {
range 0..254;
}
type identityref {
base IP_PROTOCOL;
}
}
description
"The IP protocol number may be expressed as a valid protocol
number (integer) or using a protocol type defined by the
IP_PROTOCOL identity";
}
typedef ethertype-type {
type union {
type uint16 {
range 1536..65535;
}
type identityref {
base ETHERTYPE;
}
}
description
"The Ethertype value may be expressed as a 16-bit number in
decimal notation, or using a type defined by the
ETHERTYPE identity";
}
}

View File

@@ -1,727 +0,0 @@
module openconfig-packet-match {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/header-fields";
prefix "oc-pkt-match";
// import some basic types
import openconfig-inet-types { prefix oc-inet; }
import openconfig-yang-types { prefix oc-yang; }
import openconfig-packet-match-types { prefix oc-pkt-match-types; }
import openconfig-extensions { prefix oc-ext; }
import openconfig-mpls-types { prefix oc-mpls; }
import openconfig-defined-sets { prefix oc-sets; }
import openconfig-icmpv4-types { prefix oc-icmpv4-types; }
import openconfig-icmpv6-types { prefix oc-icmpv6-types; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module defines data related to packet header fields
used in matching operations, for example in ACLs. When a
field is omitted from a match expression, the effect is a
wildcard ('any') for that field.";
oc-ext:openconfig-version "2.1.0";
revision "2023-03-01" {
description
"Add ICMP Fields for filtering.";
reference "2.1.0";
}
revision "2023-01-27" {
description
"Update the mechanism to match detailed transport flags,
adding means for AND/OR in the explicitly specified flags
and commonly supported match aliases.";
reference "2.0.0";
}
revision "2022-06-01" {
description
"Add the ability to match source/destination ipv4 and
ipv6 prefix list and source/destination port list ";
reference "1.4.0";
}
revision "2021-06-16" {
description
"Remove trailing whitespace.";
reference "1.3.1";
}
revision "2021-05-19" {
description
"Add the ability to match multiple DSCPs in a rule.";
reference "1.3.0";
}
revision "2021-03-17" {
description
"Add MPLS filter Support.";
reference "1.2.0";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "1.1.1";
}
revision "2017-12-15" {
description
"Add MPLS packet field matches";
reference "1.1.0";
}
revision "2017-05-26" {
description
"Separated IP matches into AFs";
reference "1.0.0";
}
revision "2016-08-08" {
description
"OpenConfig public release";
reference "0.2.0";
}
revision "2016-04-27" {
description
"Initial revision";
reference "TBD";
}
// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
// Physical Layer fields
// ethernet-header
grouping ethernet-header-config {
description
"Configuration data of fields in Ethernet header.";
leaf source-mac {
type oc-yang:mac-address;
description
"Source IEEE 802 MAC address.";
}
leaf source-mac-mask {
type oc-yang:mac-address;
description
"Source IEEE 802 MAC address mask.";
}
leaf destination-mac {
type oc-yang:mac-address;
description
"Destination IEEE 802 MAC address.";
}
leaf destination-mac-mask {
type oc-yang:mac-address;
description
"Destination IEEE 802 MAC address mask.";
}
leaf ethertype {
type oc-pkt-match-types:ethertype-type;
description
"Ethertype field to match in Ethernet packets";
}
}
grouping ethernet-header-state {
description
"State information of fields in Ethernet header.";
}
grouping ethernet-header-top {
description
"Top level container for fields in Ethernet header.";
container l2 {
description
"Ethernet header fields";
container config {
description
"Configuration data";
uses ethernet-header-config;
}
container state {
config false;
description
"State Information.";
uses ethernet-header-config;
uses ethernet-header-state;
}
}
}
grouping mpls-header-top {
description
"Top-level container for fields in an MPLS header.";
container mpls {
description
"MPLS header fields";
container config {
description
"Configuration parameters relating to fields within
the MPLS header.";
uses mpls-header-config;
}
container state {
config false;
description
"Operational state parameters relating to fields
within the MPLS header";
uses mpls-header-config;
}
}
}
grouping mpls-header-config {
description
"Configuration parameters relating to matches within
MPLS header fields.";
leaf traffic-class {
type oc-mpls:mpls-tc;
description
"The value of the MPLS traffic class (TC) bits,
formerly known as the EXP bits.";
}
leaf start-label-value {
type oc-mpls:mpls-label;
description
"Match MPLS label value on the MPLS header.
The usage of this field indicated the upper
range value in the top of the stack.
The range that is used is inclusive. The match that
is done for a particular received pkt_label is:
start-label-value <= pkt_label <= end-label-value.
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.";
}
leaf end-label-value {
type oc-mpls:mpls-label;
description
"Match MPLS label value on the MPLS header.
The usage of this field indicated the upper
range value in the top of the stack.
The range that is used is inclusive. The match that
is done for a particular received pkt_label is:
start-label-value <= pkt_label <= end-label-value.
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.";
}
leaf ttl-value {
type uint8;
description
"Time-to-live MPLS packet value match.";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
}
grouping ip-protocol-fields-common-config {
description
"IP protocol fields common to IPv4 and IPv6";
leaf dscp {
type oc-inet:dscp;
description
"Value of diffserv codepoint.";
}
leaf-list dscp-set {
type oc-inet:dscp;
description
"A list of DSCP values to be matched for incoming packets. AN OR match should
be performed, such that a packet must match one of the values defined in this
list. If the field is left empty then any DSCP value matches unless the 'dscp'
leaf is specified. It is not valid to specify both 'dscp' and 'dscp-set together.'";
}
leaf length {
type uint16;
description
"In the IPv4 header field, this field is known as the Total
Length. Total Length is the length of the datagram, measured
in octets, including internet header and data.
In the IPv6 header field, this field is known as the Payload
Length, which is the length of the IPv6 payload, i.e., the rest
of the packet following the IPv6 header, in octets.";
reference
"RFC 791: Internet Protocol
RFC 8200: Internet Protocol, Version 6 (IPv6) Specification.";
}
leaf protocol {
type oc-pkt-match-types:ip-protocol-type;
description
"The protocol carried in the IP packet, expressed either
as its IP protocol number, or by a defined identity.";
}
leaf hop-limit {
type uint8 {
range 0..255;
}
description
"The IP packet's hop limit -- known as TTL (in hops) in
IPv4 packets, and hop limit in IPv6";
}
}
// IP Layer
// ip-protocol-fields
grouping ipv4-protocol-fields-config {
description
"Configuration data of IP protocol fields
for IPv4";
leaf source-address {
type oc-inet:ipv4-prefix;
description
"Source IPv4 address prefix.";
}
leaf source-address-prefix-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:ipv4-prefix-sets"
+ "/oc-sets:ipv4-prefix-set/oc-sets:name";
}
description
"Reference to a IPv4 address prefix Set
to match the source address";
}
leaf destination-address {
type oc-inet:ipv4-prefix;
description
"Destination IPv4 address prefix.";
}
leaf destination-address-prefix-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:ipv4-prefix-sets"
+ "/oc-sets:ipv4-prefix-set/oc-sets:name";
}
description
"Reference to a IPv4 address prefix set
to match the destination address";
}
uses ip-protocol-fields-common-config;
}
grouping ipv4-protocol-fields-state {
description
"State information of IP header fields for IPv4";
}
grouping ipv4-protocol-fields-top {
description
"IP header fields for IPv4";
container ipv4 {
description
"Top level container for IPv4 match field data";
container config {
description
"Configuration data for IPv4 match fields";
uses ipv4-protocol-fields-config;
}
container state {
config false;
description
"State information for IPv4 match fields";
uses ipv4-protocol-fields-config;
uses ipv4-protocol-fields-state;
}
uses ip-icmpv4-header-fields-top;
}
}
grouping ipv6-protocol-fields-config {
description
"Configuration data for IPv6 match fields";
leaf source-address {
type oc-inet:ipv6-prefix;
description
"Source IPv6 address prefix.";
}
leaf source-address-prefix-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:ipv6-prefix-sets"
+ "/oc-sets:ipv6-prefix-set/oc-sets:name";
}
description
"Reference to a IPv6 address prefix set
to match the source address";
}
leaf source-flow-label {
type oc-inet:ipv6-flow-label;
description
"Source IPv6 Flow label.";
}
leaf destination-address {
type oc-inet:ipv6-prefix;
description
"Destination IPv6 address prefix.";
}
leaf destination-address-prefix-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:ipv6-prefix-sets"
+ "/oc-sets:ipv6-prefix-set/oc-sets:name";
}
description
"Reference to a IPv6 address prefix set
to match the destination address";
}
leaf destination-flow-label {
type oc-inet:ipv6-flow-label;
description
"Destination IPv6 Flow label.";
}
uses ip-protocol-fields-common-config;
}
grouping ipv6-protocol-fields-state {
description
"Operational state data for IPv6 match fields";
}
grouping ipv6-protocol-fields-top {
description
"Top-level grouping for IPv6 match fields";
container ipv6 {
description
"Top-level container for IPv6 match field data";
container config {
description
"Configuration data for IPv6 match fields";
uses ipv6-protocol-fields-config;
}
container state {
config false;
description
"Operational state data for IPv6 match fields";
uses ipv6-protocol-fields-config;
uses ipv6-protocol-fields-state;
}
uses ip-icmpv6-header-fields-top;
}
}
// Transport fields
grouping transport-fields-config {
description
"Configuration data of transport-layer packet fields";
leaf source-port {
type oc-pkt-match-types:port-num-range;
description
"Source port or range";
}
leaf source-port-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:port-sets"
+ "/oc-sets:port-set/oc-sets:name";
}
description
"Reference to a port set
to match the source port";
}
leaf destination-port {
type oc-pkt-match-types:port-num-range;
description
"Destination port or range";
}
leaf destination-port-set {
type leafref {
path "/oc-sets:defined-sets/oc-sets:port-sets"
+ "/oc-sets:port-set/oc-sets:name";
}
description
"Reference to a port set
to match the destination port";
}
leaf detail-mode {
type enumeration {
enum EXPLICIT {
description
"Specifies that the mode for matching details at the transport
layer is to explicitly match transport flags.";
}
enum BUILTIN {
description
"Specifies that the mode for matching details at the transport
layer is to using implementation built-ins which may map to
multiple flags.";
}
}
description
"Mode that is used for matching detailed fields at the transport
layer. When EXPLICIT is specified, the implementation should
match based on the explicit flags that are specified in the
corresponding leaf. When BUILTIN is specified, the implementation
must expand the contents of the corresponding leaf to the flags
and/or fields that match the pre-defined built-in values.";
}
leaf explicit-detail-match-mode {
type enumeration {
enum ANY {
description
"Matches of the explicit-detail-flags field are treated as
an OR between the values in the list.";
}
enum ALL {
description
"Matches of the explicit-details-flags field are treated
as an AND of the values in the list.";
}
}
description
"Specifies how the contents of the explicit-details-flags list
are to be treated. ANY implies that any of the flags may match,
where ALL indicates that all the flags must be matched.";
when "../detail-mode = 'EXPLICIT'" {
description
"This leaf is only valid when the mode for matches is specified to
be explicit.";
}
}
leaf-list explicit-tcp-flags {
type identityref {
base oc-pkt-match-types:TCP_FLAGS;
}
description
"An explicit list of the TCP flags that are to be matched. The
mechanism for the match is specified by the explicit-detail-match-mode
leaf.";
when "../detail-mode = 'EXPLICIT'" {
description
"This leaf is only valid when the mode for matches is specified to
be explicit.";
}
}
leaf builtin-detail {
type enumeration {
enum TCP_INITIAL {
description
"Matches the first packet of a TCP session based on a packet
not having the ACK flag set, and having the SYN flag set.";
}
enum TCP_ESTABLISHED {
description
"Matches an established TCP session based on a packet having
the ACK or RST flags set. This does not match the first
packet.";
}
enum FRAGMENT {
description
"Matches non-zero values of the fragment-offset field, indicating
this packet is a follow up to a fragmented datagram.";
}
}
description
"Specifies a built-in (alias) for a match condition that matches
multiple flags, or specifies particular logic as to the flag matches
to be implemented. This leaf is only valid when the detail-match-mode
leaf is BUILTIN.";
when "../detail-mode = 'BUILTIN'" {
description
"This leaf is only valid when the mode for matches is specified to
be builtin.";
}
}
}
grouping transport-fields-state {
description
"State data of transport-fields";
}
grouping transport-fields-top {
description
"Destination transport-fields top level grouping";
container transport {
description
"Transport fields container";
container config {
description
"Configuration data";
uses transport-fields-config;
}
container state {
config false;
description
"State data";
uses transport-fields-config;
uses transport-fields-state;
}
}
}
grouping ip-icmpv4-header-fields-top {
description
"Top grouping for ICMPv4 filtering";
container icmpv4 {
description
"Top container for ICMPv4 filtering";
container config {
description
"Configuration attributes for ICMPv4 filtering";
uses ip-icmpv4-header-fields-config;
}
container state {
description
"State attributes for ICMPv4 filtering";
config false;
uses ip-icmpv4-header-fields-config;
}
}
}
grouping ip-icmpv6-header-fields-top {
description
"Top grouping for ICMPv6 filtering";
container icmpv6 {
description
"Top container for ICMPv6 filtering";
container config {
description
"Configuration attributes for ICMPv6 filtering";
uses ip-icmpv6-header-fields-config;
}
container state {
description
"State attributes for ICMPv6 filtering";
config false;
uses ip-icmpv6-header-fields-config;
}
}
}
grouping ip-icmpv4-header-fields-config {
description
"Collection of ICMPv4 header fields that can be
used to set up a match filter.";
leaf type {
type identityref {
base oc-icmpv4-types:TYPE;
}
description
"ICMPv4 type to be matched.";
reference
"RFC 792: Internet Control Message Protocol";
}
leaf code {
type identityref {
base oc-icmpv4-types:CODE;
}
description
"ICMPv4 code to be matched.";
reference
"RFC 792: Internet Control Message Protocol";
}
}
grouping ip-icmpv6-header-fields-config {
description
"Collection of ICMPv6 header fields that can be
used to set up a match filter.";
leaf type {
type identityref {
base oc-icmpv6-types:TYPE;
}
description
"ICMPv6 type to be matched.";
reference
"RFC 4443: Internet Control Message Protocol (ICMPv6)
for Internet Protocol Version 6 (IPv6)
Specification.";
}
leaf code {
type identityref {
base oc-icmpv6-types:CODE;
}
description
"ICMP code to be matched.";
reference
"RFC 4443: Internet Control Message Protocol (ICMPv6)
for Internet Protocol Version 6 (IPv6)
Specification.";
}
}
}

View File

@@ -1,633 +0,0 @@
module openconfig-platform-types {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/platform-types";
prefix "oc-platform-types";
import openconfig-types { prefix oc-types; }
import openconfig-extensions { prefix oc-ext; }
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module defines data types (e.g., YANG identities)
to support the OpenConfig component inventory model.";
oc-ext:openconfig-version "1.10.0";
revision "2025-07-09" {
description
"Add FPGA, BOOT_LOADER_GRUB, BOOT_LOADER_ONIE";
reference "1.10.0";
}
revision "2024-11-04" {
description
"Add FAN_TRAY_CONTROLLER";
reference "1.9.0";
}
revision "2024-04-30" {
description
"Add FAN_TRAY";
reference "1.8.0";
}
revision "2024-01-30" {
description
"Add component-last-poweroff-reason grouping";
reference "1.7.0";
}
revision "2023-06-27" {
description
"Add WIFI_ACCESS_POINT";
reference "1.6.0";
}
revision "2022-07-28" {
description
"Add grouping for component power management";
reference "1.5.0";
}
revision "2022-03-27" {
description
"Add identity for BIOS";
reference "1.4.0";
}
revision "2022-02-02" {
description
"Add support for component reboot and switchover.";
reference "1.3.0";
}
revision "2021-07-29" {
description
"Add several avg-min-max-instant-stats groupings";
reference "1.2.0";
}
revision "2021-01-18" {
description
"Add identity for software modules";
reference "1.1.0";
}
revision "2019-06-03" {
description
"Add OpenConfig component operating system patch type.";
reference "1.0.0";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.10.1";
}
revision "2018-11-16" {
description
"Added FEC_MODE_TYPE and FEC_STATUS_TYPE";
reference "0.10.0";
}
revision "2018-05-05" {
description
"Added min-max-time to
avg-min-max-instant-stats-precision1-celsius,
added new CONTROLLER_CARD identity";
reference "0.9.0";
}
revision "2018-01-16" {
description
"Added new per-component common data; add temp alarm";
reference "0.8.0";
}
revision "2017-12-14" {
description
"Added anchor containers for component data, added new
component types";
reference "0.7.0";
}
revision "2017-08-16" {
description
"Added power state enumerated type";
reference "0.6.0";
}
revision "2016-12-22" {
description
"Added temperature state variable to component";
reference "0.5.0";
}
// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
// grouping statements
grouping avg-min-max-instant-stats-precision1-celsius {
description
"Common grouping for recording temperature values in
Celsius with 1 decimal precision. Values include the
instantaneous, average, minimum, and maximum statistics";
leaf instant {
type decimal64 {
fraction-digits 1;
}
units celsius;
description
"The instantaneous value of the statistic.";
}
leaf avg {
type decimal64 {
fraction-digits 1;
}
units celsius;
description
"The arithmetic mean value of the statistic over the
sampling period.";
}
leaf min {
type decimal64 {
fraction-digits 1;
}
units celsius;
description
"The minimum value of the statistic over the sampling
period";
}
leaf max {
type decimal64 {
fraction-digits 1;
}
units celsius;
description
"The maximum value of the statistic over the sampling
period";
}
uses oc-types:stat-interval-state;
uses oc-types:min-max-time;
}
grouping avg-min-max-instant-stats-precision2-volts {
description
"Common grouping for recording voltage values in
volts with 2 decimal precision. Values include the
instantaneous, average, minimum, and maximum statistics.
If supported by the device, the time interval over which
the statistics are computed, and the times at which the
minimum and maximum values occurred, are also reported.";
leaf instant {
type decimal64 {
fraction-digits 2;
}
units volts;
description
"The instantaneous value of the statistic.";
}
leaf avg {
type decimal64 {
fraction-digits 2;
}
units volts;
description
"The arithmetic mean value of the statistic over the
sampling period.";
}
leaf min {
type decimal64 {
fraction-digits 2;
}
units volts;
description
"The minimum value of the statistic over the sampling
period";
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units volts;
description
"The maximum value of the statistic over the sampling
period";
}
uses oc-types:stat-interval-state;
uses oc-types:min-max-time;
}
grouping component-last-poweroff-reason {
description
"Common grouping for recording the reason of a component's
power-off state";
leaf trigger {
type component-last-poweroff-reason-trigger;
description
"Records the generic triggers for the last poweroff
event. Component power-off can be triggered
in various ways,
- USER_INITIATED
- SYSTEM_INITIATED
- POWER_FAILURE
This field is not updated during reboots; those are
tracked in the 'last-reboot-reason' leaf.";
}
leaf details {
type string;
description
"Provides a detailed reason for component power-off.
For system-initiated power-offs, this field can include
specific causes (e.g., critical errors resulting in a
controller-card bootloop).";
}
}
grouping component-redundant-role-switchover-reason {
description
"Common grouping for recording the reason of a component's
redundant role switchover. For example two supervisors in
a device, one as primary the other as secondary, switchover
can happen in different scenarios, e.g. user requested,
system error, priority contention, etc.";
leaf trigger {
type component-redundant-role-switchover-reason-trigger;
description
"Records the generic triggers, e.g. user or system
initiated the switchover.";
}
leaf details {
type string;
description
"Records detailed description of why the switchover happens.
For example, when system initiated the switchover, this leaf
can be used to record the specific reason, e.g. due to critical
errors of the routing daemon in the primary role.";
}
}
// identity statements
identity OPENCONFIG_HARDWARE_COMPONENT {
description
"Base identity for hardware related components in a managed
device. Derived identities are partially based on contents
of the IANA Entity MIB.";
reference
"IANA Entity MIB and RFC 6933";
}
identity OPENCONFIG_SOFTWARE_COMPONENT {
description
"Base identity for software-related components in a managed
device";
}
// hardware types
identity CHASSIS {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Chassis component, typically with multiple slots / shelves";
}
identity BACKPLANE {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Backplane component for aggregating traffic, typically
contained in a chassis component";
}
identity FABRIC {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Interconnect between ingress and egress ports on the
device (e.g., a crossbar switch).";
}
identity POWER_SUPPLY {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Component that is supplying power to the device";
}
identity FAN {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Cooling fan, or could be some other heat-reduction component";
}
identity FAN_TRAY {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Contains multiple fans that work in unison to cool the router components.";
}
identity FAN_TRAY_CONTROLLER {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Controls the fan trays.";
}
identity SENSOR {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Physical sensor, e.g., a temperature sensor in a chassis";
}
identity FRU {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Replaceable hardware component that does not have a more
specific defined schema.";
}
identity LINECARD {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Linecard component, typically inserted into a chassis slot";
}
identity CONTROLLER_CARD {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"A type of linecard whose primary role is management or control
rather than data forwarding.";
}
identity PORT {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Physical port, e.g., for attaching pluggables and networking
cables";
}
identity TRANSCEIVER {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Pluggable module present in a port";
}
identity CPU {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Processing unit, e.g., a management processor";
}
identity STORAGE {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"A storage subsystem on the device (disk, SSD, etc.)";
}
identity INTEGRATED_CIRCUIT {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"A special purpose processing unit, typically for traffic
switching/forwarding (e.g., switching ASIC, NPU, forwarding
chip, etc.)";
}
identity WIFI_ACCESS_POINT {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"A device that attaches to a an Ethernet network and creates a wireless
local area network";
}
identity FPGA {
base OPENCONFIG_HARDWARE_COMPONENT;
description
"Field-Programmable Gate Array (FPGA) is a type of integrated circuit
that can be configured after manufacturing. This type should not be
used to represent a switching ASIC";
}
identity OPERATING_SYSTEM {
base OPENCONFIG_SOFTWARE_COMPONENT;
description
"Operating system running on a component";
}
identity OPERATING_SYSTEM_UPDATE {
base OPENCONFIG_SOFTWARE_COMPONENT;
description
"An operating system update - which should be a subcomponent
of the `OPERATING_SYSTEM` running on a component. An update is
defined to be a set of software changes that are atomically
installed (and uninstalled) together. Multiple updates may be
present for the Operating System. A system should not list all
installed software packages using this type -- but rather
updates that are bundled together as a single installable
item";
}
identity BIOS {
base OPENCONFIG_SOFTWARE_COMPONENT;
description
"Legacy BIOS or UEFI firmware interface responsible for
initializing hardware components and first stage boot loader.";
}
identity BOOT_LOADER {
base OPENCONFIG_SOFTWARE_COMPONENT;
description
"Software layer responsible for loading and booting the
device OS or network OS.";
}
identity SOFTWARE_MODULE {
base OPENCONFIG_SOFTWARE_COMPONENT;
description
"A base identity for software modules installed and/or
running on the device. Modules include user-space programs
and kernel modules that provide specific functionality.
A component with type SOFTWARE_MODULE should also have a
module type that indicates the specific type of software module";
}
identity COMPONENT_OPER_STATUS {
description
"Current operational status of a platform component";
}
identity ACTIVE {
base COMPONENT_OPER_STATUS;
description
"Component is enabled and active (i.e., up)";
}
identity INACTIVE {
base COMPONENT_OPER_STATUS;
description
"Component is enabled but inactive (i.e., down)";
}
identity DISABLED {
base COMPONENT_OPER_STATUS;
description
"Component is administratively disabled.";
}
identity FEC_MODE_TYPE {
description
"Base identity for FEC operational modes.";
}
identity FEC_ENABLED {
base FEC_MODE_TYPE;
description
"FEC is administratively enabled.";
}
identity FEC_DISABLED {
base FEC_MODE_TYPE;
description
"FEC is administratively disabled.";
}
identity FEC_AUTO {
base FEC_MODE_TYPE;
description
"System will determine whether to enable or disable
FEC on a transceiver.";
}
identity FEC_STATUS_TYPE {
description
"Base identity for FEC operational statuses.";
}
identity FEC_STATUS_LOCKED {
base FEC_STATUS_TYPE;
description
"FEC is operationally locked.";
}
identity FEC_STATUS_UNLOCKED {
base FEC_STATUS_TYPE;
description
"FEC is operationally unlocked.";
}
// typedef statements
typedef component-power-type {
type enumeration {
enum POWER_ENABLED {
description
"Enable power on the component";
}
enum POWER_DISABLED {
description
"Disable power on the component";
}
}
description
"A generic type reflecting whether a hardware component
is powered on or off";
}
identity COMPONENT_REBOOT_REASON {
description
"Base entity for component reboot reasons.";
}
identity REBOOT_USER_INITIATED {
base COMPONENT_REBOOT_REASON;
description
"User initiated the reboot of the componenent.";
}
identity REBOOT_POWER_FAILURE {
base COMPONENT_REBOOT_REASON;
description
"The component reboots due to power failure.";
}
identity REBOOT_CRITICAL_ERROR {
base COMPONENT_REBOOT_REASON;
description
"The component reboots due to critical errors.";
}
typedef component-redundant-role {
type enumeration {
enum PRIMARY {
description
"Component is acting the primary role.";
}
enum SECONDARY {
description
"Component is acting the secondary role.";
}
}
description
"A generic type reflecting the component's redundanty role.
For example, a device might have dual supervisors components
for redundant purpose, with one being the primary and the
other secondary.";
}
typedef component-redundant-role-switchover-reason-trigger {
type enumeration {
enum USER_INITIATED {
description
"User initiated the switchover, e.g. via command line.";
}
enum SYSTEM_INITIATED {
description
"The system initiated the switchover, e.g. due to
critical errors in the component of the primar role.";
}
}
description
"Records how the role switchover is triggered.";
}
typedef component-last-poweroff-reason-trigger {
type enumeration {
enum USER_INITIATED {
description
"User initiated the power-off, e.g. via command line.";
}
enum SYSTEM_INITIATED {
description
"The system initiated the power-off, e.g. due to
critical errors in the component of the primary role.";
}
enum POWER_FAILURE {
description
"The last power-off was due to power failure.";
}
}
description
"Records how the last power-off was triggered.";
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,485 +0,0 @@
module openconfig-types {
yang-version "1";
namespace "http://openconfig.net/yang/openconfig-types";
prefix "oc-types";
// import statements
import openconfig-extensions { prefix oc-ext; }
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module contains a set of general type definitions that
are used across OpenConfig models. It can be imported by modules
that make use of these types.";
oc-ext:openconfig-version "1.0.0";
revision "2024-01-31" {
description
"Add posix-eregexp type and promote model to version 1.0.0.";
reference "1.0.0";
}
revision "2019-04-16" {
description
"Clarify definition of timeticks64.";
reference "0.6.0";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.5.1";
}
revision "2018-05-05" {
description
"Add grouping of min-max-time and
included them to all stats with min/max/avg";
reference "0.5.0";
}
revision "2018-01-16" {
description
"Add interval to min/max/avg stats; add percentage stat";
reference "0.4.0";
}
revision "2017-08-16" {
description
"Apply fix for ieetfloat32 length parameter";
reference "0.3.3";
}
revision "2017-01-13" {
description
"Add ADDRESS_FAMILY identity";
reference "0.3.2";
}
revision "2016-11-14" {
description
"Correct length of ieeefloat32";
reference "0.3.1";
}
revision "2016-11-11" {
description
"Additional types - ieeefloat32 and routing-password";
reference "0.3.0";
}
revision "2016-05-31" {
description
"OpenConfig public release";
reference "0.2.0";
}
// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
typedef percentage {
type uint8 {
range "0..100";
}
description
"Integer indicating a percentage value";
}
typedef std-regexp {
type string;
description
"This type definition is a placeholder for a standard
definition of a regular expression that can be utilised in
OpenConfig models. Further discussion is required to
consider the type of regular expressions that are to be
supported. An initial proposal is POSIX compatible.";
}
typedef posix-eregexp {
type string;
description
"This is a string which represents an extended POSIX
regular expression.";
reference "IEEE Std 1003.1-2017";
}
typedef timeticks64 {
type uint64;
units "nanoseconds";
description
"The timeticks64 represents the time, modulo 2^64 in
nanoseconds between two epochs. The leaf using this
type must define the epochs that tests are relative to.";
}
typedef ieeefloat32 {
type binary {
length "4";
}
description
"An IEEE 32-bit floating point number. The format of this number
is of the form:
1-bit sign
8-bit exponent
23-bit fraction
The floating point value is calculated using:
(-1)**S * 2**(Exponent-127) * (1+Fraction)";
}
typedef routing-password {
type string;
description
"This type is indicative of a password that is used within
a routing protocol which can be returned in plain text to the
NMS by the local system. Such passwords are typically stored
as encrypted strings. Since the encryption used is generally
well known, it is possible to extract the original value from
the string - and hence this format is not considered secure.
Leaves specified with this type should not be modified by
the system, and should be returned to the end-user in plain
text. This type exists to differentiate passwords, which
may be sensitive, from other string leaves. It could, for
example, be used by the NMS to censor this data when
viewed by particular users.";
}
typedef stat-interval {
type uint64;
units nanoseconds;
description
"A time interval over which a set of statistics is computed.
A common usage is to report the interval over which
avg/min/max stats are computed and reported.";
}
grouping stat-interval-state {
description
"Reusable leaf definition for stats computation interval";
leaf interval {
type oc-types:stat-interval;
description
"If supported by the system, this reports the time interval
over which the min/max/average statistics are computed by
the system.";
}
}
grouping min-max-time {
description
"Common grouping for recording the absolute time at which
the minimum and maximum values occurred in the statistics";
leaf min-time {
type oc-types:timeticks64;
description
"The absolute time at which the minimum value occurred.
The value is the timestamp in nanoseconds relative to
the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
}
leaf max-time {
type oc-types:timeticks64;
description
"The absolute time at which the maximum value occurred.
The value is the timestamp in nanoseconds relative to
the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
}
}
grouping avg-min-max-stats-precision1 {
description
"Common nodes for recording average, minimum, and
maximum values for a statistic. These values all have
fraction-digits set to 1. Statistics are computed
and reported based on a moving time interval (e.g., the last
30s). If supported by the device, the time interval over which
the statistics are computed is also reported.";
leaf avg {
type decimal64 {
fraction-digits 1;
}
description
"The arithmetic mean value of the statistic over the
time interval.";
}
leaf min {
type decimal64 {
fraction-digits 1;
}
description
"The minimum value of the statistic over the time
interval.";
}
leaf max {
type decimal64 {
fraction-digits 1;
}
description
"The maximum value of the statitic over the time
interval.";
}
uses stat-interval-state;
uses min-max-time;
}
grouping avg-min-max-instant-stats-precision1 {
description
"Common grouping for recording an instantaneous statistic value
in addition to avg-min-max stats";
leaf instant {
type decimal64 {
fraction-digits 1;
}
description
"The instantaneous value of the statistic.";
}
uses avg-min-max-stats-precision1;
}
grouping avg-min-max-instant-stats-precision2-dB {
description
"Common grouping for recording dB values with 2 decimal
precision. Values include the instantaneous, average,
minimum, and maximum statistics. Statistics are computed
and reported based on a moving time interval (e.g., the last
30s). If supported by the device, the time interval over which
the statistics are computed, and the times at which the minimum
and maximum values occurred, are also reported.";
leaf instant {
type decimal64 {
fraction-digits 2;
}
units dB;
description
"The instantaneous value of the statistic.";
}
leaf avg {
type decimal64 {
fraction-digits 2;
}
units dB;
description
"The arithmetic mean value of the statistic over the
time interval.";
}
leaf min {
type decimal64 {
fraction-digits 2;
}
units dB;
description
"The minimum value of the statistic over the time interval.";
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units dB;
description
"The maximum value of the statistic over the time
interval.";
}
uses stat-interval-state;
uses min-max-time;
}
grouping avg-min-max-instant-stats-precision2-dBm {
description
"Common grouping for recording dBm values with 2 decimal
precision. Values include the instantaneous, average,
minimum, and maximum statistics. Statistics are computed
and reported based on a moving time interval (e.g., the last
30s). If supported by the device, the time interval over which
the statistics are computed, and the times at which the minimum
and maximum values occurred, are also reported.";
leaf instant {
type decimal64 {
fraction-digits 2;
}
units dBm;
description
"The instantaneous value of the statistic.";
}
leaf avg {
type decimal64 {
fraction-digits 2;
}
units dBm;
description
"The arithmetic mean value of the statistic over the
time interval.";
}
leaf min {
type decimal64 {
fraction-digits 2;
}
units dBm;
description
"The minimum value of the statistic over the time
interval.";
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units dBm;
description
"The maximum value of the statistic over the time interval.";
}
uses stat-interval-state;
uses min-max-time;
}
grouping avg-min-max-instant-stats-precision2-mA {
description
"Common grouping for recording mA values with 2 decimal
precision. Values include the instantaneous, average,
minimum, and maximum statistics. Statistics are computed
and reported based on a moving time interval (e.g., the last
30s). If supported by the device, the time interval over which
the statistics are computed, and the times at which the minimum
and maximum values occurred, are also reported.";
leaf instant {
type decimal64 {
fraction-digits 2;
}
units mA;
description
"The instantaneous value of the statistic.";
}
leaf avg {
type decimal64 {
fraction-digits 2;
}
units mA;
description
"The arithmetic mean value of the statistic over the
time interval.";
}
leaf min {
type decimal64 {
fraction-digits 2;
}
units mA;
description
"The minimum value of the statistic over the time
interval.";
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units mA;
description
"The maximum value of the statistic over the time
interval.";
}
uses stat-interval-state;
uses min-max-time;
}
grouping avg-min-max-instant-stats-pct {
description
"Common grouping for percentage statistics.
Values include the instantaneous, average,
minimum, and maximum statistics. Statistics are computed
and reported based on a moving time interval (e.g., the last
30s). If supported by the device, the time interval over which
the statistics are computed, and the times at which the minimum
and maximum values occurred, are also reported.";
leaf instant {
type oc-types:percentage;
description
"The instantaneous percentage value.";
}
leaf avg {
type oc-types:percentage;
description
"The arithmetic mean value of the percentage measure of the
statistic over the time interval.";
}
leaf min {
type oc-types:percentage;
description
"The minimum value of the percentage measure of the
statistic over the time interval.";
}
leaf max {
type oc-types:percentage;
description
"The maximum value of the percentage measure of the
statistic over the time interval.";
}
uses stat-interval-state;
uses min-max-time;
}
identity ADDRESS_FAMILY {
description
"A base identity for all address families";
}
identity IPV4 {
base ADDRESS_FAMILY;
description
"The IPv4 address family";
}
identity IPV6 {
base ADDRESS_FAMILY;
description
"The IPv6 address family";
}
identity MPLS {
base ADDRESS_FAMILY;
description
"The MPLS address family";
}
identity L2_ETHERNET {
base ADDRESS_FAMILY;
description
"The 802.3 Ethernet address family";
}
}

View File

@@ -1,250 +0,0 @@
module openconfig-yang-types {
yang-version "1";
namespace "http://openconfig.net/yang/types/yang";
prefix "oc-yang";
import openconfig-extensions { prefix "oc-ext"; }
organization
"OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module contains a set of extension types to the
YANG builtin types that are used across multiple
OpenConfig models.
Portions of this code were derived from IETF RFC 6021.
Please reproduce this note if possible.
IETF code is subject to the following copyright and license:
Copyright (c) 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).";
oc-ext:openconfig-version "1.0.0";
revision "2024-05-30" {
description
"Add hex-string-prefixed typedef";
reference "1.0.0";
}
revision "2021-07-14" {
description
"Use auto-generated regex for certain pattern statements:
- dotted-quad
- date-and-time
- date
For date-and-time, allow lowercase z and t in the pattern.";
reference "0.3.1";
}
revision "2021-03-02" {
description
"Fix date-and-time and date's pattern statement, and remove the
regexp-posix extension, which makes pattern statements conform to the
YANG standard.";
reference "0.3.0";
}
revision "2020-06-30" {
description
"Add OpenConfig POSIX pattern extensions.";
reference "0.2.2";
}
revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.2.1";
}
revision 2018-04-24 {
description
"Add date typedef";
reference "0.2.0";
}
revision 2017-07-30 {
description
"Fixed unprintable character";
reference "0.1.2";
}
revision 2017-04-03 {
description
"Update copyright notice.";
reference "0.1.1";
}
revision 2017-01-26 {
description
"Initial module for inet types";
reference "0.1.0";
}
// OpenConfig specific extensions for module metadata.
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";
typedef dotted-quad {
type string {
pattern
'([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}';
oc-ext:posix-pattern
'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|'
+ '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3})$';
}
description
"An unsigned 32-bit integer expressed as a dotted quad. The
format is four octets written as decimal numbers separated
with a period character.";
}
typedef hex-string {
status deprecated;
type string {
pattern '[0-9a-fA-F]*';
oc-ext:posix-pattern '^[0-9a-fA-F]*$';
}
description
"A string consisting of a hexadecimal characters. This leaf is
deprecated and will removed in a future version of this model.
The type hex-string-prefixed should be used instead.";
}
typedef hex-string-prefixed {
type string {
pattern '(0x)([0-9a-fA-F]{2})*';
oc-ext:posix-pattern '^(0x)([0-9a-fA-F]{2})*$';
length "3..max";
}
description
"A string encoding a hexadecimal number with a prefix of '0x' followed
by a list of bytes.";
}
typedef counter32 {
type uint32;
description
"A 32-bit counter. A counter value is a monotonically increasing
value which is used to express a count of a number of
occurrences of a particular event or entity. When the counter
reaches its maximum value, in this case 2^32-1, it wraps to 0.
Discontinuities in the counter are generally triggered only when
the counter is reset to zero.";
}
typedef counter64 {
type uint64;
description
"A 64-bit counter. A counter value is a monotonically increasing
value which is used to express a count of a number of
occurrences of a particular event or entity. When a counter64
reaches its maximum value, 2^64-1, it loops to zero.
Discontinuities in a counter are generally triggered only when
the counter is reset to zero, through operator or system
intervention.";
}
typedef date-and-time {
type string {
pattern
'[0-9]{4}\-(0[1-9]|1[0-2])\-(0[1-9]|[12][0-9]|3[01])[Tt](0[0-9]|'
+ '1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9]|'
+ '60)(\.[0-9]+)?([Zz]|([+-](0[0-9]|1[0-9]|2[0-3]):(0[0-9]|'
+ '[1-5][0-9])))';
oc-ext:posix-pattern
'^([0-9]{4}\-(0[1-9]|1[0-2])\-(0[1-9]|[12][0-9]|3[01])[Tt](0[0-9]|'
+ '1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9]|'
+ '60)(\.[0-9]+)?([Zz]|([+-](0[0-9]|1[0-9]|2[0-3]):(0[0-9]|'
+ '[1-5][0-9]))))$';
}
description
"A date and time, expressed in the format described in RFC3339.
That is to say:
YYYY-MM-DDTHH:MM:SSZ+-hh:mm
where YYYY is the year, MM is the month expressed as a two-digit
month (zero padding if required), DD is the day of the month,
expressed as a two digit value. T is the literal character 'T',
HH is the hour of the day expressed as a two digit number, using
the 24-hour clock, MM is the minute of the hour expressed as a
two digit number. Z is the literal character 'Z', followed by a
timezone offset expressed in hours (hh) and minutes (mm), both
expressed as two digit numbers. The time offset is specified as
a positive or negative offset to UTC using the '+' or '-'
character preceding the offset.
Optionally, fractional seconds can be expressed after the minute
of the hour as a decimal number of unspecified precision
reflecting fractions of a second.";
reference
"RFC3339 - Date and Time on the Internet: Timestamps";
}
typedef date {
type string {
pattern
'[0-9]{4}\-(0[1-9]|1[0-2])\-(0[1-9]|[12][0-9]|3[01])';
oc-ext:posix-pattern
'^([0-9]{4}\-(0[1-9]|1[0-2])\-(0[1-9]|[12][0-9]|3[01]))$';
}
description
"A full UTC date, expressed in the format described in RFC3339.
That is to say:
YYYY-MM-DD
where YYYY is the year, MM is the month expressed as a two-digit
month (zero padding if required), DD is the day of the month,
expressed as a two digit value.";
reference
"RFC3339 - Date and Time on the Internet: full-date";
}
typedef gauge64 {
type uint64;
description
"A gauge value may increase or decrease - and reflects a value
at a particular point in time. If the value of the variable
being modeled using the gauge exceeds its maximum - 2^64-1 in
this case - the gauge is set to its maximum value.";
}
typedef phys-address {
type string {
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
oc-ext:posix-pattern '^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?$';
}
description
"A physical layer address, expressed as a series of pairs of
hexadecimal digits.";
}
typedef mac-address {
type string {
pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
oc-ext:posix-pattern '^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$';
}
description
"An IEEE 802 MAC address";
}
}

View File

@@ -0,0 +1,97 @@
import json
import re
import pandas as pd
import ipaddress
import time
from collections import deque
from openpyxl import load_workbook
from scripts.style_excel.style_matrice_routage import style_matrice_routage
def is_pure_cidr(value):
try:
ipaddress.ip_network(value, strict=False)
return True
except ValueError:
return False
def export_to_excel(json_file_path, output_file_excel):
"""
Export firewall data from JSON to Excel
Args:
json_file_path: Path to the JSON file to process
output_file_excel: Path to the output Excel file
"""
with open(json_file_path, "r", encoding="utf-8") as f:
data = json.load(f)
address_objects = {}
addr_objs = data.get(
"custom-firewall-objects:firewall-objects", {}
).get("address", [])
for obj in addr_objs:
name = obj.get("name")
ip_netmask = obj.get("config", {}).get("ip_netmask")
if name and ip_netmask:
address_objects[name] = ip_netmask
rows = []
network_instances = data.get(
"openconfig-network-instance:network-instances", {}
).get("network-instance", [])
for ni in network_instances:
equipement = ni.get("name", "")
protocols = ni.get("protocols", {}).get("protocol", [])
for proto in protocols:
if proto.get("identifier") != "STATIC":
continue
static_routes = proto.get("static-routes", {}).get("static", [])
for route in static_routes:
prefix = route.get("prefix", "")
# Découpage réseau / masque
resolved_prefix = prefix
if not is_pure_cidr(prefix):
resolved_prefix = address_objects.get(prefix, prefix)
try:
net = ipaddress.ip_network(resolved_prefix, strict=False)
reseau = str(net.network_address)
masque = str(net.netmask)
except ValueError:
reseau = resolved_prefix
masque = ""
next_hops = route.get("next-hops", {}).get("next-hop", [])
for nh in next_hops:
nh_config = nh.get("config", {})
rows.append({
"Equipement": equipement,
"Réseau destination": reseau,
"Masque": masque,
"Next Hop": nh_config.get("next-hop", ""),
"Metrique": nh_config.get("metric", ""),
"Commentaire": prefix
})
df = pd.DataFrame(rows)
with pd.ExcelWriter(output_file_excel, engine="openpyxl") as writer:
df.to_excel(writer,sheet_name="Routes statiques",index=False,startrow=1)
wb = load_workbook(output_file_excel)
if "Sheet1" in wb.sheetnames:
del wb["Sheet1"]
style_matrice_routage(wb["Routes statiques"])
wb.save(output_file_excel)
print(f"✓ Export Excel OK: {output_file_excel}")
return output_file_excel

View File

@@ -103,12 +103,43 @@ class ForcepointParser(ParserMixin):
self.config['interfaces'].append(Interface(name=name, ip=ip_addr, netmask=netmask, comment=comment))
def _parse_virtual_routers(self):
"""Parse routeurs simples"""
for router in self.root.findall(".//router"):
name = router.get("name")
ip = router.find("mvia_address")
ip_addr = ip.get("address") if ip is not None else None
self.config['virtual_routers'].append(VirtualRouter(name=name, interfaces=[ip_addr] if ip_addr else [], static_routes=[]))
"""Parse les virtual routers avec interfaces et routes statiques"""
for router in self.root.findall(".//routing_node"):
vr_name = router.get("name")
interfaces = []
static_routes = []
for iface in router.findall(".//interface_rn_level"):
iface_name = iface.get("name", None)
for network in iface.findall(".//network_rn_level"):
for gw in network.findall(".//gateway_rn_level"):
for ip_entry in gw.findall(".//ipaddress_behind_router"):
gw_ip = ip_entry.get("gateway")
ip_cidr = ip_entry.get("ipaddress")
static_routes.append(
StaticRoute(
name=f"{vr_name}_{ip_cidr}",
destination=ip_cidr,
metric=0,
next_hop_ip=gw_ip,
interface=iface_name
)
)
if gw_ip:
interfaces.append(gw_ip)
interfaces = list(set(interfaces))
self.config['virtual_routers'].append(
VirtualRouter(
name=vr_name,
interfaces=interfaces,
static_routes=static_routes
)
)
def _parse_security_rules(self):
"""Parse règles FW Forcepoint"""

View File

@@ -196,59 +196,95 @@ class StormshieldParser(ParserMixin):
if not os.path.exists(route_path):
return
virtual_routers = {}
default_route = None
section = None
with open(route_path, encoding="utf-8", errors="ignore") as f:
for raw_line in f:
line = raw_line.strip()
if not line or line.startswith("#"):
if not line or line.startswith("off") or line.startswith("#"):
continue
if line.startswith("[") and line.endswith("]"):
section = line.strip("[]")
continue
# ===== Default route =====
if section == "Config" and line.startswith("DefaultRoute="):
self.config["default_route"] = line.split("=", 1)[1].strip()
default_route = line.split("=", 1)[1].strip()
elif section == "StaticRoutes" and not line.startswith("#"):
parts = line.split(",")
if len(parts) >= 2:
self.config["static_routes"].append({
"destination": parts[0],
"interface": parts[1],
"extra": parts[2:] if len(parts) > 2 else []
})
# ===== Static routes =====
elif section == "StaticRoutes":
parts = [p.strip() for p in line.split(",")]
if len(parts) < 2:
continue
static_routes = []
if self.config["default_route"]:
static_routes.append(
destination = parts[0]
vr_name = None
interface = None
next_hop_ip = None
# Format : VR->NextHop
if "->" in parts[1]:
vr_name, next_hop_ip = map(str.strip, parts[1].split("->", 1))
interface = vr_name
else:
vr_name = parts[1]
interface = parts[1]
# Création VR si absent
if vr_name not in virtual_routers:
virtual_routers[vr_name] = {
"interfaces": set(),
"static_routes": []
}
virtual_routers[vr_name]["interfaces"].add(interface)
static_route = StaticRoute(
name=f"{vr_name}-static-{len(virtual_routers[vr_name]['static_routes']) + 1}",
destination=destination,
metric=None,
next_vr=None,
next_hop_ip=next_hop_ip,
interface=interface,
bfd_profile=None
)
virtual_routers[vr_name]["static_routes"].append(static_route)
# ===== Default VR (route par défaut) =====
if default_route:
vr_name = "default"
virtual_routers.setdefault(vr_name, {
"interfaces": set(),
"static_routes": []
})
virtual_routers[vr_name]["static_routes"].insert(
0,
StaticRoute(
name="default-route",
destination="0.0.0.0/0",
metric=1,
next_hop_ip=self.config["default_route"],
interface=None
next_vr=None,
next_hop_ip=default_route,
interface=None,
bfd_profile=None
)
)
for idx, route in enumerate(self.config["static_routes"]):
static_routes.append(
StaticRoute(
name=f"static-{idx+1}",
destination=route["destination"],
metric=1,
next_hop_ip=None,
interface=route["interface"]
)
# ===== Construction finale =====
self.config["virtual_routers"] = [
VirtualRouter(
name=vr_name,
interfaces=list(data["interfaces"]),
static_routes=data["static_routes"]
)
vr = VirtualRouter(
name="default-vr",
interfaces=[r["interface"] for r in self.config["static_routes"]],
static_routes=static_routes
)
self.config["virtual_routers"] = [vr]
for vr_name, data in virtual_routers.items()
]
# def _parse_slotinfo_file(self):
# path = os.path.join(self.base_dir, "Filter", "slotinfo")

View File

@@ -0,0 +1,58 @@
from openpyxl.styles import Alignment, PatternFill, Font, Border, Side
from openpyxl.utils import get_column_letter
def style_matrice_routage(ws):
headers = [
"Equipement",
"Réseau destination",
"Masque",
"Next Hop",
"Metrique",
"Commentaire"
]
header_fill = PatternFill("solid", fgColor="1F4E78")
header_font = Font(color="FFFFFF", bold=True)
header_alignment = Alignment(horizontal="center", vertical="center")
cell_alignment_left = Alignment(horizontal="left", vertical="center")
cell_alignment_center = Alignment(horizontal="center", vertical="center")
thin_border = Border(
left=Side(style="thin"),
right=Side(style="thin"),
top=Side(style="thin"),
bottom=Side(style="thin")
)
for col_idx, header in enumerate(headers, start=1):
cell = ws.cell(row=1, column=col_idx, value=header)
cell.fill = header_fill
cell.font = header_font
cell.alignment = header_alignment
cell.border = thin_border
column_widths = {
"A": 22, # Equipement
"B": 22, # Réseau destination
"C": 18, # Masque
"D": 20, # Next Hop
"E": 12, # Metrique
"F": 30 # Commentaire
}
for col_letter, width in column_widths.items():
ws.column_dimensions[col_letter].width = width
for row in ws.iter_rows(min_row=2, max_row=ws.max_row, max_col=len(headers)):
for cell in row:
cell.border = thin_border
if cell.column in (1, 2, 4, 6):
cell.alignment = cell_alignment_left
else:
cell.alignment = cell_alignment_center
ws.freeze_panes = "A2"
ws.auto_filter.ref = ws.dimensions