Search in sources :

Example 46 with FieldMatch

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());
}
Also used : FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortColourCookie(org.openkilda.model.cookie.PortColourCookie) Test(org.junit.Test)

Example 47 with FieldMatch

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());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Example 48 with FieldMatch

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());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Example 49 with FieldMatch

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());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Example 50 with FieldMatch

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());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch)

Aggregations

FieldMatch (org.openkilda.rulemanager.match.FieldMatch)121 Test (org.junit.Test)61 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)55 Instructions (org.openkilda.rulemanager.Instructions)55 SpeakerData (org.openkilda.rulemanager.SpeakerData)50 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)50 Action (org.openkilda.rulemanager.action.Action)46 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)41 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)41 RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)37 Flow (org.openkilda.model.Flow)31 Cookie (org.openkilda.model.cookie.Cookie)30 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)27 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)25 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)24 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)23 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)15 FlowSourceAdapter (org.openkilda.adapter.FlowSourceAdapter)12 Switch (org.openkilda.model.Switch)12 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)12