Carmelo Cascone | cb4327a | 2018-09-11 15:17:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.net.pi.runtime; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | import org.onlab.util.Identifier; |
| 21 | |
| 22 | /** |
| 23 | * Identifier of an action profile group in a protocol-independent pipeline, |
| 24 | * unique within the scope of an action profile. |
| 25 | */ |
| 26 | @Beta |
| 27 | public final class PiActionProfileGroupId extends Identifier<Integer> implements PiTableAction { |
| 28 | |
| 29 | private PiActionProfileGroupId(int id) { |
| 30 | super(id); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Returns an action profile group identifier for the given integer value. |
| 35 | * |
| 36 | * @param id identifier |
| 37 | * @return action profile group |
| 38 | */ |
| 39 | public static PiActionProfileGroupId of(int id) { |
| 40 | return new PiActionProfileGroupId(id); |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 | In P4Runtime, groups can be referenced directly as table actions (i.e. |
| 45 | without invoking the selector). In future we should consider having a more |
| 46 | appropriate wrapper class for group IDs, instead of implementing the |
| 47 | PiTableAction interface. |
| 48 | */ |
| 49 | @Override |
| 50 | public Type type() { |
| 51 | return Type.ACTION_PROFILE_GROUP_ID; |
| 52 | } |
| 53 | } |