package org.opendaylight.transportpce.common.mapping;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import org.eclipse.jdt.annotation.NonNull;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.test.DataStoreContext;
import org.opendaylight.transportpce.test.DataStoreContextImpl;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.Network;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.NetworkBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.network.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.Network;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.NetworkBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.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;
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.PortConfigKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
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.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;
private static PortMappingVersion121 portMappingVersion121;
private Random ran = new Random();
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
// test createMappingData for a xpdr node with 3 network + 1 client + bidirectional & unidirectional ports
DataStoreContext dataStoreContext = new DataStoreContextImpl();
dataBroker = dataStoreContext.getDataBroker();
}
@Test
- public void createMappingDataTestRdm() {
+ void createMappingDataTestRdm() {
// mock node info
final Info info = getInfo2();
Protocols protocols = new ProtocolsBuilder().addAugmentation(augmentation).build();
// mock responses for deviceTransactionManager calls
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device
- .rev170206.org.openroadm.device.container.org.openroadm.device.Degree> 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<Degree> 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<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree> 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<Degree> 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<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree> 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<Degree> 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<Protocols> protocoliid =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> 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<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(portConfig.getIfName()));
+ InstanceIdentifier<Interface> 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));
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID55,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports55));
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> 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<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c1"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c2"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c3"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c4"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID5 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c5"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c6"));
+ InstanceIdentifier<CircuitPacks> 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<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(1)));
+ InstanceIdentifier<SharedRiskGroup> 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<SharedRiskGroup> srgIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(2)));
+ InstanceIdentifier<SharedRiskGroup> 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<SharedRiskGroup> srgIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(3)));
+ InstanceIdentifier<SharedRiskGroup> 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));
// test createMappingData with a node with 3 dgree + 3 srg + bidirectional & unidirectional ports
- assertTrue("creating mappingdata for existed node returns true",
- portMappingVersion121.createMappingData("node"));
+ assertTrue(portMappingVersion121.createMappingData("node"),
+ "creating mappingdata for existed node returns true");
// assert all portmappings have been created for the roadm node
ReadTransaction rr = dataBroker.newReadOnlyTransaction();
try {
Optional<Network> optionalNetwork = rr.read(LogicalDatastoreType.CONFIGURATION, mappingIID).get();
if (optionalNetwork.isPresent()) {
- network = optionalNetwork.get();
+ network = optionalNetwork.orElseThrow();
}
} catch (ExecutionException | InterruptedException e) {
LOG.error("Failed to read mapping.", e);
fail();
-
}
List<String> testMappings = Arrays.asList("SRG2-PP1-RX", "SRG3-PP1-RX", "SRG1-PP1-TXRX", "SRG3-PP1-TX",
"DEG1-TTP-TXRX", "SRG2-PP1-TX", "DEG2-TTP-RX", "DEG2-TTP-TX", "DEG3-TTP-RX", "DEG3-TTP-TX");
}
Collections.sort(testMappings);
Collections.sort(mappings);
- assertEquals("test mapping are equals to mapping", testMappings, mappings);
+ assertEquals(testMappings, mappings, "test mapping are equals to mapping");
// test updateMapping
- assertTrue("update mapping for node returns true",
- portMappingVersion121.updateMapping("node", mappingValues.get(0)));
+ assertTrue(portMappingVersion121.updateMapping("node", mappingValues.get(0)),
+ "update mapping for node returns true");
// test createMapping for non-existent roadm node
- assertFalse("create non existed roadm node returns false", portMappingVersion121.createMappingData("node2"));
+ assertFalse(portMappingVersion121.createMappingData("node2"), "create non existed roadm node returns false");
// test updateMapping for null roadm node
- assertFalse("updating null roadm node returns false",
- portMappingVersion121.updateMapping(null, mappingValues.get(0)));
+ assertFalse(portMappingVersion121.updateMapping(null, mappingValues.get(0)),
+ "updating null roadm node returns false");
}
@Test
- public void createMappingDataTestXpdr() {
+ void createMappingDataTestXpdr() {
// mock node info
final Info info = getInfo();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID5,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports5));
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> 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));
CircuitPacks circuitPackObject3 = getCircuitPacks(portsList2, "c3", "pc3");
CircuitPacks circuitPackObject4 = getCircuitPacks(portsList4, "c4", "pc4");
- InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c1"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c2"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c3"));
+ InstanceIdentifier<CircuitPacks> 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<CircuitPacks> circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c4"));
+ InstanceIdentifier<CircuitPacks> 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));
OrgOpenroadmDevice deviceObject = new OrgOpenroadmDeviceBuilder().setCircuitPacks(circuitPacksMap)
.setConnectionMap(connectionMapMap).build();
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> 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));
// test createMappingData for xpdr node with 2 network + 1 client + unidirectional & bidirectional ports
- assertTrue("returns true when create mapping ", portMappingVersion121.createMappingData("node"));
+ assertTrue(portMappingVersion121.createMappingData("node"), "returns true when create mapping");
// assert all portmappings have been created for the xpdr node
ReadTransaction rr = dataBroker.newReadOnlyTransaction();
try {
Optional<Network> optionalNetwork = rr.read(LogicalDatastoreType.CONFIGURATION, mappingIID).get();
if (optionalNetwork.isPresent()) {
- network = optionalNetwork.get();
+ network = optionalNetwork.orElseThrow();
}
} catch (ExecutionException | InterruptedException e) {
}
Collections.sort(testMappings);
Collections.sort(mappings);
- assertEquals("test mapping are equals to mapping", testMappings, mappings);
+ assertEquals(testMappings, mappings, "test mapping are equals to mapping");
}
@NonNull
- private KeyedInstanceIdentifier<Ports, PortsKey> getChild(String c4, String p5) {
- return InstanceIdentifier.create(OrgOpenroadmDevice.class).child(CircuitPacks.class, new CircuitPacksKey(c4))
- .child(Ports.class, new PortsKey(p5));
+ private InstanceIdentifier<Ports> 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<Destination> destinationList) {
private Interfaces getInterfaces(String i1) {
return new InterfacesBuilder().setInterfaceName(i1).build();
}
-
}