blob: e857c956031ae444c2f2d031e5b2c2d9021ae876 [file] [log] [blame]
Thomas Vachuska6655bee2017-08-24 16:12:59 -07001module openconfig-network-instance {
2
3 yang-version "1";
4
5 // namespace
6 namespace "http://openconfig.net/yang/network-instance";
7
8 prefix "oc-netinst";
9
10 // import some basic types
11 //import ietf-inet-types { prefix inet; }
12 import ietf-yang-types { prefix "yang"; }
13 import ietf-inet-types { prefix "inet"; }
14 import openconfig-network-instance-types { prefix "oc-ni-types"; }
15 import openconfig-policy-types { prefix "oc-pol-types"; }
16 import openconfig-routing-policy { prefix "oc-rpol"; }
17 import openconfig-local-routing { prefix "oc-loc-rt"; }
18 import openconfig-interfaces { prefix "oc-if"; }
19 import openconfig-extensions { prefix "oc-ext"; }
20 import openconfig-network-instance-l3 { prefix "oc-ni-l3"; }
21 import openconfig-types { prefix "oc-types"; }
22 import openconfig-bgp { prefix "oc-bgp"; }
23 import openconfig-mpls { prefix "oc-mpls"; }
24 import openconfig-vlan { prefix "oc-vlan"; }
25 import openconfig-ospfv2 { prefix "oc-ospfv2"; }
26 import openconfig-policy-forwarding { prefix "oc-pf"; }
27 import openconfig-segment-routing { prefix "oc-sr"; }
28 import openconfig-isis { prefix "oc-isis"; }
29 import openconfig-aft { prefix "oc-aft"; }
30
31 // include submodules
32 include openconfig-network-instance-l2;
33
34 // meta
35 organization "OpenConfig working group";
36
37 contact
38 "OpenConfig working group
39 www.openconfig.net";
40
41 description
42 "An OpenConfig description of a network-instance. This may be
43 a Layer 3 forwarding construct such as a virtual routing and
44 forwarding (VRF) instance, or a Layer 2 instance such as a
45 virtual switch instance (VSI). Mixed Layer 2 and Layer 3
46 instances are also supported.";
47
48 oc-ext:openconfig-version "0.8.0";
49
50 revision "2017-02-28" {
51 description
52 "Add OSPFv2 to network instance";
53 reference "0.8.0";
54 }
55
56 revision "2017-01-26" {
57 description
58 "Add policy forwarding to network instance";
59 reference "0.7.0";
60 }
61
62 revision "2017-01-13" {
63 description
64 "Add AFT to the network instance";
65 reference "0.6.0";
66 }
67
68 revision "2016-12-15" {
69 description
70 "Add segment routing to network instance";
71 reference "0.5.0";
72 }
73
74 revision "2016-11-10" {
75 description
76 "Add IS-IS to OpenConfig network instance";
77 reference "0.4.1";
78 }
79
80 revision "2016-10-12" {
81 description
82 "Update table connections";
83 reference "0.4.0";
84 }
85
86 revision "2016-09-28" {
87 description
88 "Change L2 instance to submodule; add MAC table";
89 reference "0.3.0";
90 }
91
92 revision "2016-08-11" {
93 description
94 "Resolve repeated container names in routing protocols";
95 reference "0.2.3";
96 }
97
98 revision "2016-07-08" {
99 description
100 "Updated with refactored routing protocol models";
101 reference "0.2.1";
102 }
103
104 revision "2016-03-29" {
105 description
106 "Initial revision";
107 reference "0.2.0";
108 }
109
110 revision "2015-10-18" {
111 description
112 "Initial revision";
113 reference "0.1.0";
114 }
115
116 grouping network-instance-top {
117 description
118 "Top-level grouping containing a list of network instances.";
119
120 container network-instances {
121 description
122 "The L2, L3, or L2+L3 forwarding instances that are
123 configured on the local system";
124
125 list network-instance {
126 key "name";
127
128 description
129 "Network instances configured on the local system";
130
131 leaf name {
132 type leafref {
133 path "../config/name";
134 }
135 description
136 "A unique name identifying the network instance";
137 }
138
139 uses l2ni-instance {
140 when "../type = 'L2VSI' or ../type = 'L2P2P'" +
141 " or ../type = 'L2L3' or ../type = 'DEFAULT_INSTANCE'" {
142 description
143 "Layer 2 configuration parameters included when
144 a network instance is a Layer 2 instance or a
145 combined L2L3 instance";
146 }
147 }
148
149 container config {
150 description
151 "Configuration parameters relating to a network
152 instance";
153 uses network-instance-config;
154 uses network-instance-type-dependent-config;
155 }
156
157
158 container state {
159 config false;
160 description
161 "Operational state parameters relating to a network
162 instance";
163 uses network-instance-config;
164 uses network-instance-type-dependent-config;
165 uses network-instance-state;
166 }
167
168 container encapsulation {
169 when "../config/type != 'DEFAULT_INSTANCE'" {
170 description
171 "Only allow the encapsulation of the instance to be
172 set when the instance is not the default instance";
173 }
174 description
175 "Configuration parameters relating to the encapsulation
176 used for the network instance";
177
178 container config {
179 description
180 "Configuration parameters relating to the encapsulation
181 of the network instance";
182
183 uses encapsulation-config;
184
185 uses l2ni-encapsulation-config {
186 when "../../../type = 'L2VSI' or ../../../type = 'L2P2P'
187 or ../../../type = 'L2L3'" {
188 description
189 "Only allow L2 encapsulations to be set
190 when the instance is of a type that supports
191 L2";
192 }
193 }
194 }
195
196 container state {
197 config false;
198 description
199 "State parameters relating to the encapsulation of
200 the network instance";
201 uses encapsulation-config;
202
203 uses l2ni-encapsulation-config {
204 when "../../../type = 'L2VSI' or ../../../type = 'L2P2P'
205 or ../../../type = 'L2L3'" {
206 description
207 "Only allow L2 encapsulations to be set
208 when the instance is of a type that supports
209 L2";
210 }
211 }
212 }
213 }
214
215 container inter-instance-policies {
216 description
217 "Policies dictating how RIB or FIB entries are imported
218 to and exported from this instance";
219
220 uses oc-rpol:apply-policy-group;
221 }
222
223 container table-connections {
224 description
225 "Policies dictating how RIB or FIB entries are propagated
226 between tables";
227
228 list table-connection {
229 key "src-protocol dst-protocol address-family";
230
231 description
232 "A list of connections between pairs of routing or
233 forwarding tables, the leaking of entries between
234 which is specified by the import policy.
235
236 A connection connecting a source table to a destination
237 table implies that routes that match the policy specified
238 for the connection are available for the destination
239 protocol to advertise, or match within its policies.";
240
241 leaf src-protocol {
242 type leafref {
243 path "../config/src-protocol";
244 }
245 description
246 "The name of the protocol associated with the table
247 which should be utilised as the source of forwarding
248 or routing information";
249 }
250
251 leaf dst-protocol {
252 type leafref {
253 path "../config/dst-protocol";
254 }
255 description
256 "The table to which routing entries should be
257 exported";
258 }
259
260 leaf address-family {
261 type leafref {
262 path "../config/address-family";
263 }
264 description
265 "The address family associated with the connection";
266 }
267
268 container config {
269 description
270 "Configuration parameters relating to the connection
271 between tables";
272 uses inter-table-policies-config;
273 }
274 container state {
275 config false;
276 description
277 "State parameters relating to the connection between
278 tables";
279 uses inter-table-policies-config;
280 }
281 }
282 }
283
284 container interfaces {
285 description
286 "The interfaces that are associated with this network
287 instance";
288
289 list interface {
290 key "id";
291 unique "config/interface config/subinterface";
292
293 description
294 "An interface associated with the network instance";
295
296 leaf id {
297 type leafref {
298 path "../config/id";
299 }
300 description
301 "A reference to an identifier for this interface which
302 acts as a key for this list";
303 }
304
305 container config {
306 description
307 "Configuration parameters relating to the associated
308 interface";
309 uses instance-interfaces-config;
310 }
311
312 container state {
313 config false;
314 description
315 "Operational state parameters relating to the
316 associated interface";
317
318 uses instance-interfaces-config;
319 uses instance-interfaces-state;
320 }
321 }
322 }
323
324 container tables {
325 description
326 "The routing tables that are managed by this network
327 instance";
328
329 list table {
330 key "protocol address-family";
331
332 description
333 "A network instance manages one or more forwarding or
334 routing tables. These may reflect a Layer 2 forwarding
335 information base, a Layer 3 routing table, or an MPLS
336 LFIB.
337
338 The table populated by a protocol within an instance is
339 identified by the protocol identifier (e.g., BGP, IS-IS)
340 and the address family (e.g., IPv4, IPv6) supported by
341 that protocol. Multiple instances of the same protocol
342 populate a single table -- such that
343 a single IS-IS or OSPF IPv4 table exists per network
344 instance.
345
346 An implementation is expected to create entries within
347 this list when the relevant protocol context is enabled.
348 i.e., when a BGP instance is created with IPv4 and IPv6
349 address families enabled, the protocol=BGP,
350 address-family=IPv4 table is created by the system.";
351
352 leaf protocol {
353 type leafref {
354 path "../config/protocol";
355 }
356 description
357 "A reference to the protocol that populates
358 the table";
359 }
360
361 leaf address-family {
362 type leafref {
363 path "../config/address-family";
364 }
365 description
366 "A reference to the address-family that the
367 table represents";
368 }
369
370 container config {
371 description
372 "Configuration parameters relating to the
373 table";
374 uses table-config;
375 }
376
377 container state {
378 config false;
379 description
380 "State parameters related to the table";
381 uses table-config;
382 }
383 }
384 }
385
386 container connection-points {
387 description
388 "The set of connection points within a forwarding
389 instance";
390
391 list connection-point {
392 key "connection-point-id";
393
394 description
395 "A connection point within a Layer 2 network instance.
396 Each connection-point consists of a set of interfaces
397 only one of which is active at any one time. Other than
398 the specification of whether an interface is local
399 (i.e., exists within this network-instance), or remote,
400 all configuration and state parameters are common";
401
402 leaf connection-point-id {
403 type leafref {
404 path "../config/connection-point-id";
405 }
406 description
407 "A locally significant reference for the
408 connection-point";
409 }
410
411 container config {
412 description
413 "Configuration parameters relating to a Layer 2
414 network instance connection point";
415 uses instance-connection-point-config;
416 }
417 container state {
418 config false;
419 description
420 "Operational state parameters relating to a Layer 2
421 network instance connection point";
422
423 uses instance-connection-point-config;
424 uses instance-connection-point-state;
425 }
426
427 container endpoints {
428 when "../config/type = 'L2P2P' " +
429 "or ../config/type = 'L2VSI'" {
430 description
431 "Configuration parameters to associate interfaces
432 into a common group for use in Layer 2 network
433 instances";
434 }
435
436 description
437 "The set of endpoints which are grouped within the
438 connection point";
439
440 list endpoint {
441 key "endpoint-id";
442
443 description
444 "A list of the endpoints (interfaces or remote
445 connection points that can be used for this
446 connection point). The active endpoint is selected
447 based on the precedence that it is configured
448 with";
449
450 leaf endpoint-id {
451 type leafref {
452 path "../config/endpoint-id";
453 }
454 description
455 "A pointer to the configured identifier for the
456 endpoint";
457 }
458
459 container config {
460 description
461 "Configuration parameters relating to the
462 endpoint";
463 uses instance-endpoint-config;
464 }
465 container state {
466 config false;
467 description
468 "Operational state parameters relating to the
469 endpoint";
470 uses instance-endpoint-config;
471 uses instance-endpoint-state;
472 }
473
474 container local {
475 when "../config/type = 'LOCAL'" {
476 description
477 "Only include the local configuration when
478 the endpoint is specified to be local to
479 the network element";
480 }
481
482 description
483 "Configuration and operational state parameters
484 relating to a local interface";
485
486 container config {
487 description
488 "Configuration parameters relating to a local
489 endpoint";
490 uses instance-endpoint-local-config;
491 }
492
493 container state {
494 config false;
495 description
496 "Operational state parameters relating to a
497 local endpoint";
498 uses instance-endpoint-local-config;
499 }
500 }
501
502 container remote {
503 when "../config/type = 'REMOTE'" {
504 description
505 "Only include the remote configuration when
506 the endpoint is specified to be remote to
507 the network element";
508 }
509
510 description
511 "Configuration and operational state parameters
512 relating to a remote interface";
513
514 container config {
515 description
516 "Configuration parameters relating to a remote
517 endpoint";
518 uses instance-endpoint-remote-config;
519 }
520
521 container state {
522 config false;
523 description
524 "Operational state parameters relating to
525 a remote endpoint";
526 uses instance-endpoint-remote-config;
527 }
528 }
529 }
530 }
531 }
532 }
533
534 uses oc-mpls:mpls-top {
535 when "../config/type = 'DEFAULT'" {
536 description
537 "MPLS configuration is only valid within the default
538 network instance.";
539 }
540 }
541
542 uses oc-sr:sr-top {
543 when "../config/type = 'DEFAULT'" {
544 description
545 "Segment routing configuration is only valid with the default
546 network instance.";
547 }
548 }
549
550 uses oc-vlan:vlan-top;
551
552 uses oc-pf:policy-forwarding-top;
553
554 uses oc-aft:aft-top;
555
556 container protocols {
557 description
558 "The routing protocols that are enabled for this
559 network-instance.";
560
561 list protocol {
562 key "identifier name";
563
564 description
565 "A process (instance) of a routing protocol. Some
566 systems may not support more than one instance of
567 a particular routing protocol";
568
569 leaf identifier {
570 type leafref {
571 path "../config/identifier";
572 }
573 description
574 "The protocol name for the routing or forwarding
575 protocol to be instantiated";
576 }
577
578 leaf name {
579 type leafref {
580 path "../config/name";
581 }
582 description
583 "An operator-assigned identifier for the routing
584 or forwarding protocol. For some processes this
585 leaf may be system defined.";
586 }
587
588 container config {
589 description
590 "Configuration parameters relating to the routing
591 protocol instance";
592
593 uses protocols-config;
594 }
595
596 container state {
597 config false;
598 description
599 "State parameters relating to the routing protocol
600 instance";
601
602 uses protocols-config;
603 uses protocols-state;
604 }
605
606 uses oc-loc-rt:local-static-top {
607 when "../config/identifier = 'STATIC'" {
608 description
609 "Include static route parameters only when the
610 protocol is set to static";
611 }
612 description
613 "Configuration and state parameters relating to
614 static routes";
615 }
616
617 uses oc-loc-rt:local-aggregate-top {
618 when "../config/identifier = 'LOCAL_AGGREGATE'" {
619 description
620 "Include aggregate route parameters only when the
621 protocol is set to aggregate";
622 }
623 description
624 "Configuration and state parameters relating to
625 locally generated aggregate routes";
626 }
627
628 uses oc-bgp:bgp-top {
629 when "../config/identifier = 'BGP'" {
630 description
631 "Include BGP parameters only when the protocol
632 is of type BGP";
633 }
634 description
635 "Configuration and state parameters relating to
636 Border Gateway Protocol (BGP)";
637 }
638
639 uses oc-ospfv2:ospfv2-top {
640 when "../config/identifier = 'OSPF2'" {
641 description
642 "Include OSPFv2 parameters only when the protocol
643 is of type OSPFv2";
644 }
645 }
646
647 uses oc-isis:isis-top {
648 when "../config/identifier = 'ISIS'" {
649 description
650 "Include IS-IS configuration when the protocol is of type
651 IS-IS";
652 }
653 description
654 "Configuration and state parameters relating to Intermediate
655 System to Intermediate System (IS-IS).";
656 }
657 }
658 }
659 }
660 }
661 }
662
663 grouping network-instance-type-dependent-config {
664 description
665 "Type dependent network instance configuration";
666
667 uses oc-ni-l3:l3ni-instance-common-config {
668 when "../type = 'L3VRF' or ../type = 'L2L3'" {
669 description
670 "Layer 3 VRF configuration parameters included when a
671 network instance is a L3VRF or combined L2L3 instance";
672 }
673 }
674
675 uses l2ni-instance-common-config {
676 when "../type = 'L2VSI' or ../type = 'L2P2P'" +
677 " or ../type = 'L2L3'" {
678 description
679 "Layer 2 configuration parameters included when
680 a network instance is a Layer 2 instance or a
681 combined L2L3 instance";
682 }
683 }
684 }
685
686 grouping instance-endpoint-config {
687 description
688 "Configuration data relating to an forwarding-instance
689 endpoint";
690
691 leaf endpoint-id {
692 type string;
693 description
694 "An identifier for the endpoint";
695 }
696
697 leaf precedence {
698 type uint16;
699 description
700 "The precedence of the endpoint - the lowest precendence
701 viable endpoint will be utilised as the active endpoint
702 within a connection";
703 }
704
705 leaf type {
706 type identityref {
707 base "oc-ni-types:ENDPOINT_TYPE";
708 }
709 description
710 "The type of endpoint that is referred to by the current
711 endpoint";
712 }
713
714 }
715
716 grouping instance-endpoint-local-config {
717 description
718 "Configuration parameters relating to an endpoint that is local
719 to the current system";
720
721 uses oc-if:interface-ref-common;
722 }
723
724 grouping instance-endpoint-remote-config {
725 description
726 "Configuration parameters relating to an endpoint that is
727 remote from the local system";
728 leaf remote-system {
729 type inet:ip-address;
730 description
731 "The IP address of the device which hosts the
732 remote end-point";
733 }
734
735 leaf virtual-circuit-identifier {
736 type uint32;
737 description
738 "The virtual-circuit identifier that identifies the
739 connection at the remote end-point";
740 }
741 }
742
743 grouping instance-endpoint-state {
744 description
745 "Operational state data relating to a forwarding-instance
746 endpoint";
747 leaf active {
748 type boolean;
749 description
750 "When the backup endpoint is active, the value of this
751 parameter is set to true";
752 }
753 }
754
755 grouping instance-connection-point-config {
756 description
757 "Configuration data relating to a forwarding-instance
758 connection point";
759
760 leaf connection-point-id {
761 type string;
762 description
763 "An identifier for a connection point";
764 }
765 }
766
767 grouping instance-connection-point-state {
768 description
769 "Operational state data relating to a forwarding-instance
770 connection point";
771 }
772
773 grouping table-config {
774 description
775 "Config parameters relating to an L2/L2.5/L3 table that exists
776 within a network instance";
777
778 leaf protocol {
779 type leafref {
780 path "../../../../protocols/protocol/config/identifier";
781 }
782 description
783 "Reference to the protocol that the table is associated with.";
784 }
785
786 leaf address-family {
787 type identityref {
788 base oc-types:ADDRESS_FAMILY;
789 }
790 description
791 "The address family (IPv4, IPv6) of the table's entries";
792 }
793 }
794
795 grouping instance-interfaces-config {
796 description
797 "Configuration parameters related to an interface associated
798 with the network instance";
799
800 leaf id {
801 type string;
802 description
803 "A unique identifier for this interface - this is expressed
804 as a free-text string";
805 }
806
807 uses oc-if:interface-ref-common;
808
809 leaf-list associated-address-families {
810 type identityref {
811 base oc-types:ADDRESS_FAMILY;
812 }
813 description
814 "The address families on the subinterface which are to be
815 associated with this network instance. When this leaf-list
816 is empty and the network instance requires Layer 3 information
817 the address families for which the network instance is
818 enabled should be imported. If the value of this leaf-list
819 is specified then the association MUST only be made for
820 those address families that are included in the list.";
821 }
822 }
823
824 grouping instance-interfaces-state {
825 description
826 "Operational state parameters relating to an interface
827 associated with this network instance";
828 }
829
830 grouping inter-table-policies-config {
831 description
832 "Configuration entries that relate to how RIB or FIB entries
833 are propagated between tables within the same network
834 instance";
835
836 leaf src-protocol {
837 type leafref {
838 // we are at table-connections/table-connection/config/.
839 path "../../../../tables/table/config/protocol";
840 }
841 description
842 "The source protocol for the table connection";
843 }
844
845 leaf address-family {
846 type leafref {
847 // we are at table-connections/table-connection/config/.
848 path "../../../../tables/" +
849 "table[protocol=current()/../src-protocol]/" +
850 "config/address-family";
851 }
852 description
853 "The address family associated with the connection. This
854 must be defined for the source protocol. The target
855 address family is implicitly defined by the address family
856 specified for the source protocol.";
857 }
858
859 leaf dst-protocol {
860 type leafref {
861 path "../../../../tables/table/config/protocol";
862 }
863 description
864 "The destination protocol for the table connection";
865 }
866
867 uses oc-rpol:apply-policy-import-config;
868 }
869
870 grouping network-instance-config {
871 description
872 "Configuration parameters relating to a top-level network
873 instance";
874
875 leaf name {
876 type string;
877 description
878 "An operator-assigned unique name for the forwarding
879 instance";
880 }
881
882 leaf type {
883 type identityref {
884 base "oc-ni-types:NETWORK_INSTANCE_TYPE";
885 }
886 description
887 "The type of network instance. The value of this leaf
888 indicates the type of forwarding entries that should be
889 supported by this network instance";
890 }
891
892 leaf enabled {
893 type boolean;
894 description
895 "Whether the network instance should be configured to be
896 active on the network element";
897 }
898
899 leaf description {
900 type string;
901 description
902 "A free-form string to be used by the network operator to
903 describe the function of this network instance";
904 }
905
906 leaf router-id {
907 type yang:dotted-quad;
908 description
909 "A identifier for the local network instance - typically
910 used within associated routing protocols or signalling
911 routing information in another network instance";
912 }
913
914 leaf route-distinguisher {
915 type oc-ni-types:route-distinguisher;
916 description
917 "The route distinguisher that should be used for the local
918 VRF or VSI instance when it is signalled via BGP.";
919 }
920 }
921
922 grouping network-instance-state {
923 description
924 "Operational state parameters relating to a network instance";
925 }
926
927 grouping protocols-config {
928 description
929 "Configuration parameters relating to a generic protocol
930 instance within a network instance";
931
932 leaf identifier {
933 type identityref {
934 base "oc-pol-types:INSTALL_PROTOCOL_TYPE";
935 }
936 description
937 "The protocol identifier for the instance";
938 }
939
940 leaf name {
941 type string;
942 description
943 "A unique name for the protocol instance";
944 }
945
946 leaf enabled {
947 type boolean;
948 description
949 "A boolean value indicating whether the local protocol
950 instance is enabled.";
951 }
952
953 leaf default-metric {
954 type uint32;
955 description
956 "The default metric within the RIB for entries that are
957 installed by this protocol instance. This value may
958 be overridden by protocol specific configuration options.
959 The lower the metric specified the more preferable the RIB
960 entry is to be selected for use within the network instance.
961 Where multiple entries have the same metric value then these
962 equal cost paths should be treated according to the specified
963 ECMP path selection behaviour for the instance";
964 }
965 }
966
967 grouping protocols-state {
968 description
969 "Operational state parameters relating to a protocol instance";
970 }
971
972 grouping instance-interface-association-config {
973 description
974 "Grouping containing leaves that are to be augmented into an
975 interface or subinterface to include mapping to a network
976 instance";
977
978 leaf network-instance {
979 type leafref {
980 path "/network-instances/network-instance/name";
981 }
982 description
983 "The network instance that this interface is associated
984 with";
985 }
986 }
987
988 grouping encapsulation-config {
989 description
990 "Type agnostic configuration parameters relating to the
991 encapsulation of the network instance";
992
993 leaf encapsulation-type {
994 type identityref {
995 base oc-ni-types:ENCAPSULATION;
996 }
997 description
998 "The on-the-wire encapsulation that should be used when
999 sending traffic from this network instance";
1000 }
1001
1002 // rjs: This is left here as I suspect that this can
1003 // be used in EVPN. Need to validate implementations, otherwise
1004 // move to L3. (TODO)
1005 leaf label-allocation-mode {
1006 type identityref {
1007 base oc-ni-types:LABEL_ALLOCATION_MODE;
1008 }
1009 description
1010 "The label allocation mode to be used for L3 entries
1011 in the network instance";
1012 }
1013 }
1014
1015 uses network-instance-top;
1016}