use of org.openkilda.messaging.info.rule.FlowSwapFieldAction in project open-kilda by telstra.
the class OfFlowStatsMapperTest method testFlowEntry.
@Test
public void testFlowEntry() {
OFFlowStatsEntry ofEntry = buildFlowStatsEntry();
FlowEntry entry = OfFlowStatsMapper.INSTANCE.toFlowEntry(ofEntry);
assertEquals(tableId, entry.getTableId());
assertEquals(cookie, entry.getCookie());
assertEquals(packetCount, entry.getPacketCount());
assertEquals(byteCount, entry.getByteCount());
assertEquals(durationSec, entry.getDurationSeconds());
assertEquals(durationNsec, entry.getDurationNanoSeconds());
assertEquals(hardTimeout, entry.getHardTimeout());
assertEquals(idleTimeout, entry.getIdleTimeout());
assertEquals(priority, entry.getPriority());
assertEquals(String.valueOf(vlanVid.getVlan()), entry.getMatch().getVlanVid());
assertEquals(ethType.toString(), entry.getMatch().getEthType());
assertEquals(ethDst.toString(), entry.getMatch().getEthDst());
assertEquals(port.toString(), entry.getMatch().getInPort());
assertEquals(ipProto.toString(), entry.getMatch().getIpProto());
assertEquals(udpSrc.toString(), entry.getMatch().getUdpSrc());
assertEquals(udpDst.toString(), entry.getMatch().getUdpDst());
FlowSetFieldAction flowSetEthSrcAction = new FlowSetFieldAction("eth_src", MAC_ADDRESS_1);
FlowSetFieldAction flowSetEthDstAction = new FlowSetFieldAction("eth_dst", MAC_ADDRESS_2);
FlowCopyFieldAction flowCopyFieldAction = FlowCopyFieldAction.builder().bits(String.valueOf(bits)).srcOffset(String.valueOf(srcOffset)).dstOffset(String.valueOf(dstOffset)).srcOxm(String.valueOf(oxmSrcHeader)).dstOxm(String.valueOf(oxmDstHeader)).build();
FlowSwapFieldAction flowSwapFieldAction = FlowSwapFieldAction.builder().bits(String.valueOf(bits)).srcOffset(String.valueOf(srcOffset)).dstOffset(String.valueOf(dstOffset)).srcOxm(String.valueOf(oxmSrcHeader)).dstOxm(String.valueOf(oxmDstHeader)).build();
FlowApplyActions applyActions = new FlowApplyActions(port.toString(), Lists.newArrayList(flowSetEthSrcAction, flowSetEthDstAction), ethType.toString(), null, null, null, group.toString(), flowCopyFieldAction, flowSwapFieldAction);
FlowInstructions instructions = new FlowInstructions(applyActions, null, meterId, goToTable.getValue());
assertEquals(instructions, entry.getInstructions());
}
Aggregations