blob: a813f6e512fea8240b1547abaad94b30b1ca4c53 [file] [log] [blame]
Carmelo Casconecb4327a2018-09-11 15:17:23 -07001/*
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
17package org.onosproject.net.pi.runtime;
18
19import com.google.common.annotations.Beta;
20import org.onlab.util.Identifier;
21
22/**
23 * Identifier of a member of an action profile in a protocol-independent
24 * pipeline, unique within the scope on an action profile.
25 */
26@Beta
27public final class PiActionProfileMemberId extends Identifier<Integer>
28 implements PiTableAction {
29
30 private PiActionProfileMemberId(int id) {
31 super(id);
32 }
33
34 /**
35 * Returns a member identifier for the given integer value.
36 *
37 * @param id identifier
38 * @return action profile group
39 */
40 public static PiActionProfileMemberId of(int id) {
41 return new PiActionProfileMemberId(id);
42 }
43
44 /*
45 In P4Runtime, action profile members can be referenced directly as table
46 actions. In future we should consider having a more appropriate wrapper
47 class for group member IDs, instead of implementing the PiTableAction
48 interface.
49 */
50 @Override
51 public Type type() {
52 return Type.ACTION_PROFILE_MEMBER_ID;
53 }
54}