blob: 8e1fe366f20075c1352929b00fed9cc7082cb4c1 [file] [log] [blame]
Khen Nursimuluf8abbc92016-11-04 19:56:45 -04001module openconfig-policy-types {
2
3 yang-version "1";
4
5 // namespace
6 namespace "http://openconfig.net/yang/policy-types";
7
8 prefix "oc-pol-types";
9
10 // import some basic types
11 import ietf-yang-types { prefix yang; }
12 import openconfig-extensions { prefix oc-ext; }
13
14 // meta
15 organization
16 "OpenConfig working group";
17
18 contact
19 "OpenConfig working group
20 netopenconfig@googlegroups.com";
21
22 description
23 "This module contains general data definitions for use in routing
24 policy. It can be imported by modules that contain protocol-
25 specific policy conditions and actions.";
26
27 oc-ext:openconfig-version "2.0.1";
28
29 revision "2016-05-12" {
30 description
31 "OpenConfig public release";
32 reference "2.0.1";
33 }
34
35 // identity statements
36
37 identity ATTRIBUTE_COMPARISON {
38 description
39 "base type for supported comparison operators on route
40 attributes";
41 }
42
43 identity ATTRIBUTE_EQ {
44 base ATTRIBUTE_COMPARISON;
45 description "== comparison";
46 }
47
48 identity ATTRIBUTE_GE {
49 base ATTRIBUTE_COMPARISON;
50 description ">= comparison";
51 }
52
53 identity ATTRIBUTE_LE {
54 base ATTRIBUTE_COMPARISON;
55 description "<= comparison";
56 }
57
58 typedef match-set-options-type {
59 type enumeration {
60 enum ANY {
61 description "match is true if given value matches any member
62 of the defined set";
63 }
64 enum ALL {
65 description "match is true if given value matches all
66 members of the defined set";
67 }
68 enum INVERT {
69 description "match is true if given value does not match any
70 member of the defined set";
71 }
72 }
73 default ANY;
74 description
75 "Options that govern the behavior of a match statement. The
76 default behavior is ANY, i.e., the given value matches any
77 of the members of the defined set";
78 }
79
80 typedef match-set-options-restricted-type {
81 type enumeration {
82 enum ANY {
83 description "match is true if given value matches any member
84 of the defined set";
85 }
86 enum INVERT {
87 description "match is true if given value does not match any
88 member of the defined set";
89 }
90 }
91 default ANY;
92 description
93 "Options that govern the behavior of a match statement. The
94 default behavior is ANY, i.e., the given value matches any
95 of the members of the defined set. Note this type is a
96 restricted version of the match-set-options-type.";
97 //TODO: restriction on enumerated types is only allowed in
98 //YANG 1.1. Until then, we will require this additional type
99 }
100
101 grouping attribute-compare-operators {
102 description "common definitions for comparison operations in
103 condition statements";
104
105 leaf operator {
106 type identityref {
107 base ATTRIBUTE_COMPARISON;
108 }
109 description
110 "type of comparison to be performed";
111 }
112
113 leaf value {
114 type uint32;
115 description
116 "value to compare with the community count";
117 }
118 }
119
120 typedef tag-type {
121 type union {
122 type uint32;
123 type yang:hex-string;
124 }
125 description "type for expressing route tags on a local system,
126 including IS-IS and OSPF; may be expressed as either decimal or
127 hexidecimal integer";
128 reference
129 "RFC 2178 OSPF Version 2
130 RFC 5130 A Policy Control Mechanism in IS-IS Using
131 Administrative Tags";
132 }
133
134 identity INSTALL_PROTOCOL_TYPE {
135 description
136 "Base type for protocols which can install prefixes into the
137 RIB";
138 }
139
140 identity BGP {
141 base INSTALL_PROTOCOL_TYPE;
142 description "BGP";
143 reference "RFC 4271";
144 }
145
146 identity ISIS {
147 base INSTALL_PROTOCOL_TYPE;
148 description "IS-IS";
149 reference "ISO/IEC 10589";
150 }
151
152 identity OSPF {
153 base INSTALL_PROTOCOL_TYPE;
154 description "OSPFv2";
155 reference "RFC 2328";
156 }
157
158 identity OSPF3 {
159 base INSTALL_PROTOCOL_TYPE;
160 description "OSPFv3";
161 reference "RFC 5340";
162 }
163
164 identity STATIC {
165 base INSTALL_PROTOCOL_TYPE;
166 description "Locally-installed static route";
167 }
168
169 identity DIRECTLY_CONNECTED {
170 base INSTALL_PROTOCOL_TYPE;
171 description "A directly connected route";
172 }
173
174 identity LOCAL_AGGREGATE {
175 base INSTALL_PROTOCOL_TYPE;
176 description "Locally defined aggregate route";
177 }
178}