summaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-terminal-device.yang
blob: 27de12dba833704083e5d52cf49ea617eb45b26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
module openconfig-terminal-device {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/terminal-device";

  prefix "oc-opt-term";

  import openconfig-types { prefix oc-types; }
  import openconfig-transport-types { prefix oc-opt-types; }
  import openconfig-if-ethernet { prefix oc-eth; }
  import openconfig-platform { prefix oc-platform; }
  import openconfig-platform-transceiver { prefix oc-transceiver; }
  import openconfig-lldp { prefix oc-lldp; }
  import openconfig-extensions { prefix oc-ext; }
  import ietf-yang-types { prefix yang; }
  import openconfig-interfaces { prefix oc-if; }
  import openconfig-yang-types { prefix oc-yang; }


  // meta
  organization "OpenConfig working group";

  contact
    "OpenConfig working group
    www.openconfig.net";

  description
    "This module describes a terminal optics device model for
    managing the terminal systems (client and line side) in a
    DWDM transport network.

    Elements of the model:

    physical port: corresponds to a physical, pluggable client
    port on the terminal device. Examples includes 10G, 40G, 100G
    (e.g., 10x10G, 4x25G or 1x100G) and 400G/1T in the future.
    Physical client ports will have associated operational state or
    PMs.

    physical channel: a physical lane or channel in the
    physical client port.  Each physical client port has 1 or more
    channels. An example is 100GBASE-LR4 client physical port having
    4x25G channels. Channels have their own optical PMs and can be
    monitored independently within a client physical port (e.g.,
    channel power).  Physical client channels are defined in the
    model as part of a physical client port, and are modeled
    primarily for reading their PMs.

    logical channel: a logical grouping of logical grooming elements
    that may be assigned to subsequent grooming stages for
    multiplexing / de-multiplexing, or to an optical channel for
    line side transmission.  The logical channels can represent, for
    example, an ODU/OTU logical packing of the client
    data onto the line side.  Tributaries are similarly logical
    groupings of demand that can be represented in this structure and
    assigned to an optical channel.  Note that different types of
    logical channels may be present, each with their corresponding
    PMs.

    optical channel:  corresponds to an optical carrier and is
    assigned a wavelength/frequency.  Optical channels have PMs
    such as power, BER, and operational mode.

    Directionality:

    To maintain simplicity in the model, the configuration is
    described from client-to-line direction.  The assumption is that
    equivalent reverse configuration is implicit, resulting in
    the same line-to-client configuration.

    Physical layout:

    The model does not assume a particular physical layout of client
    and line ports on the terminal device (e.g., such as number of
    ports per linecard, separate linecards for client and line ports,
    etc.).";

  oc-ext:openconfig-version "1.4.0";

  revision "2018-08-28" {
    description
      "Adds terminal device related Ethernet counters";
    reference "1.4.0";
  }

  revision "2018-07-30" {
    description
      "Adds lldp snooping config leaf and augmented it to oc-lldp";
    reference "1.3.0";
  }

  revision "2018-07-26" {
    description
      "Adds OTN protocol counter stats of errored-blocks and
       fec-uncorrectable-blocks, adds ethernet-config-ext grouping
       and uses it to augment oc-eth";
    reference "1.2.0";
  }

  revision "2018-07-17" {
    description
      "Adds testing enum to link-state";
    reference "1.1.0";
  }

  revision "2017-07-08" {
    description
      "Adds test-signal";
    reference "1.0.0";
  }

  revision "2016-12-22" {
    description
      "Fixes and additions to terminal optics model";
    reference "0.4.0";
  }


  grouping terminal-input-optical-power {
    description
      "Reusable leaves related to input optical power";

    leaf input-power {
      type decimal64 {
        fraction-digits 2;
      }
      units dBm;
      description
        "The input optical power of this port in units of 0.01dBm.
        If the port is an aggregate of multiple physical channels,
        this attribute is the total power or sum of all channels.";
    }
  }

  grouping terminal-ethernet-protocol-config {
    description
      "Configuration data for logical channels with Ethernet
      framing";

    //TODO:currently a empty container
  }

