Search in sources :

Example 6 with LogicalPortInfoEntry

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;
}
Also used : LogicalPortInfoEntry(org.openkilda.messaging.info.switches.LogicalPortInfoEntry) ArrayList(java.util.ArrayList) CreateLogicalPortRequest(org.openkilda.messaging.command.grpc.CreateLogicalPortRequest)

Example 7 with LogicalPortInfoEntry

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());
}
Also used : LogicalPort(org.openkilda.messaging.model.grpc.LogicalPort) LagLogicalPort(org.openkilda.model.LagLogicalPort) LogicalPortInfoEntry(org.openkilda.messaging.info.switches.LogicalPortInfoEntry) Test(org.junit.Test)

Example 8 with LogicalPortInfoEntry

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());
}
Also used : LogicalPortInfoEntry(org.openkilda.messaging.info.switches.LogicalPortInfoEntry) LagLogicalPort(org.openkilda.model.LagLogicalPort) Test(org.junit.Test)

Aggregations

LogicalPortInfoEntry (org.openkilda.messaging.info.switches.LogicalPortInfoEntry)8 Test (org.junit.Test)5 LogicalPortMisconfiguredInfoEntry (org.openkilda.messaging.info.switches.LogicalPortMisconfiguredInfoEntry)3 LogicalPort (org.openkilda.messaging.model.grpc.LogicalPort)3 LagLogicalPort (org.openkilda.model.LagLogicalPort)3 ArrayList (java.util.ArrayList)2 ValidateLogicalPortsResult (org.openkilda.wfm.topology.switchmanager.model.ValidateLogicalPortsResult)2 ValidationService (org.openkilda.wfm.topology.switchmanager.service.ValidationService)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 String.format (java.lang.String.format)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1