use of org.openkilda.rulemanager.MeterSpeakerData in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildCommandsVlanEncapsulationDoubleVlanWithOuterVlanOverlappingTest.
@Test
public void buildCommandsVlanEncapsulationDoubleVlanWithOuterVlanOverlappingTest() {
Flow oneSwitchFlow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, 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);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
assertEquals(newArrayList(meterCommand.getUuid()), 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);
assertMeterCommand(meterCommand);
}
use of org.openkilda.rulemanager.MeterSpeakerData in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildCommandsVlanEncapsulationDoubleVlanTest.
@Test
public void buildCommandsVlanEncapsulationDoubleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
MultiTableIngressYRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
assertEquals(newArrayList(meterCommand.getUuid()), 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);
assertMeterCommand(meterCommand);
}
use of org.openkilda.rulemanager.MeterSpeakerData in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildCommandsVlanEncapsulationDoubleVlanPortOverlappingTest.
@Test
public void buildCommandsVlanEncapsulationDoubleVlanPortOverlappingTest() {
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);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
assertEquals(newArrayList(meterCommand.getUuid()), 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);
assertMeterCommand(meterCommand);
}
use of org.openkilda.rulemanager.MeterSpeakerData in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method buildCommandsVlanEncapsulationDoubleVlanWithOuterVlanOverlappingTest.
@Test
public void buildCommandsVlanEncapsulationDoubleVlanWithOuterVlanOverlappingTest() {
Flow oneSwitchFlow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, 0);
Set<FlowSideAdapter> overlapping = Sets.newHashSet(FlowSideAdapter.makeIngressAdapter(oneSwitchFlow, ONE_SWITCH_PATH));
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
MultiTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION, overlapping);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
assertEquals(newArrayList(meterCommand.getUuid()), 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.DOUBLE_VLAN_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, METER_ID, null);
assertMeterCommand(meterCommand);
}
use of org.openkilda.rulemanager.MeterSpeakerData in project open-kilda by telstra.
the class SingleTableIngressRuleGeneratorTest method buildCommandsVlanEncapsulationSingleVlanTest.
@Test
public void buildCommandsVlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
SingleTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
assertEquals(newArrayList(meterCommand.getUuid()), new ArrayList<>(ingressCommand.getDependsOn()));
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_1).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.FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, METER_ID);
assertMeterCommand(meterCommand);
}
Aggregations