  grouping terminal-ethernet-protocol-state {
    description
      "Ethernet-specific counters when logical channel
      is using Ethernet protocol framing, e.g., 10GE, 100GE";

      uses oc-eth:ethernet-interface-state-counters;
      uses terminal-ethernet-protocol-state-counters;
  }

  grouping terminal-ethernet-protocol-state-counters {
    description
      "Ethernet-specific counters for terminal devices when
      logical channel is using Ethernet protocol framing,
      e.g., 10GE, 100GE";

    // ingress counters

    leaf in-pcs-bip-errors {
      type oc-yang:counter64;
      description
        "The number of received bit interleaved parity (BIP) errors
        at the physical coding sublayer (PCS). If the interface
        consists of multiple lanes, this will be the sum of all
	errors on the lane";
    }

    leaf in-pcs-errored-seconds {
      type oc-yang:counter64;
      description
        "The number of seconds that physical coding sublayer (PCS)
        errors have crossed a sytem defined threshold indicating the
        link is erroring";
    }

    leaf in-pcs-severely-errored-seconds {
      type oc-yang:counter64;
      description
        "The number of seconds that physical coding sublayer (PCS)
        errors have crossed a system defined threshold indicating the
        link is severely erroring";
    }

    leaf in-pcs-unavailable-seconds {
      type oc-yang:counter64;
      description
        "The number of seconds that physical coding sublayer (PCS)
        errors have crossed a system defined threshold indicating the
        link is unavailable";
    }

    // egress counters

    leaf out-pcs-bip-errors {
      type oc-yang:counter64;
      description
        "The number of transmitted bit interleaved parity (BIP) errors
        at the physical coding sublayer (PCS). If the interface
        consists of multiple lanes, this will be the sum of all
        errors on the lane";
    }

    leaf out-crc-errors {
      type oc-yang:counter64;
      description
        "Number of FCS/CRC error check failures sent on the interface";
    }

    leaf out-block-errors {
      type oc-yang:counter64;
      description
        "The number of transmitted errored blocks. Error detection
        codes are capable of detecting whether one or more errors have
        occurred in a given sequence of bits - the block. It is
        normally not possible to determine the exact number of errored
        bits within the block";
    }
  }

  grouping terminal-ethernet-protocol-top {
    description
      "Top-level grouping for data related to Ethernet protocol
      framing on logical channels";

    container ethernet {
      description
        "Top level container for data related to Ethernet framing
        for the logical channel";

      container config {
        description
          "Configuration data for Ethernet protocol framing on
          logical channels";

        uses terminal-ethernet-protocol-config;
      }

      container state {
        config false;
        description
          "Operational state data for Ethernet protocol framing
          on logical channels";

        uses terminal-ethernet-protocol-state;
      }
    }
  }

  grouping terminal-otn-protocol-config {
    description
      "OTU configuration when logical channel
      framing is using an OTU protocol, e.g., OTU1, OTU3, etc.";

    leaf tti-msg-transmit {
      type string;
      description
        "Trail trace identifier (TTI) message transmitted";
    }

    leaf tti-msg-expected {
      type string;
      description
        "Trail trace identifier (TTI) message expected";
    }

    leaf tti-msg-auto {
      type boolean;
      description
        "Trail trace identifier (TTI) transmit message automatically
        created.  If true, then setting a custom transmit message
        would be invalid.";
    }
  }

