Jonathan Hart | f4b2ca1 | 2017-05-17 16:10:16 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2017-present Open Networking Foundation |
Jonathan Hart | f4b2ca1 | 2017-05-17 16:10:16 -0700 | [diff] [blame] | 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.routing.fpm; |
| 18 | |
| 19 | import java.util.Collection; |
| 20 | |
| 21 | import static com.google.common.base.Preconditions.checkNotNull; |
| 22 | |
| 23 | /** |
| 24 | * Information about an FPM peer. |
| 25 | */ |
| 26 | public class FpmPeerInfo { |
| 27 | |
| 28 | private final Collection<FpmConnectionInfo> connections; |
| 29 | private final int routes; |
| 30 | |
| 31 | /** |
| 32 | * Class constructor. |
| 33 | * |
| 34 | * @param connections connection information for the peer |
| 35 | * @param routes number of routes the peer has sent to this node |
| 36 | */ |
| 37 | public FpmPeerInfo(Collection<FpmConnectionInfo> connections, int routes) { |
| 38 | this.connections = checkNotNull(connections); |
| 39 | this.routes = routes; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Returns connection information for the peer. |
| 44 | * |
| 45 | * @return collection of connection information |
| 46 | */ |
| 47 | public Collection<FpmConnectionInfo> connections() { |
| 48 | return connections; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Returns number of routes sent to this node. |
| 53 | * |
| 54 | * @return number of routes |
| 55 | */ |
| 56 | public int routes() { |
| 57 | return routes; |
| 58 | } |
| 59 | } |