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