use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableFullPortEgressMirrorRuleTest.
@Test
public void buildVlanMultiTableFullPortEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(true);
Flow flow = buildFlow(path, 0, 0);
EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
assertEquals(2, commands.size());
FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.EGRESS, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVlanSingleTableOuterVlanEqualsTransitVlanEgressMirrorRuleTest.
@Test
public void buildVlanSingleTableOuterVlanEqualsTransitVlanEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(false);
Flow flow = buildFlow(path, VLAN_ENCAPSULATION.getId(), 0);
EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
assertEquals(2, commands.size());
FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.INPUT, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableOuterInnerVlanEqualsTransitEgressMirrorRuleTest.
@Test
public void buildVlanMultiTableOuterInnerVlanEqualsTransitEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(true);
Flow flow = buildFlow(path, OUTER_VLAN_ID, VLAN_ENCAPSULATION.getId());
EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
assertEquals(2, commands.size());
FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID).build(), new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.EGRESS, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVxlanMultiTableFullPortEgressMirrorRuleTest.
@Test
public void buildVxlanMultiTableFullPortEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(true);
Flow flow = buildFlow(path, 0, 0);
EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VXLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
assertEquals(2, commands.size());
FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW), new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.EGRESS, VXLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class DatabaseSupportImpl method updateFlowMeterId.
@Override
public void updateFlowMeterId(String flowId, long newMeterId) {
// TODO(andriidovhan) rewrite it, FlowPair flowPair -> Flow
// FlowPair flowPair = flowPairRepository.findById(flowId)
// .orElseThrow(() -> new RuntimeException(format("Unable to find Flow for %s", flowId)));
// flowPair.getForward().setMeterId(newMeterId.getValue());
// flowPair.getReverse().setMeterId(newMeterId.getValue());
// flowRepository.createOrUpdate(flowPair);
// flow path
transactionManager.doInTransaction(() -> {
Collection<FlowPath> flowPaths = flowPathRepository.findByFlowId(flowId);
long meterId = newMeterId;
for (FlowPath flowPath : flowPaths) {
flowPath.setMeterId(new MeterId(meterId));
Optional<FlowMeter> meter = flowMeterRepository.findByPathId(flowPath.getPathId());
if (meter.isPresent()) {
meter.get().setMeterId(new MeterId(meterId++));
}
}
});
}
Aggregations