Code Clean Up
[bgpcep.git] / rsvp / impl / src / test / java / org / opendaylight / protocol / rsvp / parser / impl / te / TEObjectTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.protocol.rsvp.parser.impl.te;
10
11 import static org.junit.Assert.assertArrayEquals;
12
13 import io.netty.buffer.ByteBuf;
14 import io.netty.buffer.Unpooled;
15 import org.junit.Assert;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator;
19 import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser;
20 import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SERODynamicProtectionSubobjectParser;
21 import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser;
22 import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser;
23 import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
24 import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
25 import org.opendaylight.protocol.util.ByteArray;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
30
31 public class TEObjectTest {
32     RSVPActivator act;
33     SimpleRSVPExtensionProviderContext context;
34
35     @Before
36     public void setUp() {
37         this.act = new RSVPActivator();
38         this.context = new SimpleRSVPExtensionProviderContext();
39         this.act.start(this.context);
40     }
41
42     @Test
43     public void testAdminStatusObjectParser() throws RSVPParsingException {
44         final AdminStatusObjectParser admParser = new AdminStatusObjectParser();
45         final RsvpTeObject obj = admParser.parseObject(Unpooled.copiedBuffer(
46             ByteArray.subByte(TEObjectUtil.TE_LSP_ADMIN_STATUS, 4, TEObjectUtil.TE_LSP_ADMIN_STATUS.length - 4)));
47         final ByteBuf output = Unpooled.buffer();
48         admParser.serializeObject(obj, output);
49         assertArrayEquals(TEObjectUtil.TE_LSP_ADMIN_STATUS, ByteArray.getAllBytes(output));
50     }
51
52     @Test
53     public void testAssociationObjectParser1() throws RSVPParsingException {
54         final AssociationObjectParserIPV4 parser = new AssociationObjectParserIPV4();
55         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
56             ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_1, 4, TEObjectUtil.TE_LSP_ASSOCIATION_1.length - 4)));
57
58         final ByteBuf output = Unpooled.buffer();
59         parser.serializeObject(obj, output);
60         assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_1, ByteArray.getAllBytes(output));
61     }
62
63     @Test
64     public void testAssociationObjectParser2() throws RSVPParsingException {
65         final AssociationObjectParserIPV6 parser = new AssociationObjectParserIPV6();
66         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
67             ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_2, 4, TEObjectUtil.TE_LSP_ASSOCIATION_2.length - 4)));
68
69         final ByteBuf output = Unpooled.buffer();
70         parser.serializeObject(obj, output);
71         assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_2, ByteArray.getAllBytes(output));
72     }
73
74     @Test
75     public void testBandwidthObjectParser1() throws RSVPParsingException {
76         final BandwidthObjectParser parser = new BandwidthObjectParser();
77         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
78             ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_1, 4, TEObjectUtil.TE_LSP_BANDWIDTH_1
79                 .length - 4)));
80
81         final ByteBuf output = Unpooled.buffer();
82         parser.serializeObject(obj, output);
83         assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_1, ByteArray.getAllBytes(output));
84     }
85
86     @Test
87     public void testBandwidthObjectParser2() throws RSVPParsingException {
88         final ReoptimizationBandwidthObjectParser parser = new ReoptimizationBandwidthObjectParser();
89         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
90             ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_2, 4, TEObjectUtil.TE_LSP_BANDWIDTH_2
91                 .length - 4)));
92
93         final ByteBuf output = Unpooled.buffer();
94         parser.serializeObject(obj, output);
95         assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_2, ByteArray.getAllBytes(output));
96     }
97
98     @Test
99     public void testExcludeRouteParser() throws RSVPParsingException {
100         final ExcludeRouteObjectParser parser = new ExcludeRouteObjectParser(this.context.getXROSubobjectHandlerRegistry());
101         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
102             ByteArray.subByte(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, 4, TEObjectUtil.TE_LSP_EXCLUDE_ROUTE.length - 4)));
103
104         final ByteBuf output = Unpooled.buffer();
105         parser.serializeObject(obj, output);
106         assertArrayEquals(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, ByteArray.getAllBytes(output));
107     }
108
109     @Test
110     public void testExplicitRouteParser() throws RSVPParsingException {
111         final ExplicitRouteObjectParser parser = new ExplicitRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
112         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_EXPLICIT, 4,
113             TEObjectUtil.TE_LSP_EXPLICIT.length - 4)));
114
115         final ByteBuf output = Unpooled.buffer();
116         parser.serializeObject(obj, output);
117         assertArrayEquals(TEObjectUtil.TE_LSP_EXPLICIT, ByteArray.getAllBytes(output));
118     }
119
120     @Test
121     public void testAttributesObject12Parser() throws RSVPParsingException {
122         final AttributesObjectParser parser = new AttributesObjectParser();
123         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
124             ByteArray.subByte(TEObjectUtil.TE_LSP_ATTRIBUTES, 4, TEObjectUtil.TE_LSP_ATTRIBUTES.length - 4)));
125
126         final ByteBuf output = Unpooled.buffer();
127         parser.serializeObject(obj, output);
128         assertArrayEquals(TEObjectUtil.TE_LSP_ATTRIBUTES, ByteArray.getAllBytes(output));
129     }
130
131     @Test
132     public void testRequiredAttributesParser() throws RSVPParsingException {
133         final RequiredAttributesObjectParser parser = new RequiredAttributesObjectParser();
134         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
135             ByteArray.subByte(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, 4, TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES.length - 4)));
136
137         final ByteBuf output = Unpooled.buffer();
138         parser.serializeObject(obj, output);
139         assertArrayEquals(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, ByteArray.getAllBytes(output));
140     }
141
142     @Test
143     public void testPrimaryPathRouteParser() throws RSVPParsingException {
144         final PrimaryPathRouteObjectParser parser = new PrimaryPathRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
145         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
146             ByteArray.subByte(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, 4, TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE
147                 .length - 4)));
148
149         final ByteBuf output = Unpooled.buffer();
150         parser.serializeObject(obj, output);
151         assertArrayEquals(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, ByteArray.getAllBytes(output));
152     }
153
154
155     @Test
156     public void testProtectionObjectParser1() throws RSVPParsingException {
157         final ProtectionObjectParser parser = new ProtectionObjectParser();
158         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
159             ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C1, 4, TEObjectUtil.TE_LSP_PROTECTION_C1.length - 4)));
160         final ByteBuf output = Unpooled.buffer();
161         parser.serializeObject(obj, output);
162         assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C1, ByteArray.getAllBytes(output));
163     }
164
165     @Test
166     public void testProtectionObjectParser2() throws RSVPParsingException {
167         final DynamicProtectionObjectParser parser = new DynamicProtectionObjectParser();
168         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
169             ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C2, 4, TEObjectUtil.TE_LSP_PROTECTION_C2.length - 4)));
170         final ByteBuf output = Unpooled.buffer();
171         parser.serializeObject(obj, output);
172         assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C2, ByteArray.getAllBytes(output));
173     }
174
175     @Test
176     public void testProtectionCommonParser() {
177         final ByteBuf emptyBuff = Unpooled.buffer();
178         try {
179             ProtectionCommonParser.parseCommonProtectionBodyType2(emptyBuff);
180             Assert.fail();
181         } catch (final RSVPParsingException e) {
182             Assert.assertEquals("Wrong length of array of bytes. Passed: " + emptyBuff.readableBytes() + "; Expected:" +
183                 " " + ProtectionCommonParser.CONTENT_LENGTH_C2 + ".", e.getMessage());
184         }
185     }
186
187     @Test
188     public void testRecordRouteParser() throws RSVPParsingException {
189         final RecordRouteObjectParser parser = new RecordRouteObjectParser(this.context.getRROSubobjectHandlerRegistry());
190         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
191             ByteArray.subByte(TEObjectUtil.TE_LSP_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_RECORD_ROUTE.length - 4)));
192
193         final ByteBuf output = Unpooled.buffer();
194         parser.serializeObject(obj, output);
195         assertArrayEquals(TEObjectUtil.TE_LSP_RECORD_ROUTE, ByteArray.getAllBytes(output));
196     }
197
198     @Test
199     public void testSecondaryExplicitRouteParser() throws RSVPParsingException {
200         final SecondaryExplicitRouteObjectParser parser = new SecondaryExplicitRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
201         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
202             ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, 4, TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT
203                 .length - 4)));
204
205         final ByteBuf output = Unpooled.buffer();
206         parser.serializeObject(obj, output);
207         assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, ByteArray.getAllBytes(output));
208     }
209
210     @Test
211     public void testSecondaryRecordRouteObjectParser() throws RSVPParsingException {
212         final SecondaryRecordRouteObjectParser parser = new SecondaryRecordRouteObjectParser(this.context.getRROSubobjectHandlerRegistry());
213         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
214             ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE
215                 .length - 4)));
216
217         final ByteBuf output = Unpooled.buffer();
218         parser.serializeObject(obj, output);
219         assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, ByteArray.getAllBytes(output));
220     }
221
222     @Test
223     public void testSSRODynamicProtectionSubobjectParser() throws RSVPParsingException {
224         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
225         final SRRODynamicProtectionSubobjectParser dynamicParser = new SRRODynamicProtectionSubobjectParser();
226         final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
227             ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION
228                 .length - 2)));
229
230         final ByteBuf output = Unpooled.buffer();
231         dynamicParser.serializeSubobject(sub, output);
232         assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
233     }
234
235     @Test
236     public void testSSROBasicProtectionSubobjectParser() throws RSVPParsingException {
237         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
238         final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
239             ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION.length - 2)));
240
241         final ByteBuf output = Unpooled.buffer();
242         parser.serializeSubobject(sub, output);
243         assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
244     }
245
246     @Test(expected = IllegalArgumentException.class)
247     public void testWrongParseSRRO() throws RSVPParsingException {
248         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
249         parser.parseSubobject(null);
250     }
251
252     @Test(expected = IllegalArgumentException.class)
253     public void testWrongSerializeSRRO() throws RSVPParsingException {
254         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route
255             .object.secondary.record.route.object.subobject.container.subobject.type
256             .DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn
257             .opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route
258             .object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder().build();
259         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
260         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.
261             SubobjectContainer subContainer = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
262             .rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder().setSubobjectType(dynamicProtection).build();
263         parser.serializeSubobject(subContainer, Unpooled.buffer());
264     }
265
266     @Test
267     public void testSERODynamicProtectionSubobjectParser() throws RSVPParsingException {
268         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
269         final SERODynamicProtectionSubobjectParser dynamicParser = new SERODynamicProtectionSubobjectParser();
270         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.
271             SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
272             ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION.length - 2)), true);
273
274         final ByteBuf output = Unpooled.buffer();
275         dynamicParser.serializeSubobject(sub, output);
276         assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
277     }
278
279     @Test(expected = IllegalArgumentException.class)
280     public void testWrongParseSERO() throws RSVPParsingException {
281         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
282         parser.parseSubobject(null, false);
283     }
284
285     @Test(expected = IllegalArgumentException.class)
286     public void testWrongSerializeSERO() throws RSVPParsingException {
287         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
288         parser.serializeSubobject(new SubobjectContainerBuilder().setSubobjectType
289             (new DynamicControlProtectionCaseBuilder().build()).build(), Unpooled.buffer());
290     }
291
292     @Test
293     public void testSEROBasicProtectionSubobjectParser() throws RSVPParsingException {
294         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
295         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.
296             SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
297             ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION.length - 2)), true);
298
299         final ByteBuf output = Unpooled.buffer();
300         parser.serializeSubobject(sub, output);
301         assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
302     }
303
304     @Test
305     public void testDetourObjectParser7() throws RSVPParsingException {
306         final DetourObjectIpv4Parser parser = new DetourObjectIpv4Parser();
307         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
308             ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR7, 4, TEObjectUtil.TE_LSP_DETOUR7.length - 4)));
309
310         final ByteBuf output = Unpooled.buffer();
311         parser.serializeObject(obj, output);
312         assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR7, ByteArray.getAllBytes(output));
313     }
314
315     @Test
316     public void testDetourObjectParser8() throws RSVPParsingException {
317         final DetourObjectIpv6Parser parser = new DetourObjectIpv6Parser();
318         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
319             ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR8, 4, TEObjectUtil.TE_LSP_DETOUR8.length - 4)));
320
321         final ByteBuf output = Unpooled.buffer();
322         parser.serializeObject(obj, output);
323         assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR8, ByteArray.getAllBytes(output));
324     }
325
326     @Test
327     public void testFastRerouteObjectParser1() throws RSVPParsingException {
328         final FastRerouteObjectParser parser = new FastRerouteObjectParser();
329         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
330             ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE1, 4, TEObjectUtil.TE_LSP_FAST_REROUTE1.length - 4)));
331
332         final ByteBuf output = Unpooled.buffer();
333         parser.serializeObject(obj, output);
334         assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE1, ByteArray.getAllBytes(output));
335     }
336
337     @Test
338     public void testFastRerouteObjectParser7() throws RSVPParsingException {
339         final InformationalFastRerouteObjectParser parser = new InformationalFastRerouteObjectParser();
340         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
341             ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE7, 4, TEObjectUtil.TE_LSP_FAST_REROUTE7.length - 4)));
342
343         final ByteBuf output = Unpooled.buffer();
344         parser.serializeObject(obj, output);
345         assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE7, ByteArray.getAllBytes(output));
346     }
347
348     @Test
349     public void testFlowSpecObjectParser_HEADER_5() throws RSVPParsingException {
350         final FlowSpecObjectParser parser = new FlowSpecObjectParser();
351         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
352             ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H5, 4, TEObjectUtil.TE_LSP_FLOWSPEC_H5.length - 4)));
353
354         final ByteBuf output = Unpooled.buffer();
355         parser.serializeObject(obj, output);
356         assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H5, ByteArray.getAllBytes(output));
357     }
358
359     @Test
360     public void testFlowSpecObjectParser_HEADER_2() throws RSVPParsingException {
361         final FlowSpecObjectParser parser = new FlowSpecObjectParser();
362         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
363             ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H2, 4, TEObjectUtil.TE_LSP_FLOWSPEC_H2.length - 4)));
364
365         final ByteBuf output = Unpooled.buffer();
366         parser.serializeObject(obj, output);
367         assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H2, ByteArray.getAllBytes(output));
368     }
369
370     @Test
371     public void testParser_HEADER_5() throws RSVPParsingException {
372         final SenderTspecObjectParser parser = new SenderTspecObjectParser();
373         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
374             ByteArray.subByte(TEObjectUtil.TE_LSP_SENDER_TSPEC, 4, TEObjectUtil.TE_LSP_SENDER_TSPEC.length - 4)));
375
376         final ByteBuf output = Unpooled.buffer();
377         parser.serializeObject(obj, output);
378         assertArrayEquals(TEObjectUtil.TE_LSP_SENDER_TSPEC, ByteArray.getAllBytes(output));
379     }
380
381     @Test
382     public void testSessionAttributeParser1() throws RSVPParsingException {
383         final SessionAttributeLspRaObjectParser parser = new SessionAttributeLspRaObjectParser();
384         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
385             ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C1, 4, TEObjectUtil.TE_LSP_SESSION_C1
386                 .length - 4)));
387
388         final ByteBuf output = Unpooled.buffer();
389         parser.serializeObject(obj, output);
390         assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C1, ByteArray.getAllBytes(output));
391     }
392
393     @Test
394     public void testSessionAttributeParser7() throws RSVPParsingException {
395         final SessionAttributeLspObjectParser parser = new SessionAttributeLspObjectParser();
396         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
397             ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C7, 4, TEObjectUtil.TE_LSP_SESSION_C7
398                 .length - 4)));
399
400         final ByteBuf output = Unpooled.buffer();
401         parser.serializeObject(obj, output);
402         assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C7, ByteArray.getAllBytes(output));
403     }
404 }