mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 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 | package org.onosproject.bgp.cli; |
| 17 | |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 18 | import org.apache.karaf.shell.api.action.Argument; |
| 19 | import org.apache.karaf.shell.api.action.Command; |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 20 | import org.apache.karaf.shell.api.action.lifecycle.Service; |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 21 | import org.onosproject.bgp.controller.BgpController; |
| 22 | import org.onosproject.bgp.controller.BgpLocalRib; |
| 23 | import org.onosproject.bgpio.protocol.BgpLSNlri; |
| 24 | |
| 25 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier; |
| 26 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; |
| 27 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; |
| 28 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib; |
| 29 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier; |
| 30 | import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; |
| 31 | import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors; |
| 32 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; |
| 33 | import org.onosproject.bgpio.types.IPv4AddressTlv; |
| 34 | import org.onosproject.bgpio.types.RouteDistinguisher; |
| 35 | import org.onosproject.bgpio.types.BgpValueType; |
| 36 | import org.onosproject.bgpio.types.LinkStateAttributes; |
| 37 | import org.onosproject.bgpio.types.MpReachNlri; |
| 38 | import org.onosproject.bgpio.types.AutonomousSystemTlv; |
| 39 | import org.onosproject.bgpio.types.IsIsNonPseudonode; |
| 40 | import org.onosproject.bgpio.types.LocalPref; |
| 41 | import org.onosproject.bgpio.types.Origin; |
| 42 | import org.onosproject.bgpio.types.attr.BgpAttrRouterIdV4; |
| 43 | import org.onosproject.bgpio.types.attr.BgpLinkAttrMaxLinkBandwidth; |
| 44 | import org.onosproject.bgpio.types.attr.BgpLinkAttrUnRsrvdLinkBandwidth; |
| 45 | import org.onosproject.bgpio.types.attr.BgpLinkAttrTeDefaultMetric; |
| 46 | import org.onosproject.bgpio.types.attr.BgpLinkAttrIgpMetric; |
| 47 | import org.onosproject.cli.AbstractShellCommand; |
| 48 | import org.slf4j.Logger; |
| 49 | import org.slf4j.LoggerFactory; |
| 50 | |
| 51 | import java.util.Map; |
| 52 | import java.util.Set; |
| 53 | import java.util.List; |
| 54 | import java.util.Iterator; |
| 55 | import java.util.Arrays; |
| 56 | |
| 57 | |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 58 | @Service |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 59 | @Command(scope = "onos", name = "bgp-rib", description = "lists RIB configuration") |
| 60 | public class BgpLocalRibDisplay extends AbstractShellCommand { |
| 61 | private static final Logger log = LoggerFactory.getLogger(BgpLocalRibDisplay.class); |
| 62 | private static final String NODETREE = "nodes"; |
| 63 | private static final String LINKTREE = "links"; |
| 64 | private static final String PREFIXTREE = "prefix"; |
| 65 | private static final String VPNNODETREE = "vpnnodes"; |
| 66 | private static final String VPNLINKTREE = "vpnlinkS"; |
| 67 | private static final String VPNPREFIXTREE = "vpnprefix"; |
| 68 | protected Origin origin; |
| 69 | protected LocalPref localPref; |
| 70 | protected BgpAttrRouterIdV4 bgpAttrRouterIdV4; |
| 71 | protected IsIsNonPseudonode isIsNonPseudonode; |
| 72 | protected AutonomousSystemTlv autonomousSystemTlv; |
| 73 | protected IPv4AddressTlv iPv4AddressTlv; |
| 74 | protected BgpLinkAttrMaxLinkBandwidth bgpLinkAttrMaxLinkBandwidth; |
| 75 | protected BgpLinkAttrUnRsrvdLinkBandwidth bgpLinkAttrUnRsrvdLinkBandwidth; |
| 76 | protected BgpLinkAttrTeDefaultMetric bgpLinkAttrTeDefaultMetric; |
| 77 | protected BgpLinkAttrIgpMetric bgpLinkAttrIgpMetric; |
| 78 | protected PathAttrNlriDetailsLocalRib pathAttrNlriDetailsLocalRib; |
| 79 | protected MpReachNlri mpReachNlri; |
| 80 | protected PathAttrNlriDetails pathAttrNlriDetails; |
| 81 | protected BgpNodeLSNlriVer4.ProtocolType protocolType; |
| 82 | protected BgpController bgpController = get(BgpController.class); |
| 83 | protected BgpLocalRib bgpLocalRib = bgpController.bgpLocalRib(); |
| 84 | Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib> nodeTreeMap = bgpLocalRib.nodeTree(); |
| 85 | Set<BgpNodeLSIdentifier> nodekeySet = nodeTreeMap.keySet(); |
| 86 | Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib> linkTreeMap = bgpLocalRib.linkTree(); |
| 87 | Set<BgpLinkLSIdentifier> linkkeySet = linkTreeMap.keySet(); |
| 88 | @Argument(index = 0, name = "name", |
| 89 | description = "nodetree" + "\n" + "linktree" + "\n" + "prefixtree" + "\n" + "vpnnodetree" + "\n" + |
| 90 | "vpnlinktree" + "\n" + "vpnprefixtree", required = true, multiValued = false) |
| 91 | String name = null; |
| 92 | @Argument(index = 1, name = "numberofentries", |
| 93 | description = "numberofentries", required = false, multiValued = false) |
| 94 | int numberofentries; |
| 95 | @Argument(index = 2, name = "vpnId", |
| 96 | description = "vpnId", required = false, multiValued = false) |
| 97 | String vpnId = null; |
| 98 | private int count = 0; |
| 99 | |
| 100 | @Override |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 101 | protected void doExecute() { |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 102 | switch (name) { |
| 103 | case NODETREE: |
| 104 | displayNodes(); |
| 105 | break; |
| 106 | case LINKTREE: |
| 107 | displayLinks(); |
| 108 | break; |
| 109 | case PREFIXTREE: |
| 110 | displayPrefix(); |
| 111 | break; |
| 112 | case VPNNODETREE: |
| 113 | displayVpnNodes(); |
| 114 | break; |
| 115 | case VPNLINKTREE: |
| 116 | displayVpnLinks(); |
| 117 | break; |
| 118 | case VPNPREFIXTREE: |
| 119 | displayVpnPrefix(); |
| 120 | break; |
| 121 | default: |
| 122 | System.out.print("Unknown Command"); |
| 123 | break; |
| 124 | } |
| 125 | |
| 126 | } |
| 127 | |
| 128 | private void displayNodes() { |
| 129 | try { |
| 130 | int counter = 0; |
| 131 | print("Total number of entries = %s", nodeTreeMap.size()); |
| 132 | for (BgpNodeLSIdentifier nodes : nodekeySet) { |
| 133 | if (numberofentries > nodeTreeMap.size() || numberofentries < 0) { |
| 134 | System.out.print("Wrong Argument"); |
| 135 | break; |
| 136 | } else if (counter < numberofentries) { |
| 137 | pathAttrNlriDetailsLocalRib = nodeTreeMap.get(nodes); |
| 138 | displayNode(); |
| 139 | counter++; |
| 140 | } else if (counter == 0) { |
| 141 | pathAttrNlriDetailsLocalRib = nodeTreeMap.get(nodes); |
| 142 | displayNode(); |
| 143 | |
| 144 | |
| 145 | } |
| 146 | |
| 147 | } |
| 148 | } catch (Exception e) { |
| 149 | log.debug("Error occurred while displaying BGP nodes: {}", e.getMessage()); |
| 150 | } |
| 151 | |
| 152 | } |
| 153 | |
| 154 | |
| 155 | private void displayLinks() { |
| 156 | try { |
| 157 | int counter = 0; |
| 158 | print("Total Number of entries = %d", linkTreeMap.size()); |
| 159 | for (BgpLinkLSIdentifier links : linkkeySet) { |
| 160 | if (numberofentries > linkTreeMap.size() || numberofentries < 0) { |
| 161 | System.out.print("Wrong Argument"); |
| 162 | break; |
| 163 | } else if (counter < numberofentries) { |
| 164 | pathAttrNlriDetailsLocalRib = linkTreeMap.get(links); |
| 165 | print("Total number of entries = %d", linkTreeMap.size()); |
| 166 | displayLink(); |
| 167 | counter++; |
| 168 | } else if (counter == 0) { |
| 169 | pathAttrNlriDetailsLocalRib = linkTreeMap.get(links); |
| 170 | displayLink(); |
| 171 | } |
| 172 | |
| 173 | } |
| 174 | } catch (Exception e) { |
| 175 | log.debug("Error occurred while displaying BGP links: {}", e.getMessage()); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | private void displayPrefix() { |
| 180 | try { |
| 181 | this.bgpController = get(BgpController.class); |
| 182 | bgpLocalRib = bgpController.bgpLocalRib(); |
| 183 | Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixmap = bgpLocalRib.prefixTree(); |
| 184 | Set<BgpPrefixLSIdentifier> prefixkeySet = prefixmap.keySet(); |
| 185 | for (BgpPrefixLSIdentifier prefix : prefixkeySet) { |
| 186 | pathAttrNlriDetailsLocalRib = prefixmap.get(prefix); |
| 187 | pathAttrNlriDetails = pathAttrNlriDetailsLocalRib.localRibNlridetails(); |
| 188 | print("No of entries = %d", prefixmap.size()); |
| 189 | System.out.print(pathAttrNlriDetailsLocalRib.toString()); |
| 190 | |
| 191 | } |
| 192 | |
| 193 | |
| 194 | } catch (Exception e) { |
| 195 | log.debug("Error occurred while displaying BGP prefixes: {}", e.getMessage()); |
| 196 | |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | private void displayVpnNodes() { |
| 201 | try { |
| 202 | this.bgpController = get(BgpController.class); |
| 203 | bgpLocalRib = bgpController.bgpLocalRib(); |
| 204 | Map<RouteDistinguisher, Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnNode = |
| 205 | bgpLocalRib.vpnNodeTree(); |
| 206 | Set<RouteDistinguisher> vpnNodekeySet = vpnNode.keySet(); |
| 207 | for (RouteDistinguisher vpnNodes : vpnNodekeySet) { |
| 208 | boolean invalidProcess = true; |
Bharath Thiruveedula | 587a483 | 2017-01-13 20:12:02 +0530 | [diff] [blame] | 209 | if (vpnId != null && Integer.parseInt(vpnId.trim()) == vpnNodes.hashCode()) { |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 210 | invalidProcess = false; |
| 211 | displayNodes(); |
| 212 | } |
| 213 | if (invalidProcess) { |
| 214 | print("%s\n", "Id " + vpnId + "does not exist...!!!"); |
| 215 | } |
| 216 | } |
| 217 | } catch (Exception e) { |
| 218 | log.debug("Error occurred while displaying BGP nodes based on VPN : {}", e.getMessage()); |
| 219 | } |
| 220 | |
| 221 | } |
| 222 | |
| 223 | private void displayVpnLinks() { |
| 224 | try { |
| 225 | this.bgpController = get(BgpController.class); |
| 226 | bgpLocalRib = bgpController.bgpLocalRib(); |
| 227 | Map<RouteDistinguisher, Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnLink = |
| 228 | bgpLocalRib.vpnLinkTree(); |
| 229 | Set<RouteDistinguisher> vpnLinkkeySet = vpnLink.keySet(); |
| 230 | for (RouteDistinguisher vpnLinks : vpnLinkkeySet) { |
| 231 | boolean invalidProcess = true; |
Bharath Thiruveedula | 587a483 | 2017-01-13 20:12:02 +0530 | [diff] [blame] | 232 | if (vpnId != null && Integer.parseInt(vpnId.trim()) == vpnLinks.hashCode()) { |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 233 | invalidProcess = false; |
| 234 | displayLinks(); |
| 235 | } |
| 236 | if (invalidProcess) { |
| 237 | print("%s\n", "Id " + vpnId + "does not exist...!!!"); |
| 238 | } |
| 239 | } |
| 240 | } catch (Exception e) { |
| 241 | log.debug("Error occurred while displaying BGP links based on VPN : {}", e.getMessage()); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | private void displayVpnPrefix() { |
| 246 | try { |
| 247 | this.bgpController = get(BgpController.class); |
| 248 | bgpLocalRib = bgpController.bgpLocalRib(); |
| 249 | Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefix = |
| 250 | bgpLocalRib.vpnPrefixTree(); |
| 251 | Set<RouteDistinguisher> vpnPrefixkeySet = vpnPrefix.keySet(); |
| 252 | for (RouteDistinguisher vpnprefixId : vpnPrefixkeySet) { |
| 253 | boolean invalidProcess = true; |
Bharath Thiruveedula | 587a483 | 2017-01-13 20:12:02 +0530 | [diff] [blame] | 254 | if (vpnId != null && Integer.parseInt(vpnId.trim()) == vpnprefixId.hashCode()) { |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 255 | invalidProcess = false; |
| 256 | displayPrefix(); |
| 257 | } |
| 258 | if (invalidProcess) { |
| 259 | print("%s\n", "Id " + vpnId + "does not exist...!!!"); |
| 260 | } |
| 261 | } |
| 262 | } catch (Exception e) { |
| 263 | log.debug("Error occurred while displaying BGP prefixes based on VPN : {}", e.getMessage()); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | private void displayNode() { |
| 268 | |
| 269 | |
| 270 | pathAttrNlriDetails = pathAttrNlriDetailsLocalRib.localRibNlridetails(); |
| 271 | List<BgpValueType> bgpValueTypeList = pathAttrNlriDetails.pathAttributes(); |
| 272 | protocolType = pathAttrNlriDetails.protocolID(); |
| 273 | Iterator<BgpValueType> itrBgpValueType = bgpValueTypeList.iterator(); |
| 274 | while (itrBgpValueType.hasNext()) { |
| 275 | BgpValueType bgpValueType = itrBgpValueType.next(); |
| 276 | if (bgpValueType instanceof Origin) { |
| 277 | origin = (Origin) bgpValueType; |
| 278 | } else if (bgpValueType instanceof LocalPref) { |
| 279 | localPref = (LocalPref) bgpValueType; |
| 280 | } else if (bgpValueType instanceof LinkStateAttributes) { |
| 281 | LinkStateAttributes linkStateAttributes = (LinkStateAttributes) bgpValueType; |
| 282 | List linkStateAttribiuteList = linkStateAttributes.linkStateAttributes(); |
| 283 | Iterator<BgpValueType> linkStateAttribiteIterator = linkStateAttribiuteList.iterator(); |
| 284 | while (linkStateAttribiteIterator.hasNext()) { |
| 285 | BgpValueType bgpValueType1 = linkStateAttribiteIterator.next(); |
| 286 | if (bgpValueType1 instanceof BgpAttrRouterIdV4) { |
| 287 | bgpAttrRouterIdV4 = (BgpAttrRouterIdV4) bgpValueType1; |
| 288 | } |
| 289 | } |
| 290 | } else if (bgpValueType instanceof MpReachNlri) { |
| 291 | mpReachNlri = (MpReachNlri) bgpValueType; |
| 292 | List<BgpLSNlri> bgpLSNlris = mpReachNlri.mpReachNlri(); |
| 293 | Iterator<BgpLSNlri> bgpLsnlrisIterator = bgpLSNlris.iterator(); |
| 294 | while (bgpLsnlrisIterator.hasNext()) { |
| 295 | BgpLSNlri bgpLSNlri = bgpLsnlrisIterator.next(); |
| 296 | if (bgpLSNlri instanceof BgpNodeLSNlriVer4) { |
| 297 | BgpNodeLSNlriVer4 bgpNodeLSNlriVer4 = (BgpNodeLSNlriVer4) bgpLSNlri; |
| 298 | BgpNodeLSIdentifier bgpNodeLSIdentifier = bgpNodeLSNlriVer4.getLocalNodeDescriptors(); |
| 299 | NodeDescriptors nodeDescriptors = bgpNodeLSIdentifier.getNodedescriptors(); |
| 300 | List<BgpValueType> bgpvalueTypesList = nodeDescriptors.getSubTlvs(); |
| 301 | Iterator<BgpValueType> bgpValueTypeIterator = bgpvalueTypesList.iterator(); |
| 302 | while (bgpValueTypeIterator.hasNext()) { |
| 303 | BgpValueType valueType = bgpValueTypeIterator.next(); |
| 304 | if (valueType instanceof IsIsNonPseudonode) { |
| 305 | isIsNonPseudonode = (IsIsNonPseudonode) valueType; |
| 306 | |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | print("RibAsNumber = %s,PeerIdentifier = %s,RibIpAddress = %s,ProtocolType = %s,Origin = %s,LocalPref = %s," + |
| 314 | "RouterID = %s,IsoNodeID = %s,NextHop = %s", pathAttrNlriDetailsLocalRib.localRibAsNum(), |
| 315 | pathAttrNlriDetailsLocalRib.localRibIdentifier(), pathAttrNlriDetailsLocalRib.localRibIpAddress(), |
| 316 | protocolType.toString(), origin.origin(), localPref.localPref(), bgpAttrRouterIdV4.attrRouterId(), |
| 317 | Arrays.toString(isIsNonPseudonode.getIsoNodeId()), mpReachNlri.nexthop4()); |
| 318 | } |
| 319 | |
| 320 | private void displayLink() { |
| 321 | |
| 322 | pathAttrNlriDetails = pathAttrNlriDetailsLocalRib.localRibNlridetails(); |
| 323 | List<BgpValueType> valueTypes = pathAttrNlriDetails.pathAttributes(); |
| 324 | Iterator<BgpValueType> itrBgpValueType = valueTypes.iterator(); |
| 325 | while (itrBgpValueType.hasNext()) { |
| 326 | BgpValueType bgpValueType = itrBgpValueType.next(); |
| 327 | if (bgpValueType instanceof Origin) { |
| 328 | origin = (Origin) bgpValueType; |
| 329 | } else if (bgpValueType instanceof LocalPref) { |
| 330 | localPref = (LocalPref) bgpValueType; |
| 331 | } else if (bgpValueType instanceof LinkStateAttributes) { |
| 332 | LinkStateAttributes linkStateAttributes = (LinkStateAttributes) bgpValueType; |
| 333 | List linkStateAttributelist = linkStateAttributes.linkStateAttributes(); |
| 334 | Iterator<BgpValueType> linkStateAttributeIterator = linkStateAttributelist.iterator(); |
| 335 | while (linkStateAttributeIterator.hasNext()) { |
| 336 | BgpValueType bgpValueType1 = linkStateAttributeIterator.next(); |
| 337 | if (bgpValueType1 instanceof BgpAttrRouterIdV4) { |
| 338 | bgpAttrRouterIdV4 = (BgpAttrRouterIdV4) bgpValueType1; |
| 339 | } else if (bgpValueType1 instanceof BgpLinkAttrMaxLinkBandwidth) { |
| 340 | bgpLinkAttrMaxLinkBandwidth = (BgpLinkAttrMaxLinkBandwidth) bgpValueType1; |
| 341 | } else if (bgpValueType1 instanceof BgpLinkAttrUnRsrvdLinkBandwidth) { |
| 342 | bgpLinkAttrUnRsrvdLinkBandwidth = (BgpLinkAttrUnRsrvdLinkBandwidth) bgpValueType1; |
| 343 | } else if (bgpValueType1 instanceof BgpLinkAttrTeDefaultMetric) { |
| 344 | bgpLinkAttrTeDefaultMetric = (BgpLinkAttrTeDefaultMetric) bgpValueType1; |
| 345 | } else if (bgpValueType1 instanceof BgpLinkAttrIgpMetric) { |
| 346 | bgpLinkAttrIgpMetric = (BgpLinkAttrIgpMetric) bgpValueType1; |
| 347 | } |
| 348 | |
| 349 | } |
| 350 | } else if (bgpValueType instanceof MpReachNlri) { |
| 351 | mpReachNlri = (MpReachNlri) bgpValueType; |
| 352 | List<BgpLSNlri> bgpLSNlris = mpReachNlri.mpReachNlri(); |
| 353 | Iterator<BgpLSNlri> bgpLsnlrisIterator = bgpLSNlris.iterator(); |
| 354 | while (bgpLsnlrisIterator.hasNext()) { |
| 355 | BgpLSNlri bgpLSNlri = bgpLsnlrisIterator.next(); |
| 356 | if (bgpLSNlri instanceof BgpLinkLsNlriVer4) { |
| 357 | BgpLinkLsNlriVer4 bgpLinkLsNlriVer4 = (BgpLinkLsNlriVer4) bgpLSNlri; |
| 358 | BgpLinkLSIdentifier bgpLinkLSIdentifier = bgpLinkLsNlriVer4.getLinkIdentifier(); |
| 359 | NodeDescriptors localnodeDescriptors = bgpLinkLSIdentifier.localNodeDescriptors(); |
| 360 | NodeDescriptors remotenodeDescriptors = bgpLinkLSIdentifier.remoteNodeDescriptors(); |
| 361 | List<BgpValueType> linkDescriptors = bgpLinkLSIdentifier.linkDescriptors(); |
| 362 | List<BgpValueType> subTlvList = localnodeDescriptors.getSubTlvs(); |
| 363 | Iterator<BgpValueType> subTlvIterator = subTlvList.iterator(); |
| 364 | while (subTlvIterator.hasNext()) { |
| 365 | BgpValueType valueType = subTlvIterator.next(); |
| 366 | if (valueType instanceof IsIsNonPseudonode) { |
| 367 | isIsNonPseudonode = (IsIsNonPseudonode) valueType; |
| 368 | } else if (valueType instanceof AutonomousSystemTlv) { |
| 369 | autonomousSystemTlv = (AutonomousSystemTlv) valueType; |
| 370 | } |
| 371 | } |
| 372 | List<BgpValueType> remotevalueTypes = remotenodeDescriptors.getSubTlvs(); |
| 373 | Iterator<BgpValueType> remoteValueTypesIterator = remotevalueTypes.iterator(); |
| 374 | while (remoteValueTypesIterator.hasNext()) { |
| 375 | BgpValueType valueType = remoteValueTypesIterator.next(); |
| 376 | if (valueType instanceof IsIsNonPseudonode) { |
| 377 | isIsNonPseudonode = (IsIsNonPseudonode) valueType; |
| 378 | } else if (valueType instanceof AutonomousSystemTlv) { |
| 379 | autonomousSystemTlv = (AutonomousSystemTlv) valueType; |
| 380 | } |
| 381 | } |
| 382 | Iterator<BgpValueType> listIterator = linkDescriptors.iterator(); |
| 383 | while (listIterator.hasNext()) { |
| 384 | BgpValueType valueType = listIterator.next(); |
| 385 | if (valueType instanceof IPv4AddressTlv) { |
| 386 | iPv4AddressTlv = (IPv4AddressTlv) valueType; |
| 387 | } |
| 388 | |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | print("PeerIdentifier = %s,Origin = %s,LocalPref = %s,RouterID = %s,MaxBandwidth = %s," + |
| 395 | "UnreservedBandwidth = %s,DefaultMetric = %s,IGPMetric = %s,IsoNodeID = %s,ASNum = %s," + |
| 396 | "IPAddress = %s,NextHop = %s", pathAttrNlriDetailsLocalRib.localRibIdentifier(), |
| 397 | origin.origin(), localPref.localPref(), bgpAttrRouterIdV4.attrRouterId(), |
| 398 | bgpLinkAttrMaxLinkBandwidth.linkAttrMaxLinkBandwidth(), |
| 399 | bgpLinkAttrUnRsrvdLinkBandwidth.getLinkAttrUnRsrvdLinkBandwidth().toString(), |
| 400 | bgpLinkAttrTeDefaultMetric.attrLinkDefTeMetric(), bgpLinkAttrIgpMetric.attrLinkIgpMetric(), |
| 401 | Arrays.toString(isIsNonPseudonode.getIsoNodeId()), autonomousSystemTlv.getAsNum(), |
| 402 | iPv4AddressTlv.address(), mpReachNlri.nexthop4().toString(), |
| 403 | pathAttrNlriDetailsLocalRib.localRibIpAddress(), origin.origin(), localPref.localPref(), |
| 404 | bgpAttrRouterIdV4.attrRouterId()); |
| 405 | |
| 406 | } |
| 407 | } |