Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -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 | dc7e76c | 2017-03-27 11:35:34 -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 org.onosproject.cluster.NodeId; |
| 20 | |
| 21 | /** |
| 22 | * Information about an FPM connection. |
| 23 | */ |
| 24 | public class FpmConnectionInfo { |
| 25 | |
| 26 | private final NodeId connectedTo; |
| 27 | private final long connectTime; |
| 28 | private final FpmPeer peer; |
William Davies | d368750 | 2019-06-19 20:23:17 +0000 | [diff] [blame^] | 29 | private final boolean acceptRoutes; |
Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Creates a new connection info. |
| 33 | * |
| 34 | * @param connectedTo ONOS node the FPM peer is connected to |
| 35 | * @param peer FPM peer |
| 36 | * @param connectTime time the connection was made |
| 37 | */ |
William Davies | d368750 | 2019-06-19 20:23:17 +0000 | [diff] [blame^] | 38 | @Deprecated |
Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -0700 | [diff] [blame] | 39 | public FpmConnectionInfo(NodeId connectedTo, FpmPeer peer, long connectTime) { |
| 40 | this.connectedTo = connectedTo; |
| 41 | this.peer = peer; |
| 42 | this.connectTime = connectTime; |
William Davies | d368750 | 2019-06-19 20:23:17 +0000 | [diff] [blame^] | 43 | this.acceptRoutes = true; |
Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | /** |
William Davies | d368750 | 2019-06-19 20:23:17 +0000 | [diff] [blame^] | 47 | * Creates a new connection info. |
| 48 | * |
| 49 | * @param connectedTo ONOS node the FPM peer is connected to |
| 50 | * @param peer FPM peer |
| 51 | * @param connectTime time the connection was made |
| 52 | * @param acceptRoutes flag to accept or discard routes |
| 53 | */ |
| 54 | FpmConnectionInfo(NodeId connectedTo, FpmPeer peer, long connectTime, boolean acceptRoutes) { |
| 55 | this.connectedTo = connectedTo; |
| 56 | this.peer = peer; |
| 57 | this.connectTime = connectTime; |
| 58 | this.acceptRoutes = acceptRoutes; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | /** |
Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -0700 | [diff] [blame] | 63 | * Returns the node the FPM peers is connected to. |
| 64 | * |
| 65 | * @return ONOS node |
| 66 | */ |
| 67 | public NodeId connectedTo() { |
| 68 | return connectedTo; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Returns the FPM peer. |
| 73 | * |
| 74 | * @return FPM peer |
| 75 | */ |
| 76 | public FpmPeer peer() { |
| 77 | return peer; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Returns the time the connection was made. |
| 82 | * |
| 83 | * @return connect time |
| 84 | */ |
| 85 | public long connectTime() { |
| 86 | return connectTime; |
| 87 | } |
William Davies | d368750 | 2019-06-19 20:23:17 +0000 | [diff] [blame^] | 88 | |
| 89 | /** |
| 90 | * Returns the acceptRoutes flag status of the peer. |
| 91 | * |
| 92 | * @return acceptRoutes flag |
| 93 | */ |
| 94 | public boolean isAcceptRoutes() { |
| 95 | return acceptRoutes; |
| 96 | } |
Jonathan Hart | dc7e76c | 2017-03-27 11:35:34 -0700 | [diff] [blame] | 97 | } |