  grouping terminal-otn-protocol-counter-stats {
    description
      "Counter based statistics containers for logical channels
      using OTN framing";

    leaf errored-seconds {
      type yang:counter64;
      description
        "The number of seconds that at least one errored blocks
        occurs, at least one code violation occurs, loss of sync is
        detected or loss of signal is detected";
    }

    leaf severely-errored-seconds {
      type yang:counter64;
      description
        "The number of seconds that loss of frame is detected OR
        the number of errored blocks, code violations, loss of sync
        or loss of signal is detected exceeds a predefined
        threshold";
    }

    leaf unavailable-seconds {
      type yang:counter64;
      description
        "The number of seconds during which the link is unavailable";
    }

    leaf code-violations {
      type yang:counter64;
      description
        "For ethernet or fiberchannel links, the number of 8b/10b
        coding violations. For SONET/SDH, the number of BIP (bit
        interleaved parity) errors";
    }

    leaf errored-blocks {
      type yang:counter64;
      description
        "The number of errored blocks. Error detection codes are
        capable to detect whether one or more errors have occurred
        in a given sequence of bits - the block. It is normally not
        possible to determine the exact number of errored bits within
        the block.";
      reference "ITU-T Rec. G.826";
    }

    leaf fec-uncorrectable-blocks {
      type yang:counter64;
      description
        "The number of blocks that were uncorrectable by the FEC";
    }

    leaf fec-uncorrectable-words {
      type yang:counter64;
      description
        "The number of words that were uncorrectable by the FEC";
    }

    leaf fec-corrected-bytes {
      type yang:counter64;
      description
        "The number of bytes that were corrected by the FEC";
    }

    leaf fec-corrected-bits {
      type yang:counter64;
      description
        "The number of bits that were corrected by the FEC";
    }

    leaf background-block-errors {
      type yang:counter64;
      description
        "The number of background block errors";
    }
  }

  grouping terminal-otn-protocol-multi-stats {
    description
      "Multi-value statistics containers for logical channels using
      OTN framing (e.g., max, min, avg, instant)";

    container pre-fec-ber {
      description
        "Bit error rate before forward error correction -- computed
        value with 18 decimal precision. Note that decimal64
        supports values as small as i x 10^-18 where i is an
        integer. Values smaller than this should be reported as 0
        to inidicate error free or near error free performance.
        Values include the instantaneous, average, minimum, and
        maximum statistics. If avg/min/max statistics are not
        supported, the target is expected to just supply the
        instant value";

      uses oc-opt-types:avg-min-max-instant-stats-precision18-ber;
    }

    container post-fec-ber {
      description
        "Bit error rate after forward error correction -- computed
        value with 18 decimal precision. Note that decimal64
        supports values as small as i x 10^-18 where i is an
        integer. Values smaller than this should be reported as 0
        to inidicate error free or near error free performance.
        Values include the instantaneous, average, minimum, and
        maximum statistics. If avg/min/max statistics are not
        supported, the target is expected to just supply the
        instant value";

      uses oc-opt-types:avg-min-max-instant-stats-precision18-ber;
    }

    container q-value {
      description
        "Quality value (factor) in dB of a channel with two
        decimal precision. Values include the instantaneous,
        average, minimum, and maximum statistics. If avg/min/max
        statistics are not supported, the target is expected
        to just supply the instant value";

      uses oc-types:avg-min-max-instant-stats-precision2-dB;
    }

    container esnr {
      description
        "Electrical signal to noise ratio. Baud rate
        normalized signal to noise ratio based on
        error vector magnitude in dB with two decimal
        precision. Values include the instantaneous, average,
        minimum, and maximum statistics. If avg/min/max
        statistics are not supported, the target is expected
        to just supply the instant value";

      uses oc-types:avg-min-max-instant-stats-precision2-dB;
    }
  }

  grouping terminal-otn-protocol-state {
    description
      "OTU operational state when logical channel
      framing is using an OTU protocol, e.g., OTU1, OTU3, etc.";


      leaf tti-msg-recv {
        type string;
        description
          "Trail trace identifier (TTI) message received";
      }

      leaf rdi-msg {
        type string;
        description
          "Remote defect indication (RDI) message received";
      }
      uses terminal-otn-protocol-counter-stats;
      uses terminal-otn-protocol-multi-stats;
  }

  grouping terminal-otn-protocol-top {
    description
      "Top-level grouping for data related to OTN protocol framing";

    container otn {
      description
        "Top level container for OTU configuration when logical
        channel framing is using an OTU protocol, e.g., OTU1, OTU3,
        etc.";

      container config {
        description
          "Configuration data for OTN protocol framing";

        uses terminal-otn-protocol-config;
      }

      container state {

        config false;

        description
          "Operational state data for OTN protocol PMs, statistics,
          etc.";

        uses terminal-otn-protocol-config;
        uses terminal-otn-protocol-state;
      }
    }
  }

