use of org.openkilda.rulemanager.match.FieldMatch 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.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class LldpIngressRuleGeneratorTest method checkMatch.
@Override
protected void checkMatch(Set<FieldMatch> match) {
assertEquals(1, match.size());
FieldMatch metadataMatch = getMatchByField(Field.METADATA, match);
RoutingMetadata expectedMetadata = RoutingMetadata.builder().lldpFlag(true).build(sw.getFeatures());
assertEquals(expectedMetadata.getValue(), metadataMatch.getValue());
assertTrue(metadataMatch.isMasked());
assertEquals(expectedMetadata.getMask(), metadataMatch.getMask().longValue());
}
use of org.openkilda.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class LldpPostIngressOneSwitchRuleGeneratorTest method checkMatch.
@Override
protected void checkMatch(Set<FieldMatch> match) {
assertEquals(1, match.size());
FieldMatch metadataMatch = getMatchByField(Field.METADATA, match);
RoutingMetadata expectedMetadata = RoutingMetadata.builder().lldpFlag(true).oneSwitchFlowFlag(true).build(sw.getFeatures());
assertEquals(expectedMetadata.getValue(), metadataMatch.getValue());
assertTrue(metadataMatch.isMasked());
assertEquals(expectedMetadata.getMask(), metadataMatch.getMask().longValue());
}
use of org.openkilda.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class LldpPostIngressVxlanRuleGeneratorTest method checkMatch.
@Override
protected void checkMatch(Set<FieldMatch> match) {
assertEquals(4, match.size());
FieldMatch metadataMatch = getMatchByField(Field.METADATA, match);
RoutingMetadata expectedMetadata = RoutingMetadata.builder().lldpFlag(true).build(sw.getFeatures());
assertEquals(expectedMetadata.getValue(), metadataMatch.getValue());
assertTrue(metadataMatch.isMasked());
assertEquals(expectedMetadata.getMask(), metadataMatch.getMask().longValue());
FieldMatch ipProtoMatch = getMatchByField(Field.IP_PROTO, match);
assertEquals(IpProto.UDP, ipProtoMatch.getValue());
assertFalse(ipProtoMatch.isMasked());
FieldMatch udpSrcMatch = getMatchByField(Field.UDP_SRC, match);
assertEquals(STUB_VXLAN_UDP_SRC, udpSrcMatch.getValue());
assertFalse(udpSrcMatch.isMasked());
FieldMatch updDestMatch = getMatchByField(Field.UDP_DST, match);
assertEquals(VXLAN_UDP_DST, updDestMatch.getValue());
assertFalse(updDestMatch.isMasked());
}
use of org.openkilda.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class TransitIslVxlanRuleGeneratorTest method checkMatch.
private void checkMatch(Set<FieldMatch> match) {
FieldMatch ethTypeMatch = getMatchByField(Field.ETH_TYPE, match);
assertEquals(EthType.IPv4, ethTypeMatch.getValue());
assertFalse(ethTypeMatch.isMasked());
FieldMatch ipProtoMatch = getMatchByField(Field.IP_PROTO, match);
assertEquals(IpProto.UDP, ipProtoMatch.getValue());
assertFalse(ipProtoMatch.isMasked());
FieldMatch inPortMatch = getMatchByField(Field.IN_PORT, match);
assertEquals(ISL_PORT, inPortMatch.getValue());
assertFalse(inPortMatch.isMasked());
FieldMatch udpSrcMatch = getMatchByField(Field.UDP_SRC, match);
assertEquals(STUB_VXLAN_UDP_SRC, udpSrcMatch.getValue());
assertFalse(udpSrcMatch.isMasked());
FieldMatch udpDstMatch = getMatchByField(Field.UDP_DST, match);
assertEquals(VXLAN_UDP_DST, udpDstMatch.getValue());
assertFalse(udpDstMatch.isMasked());
}
Aggregations