Search in sources :

Example 1 with FlowSwapFieldAction

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());
}
Also used : OFFlowStatsEntry(org.projectfloodlight.openflow.protocol.OFFlowStatsEntry) FlowSetFieldAction(org.openkilda.messaging.info.rule.FlowSetFieldAction) FlowSwapFieldAction(org.openkilda.messaging.info.rule.FlowSwapFieldAction) FlowInstructions(org.openkilda.messaging.info.rule.FlowInstructions) FlowApplyActions(org.openkilda.messaging.info.rule.FlowApplyActions) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry) FlowCopyFieldAction(org.openkilda.messaging.info.rule.FlowCopyFieldAction) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FlowApplyActions (org.openkilda.messaging.info.rule.FlowApplyActions)1 FlowCopyFieldAction (org.openkilda.messaging.info.rule.FlowCopyFieldAction)1 FlowEntry (org.openkilda.messaging.info.rule.FlowEntry)1 FlowInstructions (org.openkilda.messaging.info.rule.FlowInstructions)1 FlowSetFieldAction (org.openkilda.messaging.info.rule.FlowSetFieldAction)1 FlowSwapFieldAction (org.openkilda.messaging.info.rule.FlowSwapFieldAction)1 OFFlowStatsEntry (org.projectfloodlight.openflow.protocol.OFFlowStatsEntry)1