module openroadm-devices-inventory-v2 {
    yang-version 1;
    namespace "http://com/fujitsu/openroadm/devices/v2";
    prefix "owbiv2";

    import yang-ext {
      prefix ext;
      revision-date "2013-07-09";
    }

    import ietf-yang-types {prefix yangtypes;}

    import openroadm-devices-inventory-common {
      prefix owbi-common;
      revision-date  2016-10-14;
    }

    import org-openroadm-device {
      prefix org-openroadm-device;
      revision-date 2018-10-19;
    }
    import org-openroadm-interfaces {
      prefix openROADM-if;
      revision-date 2017-06-26;
    }
    import org-openroadm-ethernet-interfaces {
      prefix org-openroadm-eth-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-optical-channel-interfaces {
      prefix org-openroadm-optical-channel-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-optical-transport-interfaces {
      prefix org-openroadm-optical-transport-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-otn-odu-interfaces {
      prefix org-openroadm-otn-odu-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-otn-otu-interfaces {
      prefix org-openroadm-otn-otu-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-network-media-channel-interfaces {
      prefix org-openroadm-network-media-channel-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-media-channel-interfaces {
      prefix org-openroadm-media-channel-interfaces;
      revision-date 2018-10-19;
    }
    import org-openroadm-lldp {
      prefix org-openroadm-lldp;
      revision-date 2018-10-19;
    }
    import org-openroadm-rstp {
      prefix org-openroadm-rstp;
      revision-date 2018-10-19;
    }
    import org-openroadm-port-capability {
      prefix org-openroadm-port-capability;
      revision-date 2018-10-19;
    }
    import org-openroadm-pluggable-optics-holder-capability {
      prefix org-openroadm-pluggable-optics-holder-capability;
      revision-date 2018-10-19;
    }
    import common-types {
      prefix common-types;
    }

    organization "Fujitsu Network Communications";
    contact "SDN Development";

    revision 2018-01-18 {
        description "Initial revision of OWB device version 2.2 inventory model";
    }


    container openroadm-devices {
          list openroadm-device {
              description  "An openroadm device";
              key "device-id";
              uses owbi-common:openroadm-device-common;
              uses owbi-common:openroadm-device-ext-header-info;

              uses org-openroadm-device:org-openroadm-device-container {
                refine org-openroadm-device/info/node-type {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/info/vendor {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/info/openroadm-version {
                  config true;
                }
                refine org-openroadm-device/shelves/vendor {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/vendor {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/info/model {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/info/serial-id {
                  mandatory false;
                }
                refine org-openroadm-device/shelves/model {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/shelves/serial-id {
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/model {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/serial-id {
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/is-pluggable-optics {
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/circuit-pack-category/type {
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/ports/port-direction {
                  config true;
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/ports/operational-state {
                  mandatory false;
                }
                refine org-openroadm-device/circuit-packs/ports/label {
                  config true;
                }
                refine org-openroadm-device/degree/max-wavelengths {
                  mandatory false;
                }
                refine org-openroadm-device/shared-risk-group/current-provisioned-add-drop-ports {
                  mandatory false;
                }
                refine org-openroadm-device/shared-risk-group/max-add-drop-ports {
                  mandatory false;
                }
                refine org-openroadm-device/shared-risk-group/wavelength-duplication {
                  mandatory false;
                }
                 augment "org-openroadm-device/interface" {
                   when "type = 'openROADM-if:ethernetCsmacd'";
                   ext:augment-identifier "interface-ethernet";
                   uses org-openroadm-eth-interfaces:ethernet-container;
                 }
                 augment "org-openroadm-device/interface" {
                   when "type = 'openROADM-if:opticalChannel'";
                   ext:augment-identifier "interface-och";
                   uses org-openroadm-optical-channel-interfaces:och-container;
                 }
                 augment "org-openroadm-device/interface" {
                   when "type = 'openROADM-if:opticalTransport'";
                   ext:augment-identifier "interface-ots";
                   uses org-openroadm-optical-transport-interfaces:ots-container;
                 }
                 augment "org-openroadm-device/interface" {
                   when "type = 'openROADM-if:otnOdu'";
                   ext:augment-identifier "interface-odu";
                   uses org-openroadm-otn-odu-interfaces:odu-container;
                 }
                 augment "org-openroadm-device/interface" {
                   when "type = 'openROADM-if:otnOtu'";
                   ext:augment-identifier "interface-otu";
                   uses org-openroadm-otn-otu-interfaces:otu-container;
                 }
                 augment "org-openroadm-device/interface" {
		    when "type = 'openROADM-if:networkMediaChannelConnectionTerminationPoint'";
		    ext:augment-identifier "interface-nmcctp";
		    uses org-openroadm-network-media-channel-interfaces:nmc-ctp-container;
		  }
                  augment "org-openroadm-device/interface" {
                    when "type = 'openROADM-if:mediaChannelTrailTerminationPoint'";
                    ext:augment-identifier "interface-mcttp";
                    uses org-openroadm-media-channel-interfaces:mc-ttp-container;
                 }
                 augment "org-openroadm-device/circuit-packs/ports" {
                   ext:augment-identifier "ports-capability-grp";
                   uses org-openroadm-port-capability:port-capability-grp;
                 }
                 augment "org-openroadm-device/circuit-packs/cp-slots" {
                   ext:augment-identifier "poh-capability";
                   uses org-openroadm-pluggable-optics-holder-capability:pluggable-optics-holder-capability;
                 }
                 augment "org-openroadm-device/protocols" {
                   when "org-openroadm-device/info/node-type='rdm' or org-openroadm-device/info/node-type='ila'";
                   ext:augment-identifier "protocol-rstp";
                   uses org-openroadm-rstp:rstp-container;
                 }
                 augment "org-openroadm-device/protocols" {
                   when "org-openroadm-device/info/node-type='rdm' or org-openroadm-device/info/node-type='ila'";
                   ext:augment-identifier "protocol-lldp";
                   uses org-openroadm-lldp:lldp-container;
                 }
                 augment "org-openroadm-device/info" {
                   ext:augment-identifier "info-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/shelves" {
                   ext:augment-identifier "shelves-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/circuit-packs" {
                   ext:augment-identifier "cp-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/circuit-packs" {
                   ext:augment-identifier "cp-fw-managed-state";
                   leaf fw-managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/degree" {
                   ext:augment-identifier "degree-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/shared-risk-group" {
                   ext:augment-identifier "srg-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/interface" {
                   ext:augment-identifier "intf-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/physical-link" {
                   ext:augment-identifier "phy-link-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/protocols" {
                   when "org-openroadm-device/info/node-type='rdm' or org-openroadm-device/info/node-type='ila'";
                   ext:augment-identifier "protocol-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device/xponder" {
                   when "org-openroadm-device/info/node-type='xpdr'";
                   ext:augment-identifier "xpdr-managed-state";
                   leaf managed-state {
                     type common-types:managed-states;
                   }
                 }
                 augment "org-openroadm-device" {
                   ext:augment-identifier "pg-restriction-grp";
                   uses org-openroadm-port-capability:port-group-restriction-grp;
                 }
              }
            }
    }
}
