blob: 2e799a904201935ea0ea22ed6e815b6c8d9a1d1f [file] [log] [blame]
Carmelo Cascone87892e22017-11-13 16:01:29 -08001/*
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.model;
18
19import com.google.common.annotations.Beta;
20import org.onlab.util.Identifier;
21import org.onosproject.net.flow.TableId;
22
23import static com.google.common.base.Preconditions.checkArgument;
24import static com.google.common.base.Preconditions.checkNotNull;
25
26/**
27 * Identifier of a table in a protocol-independent pipeline, unique within the scope of a pipeline model.
28 */
29@Beta
30public final class PiTableId extends Identifier<String> implements TableId {
31
32 private PiTableId(String name) {
33 super(name);
34 }
35
36 /**
37 * Returns an identifier for the given table name.
38 *
39 * @param name table name
40 * @return table ID
41 */
42 public static PiTableId of(String name) {
43 checkNotNull(name);
44 checkArgument(!name.isEmpty(), "Name can't be empty");
45 return new PiTableId(name);
46 }
47
48 @Override
49 public Type type() {
50 return Type.PIPELINE_INDEPENDENT;
51 }
52}