  grouping terminal-client-port-assignment-config {
    description
      "Configuration data for assigning physical client ports to
      logical channels";

    leaf index {
      type uint32;
      description
        "Index of the client port assignment";
    }

    leaf description {
      type string;
      description
        "Descriptive name for the client port-to-logical channel
        mapping";
    }

    leaf logical-channel {
      type leafref {
        path "/oc-opt-term:terminal-device/oc-opt-term:logical-channels" +
          "/oc-opt-term:channel/oc-opt-term:index";
      }
      description
        "Reference to the logical channel for this
        assignment";
    }

    leaf allocation {
      type decimal64 {
        fraction-digits 3;
      }
      units Gbps;
      description
        "Allocation of the client physical port to the assigned
        logical channel expressed in Gbps.  In most cases,
        the full client physical port rate is assigned to a single
        logical channel.";
    }

  }

  grouping terminal-client-port-assignment-state {
    description
      "Operational state data for assigning physical client ports
      to logical channels";
  }

  grouping terminal-client-port-assignment-top {
    description
      "Top-level grouping for the assigment of client physical ports
      to logical channels";
    //TODO: this grouping could be removed, instead reusing a common
    //grouping for logical client assignment pointers

    container logical-channel-assignments {
      description
        "Enclosing container for client port to logical client
        mappings";

      list assignment {
        key "index";
        description
          "List of assignments to logical clients";

        leaf index {
          type leafref {
            path "../config/index";
          }
          description
            "Reference to the index of this logical client
            assignment";
        }

        container config {
          description
            "Configuration data for the logical client assignment";

          uses terminal-client-port-assignment-config;
        }

        container state {

          config false;

          description
            "Operational state data for the logical client
            assignment";

          uses terminal-client-port-assignment-config;
          uses terminal-client-port-assignment-state;
        }
      }
    }
  }


  grouping terminal-logical-chan-assignment-config {
    description
      "Configuration data for assigning client logical channels
      to line-side tributaries";

    leaf index {
      type uint32;
      description
        "Index of the current logical client channel to tributary
        mapping";
    }

    leaf description {
      type string;
      description
        "Name assigned to the logical client channel";
    }

    leaf assignment-type {
      type enumeration {
        enum LOGICAL_CHANNEL {
          description
            "Subsequent channel is a logical channel";
        }
        enum OPTICAL_CHANNEL {
          description
            "Subsequent channel is a optical channel / carrier";
        }
      }
      description
        "Each logical channel element may be assigned to subsequent
        stages of logical elements to implement further grooming, or
        can be assigned to a line-side optical channel for
        transmission.  Each assignment also has an associated
        bandwidth allocation.";
    }

    leaf logical-channel {
      type leafref {
        path "/oc-opt-term:terminal-device/" +
          "oc-opt-term:logical-channels/oc-opt-term:channel/" +
          "oc-opt-term:index";
      }
      must "../assignment-type = 'LOGICAL_CHANNEL'" {
        description
          "The assignment-type must be set to LOGICAL_CHANNEL for
          this leaf to be valid";
      }
      description
         "Reference to another stage of logical channel elements.";
    }

    leaf optical-channel {
      type leafref {
        path "/oc-platform:components/oc-platform:component/" +
          "oc-platform:name";
      }
      must "../assignment-type = 'OPTICAL_CHANNEL'" {
        description
          "The assignment-type must be set to OPTICAL_CHANNEL for
          this leaf to be valid";
      }
      description
        "Reference to the line-side optical channel that should
        carry the current logical channel element.  Use this
        reference to exit the logical element stage.";
    }

    leaf allocation {
      type decimal64 {
        fraction-digits 3;
      }
      units Gbps;
      description
        "Allocation of the logical client channel to the tributary
        or sub-channel, expressed in Gbps";
    }

  }

  grouping terminal-logical-chan-assignment-state {
    description
      "Operational state data for the assignment of logical client
      channel to line-side tributary";
  }

