Search in sources :

Example 16 with U64

use of org.projectfloodlight.openflow.types.U64 in project open-kilda by telstra.

the class RoutingMetadata method makeValue.

private static U64 makeValue(Boolean lldpFlag, Boolean arpFlag, Boolean oneSwitchFlowFlag, Integer outerVlanId, Integer inputPort) {
    U64 result = U64.ZERO;
    if (lldpFlag != null) {
        result = setField(result, lldpFlag ? 1 : 0, LLDP_MARKER_FLAG);
    }
    if (arpFlag != null) {
        result = setField(result, arpFlag ? 1 : 0, ARP_MARKER_FLAG);
    }
    if (oneSwitchFlowFlag != null) {
        result = setField(result, oneSwitchFlowFlag ? 1 : 0, ONE_SWITCH_FLOW_FLAG);
    }
    if (outerVlanId != null) {
        result = setField(result, 1, OUTER_VLAN_PRESENCE_FLAG);
        result = setField(result, outerVlanId, OUTER_VLAN_FIELD);
    }
    if (inputPort != null) {
        if (inputPort < 0 || inputPort > MAX_INPUT_PORT) {
            throw new IllegalArgumentException(format("Invalid inputPort %s. Valid range [0, %d]", inputPort, MAX_INPUT_PORT));
        }
        result = setField(result, inputPort, INPUT_PORT_FIELD);
    }
    return result;
}
Also used : U64(org.projectfloodlight.openflow.types.U64)

Aggregations

U64 (org.projectfloodlight.openflow.types.U64)16 OFPort (org.projectfloodlight.openflow.types.OFPort)6 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)5 TransportPort (org.projectfloodlight.openflow.types.TransportPort)5 HashSet (java.util.HashSet)4 Match (org.projectfloodlight.openflow.protocol.match.Match)4 EthType (org.projectfloodlight.openflow.types.EthType)4 IpProtocol (org.projectfloodlight.openflow.types.IpProtocol)4 MacAddress (org.projectfloodlight.openflow.types.MacAddress)4 OFMetadata (org.projectfloodlight.openflow.types.OFMetadata)4 List (java.util.List)3 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)3 FloodlightModuleException (net.floodlightcontroller.core.module.FloodlightModuleException)3 Test (org.junit.Test)3 SwitchId (org.openkilda.model.SwitchId)3 OFFlowStatsEntry (org.projectfloodlight.openflow.protocol.OFFlowStatsEntry)3 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)3 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Lists (com.google.common.collect.Lists)2