blob: e63bdca0623a52b59e36a16b27be582ab524688a [file] [log] [blame]
Andrea Campanellae4084402017-12-15 15:27:31 +01001/*
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.t3.api;
18
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.flow.TrafficSelector;
21import org.onosproject.net.group.Group;
22
23import java.util.List;
24
25/**
26 * Class to represent the groups in a device for a given output and packet.
27 */
Andrea Campanellae6798012018-02-06 15:46:52 +010028//FIXME consider name change.
Andrea Campanellae4084402017-12-15 15:27:31 +010029public class GroupsInDevice {
30
31 private ConnectPoint output;
32 private List<Group> groups;
33 private TrafficSelector selector;
34
35 /**
36 * Saves the given groups for the output connect point and the selector.
Andrea Campanellae6798012018-02-06 15:46:52 +010037 *
38 * @param output the output connect point
39 * @param groups the groups
Andrea Campanellae4084402017-12-15 15:27:31 +010040 * @param selector the selector representing the final packet
41 */
42 public GroupsInDevice(ConnectPoint output, List<Group> groups, TrafficSelector selector) {
43
44 this.output = output;
45 this.groups = groups;
46 this.selector = selector;
47 }
48
49 /**
50 * Returns the output connect point.
Andrea Campanellae6798012018-02-06 15:46:52 +010051 *
Andrea Campanellae4084402017-12-15 15:27:31 +010052 * @return the connect point
53 */
54 public ConnectPoint getOutput() {
55 return output;
56 }
57
58 /**
59 * Returns the groups.
Andrea Campanellae6798012018-02-06 15:46:52 +010060 *
Andrea Campanellae4084402017-12-15 15:27:31 +010061 * @return groups.
62 */
63 public List<Group> getGroups() {
64 return groups;
65 }
66
67 /**
68 * Returns the final packet after traversing the network.
Andrea Campanellae6798012018-02-06 15:46:52 +010069 *
Andrea Campanellae4084402017-12-15 15:27:31 +010070 * @return the selector with packet info
71 */
72 public TrafficSelector getFinalPacket() {
73 return selector;
74 }
75
Andrea Campanellae6798012018-02-06 15:46:52 +010076 /**
77 * Updates the final packet.
78 *
79 * @param updatedPacket the updated final packet
80 */
81 public void setFinalPacket(TrafficSelector updatedPacket) {
82 selector = updatedPacket;
83 }
84
Andrea Campanellae4084402017-12-15 15:27:31 +010085 @Override
86 public String toString() {
87 return "GroupsInDevice{" +
88 "output=" + output +
89 ", groups=" + groups +
90 ", selector=" + selector +
91 '}';
92 }
93
94}