blob: 33623dc2f9ffe61455dff274aa23e35fce7a6059 [file] [log] [blame]
Shashikanth VH9f8afb42015-11-04 18:00:30 +05301/*
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
14package org.onosproject.bgp.controller.impl;
15
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053016import org.onosproject.bgp.controller.BgpId;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053017import org.onosproject.bgp.controller.BgpSessionInfo;
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053018import org.onosproject.bgpio.protocol.BgpVersion;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053019import org.slf4j.Logger;
20import org.slf4j.LoggerFactory;
21
22/**
23 * Class maintains BGP peer session info.
24 */
25public class BgpSessionInfoImpl implements BgpSessionInfo {
26
27 protected final Logger log = LoggerFactory.getLogger(BgpSessionInfoImpl.class);
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053028 private BgpId remoteBgpId;
29 private BgpVersion remoteBgpVersion;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053030 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 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053047 public BgpSessionInfoImpl(BgpId remoteBgpId, BgpVersion remoteBgpVersion, long remoteBgpASNum,
Shashikanth VH9f8afb42015-11-04 18:00:30 +053048 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
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053070 public BgpId remoteBgpId() {
Shashikanth VH9f8afb42015-11-04 18:00:30 +053071 return remoteBgpId;
72 }
73
74 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053075 public BgpVersion remoteBgpVersion() {
Shashikanth VH9f8afb42015-11-04 18:00:30 +053076 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}