  grouping terminal-logical-chan-assignment-top {
    description
      "Top-level grouping for the list of logical client channel-to-
      tributary assignments";

    container logical-channel-assignments {
      //TODO: we need a commonly understood name for this logical
      //channel structure
      description
        "Enclosing container for tributary assignments";

      list assignment {
        key "index";
        description
          "Logical channel elements may be assigned directly to
          optical channels for line-side transmission, or can be
          further groomed into additional stages of logical channel
          elements.  The grooming can multiplex (i.e., split the
          current element into multiple elements in the subsequent
          stage) or de-multiplex (i.e., combine the current element
          with other elements into the same element in the subsequent
          stage) logical elements in each stage.

          Note that to support the ability to groom the logical
          elements, the list of logical channel elements should be
          populated with an entry for the logical elements at
          each stage, starting with the initial assignment from the
          respective client physical port.

          Each logical element assignment consists of a pointer to
          an element in the next stage, or to an optical channel,
          along with a bandwidth allocation for the corresponding
          assignment (e.g., to split or combine signal).";

        leaf index {
          type leafref {
            path "../config/index";
          }
          description
            "Reference to the index for the current tributary
            assignment";
        }

        container config {
          description
            "Configuration data for tributary assignments";

          uses terminal-logical-chan-assignment-config;
        }

        container state {

          config false;

          description
            "Operational state data for tributary assignments";

          uses terminal-logical-chan-assignment-config;
          uses terminal-logical-chan-assignment-state;
        }
      }
    }
  }

  grouping terminal-logical-channel-ingress-config {
    description
      "Configuration data for ingress signal to logical channel";

    leaf transceiver {
      type leafref {
        path "/oc-platform:components/oc-platform:component/" +
        "oc-platform:name";
      }
      description
        "Reference to the transceiver carrying the input signal
        for the logical channel.  If specific physical channels
        are mapped to the logical channel (as opposed to all
        physical channels carried by the transceiver), they can be
        specified in the list of physical channel references.";
    }

    leaf-list physical-channel {
      type leafref {
        path "/oc-platform:components/oc-platform:component/" +
          "oc-transceiver:transceiver/" +
          "oc-transceiver:physical-channels/" +
          "oc-transceiver:channel/oc-transceiver:index";
      }
      description
        "This list should be populated with references
        to the client physical channels that feed this logical
        channel from the transceiver specified in the 'transceiver'
        leaf, which must be specified.  If this leaf-list is empty,
        all physical channels in the transceiver are assumed to be
        mapped to the logical channel.";
    }
  }

  grouping terminal-logical-channel-ingress-state {
    description
      "Operational state data for ingress signal to logical channel";
  }

  grouping terminal-logical-channel-ingress-top {
    description
      "Top-level grouping for ingress signal to logical channel";

    container ingress {
      description
        "Top-level container for specifying references to the
        source of signal for the logical channel, either a
        transceiver or individual physical channels";

      container config {
        description
          "Configuration data for the signal source for the
          logical channel";

        uses terminal-logical-channel-ingress-config;
      }

      container state {

        config false;

        description
          "Operational state data for the signal source for the
          logical channel";

        uses terminal-logical-channel-ingress-config;
        uses terminal-logical-channel-ingress-state;
      }
    }
  }

