Shashikanth VH | 6de20d3 | 2015-10-09 12:04:13 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 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 | |
| 17 | package org.onosproject.bgp.controller.impl; |
| 18 | |
| 19 | import org.onosproject.bgp.controller.BGPId; |
| 20 | import org.onosproject.bgpio.protocol.BGPVersion; |
| 21 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; |
| 23 | |
| 24 | /** |
| 25 | * Class maintains BGP peer session info. |
| 26 | */ |
| 27 | public class BGPSessionInfo { |
| 28 | |
| 29 | protected final Logger log = LoggerFactory.getLogger(BGPSessionInfo.class); |
| 30 | private BGPId remoteBgpId; |
| 31 | private BGPVersion remoteBgpVersion; |
| 32 | private short remoteBgpASNum; |
| 33 | private short remoteBgpholdTime; |
| 34 | private int remoteBgpIdentifier; |
| 35 | private short negotiatedholdTime; |
| 36 | |
| 37 | /** |
| 38 | * Gets the negotiated hold time for the session. |
| 39 | * |
| 40 | * @return negotiated hold time. |
| 41 | */ |
| 42 | public short getNegotiatedholdTime() { |
| 43 | return negotiatedholdTime; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Sets the negotiated hold time for the session. |
| 48 | * |
| 49 | * @param negotiatedholdTime negotiated hold time. |
| 50 | */ |
| 51 | public void setNegotiatedholdTime(short negotiatedholdTime) { |
| 52 | this.negotiatedholdTime = negotiatedholdTime; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Gets the BGP ID of BGP peer. |
| 57 | * |
| 58 | * @return bgp ID. |
| 59 | */ |
| 60 | public BGPId getRemoteBgpId() { |
| 61 | return remoteBgpId; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Sets the BGP ID of bgp peer. |
| 66 | * |
| 67 | * @param bgpId BGP ID to set. |
| 68 | */ |
| 69 | public void setRemoteBgpId(BGPId bgpId) { |
| 70 | log.debug("Remote BGP ID {}", bgpId); |
| 71 | this.remoteBgpId = bgpId; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Gets the BGP version of peer. |
| 76 | * |
| 77 | * @return bgp version. |
| 78 | */ |
| 79 | public BGPVersion getRemoteBgpVersion() { |
| 80 | return remoteBgpVersion; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Sets the BGP version for this bgp peer. |
| 85 | * |
| 86 | * @param bgpVersion bgp version to set. |
| 87 | */ |
| 88 | public void setRemoteBgpVersion(BGPVersion bgpVersion) { |
| 89 | log.debug("Remote BGP version {}", bgpVersion); |
| 90 | this.remoteBgpVersion = bgpVersion; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Gets the BGP remote bgp AS number. |
| 95 | * |
| 96 | * @return remoteBgpASNum peer AS number. |
| 97 | */ |
| 98 | public short getRemoteBgpASNum() { |
| 99 | return remoteBgpASNum; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Sets the AS Number for this bgp peer. |
| 104 | * |
| 105 | * @param bgpASNum the autonomous system number value to set. |
| 106 | */ |
| 107 | public void setRemoteBgpASNum(short bgpASNum) { |
| 108 | log.debug("Remote BGP AS number {}", bgpASNum); |
| 109 | this.remoteBgpASNum = bgpASNum; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Gets the BGP peer hold time. |
| 114 | * |
| 115 | * @return bgp hold time. |
| 116 | */ |
| 117 | public short getRemoteBgpHoldTime() { |
| 118 | return remoteBgpholdTime; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Sets the hold time for this bgp peer. |
| 123 | * |
| 124 | * @param holdTime the hold timer value to set. |
| 125 | */ |
| 126 | public void setRemoteBgpHoldTime(short holdTime) { |
| 127 | log.debug("Remote BGP HoldTime {}", holdTime); |
| 128 | this.remoteBgpholdTime = holdTime; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Gets the BGP version for this bgp peer. |
| 133 | * |
| 134 | * @return bgp identifier. |
| 135 | */ |
| 136 | public int getRemoteBgpIdentifier() { |
| 137 | return remoteBgpIdentifier; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Sets the peer identifier value. |
| 142 | * |
| 143 | * @param bgpIdentifier the bgp peer identifier value. |
| 144 | */ |
| 145 | public void setRemoteBgpIdentifier(int bgpIdentifier) { |
| 146 | log.debug("Remote BGP Identifier {}", bgpIdentifier); |
| 147 | this.remoteBgpIdentifier = bgpIdentifier; |
| 148 | } |
| 149 | } |