Committed by
Gerrit Code Review
[Goldeneye] [ONOS-4161] BGP L3 Topology
Change-Id: I81ae4e88f6ab75202b98ed03cbe1597d0f6ddd1e
Showing
12 changed files
with
282 additions
and
104 deletions
| ... | @@ -128,4 +128,25 @@ public interface BgpController { | ... | @@ -128,4 +128,25 @@ public interface BgpController { |
| 128 | * @return node listener | 128 | * @return node listener |
| 129 | */ | 129 | */ |
| 130 | Set<BgpNodeListener> listener(); | 130 | Set<BgpNodeListener> listener(); |
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * Register a listener for BGP message events. | ||
| 134 | + * | ||
| 135 | + * @param listener the listener to notify | ||
| 136 | + */ | ||
| 137 | + void addLinkListener(BgpLinkListener listener); | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * Unregister a listener. | ||
| 141 | + * | ||
| 142 | + * @param listener the listener to unregister | ||
| 143 | + */ | ||
| 144 | + void removeLinkListener(BgpLinkListener listener); | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * Return BGP link listener. | ||
| 148 | + * | ||
| 149 | + * @return link listener | ||
| 150 | + */ | ||
| 151 | + Set<BgpLinkListener> linkListener(); | ||
| 131 | } | 152 | } | ... | ... |
| ... | @@ -20,12 +20,9 @@ import java.net.URISyntaxException; | ... | @@ -20,12 +20,9 @@ import java.net.URISyntaxException; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | import java.util.ListIterator; | 21 | import java.util.ListIterator; |
| 22 | 22 | ||
| 23 | -import org.onosproject.bgpio.exceptions.BgpParseException; | ||
| 24 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; | 23 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; |
| 25 | -import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier; | ||
| 26 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; | 24 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; |
| 27 | import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors; | 25 | import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors; |
| 28 | -import org.onosproject.bgpio.types.AreaIDTlv; | ||
| 29 | import org.onosproject.bgpio.types.AutonomousSystemTlv; | 26 | import org.onosproject.bgpio.types.AutonomousSystemTlv; |
| 30 | import org.onosproject.bgpio.types.BgpLSIdentifierTlv; | 27 | import org.onosproject.bgpio.types.BgpLSIdentifierTlv; |
| 31 | import org.onosproject.bgpio.types.BgpValueType; | 28 | import org.onosproject.bgpio.types.BgpValueType; |
| ... | @@ -49,9 +46,9 @@ public final class BgpDpid { | ... | @@ -49,9 +46,9 @@ public final class BgpDpid { |
| 49 | public static final int NODE_DESCRIPTOR_REMOTE = 2; | 46 | public static final int NODE_DESCRIPTOR_REMOTE = 2; |
| 50 | 47 | ||
| 51 | /** | 48 | /** |
| 52 | - * Initialize bgp id to generate URI. | 49 | + * Initialize BGP id to generate URI. |
| 53 | * | 50 | * |
| 54 | - * @param linkNlri node Nlri. | 51 | + * @param linkNlri node NLRI. |
| 55 | * @param nodeDescriptorType node descriptor type, local/remote | 52 | * @param nodeDescriptorType node descriptor type, local/remote |
| 56 | */ | 53 | */ |
| 57 | public BgpDpid(final BgpLinkLsNlriVer4 linkNlri, int nodeDescriptorType) { | 54 | public BgpDpid(final BgpLinkLsNlriVer4 linkNlri, int nodeDescriptorType) { |
| ... | @@ -61,26 +58,13 @@ public final class BgpDpid { | ... | @@ -61,26 +58,13 @@ public final class BgpDpid { |
| 61 | this.stringBuilder.append("RD=").append(linkNlri.getRouteDistinguisher() | 58 | this.stringBuilder.append("RD=").append(linkNlri.getRouteDistinguisher() |
| 62 | .getRouteDistinguisher()).append(":"); | 59 | .getRouteDistinguisher()).append(":"); |
| 63 | } | 60 | } |
| 61 | + this.stringBuilder.append(":ROUTINGUNIVERSE=").append(((BgpLinkLsNlriVer4) linkNlri).getIdentifier()); | ||
| 64 | 62 | ||
| 65 | - try { | 63 | + if (nodeDescriptorType == NODE_DESCRIPTOR_LOCAL) { |
| 66 | - if ((linkNlri.getProtocolId() == BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_ONE) | 64 | + add(linkNlri.localNodeDescriptors()); |
| 67 | - || (linkNlri.getProtocolId() == BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO)) { | 65 | + } else if (nodeDescriptorType == NODE_DESCRIPTOR_REMOTE) { |
| 68 | - this.stringBuilder.append("PROTO=").append("ISIS").append(":ID=") | 66 | + add(linkNlri.remoteNodeDescriptors()); |
| 69 | - .append(linkNlri.getIdentifier()); | ||
| 70 | - } else { | ||
| 71 | - this.stringBuilder.append("PROTO=").append(linkNlri.getProtocolId()).append(":ID=") | ||
| 72 | - .append(linkNlri.getIdentifier()); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - if (nodeDescriptorType == NODE_DESCRIPTOR_LOCAL) { | ||
| 76 | - add(linkNlri.localNodeDescriptors()); | ||
| 77 | - } else if (nodeDescriptorType == NODE_DESCRIPTOR_REMOTE) { | ||
| 78 | - add(linkNlri.remoteNodeDescriptors()); | ||
| 79 | - } | ||
| 80 | - } catch (BgpParseException e) { | ||
| 81 | - log.info("Exception BgpId string: " + e.toString()); | ||
| 82 | } | 67 | } |
| 83 | - | ||
| 84 | } | 68 | } |
| 85 | 69 | ||
| 86 | /* | 70 | /* |
| ... | @@ -96,72 +80,52 @@ public final class BgpDpid { | ... | @@ -96,72 +80,52 @@ public final class BgpDpid { |
| 96 | } | 80 | } |
| 97 | 81 | ||
| 98 | /** | 82 | /** |
| 99 | - * Initialize bgp id to generate URI. | 83 | + * Initialize BGP id to generate URI. |
| 100 | * | 84 | * |
| 101 | - * @param nodeNlri node Nlri. | 85 | + * @param nlri node NLRI. |
| 102 | */ | 86 | */ |
| 103 | - public BgpDpid(final BgpNodeLSNlriVer4 nodeNlri) { | 87 | + public BgpDpid(final BgpNodeLSNlriVer4 nlri) { |
| 104 | this.stringBuilder = new StringBuilder(""); | 88 | this.stringBuilder = new StringBuilder(""); |
| 105 | - | 89 | + if (((BgpNodeLSNlriVer4) nlri).getRouteDistinguisher() != null) { |
| 106 | - if (nodeNlri.getRouteDistinguisher() != null) { | 90 | + this.stringBuilder.append("RD=") |
| 107 | - this.stringBuilder.append("RD=").append(nodeNlri.getRouteDistinguisher() | 91 | + .append(((BgpNodeLSNlriVer4) nlri).getRouteDistinguisher().getRouteDistinguisher()).append(":"); |
| 108 | - .getRouteDistinguisher()).append(":"); | ||
| 109 | } | 92 | } |
| 110 | 93 | ||
| 111 | - try { | 94 | + this.stringBuilder.append(":ROUTINGUNIVERSE=").append(((BgpNodeLSNlriVer4) nlri).getIdentifier()); |
| 112 | - if ((nodeNlri.getProtocolId() == BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_ONE) | 95 | + add(((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors().getNodedescriptors()); |
| 113 | - || (nodeNlri.getProtocolId() == BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO)) { | 96 | + log.info("BgpDpid :: add"); |
| 114 | - | ||
| 115 | - this.stringBuilder.append("PROTO=").append("ISIS").append(":ID=") | ||
| 116 | - .append(nodeNlri.getIdentifier()); | ||
| 117 | - } else { | ||
| 118 | - this.stringBuilder.append("PROTO=").append(nodeNlri.getProtocolId()).append(":ID=") | ||
| 119 | - .append(nodeNlri.getIdentifier()); | ||
| 120 | - } | ||
| 121 | - add(nodeNlri.getLocalNodeDescriptors()); | ||
| 122 | - | ||
| 123 | - } catch (BgpParseException e) { | ||
| 124 | - log.info("Exception node string: " + e.toString()); | ||
| 125 | - } | ||
| 126 | } | 97 | } |
| 127 | 98 | ||
| 128 | - BgpDpid add(final Object value) { | 99 | + /** |
| 129 | - NodeDescriptors nodeDescriptors = null; | 100 | + * Obtains instance of this class by appending stringBuilder with node descriptor value. |
| 130 | - if (value instanceof BgpNodeLSIdentifier) { | 101 | + * |
| 131 | - BgpNodeLSIdentifier nodeLsIdentifier = (BgpNodeLSIdentifier) value; | 102 | + * @param value node descriptor |
| 132 | - nodeDescriptors = nodeLsIdentifier.getNodedescriptors(); | 103 | + * @return instance of this class |
| 133 | - } else if (value instanceof NodeDescriptors) { | 104 | + */ |
| 134 | - nodeDescriptors = (NodeDescriptors) value; | 105 | + public BgpDpid add(final NodeDescriptors value) { |
| 135 | - } | 106 | + log.info("BgpDpid :: add function"); |
| 136 | - | 107 | + if (value != null) { |
| 137 | - if (nodeDescriptors != null) { | 108 | + List<BgpValueType> subTlvs = value.getSubTlvs(); |
| 138 | - List<BgpValueType> subTlvs = nodeDescriptors.getSubTlvs(); | ||
| 139 | ListIterator<BgpValueType> listIterator = subTlvs.listIterator(); | 109 | ListIterator<BgpValueType> listIterator = subTlvs.listIterator(); |
| 140 | while (listIterator.hasNext()) { | 110 | while (listIterator.hasNext()) { |
| 141 | BgpValueType tlv = listIterator.next(); | 111 | BgpValueType tlv = listIterator.next(); |
| 142 | if (tlv.getType() == AutonomousSystemTlv.TYPE) { | 112 | if (tlv.getType() == AutonomousSystemTlv.TYPE) { |
| 143 | - AutonomousSystemTlv autonomousSystem = (AutonomousSystemTlv) tlv; | 113 | + this.stringBuilder.append(":ASN=").append(((AutonomousSystemTlv) tlv).getAsNum()); |
| 144 | - this.stringBuilder.append(":AS=").append(autonomousSystem.getAsNum()); | ||
| 145 | } else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) { | 114 | } else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) { |
| 146 | - BgpLSIdentifierTlv lsIdentifierTlv = (BgpLSIdentifierTlv) tlv; | 115 | + this.stringBuilder.append(":DOMAINID=").append(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier()); |
| 147 | - this.stringBuilder.append(":LSID=").append(lsIdentifierTlv.getBgpLsIdentifier()); | ||
| 148 | - } else if (tlv.getType() == AreaIDTlv.TYPE) { | ||
| 149 | - AreaIDTlv areaIdTlv = (AreaIDTlv) tlv; | ||
| 150 | - this.stringBuilder.append(":AREA=").append(areaIdTlv.getAreaID()); | ||
| 151 | } else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) { | 116 | } else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) { |
| 152 | if (tlv instanceof IsIsNonPseudonode) { | 117 | if (tlv instanceof IsIsNonPseudonode) { |
| 153 | - IsIsNonPseudonode isisNonPseudonode = (IsIsNonPseudonode) tlv; | 118 | + this.stringBuilder.append(":ISOID=").append( |
| 154 | - this.stringBuilder.append(":ISOID=").append(isoNodeIdString(isisNonPseudonode.getIsoNodeId())); | 119 | + isoNodeIdString(((IsIsNonPseudonode) tlv).getIsoNodeId())); |
| 155 | } else if (tlv instanceof IsIsPseudonode) { | 120 | } else if (tlv instanceof IsIsPseudonode) { |
| 156 | - IsIsPseudonode isisPseudonode = (IsIsPseudonode) tlv; | 121 | + IsIsPseudonode isisPseudonode = ((IsIsPseudonode) tlv); |
| 157 | - this.stringBuilder.append(":ISOID=").append(isoNodeIdString(isisPseudonode.getIsoNodeId())); | 122 | + this.stringBuilder.append(":ISOID=").append( |
| 123 | + isoNodeIdString(((IsIsPseudonode) tlv).getIsoNodeId())); | ||
| 158 | this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier()); | 124 | this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier()); |
| 159 | } else if (tlv instanceof OspfNonPseudonode) { | 125 | } else if (tlv instanceof OspfNonPseudonode) { |
| 160 | - OspfNonPseudonode ospfNonPseudonode = (OspfNonPseudonode) tlv; | 126 | + this.stringBuilder.append(":RID=").append(((OspfNonPseudonode) tlv).getrouterID()); |
| 161 | - this.stringBuilder.append(":RID=").append(ospfNonPseudonode.getrouterID()); | ||
| 162 | } else if (tlv instanceof OspfPseudonode) { | 127 | } else if (tlv instanceof OspfPseudonode) { |
| 163 | - OspfPseudonode ospfPseudonode = (OspfPseudonode) tlv; | 128 | + this.stringBuilder.append(":RID=").append(((OspfPseudonode) tlv).getrouterID()); |
| 164 | - this.stringBuilder.append(":RID=").append(ospfPseudonode.getrouterID()); | ||
| 165 | } | 129 | } |
| 166 | } | 130 | } |
| 167 | } | 131 | } | ... | ... |
| ... | @@ -12,24 +12,29 @@ | ... | @@ -12,24 +12,29 @@ |
| 12 | */ | 12 | */ |
| 13 | package org.onosproject.bgp.controller; | 13 | package org.onosproject.bgp.controller; |
| 14 | 14 | ||
| 15 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
| 15 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; | 16 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; |
| 17 | +import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; | ||
| 16 | 18 | ||
| 17 | /** | 19 | /** |
| 18 | - * Allows for providers interested in Link events to be notified. | 20 | + * Allows for providers interested in link events to be notified. |
| 19 | */ | 21 | */ |
| 20 | public interface BgpLinkListener { | 22 | public interface BgpLinkListener { |
| 21 | 23 | ||
| 22 | /** | 24 | /** |
| 23 | - * Notify that got a packet of link from network and need do processing. | 25 | + * Notify that got a packet of link from network and adds link. |
| 24 | * | 26 | * |
| 25 | - * @param linkNlri bgp link | 27 | + * @param linkNlri BGP link NLRI |
| 28 | + * @param details path attributes and NLRI information | ||
| 29 | + * @throws BgpParseException BGP parse exception | ||
| 26 | */ | 30 | */ |
| 27 | - void addLink(BgpLinkLsNlriVer4 linkNlri); | 31 | + void addLink(BgpLinkLsNlriVer4 linkNlri, PathAttrNlriDetails details) throws BgpParseException; |
| 28 | 32 | ||
| 29 | /** | 33 | /** |
| 30 | - * Notify that got a packet of link from network and need do processing. | 34 | + * Notify that got a packet of link from network and remove link. |
| 31 | * | 35 | * |
| 32 | - * @param linkNlri bgp link | 36 | + * @param linkNlri BGP link NLRI |
| 37 | + * @throws BgpParseException BGP parse exception | ||
| 33 | */ | 38 | */ |
| 34 | - void deleteLink(BgpLinkLsNlriVer4 linkNlri); | 39 | + void deleteLink(BgpLinkLsNlriVer4 linkNlri) throws BgpParseException; |
| 35 | } | 40 | } | ... | ... |
| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | ||
| 14 | package org.onosproject.bgp.controller; | 14 | package org.onosproject.bgp.controller; |
| 15 | 15 | ||
| 16 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
| 16 | import org.onosproject.bgpio.protocol.BgpLSNlri; | 17 | import org.onosproject.bgpio.protocol.BgpLSNlri; |
| 17 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; | 18 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; |
| 18 | import org.onosproject.bgpio.types.RouteDistinguisher; | 19 | import org.onosproject.bgpio.types.RouteDistinguisher; |
| ... | @@ -27,16 +28,18 @@ public interface BgpLocalRib { | ... | @@ -27,16 +28,18 @@ public interface BgpLocalRib { |
| 27 | * | 28 | * |
| 28 | * @param sessionInfo session info | 29 | * @param sessionInfo session info |
| 29 | * @param nlri network layer reach info | 30 | * @param nlri network layer reach info |
| 30 | - * @param details nlri details | 31 | + * @param details path attributes and NLRI information |
| 32 | + * @throws BgpParseException while adding NLRI to local rib | ||
| 31 | */ | 33 | */ |
| 32 | - void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details); | 34 | + void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) throws BgpParseException; |
| 33 | 35 | ||
| 34 | /** | 36 | /** |
| 35 | * Removes NLRI identifier if it exists. | 37 | * Removes NLRI identifier if it exists. |
| 36 | * | 38 | * |
| 37 | * @param nlri info | 39 | * @param nlri info |
| 40 | + * @throws BgpParseException while deleting NLRI from local rib | ||
| 38 | */ | 41 | */ |
| 39 | - void delete(BgpLSNlri nlri); | 42 | + void delete(BgpLSNlri nlri) throws BgpParseException; |
| 40 | 43 | ||
| 41 | /** | 44 | /** |
| 42 | * Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI infomation mapped | 45 | * Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI infomation mapped |
| ... | @@ -46,15 +49,17 @@ public interface BgpLocalRib { | ... | @@ -46,15 +49,17 @@ public interface BgpLocalRib { |
| 46 | * @param nlri info | 49 | * @param nlri info |
| 47 | * @param details has pathattribute, protocol id and identifier | 50 | * @param details has pathattribute, protocol id and identifier |
| 48 | * @param routeDistinguisher unique for each VPN | 51 | * @param routeDistinguisher unique for each VPN |
| 52 | + * @throws BgpParseException while adding NLRI updation | ||
| 49 | */ | 53 | */ |
| 50 | void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, | 54 | void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, |
| 51 | - RouteDistinguisher routeDistinguisher); | 55 | + RouteDistinguisher routeDistinguisher) throws BgpParseException; |
| 52 | 56 | ||
| 53 | /** | 57 | /** |
| 54 | * Removes VPN NLRI identifier mapped to route distinguisher if it exists. | 58 | * Removes VPN NLRI identifier mapped to route distinguisher if it exists. |
| 55 | * | 59 | * |
| 56 | * @param nlri info | 60 | * @param nlri info |
| 57 | * @param routeDistinguisher unique for each VPN | 61 | * @param routeDistinguisher unique for each VPN |
| 62 | + * @throws BgpParseException while deleting NLRI from local rib | ||
| 58 | */ | 63 | */ |
| 59 | - void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher); | 64 | + void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException; |
| 60 | } | 65 | } | ... | ... |
| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | package org.onosproject.bgp.controller; | 13 | package org.onosproject.bgp.controller; |
| 14 | 14 | ||
| 15 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; | 15 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; |
| 16 | +import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; | ||
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| 18 | * Allows for providers interested in node events to be notified. | 19 | * Allows for providers interested in node events to be notified. |
| ... | @@ -22,14 +23,15 @@ public interface BgpNodeListener { | ... | @@ -22,14 +23,15 @@ public interface BgpNodeListener { |
| 22 | /** | 23 | /** |
| 23 | * Notifies that the node was added. | 24 | * Notifies that the node was added. |
| 24 | * | 25 | * |
| 25 | - * @param nodeNlri node rechability info | 26 | + * @param nodeNlri node reachability info |
| 27 | + * @param details attributes and nlri details | ||
| 26 | */ | 28 | */ |
| 27 | - void addNode(BgpNodeLSNlriVer4 nodeNlri); | 29 | + void addNode(BgpNodeLSNlriVer4 nodeNlri, PathAttrNlriDetails details); |
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | * Notifies that the node was removed. | 32 | * Notifies that the node was removed. |
| 31 | * | 33 | * |
| 32 | - * @param nodeNlri node rechability info | 34 | + * @param nodeNlri node reachability info |
| 33 | */ | 35 | */ |
| 34 | void deleteNode(BgpNodeLSNlriVer4 nodeNlri); | 36 | void deleteNode(BgpNodeLSNlriVer4 nodeNlri); |
| 35 | } | 37 | } | ... | ... |
| ... | @@ -260,6 +260,14 @@ public class NodeDescriptors { | ... | @@ -260,6 +260,14 @@ public class NodeDescriptors { |
| 260 | log.debug("NodeDescriptor compare subtlv's"); | 260 | log.debug("NodeDescriptor compare subtlv's"); |
| 261 | for (BgpValueType tlv : ((NodeDescriptors) o).subTlvs) { | 261 | for (BgpValueType tlv : ((NodeDescriptors) o).subTlvs) { |
| 262 | if (tlv.getType() == tlv1.getType()) { | 262 | if (tlv.getType() == tlv1.getType()) { |
| 263 | + if (tlv.getType() == IGP_ROUTERID_TYPE) { | ||
| 264 | + if ((tlv1 instanceof IsIsNonPseudonode && tlv instanceof IsIsPseudonode) | ||
| 265 | + || (tlv1 instanceof IsIsPseudonode && tlv instanceof IsIsNonPseudonode) | ||
| 266 | + || (tlv1 instanceof OspfNonPseudonode && tlv instanceof OspfPseudonode) | ||
| 267 | + || (tlv1 instanceof OspfPseudonode && tlv instanceof OspfNonPseudonode)) { | ||
| 268 | + continue; | ||
| 269 | + } | ||
| 270 | + } | ||
| 263 | int result = subTlvs.get(subTlvs.indexOf(tlv1)).compareTo( | 271 | int result = subTlvs.get(subTlvs.indexOf(tlv1)).compareTo( |
| 264 | ((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv))); | 272 | ((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv))); |
| 265 | if (result != 0) { | 273 | if (result != 0) { | ... | ... |
protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpControllerImpl.java
100755 → 100644
| ... | @@ -23,6 +23,7 @@ import org.apache.felix.scr.annotations.Service; | ... | @@ -23,6 +23,7 @@ import org.apache.felix.scr.annotations.Service; |
| 23 | import org.onosproject.bgp.controller.BgpCfg; | 23 | import org.onosproject.bgp.controller.BgpCfg; |
| 24 | import org.onosproject.bgp.controller.BgpController; | 24 | import org.onosproject.bgp.controller.BgpController; |
| 25 | import org.onosproject.bgp.controller.BgpId; | 25 | import org.onosproject.bgp.controller.BgpId; |
| 26 | +import org.onosproject.bgp.controller.BgpLinkListener; | ||
| 26 | import org.onosproject.bgp.controller.BgpLocalRib; | 27 | import org.onosproject.bgp.controller.BgpLocalRib; |
| 27 | import org.onosproject.bgp.controller.BgpNodeListener; | 28 | import org.onosproject.bgp.controller.BgpNodeListener; |
| 28 | import org.onosproject.bgp.controller.BgpPeer; | 29 | import org.onosproject.bgp.controller.BgpPeer; |
| ... | @@ -58,6 +59,7 @@ public class BgpControllerImpl implements BgpController { | ... | @@ -58,6 +59,7 @@ public class BgpControllerImpl implements BgpController { |
| 58 | private BgpLocalRib bgplocalRibVpn = new BgpLocalRibImpl(this); | 59 | private BgpLocalRib bgplocalRibVpn = new BgpLocalRibImpl(this); |
| 59 | 60 | ||
| 60 | protected Set<BgpNodeListener> bgpNodeListener = new CopyOnWriteArraySet<>(); | 61 | protected Set<BgpNodeListener> bgpNodeListener = new CopyOnWriteArraySet<>(); |
| 62 | + protected Set<BgpLinkListener> bgpLinkListener = new CopyOnWriteArraySet<>(); | ||
| 61 | 63 | ||
| 62 | final Controller ctrl = new Controller(this); | 64 | final Controller ctrl = new Controller(this); |
| 63 | 65 | ||
| ... | @@ -278,4 +280,19 @@ public class BgpControllerImpl implements BgpController { | ... | @@ -278,4 +280,19 @@ public class BgpControllerImpl implements BgpController { |
| 278 | public BgpLocalRib bgpLocalRibVpn() { | 280 | public BgpLocalRib bgpLocalRibVpn() { |
| 279 | return bgplocalRibVpn; | 281 | return bgplocalRibVpn; |
| 280 | } | 282 | } |
| 283 | + | ||
| 284 | + @Override | ||
| 285 | + public void addLinkListener(BgpLinkListener listener) { | ||
| 286 | + this.bgpLinkListener.add(listener); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + @Override | ||
| 290 | + public void removeLinkListener(BgpLinkListener listener) { | ||
| 291 | + this.bgpLinkListener.remove(listener); | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + @Override | ||
| 295 | + public Set<BgpLinkListener> linkListener() { | ||
| 296 | + return bgpLinkListener; | ||
| 297 | + } | ||
| 281 | } | 298 | } | ... | ... |
| ... | @@ -14,11 +14,14 @@ | ... | @@ -14,11 +14,14 @@ |
| 14 | package org.onosproject.bgp.controller.impl; | 14 | package org.onosproject.bgp.controller.impl; |
| 15 | 15 | ||
| 16 | import com.google.common.base.MoreObjects; | 16 | import com.google.common.base.MoreObjects; |
| 17 | + | ||
| 17 | import org.onosproject.bgp.controller.BgpController; | 18 | import org.onosproject.bgp.controller.BgpController; |
| 18 | import org.onosproject.bgp.controller.BgpId; | 19 | import org.onosproject.bgp.controller.BgpId; |
| 20 | +import org.onosproject.bgp.controller.BgpLinkListener; | ||
| 19 | import org.onosproject.bgp.controller.BgpLocalRib; | 21 | import org.onosproject.bgp.controller.BgpLocalRib; |
| 20 | import org.onosproject.bgp.controller.BgpNodeListener; | 22 | import org.onosproject.bgp.controller.BgpNodeListener; |
| 21 | import org.onosproject.bgp.controller.BgpSessionInfo; | 23 | import org.onosproject.bgp.controller.BgpSessionInfo; |
| 24 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
| 22 | import org.onosproject.bgpio.protocol.BgpLSNlri; | 25 | import org.onosproject.bgpio.protocol.BgpLSNlri; |
| 23 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier; | 26 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier; |
| 24 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; | 27 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; |
| ... | @@ -116,7 +119,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -116,7 +119,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 116 | } | 119 | } |
| 117 | 120 | ||
| 118 | @Override | 121 | @Override |
| 119 | - public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) { | 122 | + public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) throws BgpParseException { |
| 120 | int decisionResult; | 123 | int decisionResult; |
| 121 | 124 | ||
| 122 | log.debug("Add to local RIB {}", details.toString()); | 125 | log.debug("Add to local RIB {}", details.toString()); |
| ... | @@ -133,13 +136,16 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -133,13 +136,16 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 133 | // Compare local RIB entry with the current attribute | 136 | // Compare local RIB entry with the current attribute |
| 134 | decisionResult = selectionAlgo.compare(nodeTree.get(nodeLsIdentifier), detailsLocRib); | 137 | decisionResult = selectionAlgo.compare(nodeTree.get(nodeLsIdentifier), detailsLocRib); |
| 135 | if (decisionResult < 0) { | 138 | if (decisionResult < 0) { |
| 139 | + for (BgpNodeListener l : bgpController.listener()) { | ||
| 140 | + l.addNode((BgpNodeLSNlriVer4) nlri, details); | ||
| 141 | + } | ||
| 136 | nodeTree.replace(nodeLsIdentifier, detailsLocRib); | 142 | nodeTree.replace(nodeLsIdentifier, detailsLocRib); |
| 137 | log.debug("Local RIB update node: {}", detailsLocRib.toString()); | 143 | log.debug("Local RIB update node: {}", detailsLocRib.toString()); |
| 138 | } | 144 | } |
| 139 | } else { | 145 | } else { |
| 140 | nodeTree.put(nodeLsIdentifier, detailsLocRib); | 146 | nodeTree.put(nodeLsIdentifier, detailsLocRib); |
| 141 | for (BgpNodeListener l : bgpController.listener()) { | 147 | for (BgpNodeListener l : bgpController.listener()) { |
| 142 | - l.addNode((BgpNodeLSNlriVer4) nlri); | 148 | + l.addNode((BgpNodeLSNlriVer4) nlri, details); |
| 143 | } | 149 | } |
| 144 | log.debug("Local RIB ad node: {}", detailsLocRib.toString()); | 150 | log.debug("Local RIB ad node: {}", detailsLocRib.toString()); |
| 145 | } | 151 | } |
| ... | @@ -151,10 +157,16 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -151,10 +157,16 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 151 | decisionResult = selectionAlgo.compare(linkTree.get(linkLsIdentifier), detailsLocRib); | 157 | decisionResult = selectionAlgo.compare(linkTree.get(linkLsIdentifier), detailsLocRib); |
| 152 | if (decisionResult < 0) { | 158 | if (decisionResult < 0) { |
| 153 | linkTree.replace(linkLsIdentifier, detailsLocRib); | 159 | linkTree.replace(linkLsIdentifier, detailsLocRib); |
| 160 | + for (BgpLinkListener l : bgpController.linkListener()) { | ||
| 161 | + l.addLink((BgpLinkLsNlriVer4) nlri, details); | ||
| 162 | + } | ||
| 154 | log.debug("Local RIB update link: {}", detailsLocRib.toString()); | 163 | log.debug("Local RIB update link: {}", detailsLocRib.toString()); |
| 155 | } | 164 | } |
| 156 | } else { | 165 | } else { |
| 157 | linkTree.put(linkLsIdentifier, detailsLocRib); | 166 | linkTree.put(linkLsIdentifier, detailsLocRib); |
| 167 | + for (BgpLinkListener l : bgpController.linkListener()) { | ||
| 168 | + l.addLink((BgpLinkLsNlriVer4) nlri, details); | ||
| 169 | + } | ||
| 158 | log.debug("Local RIB add link: {}", detailsLocRib.toString()); | 170 | log.debug("Local RIB add link: {}", detailsLocRib.toString()); |
| 159 | } | 171 | } |
| 160 | } else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) { | 172 | } else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) { |
| ... | @@ -175,7 +187,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -175,7 +187,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 175 | } | 187 | } |
| 176 | 188 | ||
| 177 | @Override | 189 | @Override |
| 178 | - public void delete(BgpLSNlri nlri) { | 190 | + public void delete(BgpLSNlri nlri) throws BgpParseException { |
| 179 | log.debug("Delete from local RIB."); | 191 | log.debug("Delete from local RIB."); |
| 180 | 192 | ||
| 181 | // Update local RIB | 193 | // Update local RIB |
| ... | @@ -186,8 +198,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -186,8 +198,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 186 | * Update local RIB based on selection algorithm. | 198 | * Update local RIB based on selection algorithm. |
| 187 | * | 199 | * |
| 188 | * @param nlri NLRI to update | 200 | * @param nlri NLRI to update |
| 201 | + * @throws BgpParseException while updating to local RIB | ||
| 189 | */ | 202 | */ |
| 190 | - public void decisionProcess(BgpLSNlri nlri) { | 203 | + public void decisionProcess(BgpLSNlri nlri) throws BgpParseException { |
| 191 | checkNotNull(nlri); | 204 | checkNotNull(nlri); |
| 192 | if (nlri instanceof BgpNodeLSNlriVer4) { | 205 | if (nlri instanceof BgpNodeLSNlriVer4) { |
| 193 | selectionProcessNode(nlri, false); | 206 | selectionProcessNode(nlri, false); |
| ... | @@ -203,8 +216,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -203,8 +216,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 203 | * | 216 | * |
| 204 | * @param nlri NLRI to update | 217 | * @param nlri NLRI to update |
| 205 | * @param routeDistinguisher VPN id to update | 218 | * @param routeDistinguisher VPN id to update |
| 219 | + * @throws BgpParseException BGP parse exception | ||
| 206 | */ | 220 | */ |
| 207 | - public void decisionProcess(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) { | 221 | + public void decisionProcess(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException { |
| 208 | checkNotNull(nlri); | 222 | checkNotNull(nlri); |
| 209 | if (nlri instanceof BgpNodeLSNlriVer4) { | 223 | if (nlri instanceof BgpNodeLSNlriVer4) { |
| 210 | if (vpnNodeTree.containsKey(routeDistinguisher)) { | 224 | if (vpnNodeTree.containsKey(routeDistinguisher)) { |
| ... | @@ -235,8 +249,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -235,8 +249,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 235 | * | 249 | * |
| 236 | * @param nlri NLRI to update | 250 | * @param nlri NLRI to update |
| 237 | * @param isVpnRib true if VPN local RIB, otherwise false | 251 | * @param isVpnRib true if VPN local RIB, otherwise false |
| 252 | + * @throws BgpParseException throws BGP parse exception | ||
| 238 | */ | 253 | */ |
| 239 | - public void selectionProcessNode(BgpLSNlri nlri, boolean isVpnRib) { | 254 | + public void selectionProcessNode(BgpLSNlri nlri, boolean isVpnRib) throws BgpParseException { |
| 240 | BgpPeerImpl peer; | 255 | BgpPeerImpl peer; |
| 241 | BgpSessionInfo sessionInfo; | 256 | BgpSessionInfo sessionInfo; |
| 242 | int decisionResult; | 257 | int decisionResult; |
| ... | @@ -298,8 +313,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -298,8 +313,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 298 | * | 313 | * |
| 299 | * @param nlri NLRI to update | 314 | * @param nlri NLRI to update |
| 300 | * @param isVpnRib true if VPN local RIB, otherwise false | 315 | * @param isVpnRib true if VPN local RIB, otherwise false |
| 316 | + * @throws BgpParseException BGP parse exception | ||
| 301 | */ | 317 | */ |
| 302 | - public void selectionProcessLink(BgpLSNlri nlri, boolean isVpnRib) { | 318 | + public void selectionProcessLink(BgpLSNlri nlri, boolean isVpnRib) throws BgpParseException { |
| 303 | BgpPeerImpl peer; | 319 | BgpPeerImpl peer; |
| 304 | BgpSessionInfo sessionInfo; | 320 | BgpSessionInfo sessionInfo; |
| 305 | int decisionResult; | 321 | int decisionResult; |
| ... | @@ -309,6 +325,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -309,6 +325,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 309 | 325 | ||
| 310 | if (linkTree.containsKey(linkLsIdentifier)) { | 326 | if (linkTree.containsKey(linkLsIdentifier)) { |
| 311 | log.debug("Local RIB remove link: {}", linkLsIdentifier.toString()); | 327 | log.debug("Local RIB remove link: {}", linkLsIdentifier.toString()); |
| 328 | + for (BgpLinkListener l : bgpController.linkListener()) { | ||
| 329 | + l.deleteLink((BgpLinkLsNlriVer4) nlri); | ||
| 330 | + } | ||
| 312 | linkTree.remove(linkLsIdentifier); | 331 | linkTree.remove(linkLsIdentifier); |
| 313 | } | 332 | } |
| 314 | 333 | ||
| ... | @@ -361,8 +380,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -361,8 +380,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 361 | * | 380 | * |
| 362 | * @param nlri NLRI to update | 381 | * @param nlri NLRI to update |
| 363 | * @param isVpnRib true if VPN local RIB, otherwise false | 382 | * @param isVpnRib true if VPN local RIB, otherwise false |
| 383 | + * @throws BgpParseException BGP parse exception | ||
| 364 | */ | 384 | */ |
| 365 | - public void selectionProcessPrefix(BgpLSNlri nlri, boolean isVpnRib) { | 385 | + public void selectionProcessPrefix(BgpLSNlri nlri, boolean isVpnRib) throws BgpParseException { |
| 366 | BgpPeerImpl peer; | 386 | BgpPeerImpl peer; |
| 367 | BgpSessionInfo sessionInfo; | 387 | BgpSessionInfo sessionInfo; |
| 368 | int decisionResult; | 388 | int decisionResult; |
| ... | @@ -419,7 +439,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -419,7 +439,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 419 | 439 | ||
| 420 | @Override | 440 | @Override |
| 421 | public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, | 441 | public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, |
| 422 | - RouteDistinguisher routeDistinguisher) { | 442 | + RouteDistinguisher routeDistinguisher) throws BgpParseException { |
| 423 | add(sessionInfo, nlri, details); | 443 | add(sessionInfo, nlri, details); |
| 424 | if (nlri instanceof BgpNodeLSNlriVer4) { | 444 | if (nlri instanceof BgpNodeLSNlriVer4) { |
| 425 | if (!vpnNodeTree.containsKey(routeDistinguisher)) { | 445 | if (!vpnNodeTree.containsKey(routeDistinguisher)) { |
| ... | @@ -437,7 +457,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -437,7 +457,7 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 437 | } | 457 | } |
| 438 | 458 | ||
| 439 | @Override | 459 | @Override |
| 440 | - public void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) { | 460 | + public void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException { |
| 441 | // Update local RIB | 461 | // Update local RIB |
| 442 | decisionProcess(nlri, routeDistinguisher); | 462 | decisionProcess(nlri, routeDistinguisher); |
| 443 | } | 463 | } |
| ... | @@ -446,8 +466,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -446,8 +466,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 446 | * Update local RIB node based on avaliable peer adjacency RIB. | 466 | * Update local RIB node based on avaliable peer adjacency RIB. |
| 447 | * | 467 | * |
| 448 | * @param o adjacency-in/VPN adjacency-in | 468 | * @param o adjacency-in/VPN adjacency-in |
| 469 | + * @throws BgpParseException BGP parse exception | ||
| 449 | */ | 470 | */ |
| 450 | - public void localRibUpdateNode(Object o) { | 471 | + public void localRibUpdateNode(Object o) throws BgpParseException { |
| 451 | 472 | ||
| 452 | if (o instanceof AdjRibIn) { | 473 | if (o instanceof AdjRibIn) { |
| 453 | AdjRibIn adjRib = (AdjRibIn) o; | 474 | AdjRibIn adjRib = (AdjRibIn) o; |
| ... | @@ -487,8 +508,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -487,8 +508,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 487 | * Update localRIB link based on avaliable peer adjacency RIB. | 508 | * Update localRIB link based on avaliable peer adjacency RIB. |
| 488 | * | 509 | * |
| 489 | * @param o adjacency-in/VPN adjacency-in | 510 | * @param o adjacency-in/VPN adjacency-in |
| 511 | + * @throws BgpParseException BGP parse exceptions | ||
| 490 | */ | 512 | */ |
| 491 | - public void localRibUpdateLink(Object o) { | 513 | + public void localRibUpdateLink(Object o) throws BgpParseException { |
| 492 | 514 | ||
| 493 | if (o instanceof AdjRibIn) { | 515 | if (o instanceof AdjRibIn) { |
| 494 | AdjRibIn adjRib = (AdjRibIn) o; | 516 | AdjRibIn adjRib = (AdjRibIn) o; |
| ... | @@ -528,8 +550,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -528,8 +550,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 528 | * Update localRIB prefix based on avaliable peer adjacency RIB. | 550 | * Update localRIB prefix based on avaliable peer adjacency RIB. |
| 529 | * | 551 | * |
| 530 | * @param o instance of adjacency-in/VPN adjacency-in | 552 | * @param o instance of adjacency-in/VPN adjacency-in |
| 553 | + * @throws BgpParseException BGP parse exception | ||
| 531 | */ | 554 | */ |
| 532 | - public void localRibUpdatePrefix(Object o) { | 555 | + public void localRibUpdatePrefix(Object o) throws BgpParseException { |
| 533 | 556 | ||
| 534 | if (o instanceof AdjRibIn) { | 557 | if (o instanceof AdjRibIn) { |
| 535 | AdjRibIn adjRib = (AdjRibIn) o; | 558 | AdjRibIn adjRib = (AdjRibIn) o; |
| ... | @@ -572,8 +595,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -572,8 +595,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 572 | * Update localRIB. | 595 | * Update localRIB. |
| 573 | * | 596 | * |
| 574 | * @param adjRibIn adjacency RIB-in | 597 | * @param adjRibIn adjacency RIB-in |
| 598 | + * @throws BgpParseException BGP parse exception | ||
| 575 | */ | 599 | */ |
| 576 | - public void localRibUpdate(AdjRibIn adjRibIn) { | 600 | + public void localRibUpdate(AdjRibIn adjRibIn) throws BgpParseException { |
| 577 | log.debug("Update local RIB."); | 601 | log.debug("Update local RIB."); |
| 578 | 602 | ||
| 579 | localRibUpdateNode(adjRibIn); | 603 | localRibUpdateNode(adjRibIn); |
| ... | @@ -585,8 +609,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { | ... | @@ -585,8 +609,9 @@ public class BgpLocalRibImpl implements BgpLocalRib { |
| 585 | * Update localRIB. | 609 | * Update localRIB. |
| 586 | * | 610 | * |
| 587 | * @param vpnAdjRibIn VPN adjacency RIB-in | 611 | * @param vpnAdjRibIn VPN adjacency RIB-in |
| 612 | + * @throws BgpParseException BGP parse exception | ||
| 588 | */ | 613 | */ |
| 589 | - public void localRibUpdate(VpnAdjRibIn vpnAdjRibIn) { | 614 | + public void localRibUpdate(VpnAdjRibIn vpnAdjRibIn) throws BgpParseException { |
| 590 | log.debug("Update VPN local RIB."); | 615 | log.debug("Update VPN local RIB."); |
| 591 | 616 | ||
| 592 | localRibUpdateNode(vpnAdjRibIn); | 617 | localRibUpdateNode(vpnAdjRibIn); | ... | ... |
| ... | @@ -425,8 +425,9 @@ public class BgpPeerImpl implements BgpPeer { | ... | @@ -425,8 +425,9 @@ public class BgpPeerImpl implements BgpPeer { |
| 425 | * | 425 | * |
| 426 | * @param peerImpl BGP peer instance | 426 | * @param peerImpl BGP peer instance |
| 427 | * @param nlri NLRI information | 427 | * @param nlri NLRI information |
| 428 | + * @throws BgpParseException BGP parse exception | ||
| 428 | */ | 429 | */ |
| 429 | - public void callRemove(BgpPeerImpl peerImpl, List<BgpLSNlri> nlri) { | 430 | + public void callRemove(BgpPeerImpl peerImpl, List<BgpLSNlri> nlri) throws BgpParseException { |
| 430 | ListIterator<BgpLSNlri> listIterator = nlri.listIterator(); | 431 | ListIterator<BgpLSNlri> listIterator = nlri.listIterator(); |
| 431 | while (listIterator.hasNext()) { | 432 | while (listIterator.hasNext()) { |
| 432 | BgpLSNlri nlriInfo = listIterator.next(); | 433 | BgpLSNlri nlriInfo = listIterator.next(); |
| ... | @@ -479,8 +480,9 @@ public class BgpPeerImpl implements BgpPeer { | ... | @@ -479,8 +480,9 @@ public class BgpPeerImpl implements BgpPeer { |
| 479 | /** | 480 | /** |
| 480 | * Update localRIB on peer disconnect. | 481 | * Update localRIB on peer disconnect. |
| 481 | * | 482 | * |
| 483 | + * @throws BgpParseException while updating local RIB | ||
| 482 | */ | 484 | */ |
| 483 | - public void updateLocalRibOnPeerDisconnect() { | 485 | + public void updateLocalRibOnPeerDisconnect() throws BgpParseException { |
| 484 | BgpLocalRibImpl localRib = (BgpLocalRibImpl) bgplocalRib; | 486 | BgpLocalRibImpl localRib = (BgpLocalRibImpl) bgplocalRib; |
| 485 | BgpLocalRibImpl localRibVpn = (BgpLocalRibImpl) bgplocalRibVpn; | 487 | BgpLocalRibImpl localRibVpn = (BgpLocalRibImpl) bgplocalRibVpn; |
| 486 | 488 | ||
| ... | @@ -490,7 +492,6 @@ public class BgpPeerImpl implements BgpPeer { | ... | @@ -490,7 +492,6 @@ public class BgpPeerImpl implements BgpPeer { |
| 490 | 492 | ||
| 491 | /** | 493 | /** |
| 492 | * Update peer flow specification RIB on peer disconnect. | 494 | * Update peer flow specification RIB on peer disconnect. |
| 493 | - * | ||
| 494 | */ | 495 | */ |
| 495 | public void updateFlowSpecOnPeerDisconnect() { | 496 | public void updateFlowSpecOnPeerDisconnect() { |
| 496 | 497 | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2016 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 | +package org.onosproject.provider.bgp.topology.impl; | ||
| 17 | + | ||
| 18 | +import org.onosproject.bgp.controller.BgpCfg; | ||
| 19 | +import org.onosproject.bgp.controller.BgpController; | ||
| 20 | +import org.onosproject.bgp.controller.BgpId; | ||
| 21 | +import org.onosproject.bgp.controller.BgpLinkListener; | ||
| 22 | +import org.onosproject.bgp.controller.BgpLocalRib; | ||
| 23 | +import org.onosproject.bgp.controller.BgpNodeListener; | ||
| 24 | +import org.onosproject.bgp.controller.BgpPeer; | ||
| 25 | +import org.onosproject.bgp.controller.BgpPeerManager; | ||
| 26 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
| 27 | +import org.onosproject.bgpio.protocol.BgpMessage; | ||
| 28 | + | ||
| 29 | +import java.util.Map; | ||
| 30 | +import java.util.Set; | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * Adapter implementation for BGP controller. | ||
| 34 | + */ | ||
| 35 | +public class BgpControllerAdapter implements BgpController { | ||
| 36 | + @Override | ||
| 37 | + public Iterable<BgpPeer> getPeers() { | ||
| 38 | + // TODO Auto-generated method stub | ||
| 39 | + return null; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public BgpPeer getPeer(BgpId bgpId) { | ||
| 44 | + // TODO Auto-generated method stub | ||
| 45 | + return null; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void writeMsg(BgpId bgpId, BgpMessage msg) { | ||
| 50 | + // TODO Auto-generated method stub | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException { | ||
| 55 | + // TODO Auto-generated method stub | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public void closeConnectedPeers() { | ||
| 60 | + // TODO Auto-generated method stub | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public BgpCfg getConfig() { | ||
| 65 | + // TODO Auto-generated method stub | ||
| 66 | + return null; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public int connectedPeerCount() { | ||
| 71 | + // TODO Auto-generated method stub | ||
| 72 | + return 0; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public BgpLocalRib bgpLocalRibVpn() { | ||
| 77 | + // TODO Auto-generated method stub | ||
| 78 | + return null; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public BgpLocalRib bgpLocalRib() { | ||
| 83 | + // TODO Auto-generated method stub | ||
| 84 | + return null; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 88 | + public BgpPeerManager peerManager() { | ||
| 89 | + // TODO Auto-generated method stub | ||
| 90 | + return null; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public Map<BgpId, BgpPeer> connectedPeers() { | ||
| 95 | + // TODO Auto-generated method stub | ||
| 96 | + return null; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Override | ||
| 100 | + public Set<BgpNodeListener> listener() { | ||
| 101 | + // TODO Auto-generated method stub | ||
| 102 | + return null; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public Set<BgpLinkListener> linkListener() { | ||
| 107 | + // TODO Auto-generated method stub | ||
| 108 | + return null; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @Override | ||
| 112 | + public void addListener(BgpNodeListener listener) { | ||
| 113 | + // TODO Auto-generated method stub | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @Override | ||
| 117 | + public void removeListener(BgpNodeListener listener) { | ||
| 118 | + // TODO Auto-generated method stub | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @Override | ||
| 122 | + public void addLinkListener(BgpLinkListener listener) { | ||
| 123 | + // TODO Auto-generated method stub | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + @Override | ||
| 127 | + public void removeLinkListener(BgpLinkListener listener) { | ||
| 128 | + // TODO Auto-generated method stub | ||
| 129 | + } | ||
| 130 | +} |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment