use of org.openkilda.model.Switch 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.model.Switch 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.model.Switch in project open-kilda by telstra.
the class Server42FlowRttOutputVxlanRuleGeneratorTest method server42FlowRttOutputVxlanRuleGeneratorNoviflowTest.
@Test
public void server42FlowRttOutputVxlanRuleGeneratorNoviflowTest() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(NOVIFLOW_COPY_FIELD, NOVIFLOW_PUSH_POP_VXLAN));
testOutputRule(sw, new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW), true);
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class Server42FlowRttVxlanTurningRuleGeneratorTest method server42FlowRttVxlanTurningRuleGeneratorNoviflowTest.
@Test
public void server42FlowRttVxlanTurningRuleGeneratorNoviflowTest() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(NOVIFLOW_SWAP_ETH_SRC_ETH_DST));
testOutputRule(sw, ActionType.NOVI_SWAP_FIELD);
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class Server42IslRttOutputRuleGeneratorTest method server42IslRttOutputRuleGeneratorTest.
@Test
public void server42IslRttOutputRuleGeneratorTest() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(NOVIFLOW_COPY_FIELD));
List<SpeakerData> commands = generator.generateCommands(sw);
assertEquals(1, commands.size());
FlowSpeakerData flowCommandData = getCommand(FlowSpeakerData.class, commands);
assertEquals(sw.getSwitchId(), flowCommandData.getSwitchId());
assertEquals(sw.getOfVersion(), flowCommandData.getOfVersion().toString());
assertTrue(flowCommandData.getDependsOn().isEmpty());
assertEquals(new Cookie(SERVER_42_ISL_RTT_OUTPUT_COOKIE), flowCommandData.getCookie());
assertEquals(OfTable.INPUT, flowCommandData.getTable());
assertEquals(SERVER_42_ISL_RTT_OUTPUT_PRIORITY, flowCommandData.getPriority());
Set<FieldMatch> expectedMatch = Sets.newHashSet(FieldMatch.builder().field(Field.ETH_DST).value(MAC_ADDRESS.toLong()).build(), FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.IPv4).build(), FieldMatch.builder().field(Field.IP_PROTO).value(IpProto.UDP).build(), FieldMatch.builder().field(Field.UDP_SRC).value(SERVER_42_ISL_RTT_REVERSE_UDP_PORT).build());
assertEquals(expectedMatch, flowCommandData.getMatch());
List<Action> expectedApplyActions = Lists.newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(Utils.SERVER_42_VLAN).build(), SetFieldAction.builder().field(Field.ETH_SRC).value(sw.getSwitchId().toMacAddressAsLong()).build(), SetFieldAction.builder().field(Field.ETH_DST).value(Utils.SERVER_42_MAC_ADDRESS.toLong()).build(), new PortOutAction(new PortNumber(Utils.SERVER_42_PORT)));
Instructions expectedInstructions = Instructions.builder().applyActions(expectedApplyActions).build();
assertEquals(expectedInstructions, flowCommandData.getInstructions());
}
Aggregations