6b84ee1a7e29c0a9addc4556f9d173456ec3e717
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-device@2017-02-06.yang
1 module org-openroadm-device {
2   namespace "http://org/openroadm/device";
3   prefix org-openroadm-device;
4
5   import ietf-yang-types {
6     prefix ietf-yang-types;
7   }
8   import ietf-inet-types {
9     prefix ietf-inet-types;
10   }
11   import ietf-netconf {
12     prefix ietf-nc;
13   }
14   import org-openroadm-common-types {
15     prefix org-openroadm-common-types;
16     revision-date 2016-10-14;
17   }
18   import org-openroadm-resource-types {
19     prefix org-openroadm-resource-types;
20   }
21   import org-openroadm-wavelength-map {
22     prefix org-openroadm-wavelength-map;
23   }
24   import org-openroadm-physical-types {
25     prefix org-openroadm-physical-types;
26   }
27   import org-openroadm-user-mgmt {
28     prefix org-openroadm-user-mgmt;
29   }
30   import org-openroadm-port-types {
31     prefix org-openroadm-port-types;
32   }
33   import org-openroadm-interfaces {
34     prefix org-openroadm-interfaces;
35   }
36   import org-openroadm-swdl {
37     prefix org-openroadm-swdl;
38   }
39   import org-openroadm-equipment-states-types {
40     prefix org-openroadm-equipment-states-types;
41   }
42
43   organization "Open ROADM MSA";
44   contact
45     "OpenROADM.org";
46   description
47     "YANG definitions of ROADM device
48
49      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
50      AT&T Intellectual Property.  All other rights reserved.
51
52      Redistribution and use in source and binary forms, with or without modification,
53      are permitted provided that the following conditions are met:
54
55      * Redistributions of source code must retain the above copyright notice, this
56        list of conditions and the following disclaimer.
57      * Redistributions in binary form must reproduce the above copyright notice,
58        this list of conditions and the following disclaimer in the documentation and/or
59        other materials provided with the distribution.
60      * Neither the Members of the Open ROADM MSA Agreement nor the names of its
61        contributors may be used to endorse or promote products derived from this software
62        without specific prior written permission.
63
64      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS''
65      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
66      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
67      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT,
68      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
69      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA,
70      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
71      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
72      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
73      POSSIBILITY OF SUCH DAMAGE.
74
75      Also contains code components extracted from IETF netconf.  These code components
76      are copyrighted and licensed as follows:
77
78      Copyright (c) 2016 IETF Trust and the persons identified as the document authors.
79      All rights reserved.
80
81      This document is subject to BCP 78 and the IETF Trust’s Legal Provisions Relating
82      to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of
83      publication of this document. Please review these documents carefully, as they
84      describe your rights and restrictions with respect to this document. Code Components
85      extracted from this document must include Simplified BSD License text as described in
86      Section 4.e of the Trust Legal Provisions and are provided without warranty as
87      described in the Simplified BSD License.";
88
89   revision 2017-02-06 {
90     description
91       "Version 1.2.1 - removed pattern for current-datetime in info tree and rpc";
92   }
93
94   revision 2016-10-14 {
95     description
96       "Version 1.2";
97   }
98
99   rpc get-connection-port-trail {
100     input {
101       leaf connection-number {
102         type string;
103         mandatory true;
104       }
105     }
106     output {
107       uses org-openroadm-common-types:rpc-response-status;
108       list ports {
109         uses org-openroadm-common-types:physical-location;
110         uses port-name {
111           refine "circuit-pack-name" {
112             mandatory true;
113           }
114           refine "port-name" {
115             mandatory true;
116           }
117         }
118       }
119     }
120   }
121   rpc disable-automatic-shutoff {
122     input {
123       leaf amp {
124         type leafref {
125           path "/org-openroadm-device/shelves/shelf-name";
126         }
127         mandatory true;
128         description
129           "The shelf where amp is located";
130       }
131       leaf degree-number {
132         type uint16;
133         mandatory true;
134       }
135       leaf support-timer {
136         type uint16 {
137           range "1..600";
138         }
139         default "20";
140       }
141     }
142     output {
143       uses org-openroadm-common-types:rpc-response-status;
144     }
145   }
146   rpc start-scan {
147     input {
148       leaf degree-number {
149         type uint16;
150         mandatory true;
151       }
152       leaf port-direction {
153         type org-openroadm-common-types:direction;
154       }
155       leaf distance {
156         type uint32;
157       }
158       leaf resolution {
159         type uint32;
160       }
161     }
162     output {
163       uses org-openroadm-common-types:rpc-response-status;
164     }
165   }
166
167   notification otdr-scan-result {
168     leaf status {
169       type enumeration {
170         enum "Completed" {
171           value 1;
172         }
173         enum "Failed" {
174           value 2;
175         }
176       }
177       mandatory true;
178       description
179         "Completed or Failed for the scan's final status";
180     }
181     leaf result-file {
182       type string;
183     }
184   }
185
186   rpc set-current-datetime {
187     description
188       "Set the info/current-datetime leaf to the specified value.";
189     input {
190      leaf current-datetime {
191         type ietf-yang-types:date-and-time;
192         mandatory true;
193         description
194           "The current system date and time in UTC. Format: YYYY-MM-DDTHH:MM:SS";
195       }
196     }
197
198     output {
199       uses org-openroadm-common-types:rpc-response-status;
200     }
201   }
202
203   grouping device-common {
204     leaf node-id {
205       type string;
206       description
207         "Globally unique identifer for a device.";
208       default "openroadm";
209     }
210     leaf node-number {
211       type uint32;
212       description
213         "Number assigned to a ROADM node at a
214          given office";
215     }
216     leaf node-type {
217       type org-openroadm-common-types:node-types;
218       description
219         "Identifier for node-type e.g Roadm, xponder";
220       config false;
221       mandatory true;
222     }
223     leaf clli {
224       type string;
225       description
226         "Common Language Location Identifier.";
227     }
228     uses org-openroadm-physical-types:node-info;
229     leaf ipAddress {
230       type ietf-inet-types:ip-address;
231       description
232         "IP Address of device";
233     }
234     leaf prefix-length {
235       type uint8 {
236         range "0..128";
237       }
238       description
239         "The length of the subnet prefix";
240     }
241     leaf defaultGateway {
242       type ietf-inet-types:ip-address;
243       description
244         "Default Gateway";
245     }
246     leaf source {
247       type enumeration {
248         enum "static" {
249           value 1;
250         }
251         enum "dhcp" {
252           value 2;
253         }
254       }
255       config false;
256     }
257     leaf current-ipAddress {
258       type ietf-inet-types:ip-address;
259       config false;
260       description
261         "Current IP Address of device";
262     }
263     leaf current-prefix-length {
264       type uint8 {
265         range "0..128";
266       }
267       config false;
268       description
269         "The current length of the subnet prefix";
270     }
271     leaf current-defaultGateway {
272       type ietf-inet-types:ip-address;
273       config false;
274       description
275         "Current Default Gateway";
276     }
277     leaf macAddress {
278       type ietf-yang-types:mac-address;
279       description
280         "MAC Address of device";
281       config false;
282     }
283     leaf softwareVersion {
284       type string;
285       config false;
286       description
287         "Software version";
288     }
289     leaf template {
290       type string;
291       description
292         "Template information used in the deployment.";
293     }
294     leaf current-datetime {
295       type ietf-yang-types:date-and-time;
296       config false;
297       description
298         "The current system date and time in UTC. Format: YYYY-MM-DDTHH:MM:SS.mm+ ";
299     }
300     container geoLocation {
301       description
302         "GPS location";
303       leaf latitude {
304         type decimal64 {
305           fraction-digits 16;
306           range "-90 .. 90";
307         }
308         description
309           "[From wikipedia] Latitude is an angle (defined below)
310            which ranges from 0° at the Equator to 90° (North or
311            South) at the poles";
312       }
313       leaf longitude {
314         type decimal64 {
315           fraction-digits 16;
316           range "-180 .. 180";
317         }
318         description
319           "[From wikipedia] The longitude is measured as the
320            angle east or west from the Prime Meridian, ranging
321            from 0° at the Prime Meridian to +180° eastward and
322            âˆ’180° westward.";
323       }
324     }
325   }
326
327   grouping slot-info {
328     description
329       "slots information. To be populated by NE during retrieval.";
330     leaf slot-name {
331       type string;
332       description
333         "The name of this slot.";
334     }
335     leaf label {
336       type string;
337       description
338         "Faceplate label";
339     }
340     leaf provisioned-circuit-pack {
341       type leafref {
342         path "/org-openroadm-device/circuit-packs/circuit-pack-name";
343       }
344       description
345         "The supported circuit-pack. It will be empty if no provision on this slot.";
346     }
347   }
348   grouping shelves {
349     list shelves {
350       key "shelf-name";
351       uses shelf;
352     }
353   }
354   grouping shelf {
355     leaf shelf-name {
356       description
357         "Unique identifier for this shelf within a device";
358       type string;
359     }
360     leaf shelf-type {
361       description
362         "The shelf type: describe the shelf with a unique string.";
363       type string;
364       mandatory true;
365     }
366     leaf rack {
367       description
368         "Reflect the shelf physical location data including floor, aisle, bay values.";
369       type string;
370     }
371     leaf shelf-position {
372       description
373         "Reflect the shelf vertical position within an equipment bay.";
374       type string;
375     }
376     leaf administrative-state {
377       description
378         "Admin State of the shelf";
379       type org-openroadm-equipment-states-types:admin-states;
380     }
381     uses org-openroadm-physical-types:common-info;
382     leaf equipment-state {
383       type org-openroadm-equipment-states-types:states;
384       description
385         "equipment state for the shelf, used to track the lifecycle state.";
386     }
387     leaf due-date {
388       type ietf-yang-types:date-and-time;
389       description
390         "due date for the shelf.";
391     }
392     list slots {
393       description
394           "List of slots on this shelf. To be populated by NE during retrieval.";
395       key "slot-name";
396       config false;
397       uses slot-info;
398     }
399   }
400
401   grouping circuit-packs {
402     list circuit-packs {
403       description
404         "List of circuit packs. This includes common equipment, like fans, power supplies, etc.";
405       key "circuit-pack-name";
406       leaf circuit-pack-type {
407         description
408           "Type of circuit-pack";
409         type string;
410         mandatory true;
411       }
412       leaf circuit-pack-product-code {
413         description
414           "Product Code for the circuit-pack";
415         type string;
416       }
417       uses circuit-pack;
418     }
419   }
420
421   grouping circuit-pack {
422     leaf circuit-pack-name {
423       description
424         "Unique identifier for this circuit-pack within a device";
425       type string;
426     }
427     leaf administrative-state {
428       description
429         "Administrative state of circuit-pack";
430       type org-openroadm-equipment-states-types:admin-states;
431     }
432     uses org-openroadm-physical-types:common-info;
433     container circuit-pack-category {
434       description
435         "General type of circuit-pack";
436       uses org-openroadm-common-types:equipment-type;
437       config false;
438     }
439     leaf equipment-state {
440       description
441         "Equipment state, which complements operational state.";
442       type org-openroadm-equipment-states-types:states;
443     }
444     leaf circuit-pack-mode {
445       description
446         "Circuit-pack mode allowed. e.g. NORMAL or REGEN";
447       type string;
448       default "NORMAL";
449     }
450     leaf shelf {
451       type leafref {
452         path "/org-openroadm-device/shelves/shelf-name";
453       }
454       mandatory true;
455     }
456     leaf slot {
457       type string;
458       mandatory true;
459     }
460     leaf subSlot {
461       type string;
462       mandatory false;
463     }
464     leaf due-date {
465       type ietf-yang-types:date-and-time;
466       description
467         "due date for this circuit-pack.";
468     }
469     container parent-circuit-pack {
470       description
471         "In the case of circuit packs that contain other equipment (modules or pluggables), this captures the hierarchy of that equipment.  It is a vendor specific design decision if the ports for single-port pluggables are modeled as children of the parent circuit-pack, or as children of the pluggable circuit-pack contained in the parent circuit-pack.  For modules with multiple ports, it is recommended that ports be children of the module and not the carrier, to help in fault correlation and isolation in the case of a module failure.";
472       uses circuit-pack-name;
473       leaf cp-slot-name {
474         type string;
475         description
476           "Slot name on parent-circuit-pack.";
477       }
478     }
479     list cp-slots {
480       description
481           "List of circuit-pack slots on this circuit-pack. To be populated by NE during retrieval.";
482       key "slot-name";
483       config false;
484       uses slot-info;
485     }
486     list ports {
487       key "port-name";
488       description
489         "List of ports on this circuit-pack.  For single port pluggables, the port may be modeled against the pluggable itself, or against the parent-circuit-pack.  For mulit-port pluggables, it is recommended that ports be modeled against the module itself.  Modeling ports as close to the equipment hierarchy as possible will help in fault correlation and isolation since common failures associated with supporting equipment can be used to help identify symptomatic failures on the contained ports.";
490       uses port;
491       container roadm-port {
492         when "../port-qual='roadm-external'";
493         uses org-openroadm-port-types:roadm-port;
494       }
495       container transponder-port {
496         when "../port-qual='xpdr-network' or ../port-qual='xpdr-client'";
497         uses org-openroadm-port-types:common-port;
498       }
499       container otdr-port {
500         when "../port-qual='otdr'";
501         description
502           "Settings for otdr port.";
503         leaf launch-cable-length {
504           type uint32;
505           default "30";
506           units "m";
507         }
508         leaf port-direction {
509           type org-openroadm-common-types:direction;
510         }
511       }
512     }
513   }
514
515   grouping connection {
516     description
517       "Grouping used to define connections.";
518     leaf connection-number {
519       type string;
520     }
521     leaf wavelength-number {
522       type uint32;
523       mandatory true;
524       description
525         "wavelength-number, can be used to access wavelength-map
526          to get wavelength value in nm.";
527     }
528     leaf opticalControlMode {
529       description
530         "Whether connection is currently in power or gain/loss mode";
531       type org-openroadm-common-types:optical-control-mode;
532       reference "openroadm.org: Open ROADM MSA Specification.";
533       default "off";
534     }
535     leaf target-output-power {
536       type org-openroadm-common-types:power-dBm;
537       description
538         "The output target power for this connection. When set, the ROADM will work to ensure that current-output-power reaches this level.";
539     }
540     container source {
541       leaf src-if {
542         type leafref {
543           path "/org-openroadm-device/interface/name";
544         }
545         mandatory true;
546       }
547     }
548     container destination {
549       leaf dst-if {
550         type leafref {
551           path "/org-openroadm-device/interface/name";
552         }
553         mandatory true;
554       }
555     }
556   }
557
558   grouping degree {
559     leaf degree-number {
560       type uint16;
561       must "not( current() > /org-openroadm-device/info/max-degrees) and current() > 0" {
562         error-message "Degree not supported by device ";
563         description
564           "Validating if the degree is supported by device";
565       }
566     }
567     leaf max-wavelengths {
568       type uint16;
569       description
570         "maximum number of wavelengths";
571       config false;
572       mandatory true;
573     }
574     list circuit-packs {
575       key "index";
576       description
577         "list for Cards associated with a degree";
578       leaf index {
579         type uint32;
580       }
581       uses circuit-pack-name {
582         refine "circuit-pack-name" {
583           mandatory true;
584         }
585       }
586     }
587     list connection-ports {
588       description
589         "Port associated with degree: One if bi-directional; two if uni-directional";
590       key "index";
591       leaf index {
592         type uint32;
593       }
594       uses port-name {
595         refine "circuit-pack-name" {
596           mandatory true;
597         }
598         refine "port-name" {
599           mandatory true;
600         }
601       }
602     }
603     container otdr-port {
604       description
605         "otdr port associated with degree.";
606       uses port-name;
607     }
608   }
609
610   grouping external-links {
611     description
612       "YANG definitions for external links..
613        - physical links between ROADMs and between the ROADMs and XPonders, which can be added and removed maually.";
614     list external-link {
615       key "external-link-name";
616       uses external-link;
617     }
618   }
619
620   grouping external-link {
621     leaf external-link-name {
622       type string;
623     }
624     container source {
625       uses org-openroadm-resource-types:device-id {
626         refine "node-id" {
627           mandatory true;
628         }
629       }
630       uses org-openroadm-resource-types:port-name {
631         refine "circuit-pack-name" {
632           mandatory true;
633         }
634         refine "port-name" {
635           mandatory true;
636         }
637       }
638     }
639     container destination {
640       uses org-openroadm-resource-types:device-id {
641         refine "node-id" {
642           mandatory true;
643         }
644       }
645       uses org-openroadm-resource-types:port-name {
646         refine "circuit-pack-name" {
647           mandatory true;
648         }
649         refine "port-name" {
650           mandatory true;
651         }
652       }
653     }
654   }
655
656   grouping internal-links {
657     list internal-link {
658       key "internal-link-name";
659       config false;
660       uses internal-link;
661     }
662   }
663
664   grouping internal-link {
665     leaf internal-link-name {
666       type string;
667     }
668     container source {
669       uses port-name {
670         refine "circuit-pack-name" {
671           mandatory true;
672         }
673         refine "port-name" {
674           mandatory true;
675         }
676       }
677     }
678     container destination {
679       uses port-name {
680         refine "circuit-pack-name" {
681           mandatory true;
682         }
683         refine "port-name" {
684           mandatory true;
685         }
686       }
687     }
688   }
689
690   grouping physical-links {
691     description
692       "YANG definitions for physical links.
693        - phyical links between cards within a ROADM, which are populated by the ROADM and cannot be added or removed manually. ";
694     list physical-link {
695       key "physical-link-name";
696       uses physical-link;
697     }
698   }
699
700   grouping physical-link {
701     leaf physical-link-name {
702       type string;
703     }
704     container source {
705       uses port-name {
706         refine "circuit-pack-name" {
707           mandatory true;
708         }
709         refine "port-name" {
710           mandatory true;
711         }
712       }
713     }
714     container destination {
715       uses port-name {
716         refine "circuit-pack-name" {
717           mandatory true;
718         }
719         refine "port-name" {
720           mandatory true;
721         }
722       }
723     }
724   }
725
726   grouping srg {
727     leaf max-add-drop-ports {
728       type uint16;
729       config false;
730       mandatory true;
731     }
732     leaf srg-number {
733       type uint16;
734       must "not(current()>/org-openroadm-device/info/max-srgs) and current()>0" {
735         error-message "invalid SRG";
736         description
737           "Validating if the srg is supported by add/drop group";
738       }
739     }
740     leaf wavelengthDuplication {
741       description
742         "Whether the SRG can handle duplicate wavelengths and if so to what extent.";
743       config false;
744       mandatory true;
745       type enumeration {
746         enum "onePerSRG" {
747           description
748             "The SRG cannot handle wavelength duplication. Attempting to provision a connection on this SRG that uses the same wavelength as an existing service will result in failure.";
749           value 1;
750         }
751         enum "onePerDegree" {
752           description
753             "The SRG can handle wavelength duplication, but only one per degree. Attempting to provision a connection on this SRG that uses the same wavelength as an existing service will succeed, so long as the connections are not using the same degree.";
754           value 2;
755         }
756       }
757     }
758     list circuit-packs {
759       key "index";
760       description
761         "list for Cards associated with an add/drop group and srg";
762       leaf index {
763         type uint32;
764       }
765       uses circuit-pack-name {
766         refine "circuit-pack-name" {
767           mandatory true;
768         }
769       }
770     }
771   }
772
773   grouping degree-number {
774     leaf degree-number {
775       description
776         "Degree identifier. Unique within the context of a device.";
777       type leafref {
778         path "/org-openroadm-device/degree/degree-number";
779       }
780     }
781   }
782
783   grouping circuit-pack-name {
784     leaf circuit-pack-name {
785       description
786         "Circuit-Pack identifier. Unique within the context of a device.";
787       type leafref {
788         path "/org-openroadm-device/circuit-packs/circuit-pack-name";
789       }
790     }
791   }
792
793   grouping port-name {
794     uses circuit-pack-name;
795     leaf port-name {
796       description
797         "Port identifier. Unique within the context of a circuit-pack.";
798       type leafref {
799         path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name";
800       }
801     }
802   }
803
804   grouping srg-number {
805     leaf srg-number {
806       description
807         "Shared Risk Group identifier. Unique within the context of a device.";
808       type leafref {
809         path "/org-openroadm-device/shared-risk-group/srg-number";
810       }
811     }
812   }
813
814   grouping supporting-port-name {
815     leaf supporting-circuit-pack-name {
816       description
817         "Identifier of the supporting circuit-pack.";
818       type leafref {
819         path "/org-openroadm-device/circuit-packs/circuit-pack-name";
820       }
821       mandatory true;
822     }
823     leaf supporting-port {
824       description
825         "Identifier of the supporting port.";
826       mandatory true;
827       type leafref {
828         path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../supporting-circuit-pack-name]/ports/port-name";
829       }
830     }
831   }
832
833   grouping interface-name {
834     leaf interface-name {
835       description
836         "Name of an interface. Unique within the context of a device.";
837       type leafref {
838         path "/org-openroadm-device/interface/name";
839       }
840       config false;
841     }
842   }
843
844   grouping interfaces-grp {
845     description
846       "OpenROADM Interface configuration parameters.";
847     list interface {
848       key "name";
849       description
850         "The list of configured interfaces on the device.";
851       leaf name {
852         type string;
853         description
854           "The name of the interface.";
855       }
856       leaf description {
857         type string;
858         description
859           "A textual description of the interface.";
860       }
861       leaf type {
862         type identityref {
863           base org-openroadm-interfaces:interface-type;
864         }
865         mandatory true;
866         description
867           "The type of the interface.";
868       }
869       leaf administrative-state {
870         type org-openroadm-equipment-states-types:admin-states;
871       }
872       leaf operational-state {
873         type org-openroadm-common-types:state;
874         config false;
875       }
876       leaf circuit-id {
877         type string {
878           length "0..45";
879         }
880         description
881           "circuit identifier/user label,
882            can be used in alarm correlation and/or connection management ";
883       }
884       leaf supporting-interface {
885         type leafref {
886           path "/org-openroadm-device/interface/name";
887         }
888       }
889       uses supporting-port-name;
890     }
891   }
892
893   grouping port {
894     description
895       "Grouping of attributes related to a port object.";
896     leaf port-name {
897       type string;
898       mandatory true;
899       description
900         "Identifier for a port, unique within a circuit pack";
901     }
902     leaf port-type {
903       type string;
904       description
905         "Type of the pluggable or fixed port.";
906     }
907     leaf port-qual {
908       type enumeration {
909         enum "roadm-internal" {
910           value 1;
911         }
912         enum "roadm-external" {
913           value 2;
914         }
915         enum "xpdr-network" {
916           value 3;
917         }
918         enum "xpdr-client" {
919           value 4;
920         }
921         enum "otdr" {
922           value 5;
923         }
924       }
925     }
926     leaf port-wavelength-type {
927       type org-openroadm-port-types:port-wavelength-types;
928       config false;
929       description
930         "Type of port - single, multiple-wavelength, etc.";
931     }
932     leaf port-direction {
933       type org-openroadm-common-types:direction;
934       config false;
935       mandatory true;
936       description
937         "Whether port is uni (tx/rx) or bi-directional and";
938     }
939     leaf label {
940       type string;
941       config false;
942       description
943         "Faceplate label";
944     }
945     leaf circuit-id{
946       type string{
947         length "0..45";
948       }
949       description
950           "circuit identifier/user label,
951            can be used in alarm correlation and/or connection management ";
952
953     }
954     leaf administrative-state {
955       type org-openroadm-equipment-states-types:admin-states;
956       description
957         "Administrative state of port. The value of this field independant of the state of its contained and containing resources.  Setting this a port to administratively down will impact both its operational state, as well the operational state of its contained resources.  If this port is an endpoint to a connection, internal-link, physical-link, etc, then administratevely disabling this port will impact the operational state of those items unless they are using some form of port-protection schema.";
958       default "outOfService";
959     }
960     leaf operational-state {
961       type org-openroadm-common-types:state;
962       config false;
963       mandatory true;
964       description
965         "Operational state of a port";
966     }
967     leaf-list supported-interface-capability {
968       description
969         "Interface types supported on this port";
970       config false;
971       type identityref {
972         base org-openroadm-port-types:supported-if-capability;
973       }
974     }
975     leaf logical-connection-point {
976       type string;
977       description
978         "delete or replace with list logical-ports or connections?";
979     }
980     container partner-port {
981       config false;
982       description
983         "For ports which are not identified as having a direction of bidirectional, this field is used to identify the port which corresponds to the reverse direction. A port pair should include a port for each direction (tx, rx) and report their mate as partner-port.";
984       uses port-name;
985     }
986     container parent-port {
987       config false;
988       description
989         "In the case of port hierarchy, this is the parent port, which is also modeled as port within this circuit-pack. This is used in the case of a port that supports a parallel connector that contains subports.  The parent-port of the subport will be the port that contains this subport.  This can be used to help isolate faults when a single fault on a parallel connector introduces symptomatic failures on the contained subports.";
990       uses port-name;
991     }
992     list interfaces {
993       config false;
994       description
995         "List of the interfaces this port supports.  This is a list of names of instances in the flat instance list";
996       uses interface-name;
997     }
998   }
999
1000   uses org-openroadm-device-container;
1001
1002   grouping org-openroadm-device-container {
1003     container org-openroadm-device {
1004       container info {
1005         uses device-common;
1006         leaf max-degrees {
1007           type uint16;
1008           description
1009             "Max. number of degrees supported by device";
1010           config false;
1011         }
1012         leaf max-srgs {
1013           type uint16;
1014           description
1015             "Max. number of SRGs in an add/drop group";
1016           config false;
1017         }
1018       }
1019       container users {
1020         description
1021           "Stores a list of users";
1022         uses org-openroadm-user-mgmt:user-profile;
1023       }
1024       container pending-sw {
1025         config false;
1026         uses org-openroadm-swdl:sw-bank;
1027       }
1028       uses shelves;
1029       uses circuit-packs;
1030       uses interfaces-grp;
1031       container protocols {
1032         description
1033           "Contains the supported protocols";
1034       }
1035       container wavelength-map {
1036         description
1037           "The wavelength-number and center frequency, wavelength mapping";
1038         config false;
1039         uses org-openroadm-wavelength-map:wavelength-map-g;
1040       }
1041       uses internal-links;
1042       uses physical-links;
1043       uses external-links;
1044       list degree {
1045         when "/org-openroadm-device/info/node-type='rdm'";
1046         key "degree-number";
1047         uses degree;
1048       }
1049       list shared-risk-group {
1050         when "/org-openroadm-device/info/node-type='rdm'";
1051         key "srg-number";
1052         uses srg;
1053       }
1054       list roadm-connections {
1055         when "/org-openroadm-device/info/node-type='rdm'";
1056         key "connection-number";
1057         uses connection;
1058       }
1059       list connection-map {
1060         key "connection-map-number";
1061         config false;
1062         leaf connection-map-number {
1063           description
1064             "Unique identifier for this connection-map entry";
1065           type uint32;
1066         }
1067         container source {
1068           leaf circuit-pack-name {
1069             type leafref {
1070               path "/org-openroadm-device/circuit-packs/circuit-pack-name";
1071             }
1072             mandatory true;
1073           }
1074           leaf port-name {
1075             description
1076               "Port identifier. Unique within the context of a circuit-pack.";
1077             type leafref {
1078               path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name";
1079             }
1080             mandatory true;
1081           }
1082         }
1083         list destination {
1084           key "circuit-pack-name port-name";
1085           min-elements 1;
1086           leaf circuit-pack-name {
1087             type leafref {
1088               path "/org-openroadm-device/circuit-packs/circuit-pack-name";
1089             }
1090             mandatory true;
1091           }
1092           leaf port-name {
1093             description
1094               "Port identifier. Unique within the context of a circuit-pack.";
1095             type leafref {
1096               path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name";
1097             }
1098             mandatory true;
1099           }
1100         }
1101       }
1102     }
1103   }
1104
1105   grouping common-session-parms {
1106     description
1107       "Common session parameters to identify a
1108        management session.";
1109
1110     leaf username {
1111       type string;
1112       mandatory true;
1113       description
1114         "Name of the user for the session.";
1115     }
1116
1117     leaf session-id {
1118       type ietf-nc:session-id-or-zero-type;
1119       mandatory true;
1120       description
1121         "Identifier of the session.
1122          A NETCONF session MUST be identified by a non-zero value.
1123          A non-NETCONF session MAY be identified by the value zero.";
1124     }
1125
1126     leaf source-host {
1127       type ietf-inet-types:ip-address;
1128       description
1129         "Address of the remote host for the session.";
1130     }
1131   }
1132   grouping changed-by-parms {
1133     description
1134       "Common parameters to identify the source
1135        of a change event, such as a configuration
1136        or capability change.";
1137
1138      container changed-by {
1139        description
1140          "Indicates the source of the change.
1141           If caused by internal action, then the
1142           empty leaf 'server' will be present.
1143           If caused by a management session, then
1144           the name, remote host address, and session ID
1145           of the session that made the change will be reported.";
1146        choice server-or-user {
1147          leaf server {
1148            type empty;
1149            description
1150              "If present, the change was caused
1151               by the server.";
1152          }
1153
1154          case by-user {
1155            uses common-session-parms;
1156          }
1157        } // choice server-or-user
1158      } // container changed-by-parms
1159   }
1160   notification change-notification {
1161     description
1162       "The Notification that a resource has been added, modified or removed.
1163        This notification can be triggered by changes in configuration and operational data.
1164        It shall contain the changed field pointed by the xpath.
1165        Typically it is not intended for frequently changing volatile data e.g. PM, power levels";
1166
1167     leaf change-time {
1168       description "The time the change occurs.";
1169       type ietf-yang-types:date-and-time;
1170     }
1171     uses changed-by-parms;
1172
1173     leaf datastore {
1174       type enumeration {
1175         enum running {
1176           description "The <running> datastore has changed.";
1177         }
1178         enum startup {
1179           description "The <startup> datastore has changed";
1180         }
1181       }
1182       default "running";
1183       description
1184         "Indicates which configuration datastore has changed.";
1185     }
1186     list edit {
1187       description
1188         "An edit (change) record SHOULD be present for each distinct
1189          edit operation that the server has detected on
1190          the target datastore.  This list MAY be omitted
1191          if the detailed edit operations are not known.
1192          The server MAY report entries in this list for
1193          changes not made by a NETCONF session.";
1194
1195       leaf target {
1196         type instance-identifier;
1197         description
1198             "Topmost node associated with the configuration or operationa change.
1199              A server SHOULD set this object to the node within
1200              the datastore that is being altered.  A server MAY
1201              set this object to one of the ancestors of the actual
1202              node that was changed, or omit this object, if the
1203              exact node is not known.";
1204       }
1205       leaf operation {
1206         type ietf-nc:edit-operation-type;
1207         description
1208           "Type of edit operation performed.
1209          A server MUST set this object to the NETCONF edit
1210          operation performed on the target datastore.";
1211       }
1212     } // list edit
1213   } // notification change-notification
1214 }