use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method verifyIslCanBeDiscovered.
private void verifyIslCanBeDiscovered(NetworkUniIslService service, Isl link) {
Endpoint endpointA = Endpoint.of(link.getSrcSwitchId(), link.getSrcPort());
Endpoint endpointZ = Endpoint.of(link.getDestSwitchId(), link.getDestPort());
service.uniIslDiscovery(endpointA, IslMapper.INSTANCE.map(link));
verify(carrier).notifyIslUp(endpointA, new IslReference(endpointA, endpointZ), new IslDataHolder(link));
verify(carrier).exhaustedPollModeUpdateRequest(endpointA, false);
verifyNoMoreInteractions(carrier);
reset(carrier);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method newIslWithHistory.
@Test
public void newIslWithHistory() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
Endpoint endpoint2 = Endpoint.of(alphaDatapath, 2);
Switch alphaSwitch = Switch.builder().switchId(alphaDatapath).build();
Switch betaSwitch = Switch.builder().switchId(betaDatapath).build();
Isl islAtoB = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(1).build();
Isl islAtoB2 = Isl.builder().srcSwitch(alphaSwitch).srcPort(2).destSwitch(betaSwitch).destPort(2).build();
service.uniIslSetup(endpoint1, islAtoB);
service.uniIslSetup(endpoint2, islAtoB2);
// System.out.println(mockingDetails(carrier).printInvocations());
verify(carrier).setupIslFromHistory(endpoint1, IslReference.of(islAtoB), islAtoB);
verify(carrier).setupIslFromHistory(endpoint2, IslReference.of(islAtoB2), islAtoB2);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method fromUpToDown.
@Test
public void fromUpToDown() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
Endpoint endpoint2 = Endpoint.of(alphaDatapath, 2);
Switch alphaSwitch = Switch.builder().switchId(alphaDatapath).build();
Switch betaSwitch = Switch.builder().switchId(betaDatapath).build();
Isl islA1toB1 = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(1).build();
Isl islA2toB2 = Isl.builder().srcSwitch(alphaSwitch).srcPort(2).destSwitch(betaSwitch).destPort(2).build();
service.uniIslSetup(endpoint1, islA1toB1);
service.uniIslSetup(endpoint2, islA2toB2);
IslInfoData disco1 = IslMapper.INSTANCE.map(islA1toB1);
IslInfoData disco2 = IslMapper.INSTANCE.map(islA2toB2);
service.uniIslDiscovery(endpoint1, disco1);
service.uniIslDiscovery(endpoint2, disco2);
resetMocks();
service.uniIslFail(endpoint1);
service.uniIslPhysicalDown(endpoint2);
// System.out.println(mockingDetails(carrier).printInvocations());
verify(carrier).notifyIslDown(endpoint1, IslReference.of(islA1toB1), IslDownReason.POLL_TIMEOUT);
verify(carrier).notifyIslDown(endpoint2, IslReference.of(islA2toB2), IslDownReason.PORT_DOWN);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkWatcherServiceTest method discoveryBeforeConfirmation.
@Test
public void discoveryBeforeConfirmation() {
final int awaitTime = 10;
PathNode source = new PathNode(new SwitchId(1), 1, 0);
PathNode destination = new PathNode(new SwitchId(2), 1, 0);
NetworkWatcherService w = makeService(awaitTime);
w.addWatch(Endpoint.of(source.getSwitchId(), source.getPortNo()), 1);
verify(carrier, times(1)).sendDiscovery(any(DiscoverIslCommandData.class));
IslInfoData islAlphaBeta = IslInfoData.builder().source(source).destination(destination).packetId(0L).build();
w.discovery(islAlphaBeta);
w.confirmation(new Endpoint(source), 0);
w.tick(awaitTime + 1);
verify(carrier).oneWayDiscoveryReceived(eq(new Endpoint(source)), eq(0L), eq(islAlphaBeta), anyLong());
verify(carrier, never()).discoveryFailed(eq(new Endpoint(source)), anyLong(), anyLong());
assertThat(w.getConfirmedPackets().size(), is(0));
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class SwitchHandler method makePortTuple.
private Values makePortTuple(PortCommand command) {
Endpoint endpoint = command.getEndpoint();
CommandContext context = forkContext(endpoint.toString());
return new Values(endpoint.getDatapath(), endpoint.getPortNumber(), command, context);
}
Aggregations