Committed by
Gerrit Code Review
[ONOS-3857] BGP flow specification components encode and decode test.
Change-Id: I2830cd4d26ca044332a16845643ea99e11381209
Showing
5 changed files
with
273 additions
and
119 deletions
... | @@ -189,73 +189,76 @@ public class MpReachNlri implements BgpValueType { | ... | @@ -189,73 +189,76 @@ public class MpReachNlri implements BgpValueType { |
189 | && ((safi == Constants.SAFI_FLOWSPEC_VALUE) | 189 | && ((safi == Constants.SAFI_FLOWSPEC_VALUE) |
190 | || (safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) { | 190 | || (safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) { |
191 | List<BgpValueType> flowSpecComponents = new LinkedList<>(); | 191 | List<BgpValueType> flowSpecComponents = new LinkedList<>(); |
192 | - BgpValueType flowSpecComponent = null; | ||
193 | 192 | ||
194 | - byte nextHopLen = tempCb.readByte(); | 193 | + if (tempCb.readableBytes() > 0) { |
195 | - if (nextHopLen > 0) { | 194 | + BgpValueType flowSpecComponent = null; |
196 | - InetAddress ipAddress = Validation.toInetAddress(nextHopLen, tempCb); | 195 | + |
197 | - if (ipAddress.isMulticastAddress()) { | 196 | + byte nextHopLen = tempCb.readByte(); |
198 | - throw new BgpParseException("Multicast not supported"); | 197 | + if (nextHopLen > 0) { |
198 | + InetAddress ipAddress = Validation.toInetAddress(nextHopLen, tempCb); | ||
199 | + if (ipAddress.isMulticastAddress()) { | ||
200 | + throw new BgpParseException("Multicast not supported"); | ||
201 | + } | ||
202 | + ipNextHop = Ip4Address.valueOf(ipAddress); | ||
199 | } | 203 | } |
200 | - ipNextHop = Ip4Address.valueOf(ipAddress); | ||
201 | - } | ||
202 | 204 | ||
203 | - byte reserved = tempCb.readByte(); | 205 | + byte reserved = tempCb.readByte(); |
204 | - short totNlriLen = tempCb.getByte(tempCb.readerIndex()); | 206 | + short totNlriLen = tempCb.getByte(tempCb.readerIndex()); |
205 | - if (totNlriLen >= FLOW_SPEC_LEN) { | 207 | + if (totNlriLen >= FLOW_SPEC_LEN) { |
206 | - totNlriLen = tempCb.readShort(); | 208 | + totNlriLen = tempCb.readShort(); |
207 | - } else { | 209 | + } else { |
208 | - totNlriLen = tempCb.readByte(); | 210 | + totNlriLen = tempCb.readByte(); |
209 | - } | 211 | + } |
210 | - if (tempCb.readableBytes() < totNlriLen) { | 212 | + if (tempCb.readableBytes() < totNlriLen) { |
211 | - Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, | 213 | + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, |
212 | - BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen); | 214 | + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen); |
213 | - } | 215 | + } |
214 | - tempBuf = tempCb.readBytes(totNlriLen); | 216 | + tempBuf = tempCb.readBytes(totNlriLen); |
215 | - while (tempBuf.readableBytes() > 0) { | 217 | + while (tempBuf.readableBytes() > 0) { |
216 | - short type = tempBuf.readByte(); | 218 | + short type = tempBuf.readByte(); |
217 | - switch (type) { | 219 | + switch (type) { |
218 | - case Constants.BGP_FLOWSPEC_DST_PREFIX: | 220 | + case Constants.BGP_FLOWSPEC_DST_PREFIX: |
219 | - flowSpecComponent = BgpFsDestinationPrefix.read(tempBuf); | 221 | + flowSpecComponent = BgpFsDestinationPrefix.read(tempBuf); |
220 | - break; | 222 | + break; |
221 | - case Constants.BGP_FLOWSPEC_SRC_PREFIX: | 223 | + case Constants.BGP_FLOWSPEC_SRC_PREFIX: |
222 | - flowSpecComponent = BgpFsSourcePrefix.read(tempBuf); | 224 | + flowSpecComponent = BgpFsSourcePrefix.read(tempBuf); |
223 | - break; | 225 | + break; |
224 | - case Constants.BGP_FLOWSPEC_IP_PROTO: | 226 | + case Constants.BGP_FLOWSPEC_IP_PROTO: |
225 | - flowSpecComponent = BgpFsIpProtocol.read(tempBuf); | 227 | + flowSpecComponent = BgpFsIpProtocol.read(tempBuf); |
226 | - break; | 228 | + break; |
227 | - case Constants.BGP_FLOWSPEC_PORT: | 229 | + case Constants.BGP_FLOWSPEC_PORT: |
228 | - flowSpecComponent = BgpFsPortNum.read(tempBuf); | 230 | + flowSpecComponent = BgpFsPortNum.read(tempBuf); |
229 | - break; | 231 | + break; |
230 | - case Constants.BGP_FLOWSPEC_DST_PORT: | 232 | + case Constants.BGP_FLOWSPEC_DST_PORT: |
231 | - flowSpecComponent = BgpFsDestinationPortNum.read(tempBuf); | 233 | + flowSpecComponent = BgpFsDestinationPortNum.read(tempBuf); |
232 | - break; | 234 | + break; |
233 | - case Constants.BGP_FLOWSPEC_SRC_PORT: | 235 | + case Constants.BGP_FLOWSPEC_SRC_PORT: |
234 | - flowSpecComponent = BgpFsSourcePortNum.read(tempBuf); | 236 | + flowSpecComponent = BgpFsSourcePortNum.read(tempBuf); |
235 | - break; | 237 | + break; |
236 | - case Constants.BGP_FLOWSPEC_ICMP_TP: | 238 | + case Constants.BGP_FLOWSPEC_ICMP_TP: |
237 | - flowSpecComponent = BgpFsIcmpType.read(tempBuf); | 239 | + flowSpecComponent = BgpFsIcmpType.read(tempBuf); |
238 | - break; | 240 | + break; |
239 | - case Constants.BGP_FLOWSPEC_ICMP_CD: | 241 | + case Constants.BGP_FLOWSPEC_ICMP_CD: |
240 | - flowSpecComponent = BgpFsIcmpType.read(tempBuf); | 242 | + flowSpecComponent = BgpFsIcmpType.read(tempBuf); |
241 | - break; | 243 | + break; |
242 | - case Constants.BGP_FLOWSPEC_TCP_FLAGS: | 244 | + case Constants.BGP_FLOWSPEC_TCP_FLAGS: |
243 | - flowSpecComponent = BgpFsTcpFlags.read(tempBuf); | 245 | + flowSpecComponent = BgpFsTcpFlags.read(tempBuf); |
244 | - break; | 246 | + break; |
245 | - case Constants.BGP_FLOWSPEC_PCK_LEN: | 247 | + case Constants.BGP_FLOWSPEC_PCK_LEN: |
246 | - flowSpecComponent = BgpFsPacketLength.read(tempBuf); | 248 | + flowSpecComponent = BgpFsPacketLength.read(tempBuf); |
247 | - break; | 249 | + break; |
248 | - case Constants.BGP_FLOWSPEC_DSCP: | 250 | + case Constants.BGP_FLOWSPEC_DSCP: |
249 | - flowSpecComponent = BgpFsDscpValue.read(tempBuf); | 251 | + flowSpecComponent = BgpFsDscpValue.read(tempBuf); |
250 | - break; | 252 | + break; |
251 | - case Constants.BGP_FLOWSPEC_FRAGMENT: | 253 | + case Constants.BGP_FLOWSPEC_FRAGMENT: |
252 | - flowSpecComponent = BgpFsFragment.read(tempBuf); | 254 | + flowSpecComponent = BgpFsFragment.read(tempBuf); |
253 | - break; | 255 | + break; |
254 | - default: | 256 | + default: |
255 | - log.debug("flow spec type not supported" + type); | 257 | + log.debug("flow spec type not supported" + type); |
256 | - break; | 258 | + break; |
259 | + } | ||
260 | + flowSpecComponents.add(flowSpecComponent); | ||
257 | } | 261 | } |
258 | - flowSpecComponents.add(flowSpecComponent); | ||
259 | } | 262 | } |
260 | return new MpReachNlri(new BgpFlowSpecDetails(flowSpecComponents), afi, safi); | 263 | return new MpReachNlri(new BgpFlowSpecDetails(flowSpecComponents), afi, safi); |
261 | } else { | 264 | } else { | ... | ... |
... | @@ -154,63 +154,65 @@ public class MpUnReachNlri implements BgpValueType { | ... | @@ -154,63 +154,65 @@ public class MpUnReachNlri implements BgpValueType { |
154 | && ((safi == Constants.SAFI_FLOWSPEC_VALUE) | 154 | && ((safi == Constants.SAFI_FLOWSPEC_VALUE) |
155 | || (safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) { | 155 | || (safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) { |
156 | List<BgpValueType> flowSpecComponents = new LinkedList<>(); | 156 | List<BgpValueType> flowSpecComponents = new LinkedList<>(); |
157 | - BgpValueType flowSpecComponent = null; | ||
158 | 157 | ||
159 | - short totNlriLen = tempCb.getByte(tempCb.readerIndex()); | 158 | + if (tempCb.readableBytes() > 0) { |
160 | - if (totNlriLen >= FLOW_SPEC_LEN) { | 159 | + BgpValueType flowSpecComponent = null; |
161 | - totNlriLen = tempCb.readShort(); | 160 | + short totNlriLen = tempCb.getByte(tempCb.readerIndex()); |
162 | - } else { | 161 | + if (totNlriLen >= FLOW_SPEC_LEN) { |
163 | - totNlriLen = tempCb.readByte(); | 162 | + totNlriLen = tempCb.readShort(); |
164 | - } | 163 | + } else { |
165 | - if (tempCb.readableBytes() < totNlriLen) { | 164 | + totNlriLen = tempCb.readByte(); |
166 | - Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, | 165 | + } |
167 | - BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen); | 166 | + if (tempCb.readableBytes() < totNlriLen) { |
168 | - } | 167 | + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, |
169 | - tempBuf = tempCb.readBytes(totNlriLen); | 168 | + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen); |
170 | - while (tempBuf.readableBytes() > 0) { | 169 | + } |
171 | - short type = tempBuf.readByte(); | 170 | + tempBuf = tempCb.readBytes(totNlriLen); |
172 | - switch (type) { | 171 | + while (tempBuf.readableBytes() > 0) { |
173 | - case Constants.BGP_FLOWSPEC_DST_PREFIX: | 172 | + short type = tempBuf.readByte(); |
174 | - flowSpecComponent = BgpFsDestinationPrefix.read(tempBuf); | 173 | + switch (type) { |
175 | - break; | 174 | + case Constants.BGP_FLOWSPEC_DST_PREFIX: |
176 | - case Constants.BGP_FLOWSPEC_SRC_PREFIX: | 175 | + flowSpecComponent = BgpFsDestinationPrefix.read(tempBuf); |
177 | - flowSpecComponent = BgpFsSourcePrefix.read(tempBuf); | 176 | + break; |
178 | - break; | 177 | + case Constants.BGP_FLOWSPEC_SRC_PREFIX: |
179 | - case Constants.BGP_FLOWSPEC_IP_PROTO: | 178 | + flowSpecComponent = BgpFsSourcePrefix.read(tempBuf); |
180 | - flowSpecComponent = BgpFsIpProtocol.read(tempBuf); | 179 | + break; |
181 | - break; | 180 | + case Constants.BGP_FLOWSPEC_IP_PROTO: |
182 | - case Constants.BGP_FLOWSPEC_PORT: | 181 | + flowSpecComponent = BgpFsIpProtocol.read(tempBuf); |
183 | - flowSpecComponent = BgpFsPortNum.read(tempBuf); | 182 | + break; |
184 | - break; | 183 | + case Constants.BGP_FLOWSPEC_PORT: |
185 | - case Constants.BGP_FLOWSPEC_DST_PORT: | 184 | + flowSpecComponent = BgpFsPortNum.read(tempBuf); |
186 | - flowSpecComponent = BgpFsDestinationPortNum.read(tempBuf); | 185 | + break; |
187 | - break; | 186 | + case Constants.BGP_FLOWSPEC_DST_PORT: |
188 | - case Constants.BGP_FLOWSPEC_SRC_PORT: | 187 | + flowSpecComponent = BgpFsDestinationPortNum.read(tempBuf); |
189 | - flowSpecComponent = BgpFsSourcePortNum.read(tempBuf); | 188 | + break; |
190 | - break; | 189 | + case Constants.BGP_FLOWSPEC_SRC_PORT: |
191 | - case Constants.BGP_FLOWSPEC_ICMP_TP: | 190 | + flowSpecComponent = BgpFsSourcePortNum.read(tempBuf); |
192 | - flowSpecComponent = BgpFsIcmpType.read(tempBuf); | 191 | + break; |
193 | - break; | 192 | + case Constants.BGP_FLOWSPEC_ICMP_TP: |
194 | - case Constants.BGP_FLOWSPEC_ICMP_CD: | 193 | + flowSpecComponent = BgpFsIcmpType.read(tempBuf); |
195 | - flowSpecComponent = BgpFsIcmpType.read(tempBuf); | 194 | + break; |
196 | - break; | 195 | + case Constants.BGP_FLOWSPEC_ICMP_CD: |
197 | - case Constants.BGP_FLOWSPEC_TCP_FLAGS: | 196 | + flowSpecComponent = BgpFsIcmpType.read(tempBuf); |
198 | - flowSpecComponent = BgpFsTcpFlags.read(tempBuf); | 197 | + break; |
199 | - break; | 198 | + case Constants.BGP_FLOWSPEC_TCP_FLAGS: |
200 | - case Constants.BGP_FLOWSPEC_PCK_LEN: | 199 | + flowSpecComponent = BgpFsTcpFlags.read(tempBuf); |
201 | - flowSpecComponent = BgpFsPacketLength.read(tempBuf); | 200 | + break; |
202 | - break; | 201 | + case Constants.BGP_FLOWSPEC_PCK_LEN: |
203 | - case Constants.BGP_FLOWSPEC_DSCP: | 202 | + flowSpecComponent = BgpFsPacketLength.read(tempBuf); |
204 | - flowSpecComponent = BgpFsDscpValue.read(tempBuf); | 203 | + break; |
205 | - break; | 204 | + case Constants.BGP_FLOWSPEC_DSCP: |
206 | - case Constants.BGP_FLOWSPEC_FRAGMENT: | 205 | + flowSpecComponent = BgpFsDscpValue.read(tempBuf); |
207 | - flowSpecComponent = BgpFsFragment.read(tempBuf); | 206 | + break; |
208 | - break; | 207 | + case Constants.BGP_FLOWSPEC_FRAGMENT: |
209 | - default: | 208 | + flowSpecComponent = BgpFsFragment.read(tempBuf); |
210 | - log.debug("flow spec type not supported" + type); | 209 | + break; |
211 | - break; | 210 | + default: |
211 | + log.debug("flow spec type not supported" + type); | ||
212 | + break; | ||
213 | + } | ||
214 | + flowSpecComponents.add(flowSpecComponent); | ||
212 | } | 215 | } |
213 | - flowSpecComponents.add(flowSpecComponent); | ||
214 | } | 216 | } |
215 | return new MpUnReachNlri(new BgpFlowSpecDetails(flowSpecComponents), afi, safi); | 217 | return new MpUnReachNlri(new BgpFlowSpecDetails(flowSpecComponents), afi, safi); |
216 | } else { | 218 | } else { | ... | ... |
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.bgpio.types; | ||
17 | + | ||
18 | +import static org.hamcrest.MatcherAssert.assertThat; | ||
19 | +import static org.hamcrest.Matchers.instanceOf; | ||
20 | +import static org.hamcrest.core.Is.is; | ||
21 | + | ||
22 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
23 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
24 | +import org.junit.Test; | ||
25 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
26 | +import org.onosproject.bgpio.protocol.BgpFactories; | ||
27 | +import org.onosproject.bgpio.protocol.BgpMessage; | ||
28 | +import org.onosproject.bgpio.protocol.BgpMessageReader; | ||
29 | +import org.onosproject.bgpio.protocol.ver4.BgpUpdateMsgVer4; | ||
30 | + | ||
31 | +/** | ||
32 | + * Test for MP reach NLRI encoding and decoding. | ||
33 | + */ | ||
34 | +public class MpReachNlriTest { | ||
35 | + | ||
36 | + /** | ||
37 | + * This testcase checks BGP update message. | ||
38 | + */ | ||
39 | + @Test | ||
40 | + public void mpReachNlriTest1() throws BgpParseException { | ||
41 | + | ||
42 | + // BGP flow spec Message | ||
43 | + byte[] flowSpecMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
44 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
45 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
46 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
47 | + (byte) 0xff, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x00, | ||
48 | + 0x33, 0x40, 0x01, 0x01, 0x00, 0x40, 0x02, 0x04, | ||
49 | + 0x02, 0x01, 0x00, 0x64, (byte) 0x80, 0x04, 0x04, 0x00, | ||
50 | + 0x00, 0x00, 0x00, (byte) 0xc0, 0x10, 0x08, (byte) 0x80, 0x06, | ||
51 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x90, 0x0e, | ||
52 | + 0x00, 0x12, 0x00, 0x01, (byte) 0x85, 0x00, 0x00, 0x0c, | ||
53 | + 0x02, 0x20, (byte) 0xc0, (byte) 0xa8, 0x07, 0x36, 0x03, (byte) 0x81, | ||
54 | + 0x67, 0x04, (byte) 0x81, 0x01}; | ||
55 | + | ||
56 | + byte[] testFsMsg; | ||
57 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
58 | + buffer.writeBytes(flowSpecMsg); | ||
59 | + | ||
60 | + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); | ||
61 | + BgpMessage message; | ||
62 | + BgpHeader bgpHeader = new BgpHeader(); | ||
63 | + | ||
64 | + message = reader.readFrom(buffer, bgpHeader); | ||
65 | + | ||
66 | + assertThat(message, instanceOf(BgpUpdateMsgVer4.class)); | ||
67 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
68 | + message.writeTo(buf); | ||
69 | + | ||
70 | + int readLen = buf.writerIndex(); | ||
71 | + testFsMsg = new byte[readLen]; | ||
72 | + buf.readBytes(testFsMsg, 0, readLen); | ||
73 | + | ||
74 | + assertThat(testFsMsg, is(flowSpecMsg)); | ||
75 | + } | ||
76 | +} |
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.bgpio.types; | ||
17 | + | ||
18 | +import static org.hamcrest.MatcherAssert.assertThat; | ||
19 | +import static org.hamcrest.Matchers.instanceOf; | ||
20 | +import static org.hamcrest.core.Is.is; | ||
21 | + | ||
22 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
23 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
24 | +import org.junit.Test; | ||
25 | +import org.onosproject.bgpio.exceptions.BgpParseException; | ||
26 | +import org.onosproject.bgpio.protocol.BgpFactories; | ||
27 | +import org.onosproject.bgpio.protocol.BgpMessage; | ||
28 | +import org.onosproject.bgpio.protocol.BgpMessageReader; | ||
29 | +import org.onosproject.bgpio.protocol.ver4.BgpUpdateMsgVer4; | ||
30 | + | ||
31 | +/** | ||
32 | + * Test for MP unreach NLRI encoding and decoding. | ||
33 | + */ | ||
34 | +public class MpUnReachNlriTest { | ||
35 | + | ||
36 | + /** | ||
37 | + * This testcase checks BGP update message. | ||
38 | + */ | ||
39 | + @Test | ||
40 | + public void mpUnReachNlriTest() throws BgpParseException { | ||
41 | + | ||
42 | + // BGP flow spec Message | ||
43 | + byte[] flowSpecMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
44 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
45 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
46 | + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, | ||
47 | + (byte) 0xff, 0x00, 0x2b, 0x02, 0x00, 0x00, 0x00, 0x14, | ||
48 | + (byte) 0x90, 0x0f, 0x00, 0x10, 0x00, 0x01, (byte) 0x85, | ||
49 | + 0x0c, 0x02, 0x20, (byte) 0xc0, (byte) 0xa8, 0x07, 0x36, | ||
50 | + 0x03, (byte) 0x81, 0x67, 0x04, (byte) 0x81, 0x01}; | ||
51 | + | ||
52 | + byte[] testFsMsg; | ||
53 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
54 | + buffer.writeBytes(flowSpecMsg); | ||
55 | + | ||
56 | + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); | ||
57 | + BgpMessage message; | ||
58 | + BgpHeader bgpHeader = new BgpHeader(); | ||
59 | + | ||
60 | + message = reader.readFrom(buffer, bgpHeader); | ||
61 | + | ||
62 | + assertThat(message, instanceOf(BgpUpdateMsgVer4.class)); | ||
63 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
64 | + message.writeTo(buf); | ||
65 | + | ||
66 | + int readLen = buf.writerIndex(); | ||
67 | + testFsMsg = new byte[readLen]; | ||
68 | + buf.readBytes(testFsMsg, 0, readLen); | ||
69 | + | ||
70 | + assertThat(testFsMsg, is(flowSpecMsg)); | ||
71 | + } | ||
72 | +} |
... | @@ -43,6 +43,7 @@ import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4; | ... | @@ -43,6 +43,7 @@ import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4; |
43 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; | 43 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; |
44 | import org.onosproject.bgpio.types.AsPath; | 44 | import org.onosproject.bgpio.types.AsPath; |
45 | import org.onosproject.bgpio.types.As4Path; | 45 | import org.onosproject.bgpio.types.As4Path; |
46 | +import org.onosproject.bgpio.types.BgpExtendedCommunity; | ||
46 | import org.onosproject.bgpio.types.BgpValueType; | 47 | import org.onosproject.bgpio.types.BgpValueType; |
47 | import org.onosproject.bgpio.types.LocalPref; | 48 | import org.onosproject.bgpio.types.LocalPref; |
48 | import org.onosproject.bgpio.types.Med; | 49 | import org.onosproject.bgpio.types.Med; |
... | @@ -227,7 +228,7 @@ public class BgpPeerImpl implements BgpPeer { | ... | @@ -227,7 +228,7 @@ public class BgpPeerImpl implements BgpPeer { |
227 | attributesList.add(new LocalPref(100)); | 228 | attributesList.add(new LocalPref(100)); |
228 | } | 229 | } |
229 | 230 | ||
230 | - // TODO: Update flow spec action | 231 | + attributesList.add(new BgpExtendedCommunity(flowSpec.fsActionTlv())); |
231 | 232 | ||
232 | if (operType == FlowSpecOperation.ADD) { | 233 | if (operType == FlowSpecOperation.ADD) { |
233 | attributesList.add(new MpReachNlri(flowSpec, Constants.AFI_FLOWSPEC_VALUE, sAfi)); | 234 | attributesList.add(new MpReachNlri(flowSpec, Constants.AFI_FLOWSPEC_VALUE, sAfi)); | ... | ... |
-
Please register or login to post a comment