Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.t3.api; |
| 18 | |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.flow.TrafficSelector; |
| 21 | import org.onosproject.net.group.Group; |
| 22 | |
| 23 | import java.util.List; |
| 24 | |
| 25 | /** |
| 26 | * Class to represent the groups in a device for a given output and packet. |
| 27 | */ |
Andrea Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 28 | //FIXME consider name change. |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 29 | public 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 Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 37 | * |
| 38 | * @param output the output connect point |
| 39 | * @param groups the groups |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 40 | * @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 Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 51 | * |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 52 | * @return the connect point |
| 53 | */ |
| 54 | public ConnectPoint getOutput() { |
| 55 | return output; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Returns the groups. |
Andrea Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 60 | * |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 61 | * @return groups. |
| 62 | */ |
| 63 | public List<Group> getGroups() { |
| 64 | return groups; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Returns the final packet after traversing the network. |
Andrea Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 69 | * |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 70 | * @return the selector with packet info |
| 71 | */ |
| 72 | public TrafficSelector getFinalPacket() { |
| 73 | return selector; |
| 74 | } |
| 75 | |
Andrea Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame^] | 76 | /** |
| 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 Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 85 | @Override |
| 86 | public String toString() { |
| 87 | return "GroupsInDevice{" + |
| 88 | "output=" + output + |
| 89 | ", groups=" + groups + |
| 90 | ", selector=" + selector + |
| 91 | '}'; |
| 92 | } |
| 93 | |
| 94 | } |