  grouping terminal-logical-channel-config {
    description
      "Configuration data for logical channels";

    leaf index {
      type uint32;
      description
        "Index of the current logical channel";
    }

    leaf description {
      type string;
      description
        "Description of the logical channel";
    }

    leaf admin-state {
      type oc-opt-types:admin-state-type;
      description
          "Sets the admin state of the logical channel";
    }

    leaf rate-class {
      type identityref {
        base oc-opt-types:TRIBUTARY_RATE_CLASS_TYPE;
      }
      description
        "Rounded bit rate of the tributary signal. Exact bit rate
        will be refined by protocol selection.";
    }

    leaf trib-protocol {
      type identityref {
        base oc-opt-types:TRIBUTARY_PROTOCOL_TYPE;
      }
      description
        "Protocol framing of the tributary signal. If this
        LogicalChannel is directly connected to a Client-Port or
        Optical-Channel, this is the protocol of the associated port.
        If the LogicalChannel is connected to other LogicalChannels,
        the TributaryProtocol of the LogicalChannels will define a
        specific mapping/demapping or multiplexing/demultiplexing
        function.

        Not all protocols are valid, depending on the value
        of trib-rate-class.  The expectation is that the NMS
        will validate that a correct combination of rate class
        and protocol are specfied.  Basic combinations are:

        rate class: 1G
        protocols: 1GE

        rate class: 2.5G
        protocols: OC48, STM16

        rate class: 10G
        protocols:  10GE LAN, 10GE WAN, OC192, STM64, OTU2, OTU2e,
                    OTU1e, ODU2, ODU2e, ODU1e

        rate class: 40G
        protocols:  40GE, OC768, STM256, OTU3, ODU3

        rate class: 100G
        protocols:  100GE, 100G MLG, OTU4, OTUCn, ODU4";
    }

    leaf logical-channel-type {
      type identityref {
        base oc-opt-types:LOGICAL_ELEMENT_PROTOCOL_TYPE;
      }
      description
        "The type / stage of the logical element determines the
        configuration and operational state parameters (PMs)
        available for the logical element";
    }

    leaf loopback-mode {
      type oc-opt-types:loopback-mode-type;
      description
        "Sets the loopback type on the logical channel. Setting the
        mode to something besides NONE activates the loopback in
        the specified mode.";
    }

    leaf test-signal {
      type boolean;
      description
        "When enabled the logical channel's DSP will generate a pseudo
        randmon bit stream (PRBS) which can be used during testing.";
    }
  }


  grouping terminal-logical-channel-state {
    description
      "Operational state data for logical client channels";

    leaf link-state {
      type enumeration {
        enum UP {
          description
            "Logical channel is operationally up";
        }
        enum DOWN {
          description
            "Logical channel is operationally down";
        }
        enum TESTING {
          description
            "Logical channel is under test as a result of
            enabling test-signal";
        }
      }
      description
        "Link-state of the Ethernet protocol on the logical channel,
        SONET / SDH framed signal, etc.";
    }

  }

  grouping terminal-logical-channel-top {
    description
      "Top-level grouping for logical channels";

    container logical-channels {
      description
        "Enclosing container the list of logical channels";

      list channel {
        key "index";
        description
          "List of logical channels";
        //TODO: naming for this list of logical elements should be
        //revisited.

        leaf index {
          type leafref {
            path "../config/index";
          }
          description
            "Reference to the index of the logical channel";
        }

        container config {
          description
            "Configuration data for logical channels";

          uses terminal-logical-channel-config;

        }

        container state {

          config false;

          description
            "Operational state data for logical channels";

          uses terminal-logical-channel-config;
          uses terminal-logical-channel-state;
        }

        uses terminal-otn-protocol-top {
          when "config/logical-channel-type = 'PROT_OTN'" {
            description
              "Include the OTN protocol data only when the
              channel is using OTN framing.";
          }
        }
        uses terminal-ethernet-protocol-top {
          when "config/logical-channel-type = 'PROT_ETHERNET'" {
            description
              "Include the Ethernet protocol statistics only when the
              protocol used by the link is Ethernet.";
          }
        }
        uses terminal-logical-channel-ingress-top;
        uses terminal-logical-chan-assignment-top;
      }
    }
  }


  grouping terminal-optical-channel-config {
    description
      "Configuration data for describing optical channels";

    leaf frequency {
      type oc-opt-types:frequency-type;
      description
        "Frequency of the optical channel, expressed in MHz";
    }

    leaf target-output-power {
      type decimal64 {
        fraction-digits 2;
      }
      units dBm;
      description
        "Target output optical power level of the optical channel,
        expressed in increments of 0.01 dBm (decibel-milliwats)";
    }

    leaf operational-mode {
      type uint16;
      description
        "Vendor-specific mode identifier -- sets the operational
        mode for the channel.  The specified operational mode must
        exist in the list of supported operational modes supplied
        by the device";
      //
      // Ideally, this leaf should be a leafref to the supported
      // operational modes, but YANG 1.0 does not allow a r/w
      // leaf to be a leafref to a r/o leaf.
    }


    leaf line-port {
      type leafref {
        path "/oc-platform:components/oc-platform:component/" +
          "oc-platform:name";
      }
      description
        "Reference to the line-side physical port that carries
        this optical channel.  The target port should be
        a component in the physical inventory data model.";
    }
  }

