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