33623dc2f9ffe61455dff274aa23e35fce7a6059
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11  * specific language governing permissions and limitations under the License.
12  */
13
14 package org.onosproject.bgp.controller.impl;
15
16 import org.onosproject.bgp.controller.BgpId;
17 import org.onosproject.bgp.controller.BgpSessionInfo;
18 import org.onosproject.bgpio.protocol.BgpVersion;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21
22 /**
23  * Class maintains BGP peer session info.
24  */
25 public class BgpSessionInfoImpl implements BgpSessionInfo {
26
27     protected final Logger log = LoggerFactory.getLogger(BgpSessionInfoImpl.class);
28     private BgpId remoteBgpId;
29     private BgpVersion remoteBgpVersion;
30     private long remoteBgpASNum;
31     private short remoteBgpholdTime;
32     private int remoteBgpIdentifier;
33     private short negotiatedholdTime;
34     private boolean isIbgpSession;
35
36     /**
37      * Initialize session info.
38      *
39      *@param remoteBgpId remote peer id
40      *@param remoteBgpVersion remote peer version
41      *@param remoteBgpASNum remote peer AS number
42      *@param remoteBgpholdTime remote peer hold time
43      *@param remoteBgpIdentifier remote peer identifier
44      *@param negotiatedholdTime negotiated hold time
45      *@param isIbgpSession session type ibgp/ebgp
46      */
47     public BgpSessionInfoImpl(BgpId remoteBgpId, BgpVersion remoteBgpVersion, long remoteBgpASNum,
48                               short remoteBgpholdTime, int remoteBgpIdentifier, short negotiatedholdTime,
49                               boolean isIbgpSession) {
50         this.remoteBgpId = remoteBgpId;
51         this.remoteBgpVersion = remoteBgpVersion;
52         this.remoteBgpASNum = remoteBgpASNum;
53         this.remoteBgpholdTime = remoteBgpholdTime;
54         this.remoteBgpIdentifier = remoteBgpIdentifier;
55         this.negotiatedholdTime = negotiatedholdTime;
56         this.isIbgpSession = isIbgpSession;
57     }
58
59     @Override
60     public boolean isIbgpSession() {
61         return isIbgpSession;
62     }
63
64     @Override
65     public short negotiatedholdTime() {
66         return negotiatedholdTime;
67     }
68
69     @Override
70     public BgpId remoteBgpId() {
71         return remoteBgpId;
72     }
73
74     @Override
75     public BgpVersion remoteBgpVersion() {
76         return remoteBgpVersion;
77     }
78
79     @Override
80     public long remoteBgpASNum() {
81         return remoteBgpASNum;
82     }
83
84     @Override
85     public short remoteBgpHoldTime() {
86         return remoteBgpholdTime;
87     }
88
89     @Override
90     public int remoteBgpIdentifier() {
91         return remoteBgpIdentifier;
92     }
93 }