use of org.openkilda.messaging.info.switches.LogicalPortInfoEntry in project open-kilda by telstra.
the class CommandBuilderImpl method buildLogicalPortInstallCommands.
@Override
public List<CreateLogicalPortRequest> buildLogicalPortInstallCommands(SwitchId switchId, List<LogicalPortInfoEntry> missingLogicalPorts) {
String ipAddress = getSwitchIpAddress(switchId);
List<CreateLogicalPortRequest> requests = new ArrayList<>();
for (LogicalPortInfoEntry port : missingLogicalPorts) {
requests.add(new CreateLogicalPortRequest(ipAddress, port.getPhysicalPorts(), port.getLogicalPortNumber(), LogicalPortMapper.INSTANCE.map(port.getType())));
}
return requests;
}
use of org.openkilda.messaging.info.switches.LogicalPortInfoEntry in project open-kilda by telstra.
the class LogicalPortMapperTest method mapLogicalPortTest.
@Test
public void mapLogicalPortTest() {
LogicalPort logicalPort = LogicalPort.builder().logicalPortNumber(LAG_PORT).portNumbers(Lists.newArrayList(PHYSICAL_PORT_1, PHYSICAL_PORT_2)).type(LogicalPortType.LAG).name("some").build();
LogicalPortInfoEntry port = INSTANCE.map(logicalPort);
assertEquals(LAG_PORT, port.getLogicalPortNumber().intValue());
assertEquals(2, port.getPhysicalPorts().size());
assertEquals(PHYSICAL_PORT_1, port.getPhysicalPorts().get(0).intValue());
assertEquals(PHYSICAL_PORT_2, port.getPhysicalPorts().get(1).intValue());
assertNull(port.getExpected());
assertNull(port.getActual());
}
use of org.openkilda.messaging.info.switches.LogicalPortInfoEntry in project open-kilda by telstra.
the class LogicalPortMapperTest method mapLagLogicalPortTest.
@Test
public void mapLagLogicalPortTest() {
LagLogicalPort lagLogicalPort = new LagLogicalPort(SWITCH_ID, LAG_PORT, Lists.newArrayList(PHYSICAL_PORT_1, PHYSICAL_PORT_2));
LogicalPortInfoEntry port = INSTANCE.map(lagLogicalPort);
assertEquals(LAG_PORT, port.getLogicalPortNumber().intValue());
assertEquals(2, port.getPhysicalPorts().size());
assertEquals(PHYSICAL_PORT_1, port.getPhysicalPorts().get(0).intValue());
assertEquals(PHYSICAL_PORT_2, port.getPhysicalPorts().get(1).intValue());
assertNull(port.getExpected());
assertNull(port.getActual());
}
Aggregations