Update the polatis yang models

Change-Id: I11da7032b110238c52e27f5f26a36ef379685b0d
diff --git a/models/polatis/src/main/yang/optical-switch@2018-03-22.yang b/models/polatis/src/main/yang/optical-switch@2018-03-22.yang
new file mode 100644
index 0000000..0fb4e41
--- /dev/null
+++ b/models/polatis/src/main/yang/optical-switch@2018-03-22.yang
@@ -0,0 +1,1096 @@
+module optical-switch {
+    namespace "http://www.polatis.com/yang/optical-switch";
+    prefix opsw;
+
+    import ietf-yang-types {
+        prefix yang;
+    }
+    import ietf-inet-types {
+        prefix inet;
+    }
+
+    organization "Polatis Limited";
+    contact
+        "Adam Hughes
+
+        Polatis Limited
+        332/2 Cambridge Science Park
+        Cambridge CB4 0WN
+        United Kingdom
+
+        Phone: +44 (0) 1223 424200
+        Email: yang-support@polatis.com";
+
+    description "Implements the data model for an Optical Circuit Switch";
+
+    revision "2018-03-22" {
+        description " 1. Added grouped ports container.
+                      2. Defined a new typedef with 32 printable character length.
+                      3. Added 'mandatory' form 'egress' leaf in cross-connects container
+                      4. Removed operational state leaf from aps-notification";
+
+    }
+    revision "2017-08-04" {
+        description " 1. Removed the state and config data dependencies.
+                      2. Added new port configuration containers for better performance.
+                      3. Deprecated old ports/port container
+                      4. Added RADIUS, NTP, Subswitches, AuditLog and Protocols feature";
+    }
+    revision "2017-02-09" {
+        description "Added APS container and notifications";
+    }
+    revision "2016-04-22" {
+        description "Added support for peer port configuration";
+    }
+    revision "2016-02-17" {
+        description "1. Added support for Variable Optical Attenuation
+                     2. Defined new portFormat datatype to represent non-zero port Id.
+                     3. Changed the default values of power-high-alarm from +100 to +25 and
+                        and for power-low-alarm from -100 to -60.";
+    }
+    revision "2015-09-14" {
+        description "Initial revision.";
+    }
+
+    typedef namesFormat {
+        type string {
+            pattern "[ -~]{1,128}";
+        }
+        description "A non-empty string with up to 128 printable ASCII characters.";
+    }
+    typedef userNamesFormat {
+        type string {
+            pattern "[ -~]{1,32}";
+        }
+        description "A non-empty string with up to 32 printable ASCII characters.";
+    }
+    typedef namesFormatNullable {
+        type string {
+            pattern "[ -~]{0,128}";
+        }
+        description "A string with up to 128 printable ASCII characters.";
+    }
+    typedef groupNamesFormat {
+        type string {
+            pattern "[!-~]*";
+        }
+        description "A string containing printable, non-whitespace ASCII characters.";
+    }
+    typedef floatFormat2d {
+        type decimal64 {
+            fraction-digits 2;
+        }
+        description "Floating point number, restricted to 2 decimal places.";
+    }
+    typedef portFormat {
+        type uint32 {
+            range "1 .. 65535";
+        }
+    }
+    typedef PortStatus {
+        type enumeration {
+            enum PO_ENABLED  { value 1; }
+            enum PO_DISABLED { value 2; }
+            enum PO_FAILED   { value 3; }
+        }
+        description "PO_ENABLED means that light can pass through the port, shutters are open.
+        PO_DISABLED indicates the opposite. PO_FAILED is reported when the port cannot be used.
+        Only used in deprecated containers.";
+    }
+    typedef apsOperationalState {
+        type enumeration {
+            enum ON_WORKING     { value 0; }
+            enum WORKING_FAIL   { value 1; }
+            enum SWITCH_PROT    { value 2; }
+            enum ON_PROTECT     { value 3; }
+            enum PROTECT_FAIL   { value 4; }
+            enum SWITCH_WORK    { value 5; }
+            enum NOT_APPLICABLE { value 6; }
+        }
+        description "Describes the operational state of a working port in an APS service,
+        Ports in inactive services are in the NOT_APPLICABLE operational state.";
+    }
+    typedef apsFlags {
+        type bits {
+            bit GLP {position 0;}
+            bit FTP {position 1;}
+            bit FTW {position 2;}
+            bit MTP {position 3;}
+            bit MTW {position 4;}
+            bit DNR {position 5;}
+        }
+        description "Commands which can be applied to APS working ports:
+        GLP - Global Lockout of Protection
+        FTP - Force To Protection
+        FTW - Force To Working
+        MTP - Manual To Protection
+        MTW - Manual To Working
+        DNR - Do Not Revert
+        Only one of GLP, FTP, FTW, MTP, MTW may be set.
+        GLP on one port will apply GLP to all the ports in a service.";
+    }
+    typedef hostFormat {
+        type string {
+            pattern "[ -~]{1,64}";
+        }
+        description "A non-empty string with up to 64 printable ASCII characters.";
+    }
+    typedef secretFormat {
+        type string {
+            pattern "[a-zA-Z0-9]{1,128}";
+        }
+        description "A non-empty string with up to 128 alphanumeric characters.";
+    }
+
+    container product-information {
+        config false;
+        leaf manufacturer {
+            type string;
+            description "Name of the manufacturer";
+        }
+        leaf serial-number {
+            type string;
+            description "Unique number given to the product during manufacturing.";
+        }
+        leaf model-name {
+            type string;
+            description "Describes the product and the features that the product supports.";
+        }
+        leaf software-version {
+            type string;
+            description "Version of the software that is currently running on the optical switch";
+        }
+    }
+
+    container port-config {
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "Unique ID for the port";
+            }
+            leaf status {
+                config false;
+                type enumeration {
+                    enum UNSUPPORTED   { value 0; }
+                    enum ENABLED       { value 1; }
+                    enum DISABLED      { value 2; }
+                    enum FAILED        { value 3; }
+                }
+                description "Status of the port. When 'status' is ENABLED the optical path is clear and the signal
+                passes through. When 'status' is DISABLED the optical signal is blocked.
+                When 'status' is UNSUPPORTED the port doesn't have the enable/disable feature.
+                When 'status' is FAILED the port has failed to report its state correctly. ";
+            }
+            leaf label {
+                type namesFormatNullable;
+                default "";
+
+                description "User configurable string to describe the port. The optical switch includes the label in notifications for the port.";
+            }
+            leaf peer-port {
+                type namesFormatNullable;
+                default "";
+
+                description "User configurable string to describe the remote port on another switch.
+                This information is set by the management interface to record network topology.";
+            }
+        }
+    }
+    rpc port-set-state {
+        input {
+            leaf-list port-enab {
+                type portFormat;
+                description "List of port-ids to enable.";
+            }
+            leaf-list port-disab {
+                type portFormat;
+                description "List of port-ids to disable.";
+            }
+        }
+        description "This RPC is used to enable or disable a port. When the port is disabled the
+        optical signal is blocked. When the port is enabled the optical path is clear and the
+        signal passes through.";
+    }
+
+    container opm-power {
+        config false;
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "ID for the port with OPM";
+            }
+            leaf power {
+                type floatFormat2d;
+                description "Measured optical power, reported in dBm.";
+            }
+        }
+    }
+    container opm-config {
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "ID for the port with OPM";
+            }
+            leaf wavelength {
+                type floatFormat2d {
+                    range 1260.0..1640.0;
+                }
+                default 1550.0;
+
+                description "Wavelength against which the power measurements are calibrated.
+                Specified in nm.";
+            }
+            leaf offset {
+                type floatFormat2d {
+                    range -100.0..100.0;
+                }
+                default 0;
+
+                description "Offset for the power measurement; the value is added to power
+                monitor measurements when reporting /opm-power/port/power.
+                Thus, specifying an offset can be used as a means of referencing the power
+                monitors against external meters.
+                It should be noted that the offset feature does NOT impact the behaviour
+                of the alarm or attenuation features:
+                alarm and attenuation settings always operate relative to the actual
+                power monitor readings, i.e. without any user-specified offsets.
+                Specified in dBm.";
+            }
+            leaf averaging-time {
+                type uint32 {
+                    range "1..8";
+                }
+                default 4;
+
+                description "The period for which the power average is calculated. Each increment
+                in this value doubles the length of the time for which the OPM power readings are averaged.
+                Setting the value to 1 results in the shortest averaging period, around 10ms.
+                Setting the value to 8 results in the longest averaging period, 128 times greater.";
+            }
+        }
+    }
+    container opm-alarm-config {
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "ID for the port with OPM";
+            }
+            leaf mode {
+                type enumeration {
+                    enum POWER_ALARM_DISABLED;
+                    enum POWER_ALARM_ENABLED;
+                }
+                default POWER_ALARM_DISABLED;
+
+                description "Power alarms or notifications from ports can be individually enabled or disabled.
+                When enabled, Loss of Signal (LOS) or Signal Degrade notifications are generated when power
+                levels cross the set thresholds. When disabled, notifications are not generated.";
+            }
+            leaf signal-low-threshold {
+                type floatFormat2d;
+                default -60.0;
+
+                description "The switch will generate loss of service notifications should the power
+                level go below this threshold. Specified in dBm.";
+            }
+            leaf signal-degrade-threshold {
+                type floatFormat2d;
+                default -60.0;
+
+                description "The switch will generate warning (signal degrade) notifications should the
+                power level go below this threshold. Specified in dBm.";
+            }
+            leaf signal-high-threshold {
+                type floatFormat2d;
+                default 25.0;
+
+                description "The switch will generate loss of service notifications should the power
+                level go above this threshold. Specified in dBm.";
+            }
+            leaf alarm-clear-holdoff {
+                type uint32;
+                default 0;
+
+                description "When the signal is restored, this is the minimum time in seconds
+                for which the optical power level needs to remain above the threshold to clear the alarm.";
+            }
+        }
+    }
+
+    container voa {
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "ID for the port with VOA";
+            }
+            leaf atten-mode {
+                type enumeration {
+                    enum VOA_MODE_NONE        { value 0; }
+                    enum VOA_MODE_RELATIVE    { value 1; }
+                    enum VOA_MODE_ABSOLUTE    { value 2; }
+                    enum VOA_MODE_CONVERGED   { value 3; }
+                    enum VOA_MODE_MAXIMUM     { value 4; }
+                    enum VOA_MODE_FIXED       { value 5; }
+                }
+                default VOA_MODE_NONE;
+
+                description "VOA_MODE_NONE: Attenuation on the port is disabled. The light on the port will
+                have the actual power level. VOA_MODE_ABSOLUTE:  The output power of the port will be limited
+                to the atten-level, and will remain at that level if the input power is sufficient.
+                VOA_MODE_RELATIVE:  The output power will be limited to atten-level above the input power on
+                the reference port, and will remain at that level if the input power is sufficient.
+                VOA_MODE_CONVERGED: This is similar in behaviour to
+                ABSOLUTE mode, but once the attenuation converges to the desired level the switch freezes the
+                VOA control loop. This reduces noise caused by the control loop continually striving to improve
+                the attenuation. VOA_MODE_MAXIMUM: Port will achieve the maximum attenuation level. In this
+                case configured attenuation level is not used. VOA_MODE_FIXED: Disables closed loop updating
+                of the attenuation feature for the specified port. Following issuance of this command, the port
+                will continue to hold their current attenuation level without any optical feedback. Thus, any
+                changes in input power levels will no longer be tracked";
+            }
+            leaf atten-level {
+                when "../atten-mode = 'VOA_MODE_ABSOLUTE' or ../atten-mode = 'VOA_MODE_RELATIVE'" +
+                     "or ../atten-mode = 'VOA_MODE_CONVERGED'";
+                type floatFormat2d;
+                default 0;
+
+                description "The attenuated output level configured for this port. Specified in dBm
+                (or dB for RELATIVE as it is an offset value with respect to reference port).";
+            }
+            leaf reference-port {
+                when "../atten-mode = 'VOA_MODE_RELATIVE'";
+                type uint32;
+                default 0;
+
+                description "Reference ingress port for attenuation (for use with relative attenuation only).
+                If this port is specified as zero then the connected ingress port is used. For attenuation states
+                other than RELATIVE this data is ignored. When reading this object, a value of zero is returned
+                for all modes other than RELATIVE. For relative attenuation, the value returned is the current
+                reference port in use.";
+            }
+        }
+    }
+
+    container ports {
+        status "deprecated";
+        list port {
+            key port-id;
+            leaf port-id {
+                type portFormat;
+                description "Unique Id for port";
+            }
+            leaf port-label {
+                type namesFormatNullable;
+                description "When set, notifications will include the label.";
+            }
+            leaf port-state {
+                type enumeration {
+                    enum PC_ENABLED { value 1; }
+                    enum PC_DISABLED { value 2; }
+                }
+                default PC_ENABLED;
+
+                description "State of a port shutter. When port is enabled, shutter is open and
+                when port is disabled, shutter is closed.";
+            }
+            leaf port-status {
+                config false;
+                type PortStatus;
+
+                description "Switch port status. The switch can report FAILED port status when the port fails to
+                correctly report its state";
+            }
+            leaf peer-port {
+                type namesFormatNullable;
+
+                description "This leaf describes the remote port on another switch to which this
+                port is connected physically through the optical fibres. Management interface can
+                set this parameter to configure the network topology.";
+            }
+            container opm {
+                description "Optical Power Monitor (OPM) measures the optical signal strength in the fibre.";
+
+                leaf lambda {
+                    type floatFormat2d;
+                    default 1550.0;
+
+                    description "Wavelength against which the power measurements are calibrated.
+                    Specified in nm.";
+                }
+                leaf power-high-alarm {
+                    type floatFormat2d;
+                    default 25.0;
+
+                    description "The switch will generate notifications should the power level go beyond this
+                    level. Specified in dBm.";
+                }
+                leaf power-low-alarm {
+                    type floatFormat2d;
+                    default -60.0;
+
+                    description "The switch will generate notifications should the power level go below this
+                    level. Specified in dBm.";
+                }
+                leaf power-high-warning-offset {
+                    type floatFormat2d;
+                    default 0;
+
+                    description "The switch will generate (warning) notifications should the power go beyond
+                    the set level. This warning offset is subtracted from power-high-alarm to get the warning threshold.
+                    A zero value means that warnings are disabled. Specified in dBm.";
+                }
+                leaf power-low-warning-offset {
+                    type floatFormat2d;
+                    default 0;
+
+                    description "The switch can generate (warning) notifications should the power go below
+                    the set level. This warning offset is added into power-low-alarm to get the warning threshold.
+                    A zero value means that warnings are disabled. Specified in dBm.";
+                }
+                leaf power-alarm-control {
+                    type enumeration {
+                        enum POWER_ALARM_DISABLED;
+                        enum POWER_ALARM_SINGLE;
+                        enum POWER_ALARM_CONTINUOUS;
+                    }
+                    default POWER_ALARM_DISABLED;
+
+                    description "Power alarms or notifications from ports can be individually enabled or disabled.
+                    When power-alarm-control is POWER_ALARM_SINGLE then only one alarm is generated, following
+                    which power-alarm-control reverts to POWER_ALARM_DISABLED.
+                    When power-alarm-control is POWER_ALARM_CONTINUOUS then power alarms are always generated
+                    when power levels exceed the defined power alarm thresholds.";
+                }
+                leaf power-alarm-status {
+                    config false;
+                    type enumeration {
+                        enum POWER_ALARM_STATUS_OFF;
+                        enum POWER_ALARM_STATUS_ARMED;
+                        enum POWER_ALARM_STATUS_TRIGGERED;
+                    }
+
+                    description "POWER_ALARM_STATUS_OFF       - Power alarms are not enabled.
+                                 POWER_ALARM_STATUS_ARMED     - Alarms can be generated.
+                                 POWER_ALARM_STATUS_TRIGGERED - Port has an active alarm. When the alarm
+                                                                clears, power-alarm-status will change to
+                                                                one of POWER_ALARM_STATUS_OFF or
+                                                                POWER_ALARM_STATUS_ARMED depending on the
+                                                                power-alarm-control mode.";
+                }
+                leaf power {
+                    config false;
+                    type floatFormat2d;
+
+                    description "Power readings for this port. Specified in dBm.";
+                }
+                container voa {
+
+                    description "Variable Optical Attenuation (VOA) functionality controls the the optical
+                    power level of light on the port. It allows to set the desired attenuation level
+                    that the port should achieve.";
+
+                    leaf attenuation-level {
+                        type floatFormat2d;
+                        default 0;
+
+                        description "The attenuated output level configured for this port. Specified in dBm
+                        (or dB for RELATIVE as it is an offset value with respect to reference port).";
+                    }
+                    leaf attenuation-mode {
+                        type enumeration {
+                            enum VOA_ATTEN_MODE_NONE        { value 1; }
+                            enum VOA_ATTEN_MODE_ABSOLUTE    { value 2; }
+                            enum VOA_ATTEN_MODE_RELATIVE    { value 3; }
+                            enum VOA_ATTEN_MODE_VENDOR      { value 128; }
+                        }
+                        default VOA_ATTEN_MODE_NONE;
+
+                        description " VOA_ATTEN_MODE_NONE: Attenuation on the port is disabled. The light on the
+                        port will have the actual power level. VOA_ATTEN_MODE_ABSOLUTE: Port will achieve the configured
+                        attentuation level and power of the light on the port will have the absolute level configured.
+                        VOA_ATTEN_MODE_RELATIVE: Port will achieve the attentuation with respect to the power of the light
+                        of the reference port. The actual attenuation achieved depends on the configured level and power
+                        of the light of the reference port. VOA_ATTEN_MODE_VENDOR: This is vendor specific mode.";
+                    }
+                    leaf attenuation-reference-port {
+                        type uint32;
+                        default 0;
+
+                        description "Reference port for attenuation (for use with relative attenuation only). If this port
+                        is specified as zero then the default reference port will be used. The default port is the ingress
+                        to which the egress port being attenuated is connected. For attenuation states other than RELATIVE
+                        this data is ignored. When reading this object, a value of zero is returned for all modes other
+                        than RELATIVE. For relative attenuation, the value returned is the current reference port in use.";
+                    }
+                }
+            }
+        }
+    }
+
+    container cross-connects {
+        list pair {
+            key ingress;
+            leaf ingress {
+                type portFormat;
+                description "Input port that makes the connection pair.";
+            }
+            leaf egress {
+                type portFormat;
+                mandatory true;
+                description "Output port that makes the connection pair.";
+            }
+        }
+        description "List of all cross connections in the system.";
+    }
+
+    grouping network-interface-group {
+        leaf ip-address {
+            type inet:ip-address;
+            description "IP address of the switch control plane.";
+        }
+        leaf gateway {
+            type inet:ip-address;
+            description "Gateway address for the switch control plane.";
+        }
+        leaf subnet {
+            type inet:ip-address;
+            description "Subnet to which the switch control plane belongs.";
+        }
+        leaf broadcast {
+            type inet:ip-address;
+            description "Broadcast IP address for the switch control plane.";
+        }
+    }
+
+    container system-config {
+        list interface-status {
+            config false;
+            key name;
+
+            leaf name {
+                type string;
+                description "Unique name of the network interface";
+            }
+            uses network-interface-group;
+            leaf hw-addr {
+                type yang:mac-address;
+            }
+            description "List of Switch network interface and their current running configuration.";
+        }
+        list interface {
+            key name;
+            unique ip-address;
+
+            leaf name {
+                type string;
+                description "Network interface identifier (eth0 or eth1)";
+            }
+            uses network-interface-group;
+
+            description "List of Switch network interfaces and their configuration.
+            On system restart, switch will start to use this configuration as their running
+            configuration.";
+        }
+        list user {
+            key name;
+            leaf name {
+                type userNamesFormat;
+                description "The user name string identifying this entry.";
+            }
+            leaf type {
+                type enumeration {
+                    enum RADIUS_USER { value 1; }
+                    enum LOCAL_USER  { value 2; }
+                }
+                mandatory true;
+                description "When set to RADIUS_USER, the user will be authenticated against the radius-servers.
+                When set to LOCAL_USER, the user will be authenticated locally.";
+            }
+            leaf password {
+                when "../type != 'RADIUS_USER'";
+
+                type namesFormatNullable;
+                description "The password for this entry. May not be set to empty, but will report empty.";
+            }
+            list authorized-key {
+                when "../type != 'RADIUS_USER'";
+
+                key name;
+                description "A list of public SSH keys for this user. These keys are allowed for SSH
+                authentication, as described in RFC 4253.";
+                reference "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
+                leaf name {
+                    type string;
+                    description "An arbitrary name for the SSH key.";
+                }
+                leaf algorithm {
+                    type string;
+                    mandatory true;
+                    description "The public key algorithm name for this SSH key. Valid values are the
+                    values in the IANA 'Secure Shell (SSH) Protocol Parameters' registry, Public Key
+                    Algorithm Names.";
+                    reference "IANA 'Secure Shell (SSH) Protocol Parameters' registry, Public Key
+                    Algorithm Names";
+                }
+                leaf key-data {
+                    type binary;
+                    mandatory true;
+                    description "The binary public key data for this SSH key, as specified by RFC 4253,
+                    Section 6.6, i.e.: string certificate or public key format identifier byte[n]
+                    key/certificate data.";
+                    reference "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
+                }
+            }
+            description "The list of local users configured on this device. This model is adopted from
+            System Management yang model. (https://tools.ietf.org/html/rfc7317)";
+        }
+        container activity-log
+        {
+            description "Controls the audit log feature, which allows users in the admin group to
+            monitor user actions.  Actions can be monitored in four major areas (log-filter).
+            Users in the admin group can change the scope of messages seen by users not in
+            the admin group (log-access).";
+            leaf log-filter {
+                type bits {
+                    bit SYSTEM {position 0;}
+                    bit USER   {position 1;}
+                    bit OXC    {position 2;}
+                    bit OPM    {position 3;}
+                }
+                description "Defines which activity log messages are sent.
+                USER - changes to 'user' container and user sessions;
+                OXC  - changes to 'cross-connect' and 'aps' containers, and 'port-set-state' rpc;
+                OPM  - changes to 'opm-config', 'opm-alarm-config' and 'voa' containers;
+                SYSTEM - changes to 'system-config' container, except 'users'.";
+            }
+            leaf log-access {
+                type enumeration {
+                    enum NONE { value 0; }
+                    enum SELF { value 1; }
+                    enum ALL  { value 2; }
+                }
+                default NONE;
+                description "Defines whether users not in the admin group will receive activity logs, as defined by 'log-filter'.
+                NONE prevents users seeing activity logs.
+                SELF allows users to see activity logs for their own actions.
+                ALL allows users to see activity logs for all users actions.
+                Users in the admin group always receive all activity logs.";
+            }
+            leaf logging-enabled {
+                type boolean;
+                default false;
+                description "When set to true, activity logs are generated.";
+            }
+        }
+        container radius-servers
+        {
+            description "The list of RADIUS servers; the order of the list determines the priority of usage.
+            When a RADIUS server is added to this list, users can be authenticated by the RADIUS server.";
+            list radius-server {
+                key "ip-address port";
+
+                leaf ip-address {
+                    type inet:ip-address;
+                    description "Address of a RADIUS server.";
+                }
+                leaf port {
+                    type uint32;
+                    description "TCP port of the RADIUS server; defaults to 1812.";
+                }
+                leaf secret {
+                    type secretFormat;
+                    mandatory true;
+                    description "The secret used to authenticate with the RADIUS server.";
+                }
+                leaf timeout {
+                    type uint32 {
+                        range "1..30";
+                    }
+                    default 3;
+                    description "Time in seconds that the system waits before trying the next RADIUS server in the list.";
+                }
+            }
+        }
+        container ntp-servers
+        {
+            description "The list of NTP servers checked for time synchronization.";
+            list ntp-server {
+                key ip-address;
+
+                leaf ip-address {
+                    type inet:ip-address;
+                    description "Address of a NTP server to use";
+                }
+                leaf minpoll {
+                    type uint32 {
+                        range "4..6";
+                    }
+                    default 6;
+                    description "The minimum polling period. (4=16s, 5=32s, 6=64s)";
+                }
+                leaf maxpoll {
+                    type uint32 {
+                        range "10..17";
+                    }
+                    default 10;
+                    description "The maximum polling period. (10=1024s, 11=2048s ... 17=131072s)";
+                }
+                leaf version {
+                    type uint32 {
+                        range "1..4";
+                    }
+                    default 4;
+                    description "The protocol version of the NTP server.";
+                }
+            }
+        }
+        container remote-syslog
+        {
+            description "The system supports reporting notifications to a remote server
+            using the syslog protocol, according to RFC 3164. This feature is enabled
+            by configuring 'rname'.";
+            leaf rname {
+                type inet:ipv4-address;
+                description "IP Address of remote collector. When configured the feature is enabled.";
+            }
+            leaf rport {
+                type inet:port-number;
+                description "UDP port of the remote server. Default port is 514.";
+            }
+            leaf facility {
+                type enumeration {
+                    enum USER { value 8; }
+                    enum LOCAL0 { value 128; }
+                    enum LOCAL1  { value 136; }
+                    enum LOCAL2  { value 144; }
+                    enum LOCAL3  { value 152; }
+                    enum LOCAL4  { value 160; }
+                    enum LOCAL5  { value 168; }
+                    enum LOCAL6  { value 176; }
+                    enum LOCAL7  { value 184; }
+                }
+                default USER;
+                description "The facility to send messages under.  Used at the collector to categorize the messages for storage or forwarding.";
+            }
+            must "(boolean(rname) = true()) or (boolean(rport) = false())" { error-message "Cannot have port without name"; }
+        }
+        container openflow
+        {
+            leaf host {
+                type inet:ipv4-address;
+                description "IPv4 address of openflow. Use 0.0.0.0 to disable sending.  This field will change to inet:host type.";
+            }
+            leaf port {
+                type inet:port-number;
+                description "Port of openflow. Delete to remove the port.";
+            }
+//            must "(boolean(host) = true() and string(host) != '0.0.0.0') or (boolean(port) = false() or port = 0)" { error-message "Cannot have port without a host"; }
+            description "The connection for openflow. Errors if openflow not supported.";
+        }
+        container protocols
+        {
+            description "Defines which protocol interfaces are enabled
+            or disabled based on the 'enabled' leaf. Changes are applied at the next NIC reboot.
+            Only one interface for RS232 or USB can be enabled at a time.
+            A protocol interface may not disable itself.";
+            list protocol {
+                key protocol-id;
+
+                leaf protocol-id {
+                    type uint32; // TODO: change to enum.
+                    description "Defines the protocol internally, and is consistent between switches and releases.";
+                }
+                leaf protocol-name {
+                    config false;
+                    type string;
+                    description "Human readable name of the interface protocol.";
+                }
+                leaf protocol-type {
+                    config false;
+                    type string;
+                    description "Human readable description of the physical interface.";
+                }
+                leaf protocol-port {
+                    config false;
+                    type uint32;
+                    description "TCP or UDP port number, if needed.";
+                }
+                leaf enabled {
+                    type boolean;
+                    default true;
+                    description "When true, this interface will respond to commands.";
+                }
+            }
+        }
+
+        leaf current-datetime {
+            config false;
+            type yang:date-and-time;
+
+            description "The current system date and time.";
+        }
+        leaf boot-datetime {
+            config false;
+            type yang:date-and-time;
+
+            description "The system date and time when the system last restarted.";
+        }
+
+        leaf alarm-clear-hysteresis {
+            type decimal64 {
+                fraction-digits 2;
+                range "1..5";
+             }
+
+            default 1;
+
+            description "Added to 'power-low-alarm' and subtracted from 'power-high-alarm'
+            to generate alarm clear notifications. Specified in dBm.";
+        }
+
+    }
+
+
+    // APS config and status
+    container aps
+    {
+        description "Automatic Protection Switching (APS) provides optical redundancy on the Polatis switch.
+        When the switch detects signal failure on the primary optical path, it automatically switches to an alternative
+        optical path. The switch also provides manual operations to change the optical paths.
+        APS consists of list of protection services, where each service is a list of working and protection ports.";
+        list protection-service
+        {
+            key sname;
+            leaf sname {
+                type namesFormat;
+                description "Protection Service name.";
+            }
+            leaf active
+            {
+                config false;
+                type boolean;
+                description "When the Protection Service is active, protection switching will
+                occur automatically and the 'aps-command' rpc may be used.
+                Changes to the protection service may only be made when not active (configuring).
+                Use the 'aps-activate' rpc to change between active and configuring.";
+            }
+            list working-port
+            {
+                key port-id;
+                leaf port-id
+                {
+                    type portFormat;
+                    description "ID for the port that carries the payload under normal conditions, and which is protected by APS.";
+                }
+                leaf client
+                {
+                    type uint32;
+                    mandatory true;
+                    description "ID for the port to which the working or protection port is connected while the service is active.";
+                }
+                leaf priority
+                {
+                    type uint32;
+                    default 0;
+                    description "Defines an order in which protection is applied to multiple working ports.
+                    When multiple signals have failed, the first available protection port will
+                    be assigned to the failed port with the lowest value for this leaf.";
+                }
+                leaf wtr-timeout
+                {
+                    type uint32;
+                    default 0;
+                    description "Wait To Restore timeout value. The delay in seconds from the detection
+                    of a valid signal on the working port to switching the client back from protection.";
+                }
+                leaf ovs
+                {
+                    type boolean;
+                    default false;
+                    description "Override Valid Signal. Set to true to create 1+1 protection service.
+                    When false, switching occurs only when a valid signal is detected on the protection port.";
+                }
+                leaf protecting-port
+                {
+                    config false;
+                    type uint32;
+                    description "ID for the port which is currently protecting the working port. Zero if not protected.";
+                }
+                leaf operational-state
+                {
+                    config false;
+                    type apsOperationalState;
+                    description "The current operational state of the protected signal.";
+                }
+                leaf user_command
+                {
+                    config false;
+                    type apsFlags;
+                    description "APS flags applied to this port.";
+                }
+            }
+            leaf-list protection-port
+            {
+                type uint32;
+                description "List of IDs for ports to which the client may switch on signal failure
+                or in response to a user command.";
+            }
+        }
+    }
+    container subswitches {
+        description "The switch can be partitioned into virtual switches. Each has a set of users and ports.
+        Only those users may configure or cross connect those ports.";
+        list subswitch {
+            key "sname";
+            leaf sname {
+                type string;
+                description "The sub-switch name";
+            }
+            leaf-list username {
+                type string;
+                description "List of users with permission to control the sub-switch";
+            }
+            leaf-list port-id {
+                type uint32;
+                description "List of IDs for ports in the sub-switch";
+            }
+        }
+    }
+    container groups {
+        description "Ports can be grouped as a signal entity to perform one-shot configurations.
+        Two groups are connected if the ports in both groups are connected in the order defined by the user.";
+        list group {
+            key group-name;
+            leaf group-name {
+                type groupNamesFormat;
+            }
+            leaf-list ingress {
+                type portFormat;
+                ordered-by user;
+                description "The ordered list of IDs for input or reconfigurable ports.";
+            }
+            leaf-list egress {
+                type portFormat;
+                ordered-by user;
+                description "The ordered list of IDs for output ports.";
+            }
+            leaf connected-group {
+                type groupNamesFormat;
+                config false;
+                description "The name of the connected group or empty if the group is not connected";
+            }
+        }
+    }
+    rpc set-current-datetime {
+        description "Set the /system-config/current-datetime leaf to the specified value.
+        Also changes /system-config/boot-datetime, relative to current-datetime";
+        input {
+            leaf current-datetime {
+                type yang:date-and-time;
+                mandatory true;
+                description "The current system date and time.";
+            }
+        }
+    }
+    rpc system-restart {
+        description "Request to reboot the Network Interface Card (NIC).";
+        input {
+            leaf seconds {
+                type uint32;
+                default 0;
+
+                description "Reboots the interface card after the specified delay in seconds.
+                Value of 0 will reboot immediately, and in that case there won't be any response";
+            }
+        }
+    }
+    rpc system-restart-cancel {
+        description "Request to cancel the reboot. This has no effect when 'system-restart' was not requested.";
+    }
+    // APS rpcs and notification
+    rpc aps-command {
+        description "Applies an APS command to a service, or one or more working ports.";
+        input {
+            leaf mask {
+                type apsFlags;
+                mandatory true;
+                description "A list of APS flags to be set or cleared. APS flags in this leaf but not in the 'flags' leaf will be cleared.";
+            }
+            leaf flags {
+                type apsFlags;
+                mandatory true;
+                description "A list of APS flags that will be set on execution of the command.  This field should only contain APS flags from the 'mask' leaf.";
+            }
+            choice parameter
+            {
+                description "When 'sname' is specified the command applies to all the working ports in the service.  Otherwise, the command is applied to the listed ports.";
+                mandatory true;
+                leaf sname
+                {
+                    type namesFormat;
+                }
+                list port
+                {
+                    key port-id;
+                    leaf port-id {
+                        type portFormat;
+                    }
+                    leaf target-port-id
+                    {
+                        type uint32;
+                        default 0;
+                        description "Used with FTP and MTP, when the user chooses the port
+                        that should be protecting the working port. Ignored otherwise.";
+                    }
+                }
+            }
+        }
+    }
+    rpc aps-activate {
+        input {
+            leaf sname {
+                type namesFormat;
+             }
+            leaf active {
+                type boolean;
+                mandatory true;
+            }
+        }
+        description "Used to set a protection service to active or configuring.";
+    }
+    rpc radius-server-set-position {
+        description "Changes the precedence of RADIUS servers. 'ip-address' and 'port' form the key for the list.";
+        input {
+            leaf ip-address {
+                type inet:ip-address;
+                mandatory true;
+                description "IP address of the RADIUS server.";
+            }
+            leaf port {
+                type portFormat;
+                mandatory true;
+                description "Port of the RADIUS server.";
+            }
+            leaf position {
+                type int32 {
+                    range "1..5";
+                }
+                mandatory true;
+                description "Target precedence. Value 1 has the highest precedence.";
+            }
+        }
+    }
+    notification aps-notification {
+        leaf notification-details {
+            type string;
+            description "Message indicating which APS service or ports are affected.";
+         }
+        description "This is the notification which is sent when APS switching happens.";
+    }
+}
+