8be4874cf369d579a833b291e16c5ff8b5734f2c
[groupbasedpolicy.git] / groupbasedpolicy / src / main / yang / model / l2-l3-forwarding.yang
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 module l2-l3-forwarding {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:forwarding:l2_l3";
13     prefix "l2-l3-forwarding";
14
15     import forwarding { prefix forwarding; revision-date 2016-04-27; }
16     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
17     import yang-ext {prefix ext; revision-date 2013-07-09;}
18
19     revision "2016-04-27" {
20         description
21                 "Initial revision.";
22     }
23
24     identity l3-context {
25         base forwarding:context-type;
26     }
27
28     identity l2-bridge-domain {
29         base forwarding:context-type;
30     }
31
32     identity l2-flood-domain {
33         base forwarding:context-type;
34     }
35
36     identity subnet {
37         base forwarding:network-domain;
38     }
39
40     identity mac-address-type {
41         description "Values by MAC address type MUST be compatible with type ietf-yang-types:mac-address.
42             This address type can be used only if forwarding:context-type is l2-bridge-domain.";
43         base forwarding:address-type;
44     }
45
46     identity ip-prefix-type {
47         description "Values by IP prefix type MUST be compatible with type ietf-inet-types:ip-prefix.
48             This address type can be used only if forwarding:context-type is l3-context.";
49         base forwarding:address-type;
50     }
51
52     grouping subnet-fields {
53         leaf ip-prefix {
54             description "The IP prefix that defines the subnet";
55             type inet:ip-prefix;
56         }
57         leaf virtual-router-ip {
58             description
59                 "IP address to use for a virtual gateway router
60                  for the subnet, if desired.";
61             type inet:ip-address;
62         }
63         list gateways {
64             description
65                 "External gateways for subnets we serve,
66                 includes prefixes for static routing";
67             key "gateway";
68             leaf gateway {
69                 type inet:ip-address;
70             }
71             list prefixes {
72                 key "prefix";
73                 leaf prefix {
74                     type inet:ip-prefix;
75                 }
76             }
77         }
78     }
79
80     augment "/forwarding:forwarding/forwarding:forwarding-by-tenant/forwarding:network-domain" {
81         ext:augment-identifier "subnet-augment-forwarding";
82         container subnet {
83             when "../forwarding:network-domain-type = 'l2-l3-forwarding:subnet'";
84             uses subnet-fields;
85         }
86     }
87
88     // TODO add augment to renderer.yang
89
90 }