mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 19:01:06 +02:00
Translate only certain groups to PI
Change-Id: I71417e43ec456bce21a9abcc0609dc05a82b264c
This commit is contained in:
parent
089432e6de
commit
a73f1065a9
@ -16,9 +16,11 @@
|
|||||||
|
|
||||||
package org.onosproject.net.pi.impl;
|
package org.onosproject.net.pi.impl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import org.onosproject.net.Device;
|
import org.onosproject.net.Device;
|
||||||
import org.onosproject.net.group.Group;
|
import org.onosproject.net.group.Group;
|
||||||
import org.onosproject.net.group.GroupBucket;
|
import org.onosproject.net.group.GroupBucket;
|
||||||
|
import org.onosproject.net.group.GroupDescription;
|
||||||
import org.onosproject.net.pi.model.PiPipeconf;
|
import org.onosproject.net.pi.model.PiPipeconf;
|
||||||
import org.onosproject.net.pi.model.PiPipelineInterpreter;
|
import org.onosproject.net.pi.model.PiPipelineInterpreter;
|
||||||
import org.onosproject.net.pi.runtime.PiAction;
|
import org.onosproject.net.pi.runtime.PiAction;
|
||||||
@ -31,6 +33,7 @@ import org.onosproject.net.pi.runtime.PiTableAction;
|
|||||||
import org.onosproject.net.pi.service.PiTranslationException;
|
import org.onosproject.net.pi.service.PiTranslationException;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
import static org.onosproject.net.pi.impl.PiFlowRuleTranslatorImpl.translateTreatment;
|
import static org.onosproject.net.pi.impl.PiFlowRuleTranslatorImpl.translateTreatment;
|
||||||
@ -42,6 +45,11 @@ import static org.onosproject.net.pi.runtime.PiTableAction.Type.ACTION;
|
|||||||
*/
|
*/
|
||||||
final class PiGroupTranslatorImpl {
|
final class PiGroupTranslatorImpl {
|
||||||
|
|
||||||
|
private static final Set<GroupDescription.Type> SUPPORTED_GROUP_TYPES =
|
||||||
|
Sets.immutableEnumSet(
|
||||||
|
GroupDescription.Type.SELECT,
|
||||||
|
GroupDescription.Type.INDIRECT);
|
||||||
|
|
||||||
private PiGroupTranslatorImpl() {
|
private PiGroupTranslatorImpl() {
|
||||||
// Hides constructor.
|
// Hides constructor.
|
||||||
}
|
}
|
||||||
@ -57,13 +65,18 @@ final class PiGroupTranslatorImpl {
|
|||||||
*/
|
*/
|
||||||
static PiActionGroup translate(Group group, PiPipeconf pipeconf, Device device) throws PiTranslationException {
|
static PiActionGroup translate(Group group, PiPipeconf pipeconf, Device device) throws PiTranslationException {
|
||||||
|
|
||||||
|
if (!SUPPORTED_GROUP_TYPES.contains(group.type())) {
|
||||||
|
throw new PiTranslationException(format(
|
||||||
|
"group type %s not supported", group.type()));
|
||||||
|
}
|
||||||
|
|
||||||
final PiPipelineInterpreter interpreter = getInterpreterOrNull(device, pipeconf);
|
final PiPipelineInterpreter interpreter = getInterpreterOrNull(device, pipeconf);
|
||||||
|
|
||||||
final PiActionGroup.Builder piActionGroupBuilder = PiActionGroup.builder()
|
final PiActionGroup.Builder piActionGroupBuilder = PiActionGroup.builder()
|
||||||
.withId(PiActionGroupId.of(group.id().id()));
|
.withId(PiActionGroupId.of(group.id().id()));
|
||||||
|
|
||||||
if (!(group.appCookie() instanceof PiGroupKey)) {
|
if (!(group.appCookie() instanceof PiGroupKey)) {
|
||||||
throw new PiTranslationException("Group app cookie is not PI (class should be PiGroupKey)");
|
throw new PiTranslationException("group app cookie is not PI (class should be PiGroupKey)");
|
||||||
}
|
}
|
||||||
final PiGroupKey groupKey = (PiGroupKey) group.appCookie();
|
final PiGroupKey groupKey = (PiGroupKey) group.appCookie();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user