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