Thomas Vachuska | 8ca75a2 | 2017-08-24 16:12:59 -0700 | [diff] [blame] | 1 | module 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 "3.0.0"; |
| 28 | |
| 29 | revision "2017-07-14" { |
| 30 | description |
| 31 | "Replace policy choice node/type with policy-result |
| 32 | enumeration;simplified defined set naming;removed generic |
| 33 | IGP actions; migrate to OpenConfig types; added mode for |
| 34 | prefix sets"; |
| 35 | reference "3.0.0"; |
| 36 | } |
| 37 | |
| 38 | revision "2016-05-12" { |
| 39 | description |
| 40 | "OpenConfig public release"; |
| 41 | reference "2.0.1"; |
| 42 | } |
| 43 | |
| 44 | // identity statements |
| 45 | |
| 46 | identity ATTRIBUTE_COMPARISON { |
| 47 | description |
| 48 | "base type for supported comparison operators on route |
| 49 | attributes"; |
| 50 | } |
| 51 | |
| 52 | identity ATTRIBUTE_EQ { |
| 53 | base ATTRIBUTE_COMPARISON; |
| 54 | description "== comparison"; |
| 55 | } |
| 56 | |
| 57 | identity ATTRIBUTE_GE { |
| 58 | base ATTRIBUTE_COMPARISON; |
| 59 | description ">= comparison"; |
| 60 | } |
| 61 | |
| 62 | identity ATTRIBUTE_LE { |
| 63 | base ATTRIBUTE_COMPARISON; |
| 64 | description "<= comparison"; |
| 65 | } |
| 66 | |
| 67 | typedef match-set-options-type { |
| 68 | type enumeration { |
| 69 | enum ANY { |
| 70 | description "match is true if given value matches any member |
| 71 | of the defined set"; |
| 72 | } |
| 73 | enum ALL { |
| 74 | description "match is true if given value matches all |
| 75 | members of the defined set"; |
| 76 | } |
| 77 | enum INVERT { |
| 78 | description "match is true if given value does not match any |
| 79 | member of the defined set"; |
| 80 | } |
| 81 | } |
| 82 | default ANY; |
| 83 | description |
| 84 | "Options that govern the behavior of a match statement. The |
| 85 | default behavior is ANY, i.e., the given value matches any |
| 86 | of the members of the defined set"; |
| 87 | } |
| 88 | |
| 89 | typedef match-set-options-restricted-type { |
| 90 | type enumeration { |
| 91 | enum ANY { |
| 92 | description "match is true if given value matches any member |
| 93 | of the defined set"; |
| 94 | } |
| 95 | enum INVERT { |
| 96 | description "match is true if given value does not match any |
| 97 | member of the defined set"; |
| 98 | } |
| 99 | } |
| 100 | default ANY; |
| 101 | description |
| 102 | "Options that govern the behavior of a match statement. The |
| 103 | default behavior is ANY, i.e., the given value matches any |
| 104 | of the members of the defined set. Note this type is a |
| 105 | restricted version of the match-set-options-type."; |
| 106 | //TODO: restriction on enumerated types is only allowed in |
| 107 | //YANG 1.1. Until then, we will require this additional type |
| 108 | } |
| 109 | |
| 110 | grouping attribute-compare-operators { |
| 111 | description "common definitions for comparison operations in |
| 112 | condition statements"; |
| 113 | |
| 114 | leaf operator { |
| 115 | type identityref { |
| 116 | base ATTRIBUTE_COMPARISON; |
| 117 | } |
| 118 | description |
| 119 | "type of comparison to be performed"; |
| 120 | } |
| 121 | |
| 122 | leaf value { |
| 123 | type uint32; |
| 124 | description |
| 125 | "value to compare with the community count"; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | typedef tag-type { |
| 130 | type union { |
| 131 | type uint32; |
| 132 | type yang:hex-string; |
| 133 | } |
| 134 | description "type for expressing route tags on a local system, |
| 135 | including IS-IS and OSPF; may be expressed as either decimal or |
| 136 | hexidecimal integer"; |
| 137 | reference |
| 138 | "RFC 2178 OSPF Version 2 |
| 139 | RFC 5130 A Policy Control Mechanism in IS-IS Using |
| 140 | Administrative Tags"; |
| 141 | } |
| 142 | |
| 143 | identity INSTALL_PROTOCOL_TYPE { |
| 144 | description |
| 145 | "Base type for protocols which can install prefixes into the |
| 146 | RIB"; |
| 147 | } |
| 148 | |
| 149 | identity BGP { |
| 150 | base INSTALL_PROTOCOL_TYPE; |
| 151 | description "BGP"; |
| 152 | reference "RFC 4271"; |
| 153 | } |
| 154 | |
| 155 | identity ISIS { |
| 156 | base INSTALL_PROTOCOL_TYPE; |
| 157 | description "IS-IS"; |
| 158 | reference "ISO/IEC 10589"; |
| 159 | } |
| 160 | |
| 161 | identity OSPF { |
| 162 | base INSTALL_PROTOCOL_TYPE; |
| 163 | description "OSPFv2"; |
| 164 | reference "RFC 2328"; |
| 165 | } |
| 166 | |
| 167 | identity OSPF3 { |
| 168 | base INSTALL_PROTOCOL_TYPE; |
| 169 | description "OSPFv3"; |
| 170 | reference "RFC 5340"; |
| 171 | } |
| 172 | |
| 173 | identity STATIC { |
| 174 | base INSTALL_PROTOCOL_TYPE; |
| 175 | description "Locally-installed static route"; |
| 176 | } |
| 177 | |
| 178 | identity DIRECTLY_CONNECTED { |
| 179 | base INSTALL_PROTOCOL_TYPE; |
| 180 | description "A directly connected route"; |
| 181 | } |
| 182 | |
| 183 | identity LOCAL_AGGREGATE { |
| 184 | base INSTALL_PROTOCOL_TYPE; |
| 185 | description "Locally defined aggregate route"; |
| 186 | } |
| 187 | } |