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