Gaurav Agrawal
Committed by Gerrit Code Review

[Hummingbird - ONOS4647] Check for the standard l3vpn yang

Change-Id: I3008b9da2ed61c8902789abd064b8f77dfa73245
(cherry picked from commit f6e6037b)
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.ietfyang;
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Test;
import org.onosproject.yangutils.linker.impl.YangLinkerManager;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.plugin.manager.YangUtilManager;
import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
import java.io.IOException;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
/**
* Test cases for testing IETF YANG files.
*/
public class IetfYangFileTest {
private final YangUtilsParserManager manager = new YangUtilsParserManager();
private final YangUtilManager utilManager = new YangUtilManager();
private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
/**
* Checks hierarchical intra with inter file type linking.
* Reference: https://datatracker.ietf.org/doc/draft-zha-l3sm-l3vpn-onos-deployment
*/
@Test
public void l3vpnserviceyang()
throws IOException, ParserException, MojoExecutionException {
String searchDir = "src/test/resources/ietfyang/l3vpnservice";
utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/ietfyang/l3vpnservice/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
deleteDirectory(userDir + "/target/ietfyang/");
}
}
module ietf-inet-types {
yang-version 1;
namespace
"urn:ietf:params:xml:ns:yang:ietf-inet-types";
prefix inet;
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 for Internet addresses and related things.
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:
- ip-address-no-zone
- ipv4-address-no-zone
- 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";
}
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 2460.";
}
}
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 2460: 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 2460: 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. A current list of
all assignments is available from <http://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 793: Transmission Control Protocol
RFC 4960: Stream Control Transmission Protocol
RFC 4340: Datagram Congestion Control Protocol (DCCP)
RFC 4001: Textual Conventions for Internet Network Addresses";
}
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";
}
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])(%[\p{N}\p{L}]+)?';
}
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.
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])))(%[\p{N}\p{L}]+)?';
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.
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
ipv4-address, may be used in situations where the zone is
known from the context and hence 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
ipv6-address, may be used in situations where the zone is
known from the context and hence 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-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 address 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.";
}
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 address 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 IPv6 address should have all bits that do not belong
to the prefix set to zero.
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.";
reference
"RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
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.
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.
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 2782: A DNS RR for specifying the location of services
(DNS SRV)
RFC 5890: Internationalized Domain Names in Applications
(IDNA): Definitions and Document Framework";
}
typedef host {
type union {
type ip-address;
type domain-name;
}
description
"The host type represents either an IP address or a DNS
domain name.";
}
typedef uri {
type string;
description
"The uri type represents a Uniform Resource Identifier
(URI) as defined by STD 66.
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. All unnecessary
percent-encoding is removed, and all case-insensitive
characters are set to lowercase except for hexadecimal
digits, which are normalized to uppercase as described in
Section 6.2.2.1.
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)";
}
} // module ietf-inet-types
module ietf-sd-onos-common-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-common-types";
prefix types ;
/*
import ietf-inet-types{
prefix inet;
}
import ietf-yang-types {
prefix yang-types;
}
*/
organization "";
contact "";
description
"Defines common basic types of L3VPN.";
revision "2015-12-16" {
reference "";
}
typedef admin-status {
type enumeration {
enum admin-up {
value 0 ;
description "admin up, the operate-status is depend on the real
running status ." ;
}
enum admin-down {
value 1 ;
description "admin down,the operate-status is forced to down no
matter what the real status is" ;
}
enum config-up {
value 2 ;
description "the operate-status is forced to up no matter what
the real status is." ;
}
}
default admin-up;
description
"The administration status of the service.";
}
typedef notification-status {
type enumeration {
enum up {
value 0 ;
description "up." ;
}
enum down {
value 1 ;
description "down." ;
}
}
default up;
description
"The notification status of the service.";
}
typedef notification-type {
type enumeration {
enum ne{
value 0 ;
description "ncd change." ;
}
enum link{
value 1 ;
description "link change." ;
}
enum ltp{
value 2 ;
description "ltp change." ;
}
}
default ltp;
description
"The notification-type of the service.";
}
typedef operate-status {
type enumeration {
enum operate-up {
value 0 ;
description "operate up." ;
}
enum operate-down {
value 1 ;
description "operate down." ;
}
}
default operate-up;
description
"The operation status of the service.";
}
grouping command-result {
description
"Reusable container of the result of the command.";
container command-result {
description
"The result of the command.";
leaf result {
type int8;
description
"1 : success, 2 : failed, 3 : partly failed" ;
}
container success-resources {
description
"The resources those are available." ;
list success-resource-list {
description
"The resource list shows those are available." ;
leaf resource-id {
type string;
description
"The available resource id." ;
}
}
}
container failed-resources {
description
"The resources those are failed." ;
list failed-resource-list {
description
"The resources list shows those are failed." ;
leaf resource-id {
type string;
description
"The failed resources ids." ;
}
leaf error-code {
type string;
description
"The error code." ;
}
}
}
}
}
}
module ietf-sd-onos-service-l3vpn {
namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-l3vpn";
prefix l3vpn ;
/*
import ietf-inet-types{
prefix inet;
}
import ietf-yang-types {
prefix yang-types;
}
*/
import ietf-sd-onos-service-types {
prefix service-types;
}
import ietf-sd-onos-common-types {
prefix types;
}
organization "";
contact "";
description
"L3vpn configuration model in ONOS.";
revision "2015-12-16" {
reference "";
}
grouping l3vpn {
description
"The configuration module of l3 vpn.";
leaf name {
type string ;
mandatory true;
description "name of snc eline." ;
}
leaf id {
type uint32 ;
mandatory true;
description "ID of snc eline." ;
}
leaf user-label {
type string ;
description "user label of snc eline." ;
}
leaf parent-ncd-id {
type string ;
description "parent ncd id." ;
}
leaf admin-status {
type types:admin-status;
description "administration status." ;
}
leaf operate-status {
type types:operate-status;
description "operation status." ;
}
uses service-type-grouping;
container acess-information {
description "access information of the l3 vpn." ;
uses service-types:l3-ac; }
container protect-policy{
description "L3VPN Service protect policy." ;
uses service-types:protect-policy;
}
container tunnel-service {
description "tunnel service." ;
uses service-types:tunnel-service;
}
}
grouping service-type-grouping {
description "Basic service type" ;
leaf service-topology {
type enumeration {
enum full-mesh {
value 1 ;
description "full-mesh." ;
}
enum hub-spoke {
value 2 ;
description "hub-spoke." ;
}
}
default full-mesh;
description "service topology type." ;
}
}
container service {
description
"Root level of L3vpn service module.";
container l3vpn-cfg {
description
"L3vpn configuration model in ONOS.";
list vpn-cfg {
key name;
description
"vpn configuration parameter list.";
uses l3vpn;
}
}
container service-paths {
description
"The service path of the l3 vpn.";
}
}
rpc create-l3vpn-instance {
description "Create l3vpn instance." ;
input {
container l3vpn-instance {
description "Create l3vpn instance." ;
uses l3vpn;
}
}
}
rpc delete-l3vpn-instance {
description "Delete l3vpn instance." ;
input {
leaf l3vpn-id {
type string;
description "vpn id." ;
}
}
}
rpc close-l3vpn {
description "Close l3vpn." ;
input {
leaf l3vpn-id {
type string;
description "vpn id." ;
}
container ac-status {
description "Access status of the vpn." ;
list acs{
key "id";
description "Access information." ;
leaf id {
type string;
description "Access id." ;
}
leaf admin-status {
type types:admin-status;
description "Administration status." ;
}
}
}
}
}
rpc modify-l3vpn-instance-basic {
description "Modify l3vpn instance basic information." ;
input {
leaf l3vpn-id {
type string;
description "vpn id." ;
}
leaf user-label {
type string ;
description "user label." ;
}
}
}
rpc modify-l3vpn-instance-ac-qos {
description "Modify l3vpn instance ac qos information." ;
input {
leaf l3vpn-id {
type string;
description "L3vpn ID." ;
}
container ac-qos {
description "ac qos information." ;
list acs{
key "id";
description "acs list." ;
leaf id {
type string;
description "acs ID." ;
}
container qos-policy {
description "qos policy." ;
container qos-if-cars {
description "cars qos policy." ;
uses service-types:qos-if-car;
}
}
}
}
}
}
rpc modify-l3vpn-instance-connection {
description "Modify a l3vpn connection." ;
input {
leaf l3vpn-id {
type string;
description "L3vpn ID." ;
}
container ac-connection {
description "ac connection." ;
list acs{
key "id";
description "acs ID." ;
leaf id {
type string ;
description "acs ID." ;
}
container connection {
description "CE to PE connection." ;
uses service-types:connection;
}
}
}
}
}
rpc inquire-l3vpn-instance-work-path {
description "Inquire a L3VPN instance work path." ;
input {
leaf service-id {
type string;
description "service ID." ;
}
leaf ingress-ne-id {
type string ;
description "ingress network element ID." ;
}
leaf destination-ne-id {
type string ;
description "destination network element ID." ;
}
leaf ingress-ac-id {
type string ;
description "ingress ac ID." ;
}
leaf destination-ac-id {
type string ;
description "destination ac ID." ;
}
leaf path-layer {
type string ;
description "path layer." ;
}
leaf path-role {
type string ;
description "path role." ;
}
}
output {
container service-path {
description "service path." ;
leaf service-id {
type string;
description "service ID." ;
}
leaf ingress-ne-id {
type string ;
description "ingress network element ID." ;
}
leaf destination-ne-id {
type string ;
description "destination network element ID." ;
}
leaf ingress-ac-id {
type string ;
description "ingress access circuit ID." ;
}
leaf destination-ac-id {
type string ;
description "destination access circuit ID." ;
}
leaf path-layer {
type string ;
description "path layer." ;
}
leaf path-role {
type string ;
description "path role." ;
}
list path-list {
key "ne-id";
description "path list." ;
leaf ne-id {
type string;
description "network element ID." ;
}
leaf ingress-ltp-id {
type string;
description "LTP ID." ;
}
leaf backward-peer-id {
type string;
description "backward peer ID." ;
}
leaf egress-ltp-id {
type string;
description "egress ltp ID." ;
}
leaf forward-peer-id {
type string;
description "forward peer ID." ;
}
}
}
}
}
}
module ietf-sd-onos-service-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-types";
prefix service-types ;
import ietf-inet-types {prefix inet; }
import ietf-sd-onos-common-types {prefix types;}
organization "";
contact "";
description
"Defines basic service types for L3VPN service.";
revision "2015-12-16" {
reference "";
}
typedef exp {
type enumeration {
enum BE {
value 0 ;
description "BE." ;
}
enum AF1 {
value 1 ;
description "AF1." ;
}
enum AF2 {
value 2 ;
description "AF2." ;
}
enum AF3 {
value 3 ;
description "AF3." ;
}
enum AF4 {
value 4 ;
description "AF4." ;
}
enum EF {
value 5 ;
description "EF." ;
}
enum CS6 {
value 6 ;
description "CS6." ;
}
enum CS7 {
value 7 ;
description "CS7." ;
}
}
default CS7;
description
"exp parameter.";
}
typedef pw-role{
type enumeration {
enum normal{
value 0 ;
description "normal." ;
}
enum master {
value 1 ;
description "master." ;
}
enum slave {
value 2 ;
description "slave." ;
}
enum DNI-PW {
value 3 ;
description "DNI PW." ;
}
}
default normal;
description
"The role of the PW.";
}
grouping qos-if-car {
description "qos parameter." ;
list qos-if-car {
key "direction";
description "cars qos policy." ;
leaf direction {
type enumeration {
enum inbound{
value 0 ;
description "inbound." ;
}
enum outbound {
value 1 ;
description "outbound." ;
}
}
description "qos for interface car" ;
}
leaf cir {
type int32;
description "forward CIR. unit:Kbps" ;
}
leaf pir {
type int32;
description "forward PIR. unit:Kbps" ;
}
leaf cbs {
type int32;
description "forward CBS. unit:Kbps" ;
}
leaf pbs {
type int32;
description "forward PBS. unit:Kbps" ;
}
}
}
grouping protect-policy {
description "The protect policy of the VPN" ;
leaf protect-type {
type enumeration {
enum unprotected {
value 0 ;
description "unprotected." ;
}
enum protected {
value 1 ;
description "protection." ;
}
}
default unprotected ;
description "protection type" ;
}
leaf revertive-type {
type enumeration {
enum no-revertive {
value 0 ;
description "unprotected." ;
}
enum revertive {
value 1 ;
description "protection." ;
}
}
description "revertive mode" ;
}
leaf wtr {
type uint32;
default 300;
description "WTR.unit:s" ;
}
}
grouping oam-policy {
description "The oam policy of the vpn service." ;
leaf detect-type {
type enumeration {
enum undetect {
value 0 ;
description "unprotected." ;
}
enum APS {
value 1 ;
description "protection." ;
}
enum BFD {
value 2 ;
description "unprotected." ;
}
}
description "detect type" ;
}
container bfd-detect-para {
description "bfd detect parameters." ;
leaf ingress-discriminator {
type int32;
description "ingress-discriminator" ;
}
leaf egress-discriminator {
type int32;
description "egress-discriminator" ;
}
leaf tx-interval {
type int32;
description "tx-interval" ;
}
leaf rx-interval {
type int32;
description "rx-interval" ;
}
leaf detect-interval {
type int32;
description "detect-interval" ;
}
}
}
grouping ac {
description "Access information." ;
leaf id{
type string;
mandatory true;
description "ac id." ;
}
leaf name{
type string;
config false;
description "ac name." ;
}
leaf ne-id {
type string ;
mandatory true;
description "ne id." ;
}
leaf ltp-id {
type string ;
mandatory true;
description "ltp id." ;
}
leaf admin-status {
type types:admin-status;
description "Administration status." ;
}
leaf operate-status {
type types:operate-status;
description "Operation status." ;
}
container l2-access {
description "link layer access information of ac." ;
uses l2-access;
}
leaf role {
type enumeration {
enum master {
value 0 ;
description "master." ;
}
enum slave {
value 1 ;
description "slave." ;
}
enum hub {
value 2 ;
description "slave." ;
}
enum spoke {
value 3 ;
description "slave." ;
}
}
default master;
description "role of snc lsp." ;
}
container qos-policy {
description "The qos policy of the vpn service." ;
container qos-if-cars {
description "qos policy if car." ;
list qos-if-car {
//key "direction";
uses qos-if-car;
description "List of qos parameters." ;
}
}
}
}
grouping l3-ac {
description "Access information of l3vpn." ;
list access-circuit {
key "id";
description "list of access circuit." ;
uses ac;
container connection {
description "connection information of ac." ;
uses connection;
}
}
}
grouping l2-access {
description "Access information of l2vpn." ;
leaf access-type{
type enumeration {
enum Port {
value 0 ;
description "master." ;
}
enum Dot1Q {
value 1 ;
description "slave." ;
}
enum QinQ {
value 2 ;
description "master." ;
}
}
mandatory true;
description "The access type of the vpn service." ;
}
leaf dot1q-vlan-bitmap {
type string;
mandatory true;
description "Dot1Q Vlan Bitmap." ;
}
leaf qinq-svlan-bitmap {
type string;
mandatory true;
description "QinQ svlan Bitmap." ;
}
leaf qinq-cvlan-bitmap {
type string;
mandatory true;
description "QinQ cvlan Bitmap." ;
}
leaf access-action {
type enumeration {
enum Keep {
value 0 ;
description "keep." ;
}
enum Push {
value 1 ;
description "push." ;
}
enum Pop {
value 2 ;
description "pop." ;
}
enum Swap {
value 3 ;
description "swap." ;
}
}
mandatory true;
description "access type." ;
}
leaf action-vlan-id {
type int32 {
range "1..4094";
}
description "action vlan id." ;
}
}
grouping connection {
description "Describe the connection of the vpn service." ;
leaf ip-address {
type inet:ip-address ;
description "ip address of access circuit's connection." ;
}
leaf mask-length {
type int32 {
range "1..32";
}
description "mask length of ip address." ;
}
leaf protocols {
type enumeration {
enum static {
value 0 ;
description "static." ;
}
enum ospf {
value 1 ;
description "ospf." ;
}
enum isis {
value 2 ;
description "bgp" ;
}
enum bgp {
value 3 ;
description "bgp" ;
}
}
description "protocols between PE and CE." ;
}
container static-routes {
description "Defines the static routes." ;
list static-route {
key "ip-prefix mask-length";
description "List of static route." ;
leaf ip-prefix {
type inet:ipv4-address;
description "ip prefix" ;
}
leaf mask-length {
type uint32 {
range "1..32";
}
description "mast length" ;
}
leaf next-hop {
type inet:ipv4-address ;
description "next hop" ;
}
leaf preference {
type uint32 {
range "1..65535";
}
description "preference of the route." ;
}
}
}
}
grouping pw{
description "PW definition ";
leaf id {
type string ;
description "ID of pw." ;
}
uses encaplate-type-grouping;
leaf ingress-ne-id {
type string ;
description "ingress ne id." ;
}
leaf egress-ne-id {
type string ;
description "egress ne id." ;
}
leaf ctrl-word-support {
type enumeration {
enum not-support {
value 0 ;
description "pw doesn't support control word" ;
}
enum support {
value 1 ;
description "pw supports control word" ;
}
}
default support;
description "ctrl word support. 0 : not support, 1 : support" ;
}
leaf sn-support {
type enumeration {
enum not-support {
value 0 ;
description "pw doesn't support control word" ;
}
enum support {
value 1 ;
description "pw supports control word" ;
}
}
default not-support;
description "serial number support. 0 : not support, 1 : support" ;
}
leaf vccv-type {
type enumeration {
enum not-support {
value 0 ;
description "pw doesn't support vccv" ;
}
enum CWD {
value 1 ;
description "pw supports vccv" ;
}
enum Label-alert {
value 2 ;
description "pw supports vccv" ;
}
enum TTL {
value 3 ;
description "pw supports vccv" ;
}
enum CWD&Label-alert {
value 4 ;
description "pw supports vccv" ;
}
enum CWD&TTL {
value 5 ;
description "pw supports vccv" ;
}
enum Label-alert&TTL {
value 6 ;
description "pw supports vccv" ;
}
enum CWD&Label-alert&TTL {
value 7 ;
description "pw supports vccv" ;
}
}
default not-support;
description "vccv type" ;
}
leaf conn-ack-type {
type enumeration {
enum not-support {
value 0 ;
description "pw doesn't support connection ack" ;
}
enum support {
value 1 ;
description "pw supports connection ack" ;
}
}
default not-support;
description "Connectivity test type" ;
}
container tunnels {
description "Define tunnels." ;
list tunnel{
key "tunnel-id";
description "The list of tunnel id." ;
uses tunnel;
}
}
}
grouping tunnel {
description "Reusable entity of tunnel." ;
leaf tunnel-id {
type string ;
description "ID of tunnel." ;
}
}
grouping encaplate-type-grouping {
description "encaplate type" ;
leaf encaplate-type {
type enumeration {
enum NONE {
value 0 ;
description "none." ;
}
enum fr-dlci-martini {
value 1 ;
description "fr-dlci-martini." ;
}
enum atm-aal5-sdu {
value 2 ;
description "atm-aal5-sdu." ;
}
enum atm-transparent {
value 3 ;
description "atm-transparent." ;
}
enum ethernet-vlan {
value 4 ;
description "ethernet-vlan." ;
}
enum ethernet {
value 5 ;
description "ethernet ." ;
}
enum hdlc {
value 6 ;
description " hdlc." ;
}
enum ppp {
value 7 ;
description "ppp." ;
}
enum cep-mpls {
value 8 ;
description " cep-mpls." ;
}
enum atm-ntol {
value 9 ;
description "atm-ntol." ;
}
enum atm-nto1-vpc {
value 10 ;
description "atm-nto1-vpc." ;
}
enum ip-layer2 {
value 11 ;
description " ip-layer2." ;
}
enum atm-1to1-vcc {
value 12 ;
description "atm-1to1-vcc." ;
}
enum atm-1to1-vpc {
value 13 ;
description "atm-1to1-vpc." ;
}
enum atm-aal5-pdu {
value 14 ;
description "atm-aal5-pdu." ;
}
enum fr-port {
value 15 ;
description "fr-port." ;
}
enum cep-packet {
value 16 ;
description "cep-packet." ;
}
enum e1 {
value 17 ;
description "e1." ;
}
enum t1 {
value 18 ;
description "t1." ;
}
enum e3 {
value 19 ;
description "e3." ;
}
enum t3 {
value 20 ;
description " t3." ;
}
enum cesopsn-basic {
value 21 ;
description "cesopsn-basic." ;
}
enum tdmoip-aal1 {
value 22 ;
description "tdmoip-aal1." ;
}
enum cesopsn-tdm {
value 23 ;
description "cesopsn-tdm." ;
}
enum tdmoip-aal2 {
value 24 ;
description "tdmoip-aal2." ;
}
enum fr-dlci {
value 25 ;
description "fr-dlci." ;
}
}
description "encaplate type." ;
}
}
grouping pw-trail{
description "pw trail information." ;
leaf id {
type string ;
description "ID of pw-trail." ;
}
leaf role {
type pw-role;
description "role of pw-trail." ;
}
container pw-lists {
description "List of pw information." ;
list pw-list {
key id;
description "List of pw information." ;
uses pw ;
}
}
}
grouping tunnel-service {
description "Reusable entity of tunnel service." ;
leaf signaling-type {
type enumeration {
enum RSVP-TE {
value 0 ;
description "RSVP-TE" ;
}
enum LDP {
value 1 ;
description "LDP" ;
}
enum GRE {
value 2 ;
description "GRE" ;
}
enum SR-BE {
value 3 ;
description "SR-BE" ;
}
enum SR-TE {
value 4 ;
description "SR-TE" ;
}
}
default RSVP-TE;
description "signaling type." ;
}
leaf tunnel-mode {
type enumeration {
enum Nto1 {
value 0 ;
description "multi service one tunnel" ;
}
enum 1to1 {
value 1 ;
description "oner service one tunnel" ;
}
}
default Nto1;
description "service to tunnel mode." ;
}
container protect-policy {
description "Protect policy." ;
uses protect-policy;
}
container oam-policy {
description "oam policy." ;
uses oam-policy;
}
leaf latency {
type int32;
description "tunnel latency requirement." ;
}
}
grouping service-path {
description "Service path of l3vpn." ;
list service-path{
key "service-id source-ne-id source-ac-id destination-ne-id destination-ac-id";
description
"The list of service path.";
leaf service-id {
type string ;
description "l2vpn or l3vpn service id." ;
}
leaf source-ne-id {
type string ;
description "source ne id." ;
}
leaf source-ac-id {
type string ;
description "source ltp id." ;
}
leaf destination-ne-id {
type string ;
description "destination ne id." ;
}
leaf destination-ac-id {
type string ;
description "destination ltp id." ;
}
container path-lists{
description "The path list of service path." ;
list path-list {
key "path-layer path-role";
description "The path list of service path." ;
leaf path-layer {
type enumeration {
enum PW {
value 0 ;
description "pw path." ;
}
enum BGP-LSP {
value 1 ;
description "BGP-LSP Path." ;
}
enum LSP {
value 2 ;
description "LSP Path." ;
}
}
description "path type. 0 : PW, 1 : BGP-LSP, 2 : PW" ;
}
leaf path-role {
type enumeration {
enum Primary {
value 0 ;
description "master path." ;
}
enum Backup {
value 1 ;
description "backup path." ;
}
enum Active {
value 2 ;
description "active path." ;
}
}
description "path role.. 0 : master, 1 : backup, 2 :
Bypass." ;
}
container paths {
description "path definition." ;
list path {
key "ne-id";
description "Network element id list." ;
leaf ne-id {
type string;
description "Network element id." ;
}
leaf ingress-ltp-id {
type string;
description "ingress ltd id." ;
}
leaf backward-peer-id {
type string;
description "backward peer id." ;
}
leaf egress-ltp-id {
type string;
description "egress ltd id." ;
}
leaf forward-peer-id {
type string;
description "forward peer id." ;
}
}
}
}
}
}
}
}