-
- if (nodeVersion.equals(OPENROADM_DEVICE_VERSION_1_2_1)) {
- InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
- Optional<Protocols> protocolObject = this.deviceTransactionManager.getDataFromDevice(nodeId.getValue(),
- LogicalDatastoreType.OPERATIONAL, protocolsIID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (!protocolObject.isPresent() || (protocolObject.get().augmentation(Protocols1.class) == null)) {
- LOG.warn("LLDP subtree is missing : isolated openroadm device");
+ switch (nodeVersion) {
+ case OPENROADM_DEVICE_VERSION_1_2_1:
+ InstanceIdentifier<Protocols> protocols121IID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
+ Optional<Protocols> protocol121Object = this.deviceTransactionManager.getDataFromDevice(
+ nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols121IID, Timeouts.DEVICE_READ_TIMEOUT,
+ Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (!protocol121Object.isPresent()
+ || (protocol121Object.get().augmentation(Protocols1.class) == null)) {
+ LOG.warn("LLDP subtree is missing : isolated openroadm device");
+ return false;
+ }
+ // get neighbor list
+ NbrList nbr121List = protocol121Object.get().augmentation(Protocols1.class).getLldp().getNbrList();
+ LOG.info("LLDP subtree is present. Device has {} neighbours", nbr121List.getIfName().size());
+ // try to create rdm2rdm link
+ return rdm2rdmLinkCreatedv121(nodeId, nbr121List);
+ case OPENROADM_DEVICE_VERSION_2_2_1:
+ InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.Protocols> protocols221IID = InstanceIdentifier
+ .builderOfInherited(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData.class,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .OrgOpenroadmDevice.class)
+ .child(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .org.openroadm.device.Protocols.class)
+ .build();
+ Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.Protocols> protocol221Object = this.deviceTransactionManager
+ .getDataFromDevice(nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols221IID,
+ Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (!protocol221Object.isPresent() || (protocol221Object.get().augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev181019.Protocols1.class) == null)) {
+ LOG.warn("LLDP subtree is missing : isolated openroadm device");
+ return false;
+ }
+ org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev181019.lldp.container.lldp.@Nullable NbrList
+ nbr221List = protocol221Object.get().augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.lldp.rev181019.Protocols1.class).getLldp().getNbrList();
+ LOG.info("LLDP subtree is present. Device has {} neighbours", nbr221List.getIfName().size());
+ return rdm2rdmLinkCreatedv221(nodeId, nbr221List);
+ case OPENROADM_DEVICE_VERSION_7_1:
+ LOG.info("Not yet implemented?");