  grouping terminal-optical-channel-state {
    description
      "Operational state data for optical channels";

    leaf group-id {
      type uint32;
      description
        "If the device places constraints on which optical
        channels must be managed together (e.g., transmitted on the
        same line port), it can indicate that by setting the group-id
        to the same value across related optical channels.";
    }

    uses oc-transceiver:optical-power-state;

    container chromatic-dispersion {
      description
        "Chromatic Dispersion of an optical channel in
        picoseconds / nanometer (ps/nm) as reported by receiver
        with two decimal precision. Values include the instantaneous,
        average, minimum, and maximum statistics. If avg/min/max
        statistics are not supported, the target is expected to just
        supply the instant value";

      uses oc-opt-types:avg-min-max-instant-stats-precision2-ps-nm;
    }

    container polarization-mode-dispersion {
      description
        "Polarization Mode Dispersion of an optical channel
        in picosends (ps) as reported by receiver with two decimal
        precision. Values include the instantaneous, average,
        minimum, and maximum statistics. If avg/min/max statistics
        are not supported, the target is expected to just supply the
        instant value";

      uses oc-opt-types:avg-min-max-instant-stats-precision2-ps;
    }

    container second-order-polarization-mode-dispersion {
      description
        "Second Order Polarization Mode Dispersion of an optical
        channel in picoseconds squared (ps^2) as reported by
        receiver with two decimal precision. Values include the
        instantaneous, average, minimum, and maximum statistics.
        If avg/min/max statistics are not supported, the target
        is expected to just supply the instant value";

      uses oc-opt-types:avg-min-max-instant-stats-precision2-ps2;
    }

    container polarization-dependent-loss {
      description
        "Polarization Dependent Loss of an optical channel
        in dB as reported by receiver with two decimal precision.
        Values include the instantaneous, average, minimum, and
        maximum statistics. If avg/min/max statistics are not
        supported, the target is expected to just supply the
        instant value";

      uses oc-types:avg-min-max-instant-stats-precision2-dB;
    }
  }

  grouping terminal-optical-channel-top {
    description
      "Top-level grouping for optical channel data";

    container optical-channel {
      description
        "Enclosing container for the list of optical channels";

      container config {
        description
          "Configuration data for optical channels";

        uses terminal-optical-channel-config;
      }

      container state {

        config false;

        description
          "Operational state data for optical channels";

        uses terminal-optical-channel-config;
        uses terminal-optical-channel-state;
      }
    }
  }

  grouping terminal-operational-mode-config {
    description
      "Configuration data for vendor-supported operational modes";
  }

  grouping terminal-operational-mode-state {
    description
      "Operational state data for vendor-supported operational
      modes";

      leaf mode-id {
        type uint16;
        description
          "Two-octet encoding of the vendor-defined operational
          mode";
      }

      leaf description {
        type string;
        description
          "Vendor-supplied textual description of the characteristics
          of this operational mode to enable operators to select the
          appropriate mode for the application.";
      }

      //TODO: examples of the kind of info that would be useful to
      //report in the operational mode:
      //Symbol rate (32G, 40G, 43G, 64G, etc.)
      //Modulation (QPSK, 8-QAM, 16-QAM, etc.)
      //Differential encoding (on, off/pilot symbol, etc)
      //State of polarization tracking mode (default, med.
      //high-speed, etc.)
      //Pulse shaping (RRC, RC, roll-off factor)
      //FEC mode (SD, HD, % OH)

      leaf vendor-id {
        type string;
        description
          "Identifier to represent the vendor / supplier of the
          platform and the associated operational mode information";
      }
  }

  grouping terminal-operational-mode-top {
    description
      "Top-level grouping for vendor-supported operational modes";

    container operational-modes {
      description
        "Enclosing container for list of operational modes";

      list mode {
        key "mode-id";
        config false;
        description
          "List of operational modes supported by the platform.
          The operational mode provides a platform-defined summary
          of information such as symbol rate, modulation, pulse
          shaping, etc.";

        leaf mode-id {
          type leafref {
            path "../state/mode-id";
          }
          description
            "Reference to mode-id";
        }

        container config {
          description
            "Configuration data for operational mode";

          uses terminal-operational-mode-config;
        }

        container state {

          config false;

          description
            "Operational state data for the platform-defined
            operational mode";

          uses terminal-operational-mode-config;
          uses terminal-operational-mode-state;
        }
      }
    }
  }

