Class OfdpaGroupHandlerUtility
- java.lang.Object
-
- org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility
-
public final class OfdpaGroupHandlerUtility extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOfdpaGroupHandlerUtility.GroupChainElemRepresents a group element that is part of a chain of groups.static classOfdpaGroupHandlerUtility.GroupCheckerstatic classOfdpaGroupHandlerUtility.GroupInfoUtility class for moving group information around.static classOfdpaGroupHandlerUtility.OfdpaMplsGroupSubTypeHelper enum to handle the different MPLS group types.static classOfdpaGroupHandlerUtility.OfdpaNextGroupRepresents an entire group-chain that implements a Next-Objective from the application.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancreateUnfiltered(org.onosproject.net.flow.TrafficTreatment treatment, org.onosproject.net.flow.TrafficSelector meta)Helper method to decide whether L2 Interface group or L2 Unfiltered group needs to be created.static intdoubleVlanL3UnicastGroupId(org.onlab.packet.VlanId vlanId, long portNum)static intdoubleVlanL3UnicastGroupKey(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)Returns a hash as the L3 Unicast Group Key.static java.util.List<java.lang.Integer>existingPortAndLabel(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portToMatch, int labelToMatch)Returns a list of all indices in the allActiveKeys list (that represents a group) if the list element (a bucket or group-chain) has treatments that match the given outport and label.static org.onlab.packet.VlanIdextractVlanIdFromGroupId(int groupId)Extracts VlanId from given group ID.static java.util.Set<org.onosproject.net.PortNumber>getExistingOutputPorts(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)Returns the set of existing output ports in the group represented by allActiveKeys.static java.util.List<java.lang.Integer>indicesToRemoveFromNextGroup(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)Get indices to remove comparing next group with next objective.static org.onosproject.net.group.GroupKeyl2FloodGroupKey(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)static intl2GroupId(org.onlab.packet.VlanId vlanId, long portNum)static intl2HashGroupKey(org.onosproject.net.DeviceId deviceId, long portNumber)Returns a hash as the L2 Hash Group Key.static intl2InterfaceGroupKey(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)Returns a hash as the L2 Interface Group Key.static org.onosproject.net.group.GroupKeyl2MulticastGroupKey(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)static intl2UnfilteredGroupId(long portNum)static intl2UnfilteredGroupKey(org.onosproject.net.DeviceId deviceId, long portNumber)Returns a hash as the L2 Unfiltered Interface Group Key.static java.lang.IntegermakeMplsForwardingGroupId(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)Creates MPLS Forwarding group id given a sub type and the index.static java.lang.IntegermakeMplsLabelGroupId(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)Creates MPLS Label group id given a sub type and the index.static booleanverifyHashedNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective)The purpose of this function is to verify if the hashed next objective is supported by the current pipeline.
-
-
-
Method Detail
-
makeMplsLabelGroupId
public static java.lang.Integer makeMplsLabelGroupId(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)
Creates MPLS Label group id given a sub type and the index.- Parameters:
subType- the MPLS Label group sub typeindex- the index of the group- Returns:
- the OFDPA group id
-
makeMplsForwardingGroupId
public static java.lang.Integer makeMplsForwardingGroupId(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)
Creates MPLS Forwarding group id given a sub type and the index.- Parameters:
subType- the MPLS forwarding group sub typeindex- the index of the group- Returns:
- the OFDPA group id
-
getExistingOutputPorts
public static java.util.Set<org.onosproject.net.PortNumber> getExistingOutputPorts(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)Returns the set of existing output ports in the group represented by allActiveKeys.- Parameters:
allActiveKeys- list of group key chaingroupService- the group service to get group informationdeviceId- the device id to get group- Returns:
- a set of output port from the list of group key chain
-
existingPortAndLabel
public static java.util.List<java.lang.Integer> existingPortAndLabel(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portToMatch, int labelToMatch)Returns a list of all indices in the allActiveKeys list (that represents a group) if the list element (a bucket or group-chain) has treatments that match the given outport and label.- Parameters:
allActiveKeys- the representation of the groupgroupService- groups service for querying group informationdeviceId- the device id for the device that contains the groupportToMatch- the port to match in the group bucketslabelToMatch- the MPLS label-id to match in the group buckets- Returns:
- a list of indexes in the allActiveKeys list where the list element has treatments that match the given portToMatch and labelToMatch. Could be empty if no list elements were found to match the given port and label.
-
indicesToRemoveFromNextGroup
public static java.util.List<java.lang.Integer> indicesToRemoveFromNextGroup(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)Get indices to remove comparing next group with next objective.- Parameters:
allActiveKeys- the representation of the groupnextObjective- the next objective to verifygroupService- groups service for querying group informationdeviceId- the device id for the device that contains the group- Returns:
- a list of indexes in the allActiveKeys to remove.
-
verifyHashedNextObjective
public static boolean verifyHashedNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective)
The purpose of this function is to verify if the hashed next objective is supported by the current pipeline.- Parameters:
nextObjective- the hashed objective to verify- Returns:
- true if the hashed objective is supported. Otherwise false.
-
extractVlanIdFromGroupId
public static org.onlab.packet.VlanId extractVlanIdFromGroupId(int groupId)
Extracts VlanId from given group ID.- Parameters:
groupId- the group ID- Returns:
- vlan id of the group
-
l2FloodGroupKey
public static org.onosproject.net.group.GroupKey l2FloodGroupKey(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)
-
l2MulticastGroupKey
public static org.onosproject.net.group.GroupKey l2MulticastGroupKey(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)
-
l2GroupId
public static int l2GroupId(org.onlab.packet.VlanId vlanId, long portNum)
-
l2UnfilteredGroupId
public static int l2UnfilteredGroupId(long portNum)
-
l2InterfaceGroupKey
public static int l2InterfaceGroupKey(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)Returns a hash as the L2 Interface Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 22 bits.- Parameters:
deviceId- Device IDvlanId- VLAN IDportNumber- Port number- Returns:
- L2 interface group key
-
l2UnfilteredGroupKey
public static int l2UnfilteredGroupKey(org.onosproject.net.DeviceId deviceId, long portNumber)Returns a hash as the L2 Unfiltered Interface Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 22 bits.- Parameters:
deviceId- Device IDportNumber- Port number- Returns:
- L2 unfiltered interface group key
-
l2HashGroupKey
public static int l2HashGroupKey(org.onosproject.net.DeviceId deviceId, long portNumber)Returns a hash as the L2 Hash Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 28 bits.- Parameters:
deviceId- Device IDportNumber- Port number- Returns:
- L2 hash group key
-
createUnfiltered
public static boolean createUnfiltered(org.onosproject.net.flow.TrafficTreatment treatment, org.onosproject.net.flow.TrafficSelector meta)Helper method to decide whether L2 Interface group or L2 Unfiltered group needs to be created. L2 Unfiltered group will be created if meta has VlanIdCriterion with VlanId.ANY, and treatment has set Vlan ID action.- Parameters:
treatment- treatment passed in by the application as part of the nextObjectivemeta- metadata passed in by the application as part of the nextObjective- Returns:
- true if L2 Unfiltered group needs to be created, false otherwise.
-
doubleVlanL3UnicastGroupKey
public static int doubleVlanL3UnicastGroupKey(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)Returns a hash as the L3 Unicast Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 28 bits.- Parameters:
deviceId- Device IDvlanId- vlan IDportNumber- Port number- Returns:
- L3 unicast group key
-
doubleVlanL3UnicastGroupId
public static int doubleVlanL3UnicastGroupId(org.onlab.packet.VlanId vlanId, long portNum)
-
-