blob: 1a54fe93b4f66a7969a03b6fd4a6dabe525ba1e4 [file] [log] [blame]
Jonathan Hartdc7e76c2017-03-27 11:35:34 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Jonathan Hartdc7e76c2017-03-27 11:35:34 -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 */
16
17package org.onosproject.routing.fpm;
18
19import org.onosproject.cluster.NodeId;
20
21/**
22 * Information about an FPM connection.
23 */
24public class FpmConnectionInfo {
25
26 private final NodeId connectedTo;
27 private final long connectTime;
28 private final FpmPeer peer;
William Daviesd3687502019-06-19 20:23:17 +000029 private final boolean acceptRoutes;
Jonathan Hartdc7e76c2017-03-27 11:35:34 -070030
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 Daviesd3687502019-06-19 20:23:17 +000038 @Deprecated
Jonathan Hartdc7e76c2017-03-27 11:35:34 -070039 public FpmConnectionInfo(NodeId connectedTo, FpmPeer peer, long connectTime) {
40 this.connectedTo = connectedTo;
41 this.peer = peer;
42 this.connectTime = connectTime;
William Daviesd3687502019-06-19 20:23:17 +000043 this.acceptRoutes = true;
Jonathan Hartdc7e76c2017-03-27 11:35:34 -070044 }
45
46 /**
William Daviesd3687502019-06-19 20:23:17 +000047 * 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 Hartdc7e76c2017-03-27 11:35:34 -070063 * 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 Daviesd3687502019-06-19 20:23:17 +000088
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 Hartdc7e76c2017-03-27 11:35:34 -070097}