X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=common%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fcommon%2Fmapping%2FPortMappingVersion121Test.java;h=8722144366e33e00648171838568c60b280ff7dc;hb=refs%2Fchanges%2F46%2F100646%2F27;hp=de1aa85dac7b4e5443e5240ae77cbc74ad14f8d1;hpb=211dacfed540c8ddbf552c229c74b6054b185720;p=transportpce.git diff --git a/common/src/test/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121Test.java b/common/src/test/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121Test.java index de1aa85da..872214436 100644 --- a/common/src/test/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121Test.java +++ b/common/src/test/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121Test.java @@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmappi import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.Direction; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.NodeTypes; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.Port; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.ParentCircuitPackBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports; @@ -85,7 +86,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; @@ -284,45 +284,43 @@ public class PortMappingVersion121Test { Protocols protocols = new ProtocolsBuilder().addAugmentation(augmentation).build(); // mock responses for deviceTransactionManager calls - InstanceIdentifier deviceIID = InstanceIdentifier - .create(OrgOpenroadmDevice.class) - .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device - .rev170206.org.openroadm.device.container.org.openroadm.device.Degree.class, - new DegreeKey(Uint16.valueOf(1))); + InstanceIdentifier deviceIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Degree.class, new DegreeKey(Uint16.valueOf(1))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmDegreeObject)); - InstanceIdentifier deviceIID3 = InstanceIdentifier - .create(OrgOpenroadmDevice.class) - .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206 - .org.openroadm.device.container.org.openroadm.device.Degree.class, - new DegreeKey(Uint16.valueOf(2))); + InstanceIdentifier deviceIID3 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Degree.class, new DegreeKey(Uint16.valueOf(2))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID3, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmDegreeObject3)); - InstanceIdentifier deviceIID5 = InstanceIdentifier - .create(OrgOpenroadmDevice.class) - .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206 - .org.openroadm.device.container.org.openroadm.device.Degree.class, - new DegreeKey(Uint16.valueOf(3))); + InstanceIdentifier deviceIID5 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Degree.class, new DegreeKey(Uint16.valueOf(3))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID5, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmDegreeObject5)); - InstanceIdentifier protocoliid = - InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class); + InstanceIdentifier protocoliid = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Protocols.class) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, protocoliid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(protocols)); Interface interfaceObject = new InterfaceBuilder().withKey(new InterfaceKey("itf1")) .setSupportingCircuitPackName("sc1").build(); - InstanceIdentifier interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(Interface.class, new InterfaceKey(portConfig.getIfName())); + InstanceIdentifier interfaceIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Interface.class, new InterfaceKey(portConfig.getIfName())) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, interfaceIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(interfaceObject)); @@ -371,60 +369,81 @@ public class PortMappingVersion121Test { when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID55, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports55)); - InstanceIdentifier infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class); + InstanceIdentifier infoIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Info.class) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, infoIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(info)); - InstanceIdentifier circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c1")); + InstanceIdentifier circuitPacksIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c1")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject)); - InstanceIdentifier circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c2")); + InstanceIdentifier circuitPacksIID2 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c2")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID2, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject2)); - InstanceIdentifier circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c3")); + InstanceIdentifier circuitPacksIID3 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c3")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID3, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject3)); - InstanceIdentifier circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c4")); + InstanceIdentifier circuitPacksIID4 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c4")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID4, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject4)); - InstanceIdentifier circuitPacksIID5 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c5")); + InstanceIdentifier circuitPacksIID5 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c5")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID5, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject5)); - InstanceIdentifier circuitPacksIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c6")); + InstanceIdentifier circuitPacksIID6 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c6")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID6, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject6)); - InstanceIdentifier srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(1))); + InstanceIdentifier srgIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(1))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmSrgObject)); - InstanceIdentifier srgIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(2))); + InstanceIdentifier srgIID4 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(2))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID4, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmSrgObject4)); - InstanceIdentifier srgIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(3))); + InstanceIdentifier srgIID6 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(3))) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID6, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(ordmSrgObject6)); @@ -540,7 +559,10 @@ public class PortMappingVersion121Test { when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID5, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports5)); - InstanceIdentifier infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class); + InstanceIdentifier infoIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(Info.class) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, infoIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(info)); @@ -550,26 +572,34 @@ public class PortMappingVersion121Test { CircuitPacks circuitPackObject3 = getCircuitPacks(portsList2, "c3", "pc3"); CircuitPacks circuitPackObject4 = getCircuitPacks(portsList4, "c4", "pc4"); - InstanceIdentifier circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c1")); + InstanceIdentifier circuitPacksIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c1")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject)); - InstanceIdentifier circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c2")); + InstanceIdentifier circuitPacksIID2 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c2")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID2, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject2)); - InstanceIdentifier circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c3")); + InstanceIdentifier circuitPacksIID3 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c3")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID3, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject3)); - InstanceIdentifier circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("c4")); + InstanceIdentifier circuitPacksIID4 = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("c4")) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID4, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)) .thenReturn(Optional.of(circuitPackObject4)); @@ -582,7 +612,9 @@ public class PortMappingVersion121Test { OrgOpenroadmDevice deviceObject = new OrgOpenroadmDeviceBuilder().setCircuitPacks(circuitPacksMap) .setConnectionMap(connectionMapMap).build(); - InstanceIdentifier deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class); + InstanceIdentifier deviceIID = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .build(); when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(deviceObject)); @@ -617,9 +649,12 @@ public class PortMappingVersion121Test { } @NonNull - private KeyedInstanceIdentifier getChild(String c4, String p5) { - return InstanceIdentifier.create(OrgOpenroadmDevice.class).child(CircuitPacks.class, new CircuitPacksKey(c4)) - .child(Ports.class, new PortsKey(p5)); + private InstanceIdentifier getChild(String c4, String p5) { + return InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey(c4)) + .child(Ports.class, new PortsKey(p5)) + .build(); } private ConnectionMap getConnectionMap(List destinationList) {