use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.
the class EgressIslVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithOpenKildaVxlanFeature.
@Test
public void shouldBuildCorrectRuleWithOpenKildaVxlanFeature() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(KILDA_OVS_PUSH_POP_MATCH_VXLAN));
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 PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_EGRESS_RULES, ISL_PORT), flowCommandData.getCookie());
assertEquals(OfTable.INPUT, flowCommandData.getTable());
assertEquals(ISL_EGRESS_VXLAN_RULE_PRIORITY_MULTITABLE, flowCommandData.getPriority());
Set<FieldMatch> match = flowCommandData.getMatch();
assertEquals(6, match.size());
checkMatch(match, sw.getSwitchId());
FieldMatch ethTypeMatch = getMatchByField(Field.ETH_TYPE, match);
assertEquals(EthType.IPv4, ethTypeMatch.getValue());
assertFalse(ethTypeMatch.isMasked());
Instructions instructions = flowCommandData.getInstructions();
assertEquals(OfTable.EGRESS, instructions.getGoToTable());
}
use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.
the class EgressIslVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithNoviflowVxlanFeature.
@Test
public void shouldBuildCorrectRuleWithNoviflowVxlanFeature() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(SwitchFeature.NOVIFLOW_PUSH_POP_VXLAN));
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 PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_EGRESS_RULES, ISL_PORT), flowCommandData.getCookie());
assertEquals(OfTable.INPUT, flowCommandData.getTable());
assertEquals(ISL_EGRESS_VXLAN_RULE_PRIORITY_MULTITABLE, flowCommandData.getPriority());
Set<FieldMatch> match = flowCommandData.getMatch();
assertEquals(6, match.size());
checkMatch(match, sw.getSwitchId());
Instructions instructions = flowCommandData.getInstructions();
assertEquals(OfTable.EGRESS, instructions.getGoToTable());
}
use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.
the class TransitIslVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithOpenKildaVxlanFeature.
@Test
public void shouldBuildCorrectRuleWithOpenKildaVxlanFeature() {
Switch sw = buildSwitch("OF_13", Sets.newHashSet(KILDA_OVS_PUSH_POP_MATCH_VXLAN));
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 PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_TRANSIT_RULES, ISL_PORT), flowCommandData.getCookie());
assertEquals(OfTable.INPUT, flowCommandData.getTable());
assertEquals(ISL_TRANSIT_VXLAN_RULE_PRIORITY_MULTITABLE, flowCommandData.getPriority());
Set<FieldMatch> match = flowCommandData.getMatch();
assertEquals(5, match.size());
checkMatch(match);
FieldMatch ethTypeMatch = getMatchByField(Field.ETH_TYPE, match);
assertEquals(EthType.IPv4, ethTypeMatch.getValue());
assertFalse(ethTypeMatch.isMasked());
Instructions instructions = flowCommandData.getInstructions();
assertEquals(OfTable.TRANSIT, instructions.getGoToTable());
}
use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.
the class RecordHandler method processInstallServer42IslRttRule.
private Long processInstallServer42IslRttRule(SwitchId switchId, long cookie, int server42Port, int server42Vlan, MacAddress server42MacAddress) throws SwitchOperationException {
ISwitchManager switchManager = context.getSwitchManager();
DatapathId dpid = DatapathId.of(switchId.toLong());
if (cookie == SERVER_42_ISL_RTT_OUTPUT_COOKIE) {
return switchManager.installServer42IslRttOutputFlow(dpid, server42Port, server42Vlan, server42MacAddress);
} else if (new Cookie(cookie).getType() == CookieType.SERVER_42_ISL_RTT_INPUT) {
PortColourCookie portColourCookie = new PortColourCookie(cookie);
int islPort = portColourCookie.getPortNumber();
return switchManager.installServer42IslRttInputFlow(dpid, server42Port, islPort);
} else {
logger.warn("Skipping the installation of unexpected server 42 switch rule {} for switch {}", Long.toHexString(cookie), switchId);
return null;
}
}
use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.
the class RecordHandler method processInstallServer42RttRule.
private void processInstallServer42RttRule(InstallServer42Flow command) throws SwitchOperationException {
ISwitchManager switchManager = context.getSwitchManager();
DatapathId dpid = DatapathId.of(command.getSwitchId().toLong());
Cookie cookie = new Cookie(command.getCookie());
FlowSharedSegmentCookie sharedSegmentCookie = new FlowSharedSegmentCookie(command.getCookie());
if (command.getCookie() == SERVER_42_FLOW_RTT_OUTPUT_VLAN_COOKIE) {
switchManager.installServer42FlowRttOutputVlanFlow(dpid, command.getOutputPort(), command.getServer42Vlan(), command.getServer42MacAddress());
} else if (command.getCookie() == SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE) {
switchManager.installServer42FlowRttOutputVxlanFlow(dpid, command.getOutputPort(), command.getServer42Vlan(), command.getServer42MacAddress());
} else if (cookie.getType() == CookieType.SERVER_42_FLOW_RTT_INPUT) {
PortColourCookie portColourCookie = new PortColourCookie(command.getCookie());
int customerPort = portColourCookie.getPortNumber();
switchManager.installServer42FlowRttInputFlow(dpid, command.getInputPort(), customerPort, command.getServer42MacAddress());
} else if (cookie.getType() == CookieType.SHARED_OF_FLOW && sharedSegmentCookie.getSegmentType() == SharedSegmentType.SERVER42_QINQ_OUTER_VLAN) {
switchManager.installServer42OuterVlanMatchSharedFlow(dpid, sharedSegmentCookie);
} else if (command.getCookie() == SERVER_42_ISL_RTT_OUTPUT_COOKIE) {
processInstallServer42IslRttRule(command.getSwitchId(), command.getCookie(), command.getOutputPort(), command.getServer42Vlan(), command.getServer42MacAddress());
} else if (cookie.getType() == CookieType.SERVER_42_ISL_RTT_INPUT) {
processInstallServer42IslRttRule(command.getSwitchId(), command.getCookie(), command.getInputPort(), command.getServer42Vlan(), command.getServer42MacAddress());
} else {
logger.warn("Skipping the installation of unexpected server 42 switch rule {} for switch {}", Long.toHexString(command.getCookie()), command.getSwitchId());
}
}
Aggregations