Committed by
Gerrit Code Review
Using Validation util function in mpreach
Change-Id: I59978bc0c96adde03fe86c9e1d17d4c038d17971
Showing
2 changed files
with
9 additions
and
10 deletions
... | @@ -26,6 +26,7 @@ import org.onosproject.bgpio.exceptions.BGPParseException; | ... | @@ -26,6 +26,7 @@ import org.onosproject.bgpio.exceptions.BGPParseException; |
26 | import org.onosproject.bgpio.protocol.BGPLSNlri; | 26 | import org.onosproject.bgpio.protocol.BGPLSNlri; |
27 | import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4; | 27 | import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4; |
28 | import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4; | 28 | import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4; |
29 | +import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; | ||
29 | import org.onosproject.bgpio.util.Constants; | 30 | import org.onosproject.bgpio.util.Constants; |
30 | import org.onosproject.bgpio.util.Validation; | 31 | import org.onosproject.bgpio.util.Validation; |
31 | import org.slf4j.Logger; | 32 | import org.slf4j.Logger; |
... | @@ -39,7 +40,6 @@ import com.google.common.base.MoreObjects; | ... | @@ -39,7 +40,6 @@ import com.google.common.base.MoreObjects; |
39 | public class MpReachNlri implements BGPValueType { | 40 | public class MpReachNlri implements BGPValueType { |
40 | 41 | ||
41 | private static final Logger log = LoggerFactory.getLogger(MpReachNlri.class); | 42 | private static final Logger log = LoggerFactory.getLogger(MpReachNlri.class); |
42 | - | ||
43 | public static final byte MPREACHNLRI_TYPE = 14; | 43 | public static final byte MPREACHNLRI_TYPE = 14; |
44 | public static final byte LINK_NLRITYPE = 2; | 44 | public static final byte LINK_NLRITYPE = 2; |
45 | 45 | ||
... | @@ -131,8 +131,7 @@ public class MpReachNlri implements BGPValueType { | ... | @@ -131,8 +131,7 @@ public class MpReachNlri implements BGPValueType { |
131 | if ((afi == Constants.AFI_VALUE) && (safi == Constants.SAFI_VALUE) || (afi == Constants.AFI_VALUE) | 131 | if ((afi == Constants.AFI_VALUE) && (safi == Constants.SAFI_VALUE) || (afi == Constants.AFI_VALUE) |
132 | && (safi == Constants.VPN_SAFI_VALUE)) { | 132 | && (safi == Constants.VPN_SAFI_VALUE)) { |
133 | byte nextHopLen = tempCb.readByte(); | 133 | byte nextHopLen = tempCb.readByte(); |
134 | - //TODO: use Validation.toInetAddress once Validation is merged | 134 | + InetAddress ipAddress = Validation.toInetAddress(nextHopLen, cb); |
135 | - InetAddress ipAddress = (InetAddress) cb.readBytes(nextHopLen); | ||
136 | if (ipAddress.isMulticastAddress()) { | 135 | if (ipAddress.isMulticastAddress()) { |
137 | throw new BGPParseException("Multicast not supported"); | 136 | throw new BGPParseException("Multicast not supported"); |
138 | } | 137 | } |
... | @@ -151,8 +150,8 @@ public class MpReachNlri implements BGPValueType { | ... | @@ -151,8 +150,8 @@ public class MpReachNlri implements BGPValueType { |
151 | case BGPNodeLSNlriVer4.NODE_NLRITYPE: | 150 | case BGPNodeLSNlriVer4.NODE_NLRITYPE: |
152 | bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi); | 151 | bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi); |
153 | break; | 152 | break; |
154 | - case LINK_NLRITYPE: | 153 | + case BgpLinkLsNlriVer4.LINK_NLRITYPE: |
155 | - //TODO: To be merged later | 154 | + bgpLSNlri = BgpLinkLsNlriVer4.read(tempBuf, afi, safi); |
156 | break; | 155 | break; |
157 | case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE: | 156 | case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE: |
158 | bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi, safi); | 157 | bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi, safi); |
... | @@ -163,7 +162,6 @@ public class MpReachNlri implements BGPValueType { | ... | @@ -163,7 +162,6 @@ public class MpReachNlri implements BGPValueType { |
163 | mpReachNlri.add(bgpLSNlri); | 162 | mpReachNlri.add(bgpLSNlri); |
164 | } | 163 | } |
165 | } else { | 164 | } else { |
166 | - //TODO: check with the values got from capability | ||
167 | throw new BGPParseException("Not Supporting afi " + afi + "safi " + safi); | 165 | throw new BGPParseException("Not Supporting afi " + afi + "safi " + safi); |
168 | } | 166 | } |
169 | } | 167 | } | ... | ... |
... | @@ -24,6 +24,7 @@ import org.onosproject.bgpio.exceptions.BGPParseException; | ... | @@ -24,6 +24,7 @@ import org.onosproject.bgpio.exceptions.BGPParseException; |
24 | import org.onosproject.bgpio.protocol.BGPLSNlri; | 24 | import org.onosproject.bgpio.protocol.BGPLSNlri; |
25 | import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4; | 25 | import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4; |
26 | import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4; | 26 | import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4; |
27 | +import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; | ||
27 | import org.onosproject.bgpio.util.Constants; | 28 | import org.onosproject.bgpio.util.Constants; |
28 | import org.onosproject.bgpio.util.Validation; | 29 | import org.onosproject.bgpio.util.Validation; |
29 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
... | @@ -36,10 +37,10 @@ import com.google.common.base.MoreObjects; | ... | @@ -36,10 +37,10 @@ import com.google.common.base.MoreObjects; |
36 | */ | 37 | */ |
37 | public class MpUnReachNlri implements BGPValueType { | 38 | public class MpUnReachNlri implements BGPValueType { |
38 | 39 | ||
39 | - protected static final Logger log = LoggerFactory.getLogger(MpUnReachNlri.class); | 40 | + private static final Logger log = LoggerFactory.getLogger(MpUnReachNlri.class); |
40 | - | ||
41 | public static final byte MPUNREACHNLRI_TYPE = 15; | 41 | public static final byte MPUNREACHNLRI_TYPE = 15; |
42 | public static final byte LINK_NLRITYPE = 2; | 42 | public static final byte LINK_NLRITYPE = 2; |
43 | + | ||
43 | private boolean isMpUnReachNlri = false; | 44 | private boolean isMpUnReachNlri = false; |
44 | private final short afi; | 45 | private final short afi; |
45 | private final byte safi; | 46 | private final byte safi; |
... | @@ -113,8 +114,8 @@ public class MpUnReachNlri implements BGPValueType { | ... | @@ -113,8 +114,8 @@ public class MpUnReachNlri implements BGPValueType { |
113 | case BGPNodeLSNlriVer4.NODE_NLRITYPE: | 114 | case BGPNodeLSNlriVer4.NODE_NLRITYPE: |
114 | bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi); | 115 | bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi); |
115 | break; | 116 | break; |
116 | - case LINK_NLRITYPE: | 117 | + case BgpLinkLsNlriVer4.LINK_NLRITYPE: |
117 | - //TODO: to be merged later | 118 | + bgpLSNlri = BgpLinkLsNlriVer4.read(tempBuf, afi, safi); |
118 | break; | 119 | break; |
119 | case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE: | 120 | case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE: |
120 | bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi, | 121 | bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi, | ... | ... |
-
Please register or login to post a comment