Search in sources :

Example 1 with OFOxms

use of org.projectfloodlight.openflow.protocol.oxm.OFOxms in project open-kilda by telstra.

the class OutputCommands method installRoundTripLatencyRule.

/**
 * Expected result for install default round trip latency rule.
 *
 * @param dpid datapath of the switch.
 * @return expected OFFlowAdd instance.
 */
default OFFlowAdd installRoundTripLatencyRule(DatapathId dpid) {
    Match match = ofFactory.buildMatch().setExact(MatchField.ETH_TYPE, EthType.IPv4).setExact(MatchField.ETH_SRC, MacAddress.of(dpid)).setExact(MatchField.ETH_DST, MacAddress.of(VERIFICATION_BCAST_PACKET_DST)).setExact(MatchField.IP_PROTO, IpProtocol.UDP).setExact(MatchField.UDP_DST, TransportPort.of(LATENCY_PACKET_UDP_PORT)).build();
    OFOxms oxms = ofFactory.oxms();
    return ofFactory.buildFlowAdd().setCookie(U64.of(Cookie.ROUND_TRIP_LATENCY_RULE_COOKIE)).setMatch(match).setPriority(ROUND_TRIP_LATENCY_RULE_PRIORITY).setActions(ImmutableList.of(ofFactory.actions().buildNoviflowCopyField().setNBits(ROUND_TRIP_LATENCY_TIMESTAMP_SIZE).setSrcOffset(0).setDstOffset(ROUND_TRIP_LATENCY_T1_OFFSET).setOxmSrcHeader(oxms.buildNoviflowRxtimestamp().getTypeLen()).setOxmDstHeader(oxms.buildNoviflowPacketOffset().getTypeLen()).build(), ofFactory.actions().buildOutput().setPort(OFPort.CONTROLLER).setMaxLen(0xFFFFFFFF).build())).build();
}
Also used : OFOxms(org.projectfloodlight.openflow.protocol.oxm.OFOxms) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 2 with OFOxms

use of org.projectfloodlight.openflow.protocol.oxm.OFOxms in project open-kilda by telstra.

the class PathVerificationService method actionAddTxTimestamp.

private OFAction actionAddTxTimestamp(final IOFSwitch sw, int offset) {
    OFOxms oxms = sw.getOFFactory().oxms();
    OFActions actions = sw.getOFFactory().actions();
    return actions.buildNoviflowCopyField().setNBits(ROUND_TRIP_LATENCY_TIMESTAMP_SIZE).setSrcOffset(0).setDstOffset(offset).setOxmSrcHeader(oxms.buildNoviflowTxtimestamp().getTypeLen()).setOxmDstHeader(oxms.buildNoviflowPacketOffset().getTypeLen()).build();
}
Also used : OFOxms(org.projectfloodlight.openflow.protocol.oxm.OFOxms) OFActions(org.projectfloodlight.openflow.protocol.action.OFActions)

Example 3 with OFOxms

use of org.projectfloodlight.openflow.protocol.oxm.OFOxms in project open-kilda by telstra.

the class SwitchFlowUtils method actionReplaceVlan.

/**
 * Create an OFAction to change the outer most vlan.
 *
 * @param factory OF factory for the switch
 * @param newVlan final VLAN to be set on the packet
 * @return {@link OFAction}
 */
public static OFAction actionReplaceVlan(final OFFactory factory, final int newVlan) {
    OFOxms oxms = factory.oxms();
    OFActions actions = factory.actions();
    if (OF_12.compareTo(factory.getVersion()) == 0) {
        return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofRawVid((short) newVlan)).build()).build();
    } else {
        return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofVlan(newVlan)).build()).build();
    }
}
Also used : OFOxms(org.projectfloodlight.openflow.protocol.oxm.OFOxms) OFActions(org.projectfloodlight.openflow.protocol.action.OFActions)

Example 4 with OFOxms

use of org.projectfloodlight.openflow.protocol.oxm.OFOxms in project open-kilda by telstra.

the class SwitchManager method actionReplaceVlan.

/**
 * Create an OFAction to change the outer most vlan.
 *
 * @param sw      switch object
 * @param newVlan final VLAN to be set on the packet
 * @return {@link OFAction}
 */
private OFAction actionReplaceVlan(final IOFSwitch sw, final int newVlan) {
    OFFactory factory = sw.getOFFactory();
    OFOxms oxms = factory.oxms();
    OFActions actions = factory.actions();
    if (OF_12.compareTo(factory.getVersion()) == 0) {
        return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofRawVid((short) newVlan)).build()).build();
    } else {
        return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofVlan(newVlan)).build()).build();
    }
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFOxms(org.projectfloodlight.openflow.protocol.oxm.OFOxms) OFActions(org.projectfloodlight.openflow.protocol.action.OFActions)

Example 5 with OFOxms

use of org.projectfloodlight.openflow.protocol.oxm.OFOxms in project open-kilda by telstra.

the class SwitchManager method actionSetDstMac.

/**
 * Create an action to set the DstMac of a packet.
 *
 * @param sw switch object
 * @param macAddress MacAddress to set
 * @return {@link OFAction}
 */
private OFAction actionSetDstMac(final IOFSwitch sw, final MacAddress macAddress) {
    OFOxms oxms = sw.getOFFactory().oxms();
    OFActions actions = sw.getOFFactory().actions();
    return actions.buildSetField().setField(oxms.buildEthDst().setValue(macAddress).build()).build();
}
Also used : OFOxms(org.projectfloodlight.openflow.protocol.oxm.OFOxms) OFActions(org.projectfloodlight.openflow.protocol.action.OFActions)

Aggregations

OFOxms (org.projectfloodlight.openflow.protocol.oxm.OFOxms)7 OFActions (org.projectfloodlight.openflow.protocol.action.OFActions)6 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)1 Match (org.projectfloodlight.openflow.protocol.match.Match)1 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)1