blob: cf0ae5e9f363429a15f6c95d4f5db210cc6f2c3f [file] [log] [blame]
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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 */
16package org.onosproject.grouphandler;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import org.onosproject.net.PortNumber;
21import org.onosproject.net.group.GroupKey;
22
23/**
24 * Representation of policy group bucket identifier. Not exposed to
25 * the application and only to be used internally.
26 */
27public class GroupBucketIdentifier {
28 private int label;
29 private BucketOutputType type;
30 private PortNumber outPort;
31 private GroupKey outGroup;
32
33 protected enum BucketOutputType {
34 PORT,
35 GROUP
36 }
37
38 protected GroupBucketIdentifier(int label,
39 PortNumber outPort) {
40 this.label = label;
41 this.type = BucketOutputType.PORT;
42 this.outPort = checkNotNull(outPort);
43 this.outGroup = null;
44 }
45
46 protected GroupBucketIdentifier(int label,
47 GroupKey outGroup) {
48 this.label = label;
49 this.type = BucketOutputType.GROUP;
50 this.outPort = null;
51 this.outGroup = checkNotNull(outGroup);
52 }
53
54 protected int label() {
55 return this.label;
56 }
57
58 protected BucketOutputType type() {
59 return this.type;
60 }
61
62 protected PortNumber outPort() {
63 return this.outPort;
64 }
65
66 protected GroupKey outGroup() {
67 return this.outGroup;
68 }
69}
70