Demo entry 3858401

yang

   

Submitted by anonymous on Mar 03, 2016 at 19:11
Language: C++. Code size: 7.0 kB.

module transponder {
 namespace "http://sssup.it/transponder";
 prefix tran;
 import modulation-formats {
   prefix mdfrms;
 }
 import fec-types {
   prefix fec;
 }
 import ietf-yang-types {
   prefix yang;
 }

 typedef transmission-type {
   type enumeration {
     enum NWDM;
     enum O-OFDM;
     enum TFP;//Time-frequency packing
   }
 }
 typedef direction-type {
   type enumeration {
     enum TX;
     enum RX;
   }
 }
 typedef bit-rate-type {
   type decimal64 {
     fraction-digits 3;
     range "0..max";
   }
   units "Gb/s";
 }
 typedef baud-rate-type {
   type decimal64 {
     fraction-digits 3;
     range "0..max";
   }
   units "Gbaud";
 }
 typedef modulation-type {
   type identityref {
     base mdfrms:modulation-format;
   }
 }
 typedef fec-type {
   type identityref {
     base fec:fec-type;
   }
 }
 typedef frequency-ghz-type {
   type decimal64 {
     fraction-digits 8;
     range "0..max";
   }
   units "GHz";
 }

 grouping fec-config {
   container fec-in-use {
     presence "Enables FEC";
     leaf name {
       type fec-type;
     }
     container rate {
       leaf message-length {
         type int16 {
           range "1..max";
         }
       }
       leaf block-length {
         type int16 {
           range "1..max";
         }
       }
       must "block-length >= message-length" {
           error-message "block-length must be >= message-length";
       }
     }//rate
   }//fec-in-use
 }//fec-config

 grouping fec-state {
   container supported-fec {
     description "List of supported FEC schemes";
     leaf-list fec {
       type fec-type;
     }
   }//supported
 }//fec-state

 grouping transmitter-config {
   leaf output-power {
     type int16;
     units "dBm";
   }
 }//transmitter-config

 grouping transmitter-state {
 }

 grouping receiver-config {
   leaf local-oscillator {
     type frequency-ghz-type;
   }
   leaf sampling-rate {
     type uint32;
     units "GS/s";
   }
   leaf analog-bw {
     type frequency-ghz-type;
   }
 }//receiver-config

 grouping receiver-state {
   leaf input-power {
     type int16;
     units "dBm";
   }
   leaf pre-fec-ber {
     type decimal64 {
       fraction-digits 18;
       range "0..max";
     }
   }
   leaf sample-variance {
     type decimal64 {
       fraction-digits 18;
       range "0..max";
     }
     reference "http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7035536";
   }
   leaf pmd {
     type decimal64 {
       fraction-digits 8;
       range "0..max";
     }
     units "ps/(km)^0.5";
   }
   leaf cd {
     type decimal64 {
       fraction-digits 5;
     }
     units "ps/nm/km";
   }
   leaf q-factor{
     type decimal64 {
       fraction-digits 5;
     }
     units "dB";
   }
 }//receiver-state

 grouping subcarrier-module-config {
   leaf direction {
     type direction-type;
   }
   leaf bit-rate {
     description "The bit-rate in use";
     type bit-rate-type;
   }
   leaf baud-rate {
     description "The baud-rate in use";
     type baud-rate-type;
   }
   leaf modulation {
     description "Modulation format in use";
     type modulation-type;
   }
   uses fec-config;
   leaf central-frequency {
     type frequency-ghz-type;
   }
   leaf bandwidth {
     type frequency-ghz-type;
   }
 }//subcarrier-module-config

 grouping subcarrier-module-state {
   container supported-bit-rates{
     leaf-list bit-rate {
       type bit-rate-type;
     }
   }
   container supported-baud-rates {
     leaf-list baud-rate {
       type baud-rate-type;
     }
   }
   container supported-modulations {
     leaf-list modulation {
       type modulation-type;
     }
   }
   uses fec-state;
 }//subcarrier-module-state

 grouping subcarrier-module {
   container config {
     uses subcarrier-module-config;
     container transmitter {
       when "../direction = 'TX'";
       uses transmitter-config;
     }
     container receiver {
       when "../direction = 'RX'";
       uses receiver-config;
     }
   }//config
   container state {
     config false;
     uses subcarrier-module-config;
     uses subcarrier-module-state;
     container transmitter {
       when "../direction = 'TX'";
       uses transmitter-config;
       uses transmitter-state;
     }
     container receiver {
       when "../direction = 'RX'";
       uses receiver-config;
       uses receiver-state;
     }
   }//state
 }//subcarrier-module

 grouping connection-config {
   leaf connection-id{
     type uint32;
   }
   leaf transmission-scheme {
     type transmission-type;  
   }
   list subcarrier {
     key "subcarrier-id";
     leaf subcarrier-id {
       type leafref {
         path "/tran:transponder/tran:subcarrier-module/tran:subcarrier-id";
       }
     }
   }
   container frequency-slot {
     reference "draft-ietf-ccamp-flexi-grid-fwk-07";
     leaf nominal-central-frequency-granularity {
       type frequency-ghz-type;
       default 6.25;
     }
     leaf slot-width-granularity {
       type frequency-ghz-type;
       default 12.5;
     }
     leaf n {
       type int16;
       mandatory true;
     }
     leaf m {
       type int16 {
         range "1..max";
       }
       mandatory true;
     }
   }

   leaf source-address {
     Type inet:ip-address;
   }
   leaf destination-address {
     Type inet:ip-address;
   }
   
 }//connection-config

 grouping connection-state {
 }

 grouping connections {
   list connection {
     key "connection-id";
     leaf connection-id {
       type leafref {
         path "../config/connection-id";
       }
     }
     container config {
       uses connection-config;
     }
     container state {
       config false;
       uses connection-config;
       uses connection-state;
     }
   }//connection
 }//connections

 //---------- MAIN TREE ------------//  
 container transponder {
     list subcarrier-module {
       key "subcarrier-id";
       leaf subcarrier-id {
         type uint32;
       }
       uses subcarrier-module;
     }

     leaf slice-ability-support {
       when "count(../subcarrier-module) > 1";
       type boolean;
       config false;
     }

     leaf node-id {
       type uint16;
     }

     leaf add-drop-id {
       type uint16;
     }

     container connections {
       uses connections;
     }
 }

 //------------- NOTIFICATIONS ----------------//  
 notification pre-fec-ber-change {
   leaf subcarrier-module-id {
     type leafref {
       path "/tran:transponder/tran:subcarrier-module/tran:subcarrier-id";
     }
     mandatory true;
   }
   leaf pre-fec-ber {
     type leafref {
       path "/transponder/subcarrier-module[subcarrier-id=current()/../subcarrier-module-id]/state/receiver/pre-fec-ber";
     }
     mandatory true;
   }
 }
}//transponder

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).