use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.
the class LldpPostIngressRuleGeneratorTest 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.utils.RoutingMetadata in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildCommandsVxlanEncapsulationDoubleVlanTest.
@Test
public void buildCommandsVxlanEncapsulationDoubleVlanTest() {
Flow flow = buildFlow(MULTI_TABLE_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_PATH, flow, VXLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
RoutingMetadata ingressMetadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID_1).build(), FieldMatch.builder().field(Field.METADATA).value(ingressMetadata.getValue()).mask(ingressMetadata.getMask()).build());
List<Action> expectedIngressActions = newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
assertIngressCommand(ingressCommand, Priority.MIRROR_DOUBLE_VLAN_FLOW_PRIORITY, INGRESS, expectedIngressMatch, expectedIngressActions, METER_ID, groupCommand.getUuid());
Set<Action> expectedFlowBucketActions = newHashSet(buildPushVxlan(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertGroupCommand(groupCommand, expectedFlowBucketActions);
}
use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.
the class ArpPostIngressOneSwitchRuleGeneratorTest method checkMatch.
@Override
protected void checkMatch(Set<FieldMatch> match) {
assertEquals(1, match.size());
FieldMatch metadataMatch = getMatchByField(Field.METADATA, match);
RoutingMetadata expectedMetadata = RoutingMetadata.builder().arpFlag(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.utils.RoutingMetadata in project open-kilda by telstra.
the class ArpPostIngressVxlanRuleGeneratorTest method checkMatch.
@Override
protected void checkMatch(Set<FieldMatch> match) {
assertEquals(4, match.size());
FieldMatch metadataMatch = getMatchByField(Field.METADATA, match);
RoutingMetadata expectedMetadata = RoutingMetadata.builder().arpFlag(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(ARP_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.utils.RoutingMetadata in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildCommandsWithoutMeter.
@Test
public void buildCommandsWithoutMeter() {
Flow oneSwitchFlow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_2, 0);
Set<FlowSideAdapter> overlapping = Sets.newHashSet(FlowSideAdapter.makeIngressAdapter(oneSwitchFlow, ONE_SWITCH_PATH));
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
MultiTableIngressYRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION, overlapping, false);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(1, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
assertEquals(newArrayList(SHARED_METER_UUID), new ArrayList<>(ingressCommand.getDependsOn()));
RoutingMetadata ingressMetadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID_1).build(), FieldMatch.builder().field(Field.METADATA).value(ingressMetadata.getValue()).mask(ingressMetadata.getMask()).build());
List<Action> expectedIngressActions = newArrayList(SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertIngressCommand(ingressCommand, Priority.Y_FLOW_DOUBLE_VLAN_PRIORITY, expectedIngressMatch, expectedIngressActions, SHARED_METER_ID, null);
}
Aggregations