blob: e3d0a1c8dc781f7e095b6de5a22b23e901b5e250 [file] [log] [blame]
Shashikanth VH9f8afb42015-11-04 18:00:30 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Shashikanth VH9f8afb42015-11-04 18:00:30 +05303 *
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 VH0a82a8e2016-02-02 20:42:53 +053016import java.util.List;
17
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053018import org.onosproject.bgp.controller.BgpId;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053019import org.onosproject.bgp.controller.BgpSessionInfo;
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053020import org.onosproject.bgpio.protocol.BgpVersion;
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053021import org.onosproject.bgpio.types.BgpValueType;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053022import org.slf4j.Logger;
23import org.slf4j.LoggerFactory;
24
25/**
26 * Class maintains BGP peer session info.
27 */
28public class BgpSessionInfoImpl implements BgpSessionInfo {
29
30 protected final Logger log = LoggerFactory.getLogger(BgpSessionInfoImpl.class);
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053031 private BgpId remoteBgpId;
32 private BgpVersion remoteBgpVersion;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053033 private long remoteBgpASNum;
34 private short remoteBgpholdTime;
35 private int remoteBgpIdentifier;
36 private short negotiatedholdTime;
37 private boolean isIbgpSession;
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053038 List<BgpValueType> remoteBgpCapability;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053039
40 /**
41 * Initialize session info.
42 *
43 *@param remoteBgpId remote peer id
44 *@param remoteBgpVersion remote peer version
45 *@param remoteBgpASNum remote peer AS number
46 *@param remoteBgpholdTime remote peer hold time
47 *@param remoteBgpIdentifier remote peer identifier
48 *@param negotiatedholdTime negotiated hold time
49 *@param isIbgpSession session type ibgp/ebgp
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053050 *@param remoteBgpCapability remote peer capabilities
Shashikanth VH9f8afb42015-11-04 18:00:30 +053051 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053052 public BgpSessionInfoImpl(BgpId remoteBgpId, BgpVersion remoteBgpVersion, long remoteBgpASNum,
Shashikanth VH9f8afb42015-11-04 18:00:30 +053053 short remoteBgpholdTime, int remoteBgpIdentifier, short negotiatedholdTime,
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053054 boolean isIbgpSession, List<BgpValueType> remoteBgpCapability) {
Shashikanth VH9f8afb42015-11-04 18:00:30 +053055 this.remoteBgpId = remoteBgpId;
56 this.remoteBgpVersion = remoteBgpVersion;
57 this.remoteBgpASNum = remoteBgpASNum;
58 this.remoteBgpholdTime = remoteBgpholdTime;
59 this.remoteBgpIdentifier = remoteBgpIdentifier;
60 this.negotiatedholdTime = negotiatedholdTime;
61 this.isIbgpSession = isIbgpSession;
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053062 this.remoteBgpCapability = remoteBgpCapability;
63 }
64
65 @Override
66 public List<BgpValueType> remoteBgpCapability() {
67 return remoteBgpCapability;
Shashikanth VH9f8afb42015-11-04 18:00:30 +053068 }
69
70 @Override
71 public boolean isIbgpSession() {
72 return isIbgpSession;
73 }
74
75 @Override
76 public short negotiatedholdTime() {
77 return negotiatedholdTime;
78 }
79
80 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053081 public BgpId remoteBgpId() {
Shashikanth VH9f8afb42015-11-04 18:00:30 +053082 return remoteBgpId;
83 }
84
85 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053086 public BgpVersion remoteBgpVersion() {
Shashikanth VH9f8afb42015-11-04 18:00:30 +053087 return remoteBgpVersion;
88 }
89
90 @Override
91 public long remoteBgpASNum() {
92 return remoteBgpASNum;
93 }
94
95 @Override
96 public short remoteBgpHoldTime() {
97 return remoteBgpholdTime;
98 }
99
100 @Override
101 public int remoteBgpIdentifier() {
102 return remoteBgpIdentifier;
103 }
104}