  grouping ethernet-config-ext {
    description
      "Extended ethernet config data on terminal device";

    leaf client-fec {
      type enumeration {
        enum ENABLED {
          description
            "FEC is enabled";
        }

        enum DISABLED {
          description
            "FEC is disabled";
        }

        enum AUTO {
          description
            "System will automatically enable or disable FEC
            according to the Ethernet compliance codes (PMD)
            supported by transceivers";
        }
      }
      default AUTO;
      description
        "Configure whether FEC will be manually or automatically
        enabled or disabled on the client port";
    }

    leaf client-als {
      type enumeration {
        enum NONE {
          description
            "The client port will do nothing when a failure is
            detected on the line port or the remote client port";
        }
        enum LASER_SHUTDOWN {
          description
            "The client port will shut down the laser to notify the
            subtending Ethernet equipment of the failure detected on
            the line port or the remote client port.";
        }
        enum ETHERNET {
          description
            "The client port will propagate the local fault or remote
            fault signal to the subtending Ethernet equipment.";
        }
      }
      default ETHERNET;
      description
        "Sets the client port behavior that defines if the actions
        of automatic laser shutdown (als), ethernet fault
        propagation, or nothing will be done upon the detection
        of a failure on the line port or the upstream remote
        client port.";
    }

    leaf als-delay {
      type uint32;
      units milliseconds;
      default 0;
      description
        "The timer to delay the client-als actions on the client
        port when a local or remote fault is detected on the line
        port. The delay will only be valid when the client-als is
        set to LASER_SHUTDOWN";
    }
  }

  grouping terminal-device-config {
    description
      "Configuration data for transport terminal devices at a
      device-wide level";
  }

  grouping terminal-device-state {
    description
      "Operational state data for transport terminal devices at a
      device-wide level";
  }

  grouping terminal-device-top {
    description
      "Top-level grouping for data for terminal devices";

    container terminal-device {
      description
        "Top-level container for the terminal device";

      container config {
        description
          "Configuration data for global terminal-device";

        uses terminal-device-config;
      }

      container state {

        config false;

        description
          "Operational state data for global terminal device";

        uses terminal-device-config;
        uses terminal-device-state;
      }

      uses terminal-logical-channel-top;
      uses terminal-operational-mode-top;

    }
  }


  grouping lldp-interface-config {
    description
      "Extension to the configuration data for LLDP on each
      optical terminal interface";

    leaf snooping {
      type boolean;
      default "false";
      description
        "If true, LLDP PDUs are only received and processed on
        the interface, but are not originated by the local agent.
        The PDUs are not dropped by the interface after processing,
        but relayed to the downstream link layer neighbors.
        If false, LLDP PDUs are both received and originated on the
        interface. The snooping mode is valid only when LLDP is
        enabled on the interface. The snooping mode is useful
        when an interface does not want its link layer neighbors to
        discover itself since, for example, it is a lower-layer
        interface";
    }
  }

  // data definition statements

  uses terminal-device-top;

  // augment statements

  augment "/oc-platform:components/oc-platform:component" {
    when "/oc-platform:components/oc-platform:component/" +
      "oc-platform:state/oc-platform:type = 'OPTICAL_CHANNEL'" {
      description
        "Augment is active when component is of type
        OPTICAL_CHANNEL";
    }
    description
      "Adding optical channel data to physical inventory";

    uses terminal-optical-channel-top {
    }
  }

  augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet" +
    "/oc-eth:config" {
    description
      "Adds configuration data for client interfaces using Ethernet
      framing";

    uses ethernet-config-ext;
  }

  augment "/oc-lldp:lldp/oc-lldp:interfaces/oc-lldp:interface/" +
    "oc-lldp:config" {
    description
      "Augment the lldp config data to support the snooping mode
      for each optical terminal interface";

    uses lldp-interface-config;
  }
}