Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 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 | |
Shashikanth VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 16 | import java.util.List; |
| 17 | |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 18 | import org.onosproject.bgp.controller.BgpId; |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 19 | import org.onosproject.bgp.controller.BgpSessionInfo; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 20 | import org.onosproject.bgpio.protocol.BgpVersion; |
Shashikanth VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 21 | import org.onosproject.bgpio.types.BgpValueType; |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 22 | import org.slf4j.Logger; |
| 23 | import org.slf4j.LoggerFactory; |
| 24 | |
| 25 | /** |
| 26 | * Class maintains BGP peer session info. |
| 27 | */ |
| 28 | public class BgpSessionInfoImpl implements BgpSessionInfo { |
| 29 | |
| 30 | protected final Logger log = LoggerFactory.getLogger(BgpSessionInfoImpl.class); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 31 | private BgpId remoteBgpId; |
| 32 | private BgpVersion remoteBgpVersion; |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 33 | private long remoteBgpASNum; |
| 34 | private short remoteBgpholdTime; |
| 35 | private int remoteBgpIdentifier; |
| 36 | private short negotiatedholdTime; |
| 37 | private boolean isIbgpSession; |
Shashikanth VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 38 | List<BgpValueType> remoteBgpCapability; |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 39 | |
| 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 VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 50 | *@param remoteBgpCapability remote peer capabilities |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 51 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 52 | public BgpSessionInfoImpl(BgpId remoteBgpId, BgpVersion remoteBgpVersion, long remoteBgpASNum, |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 53 | short remoteBgpholdTime, int remoteBgpIdentifier, short negotiatedholdTime, |
Shashikanth VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 54 | boolean isIbgpSession, List<BgpValueType> remoteBgpCapability) { |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 55 | 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 VH | 0a82a8e | 2016-02-02 20:42:53 +0530 | [diff] [blame] | 62 | this.remoteBgpCapability = remoteBgpCapability; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public List<BgpValueType> remoteBgpCapability() { |
| 67 | return remoteBgpCapability; |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 68 | } |
| 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 VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 81 | public BgpId remoteBgpId() { |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 82 | return remoteBgpId; |
| 83 | } |
| 84 | |
| 85 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 86 | public BgpVersion remoteBgpVersion() { |
Shashikanth VH | 9f8afb4 | 2015-11-04 18:00:30 +0530 | [diff] [blame] | 87 | 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 | } |