9f4e127216c409b95712712ce57a1282b5787449
[bgpcep.git] / pcep / impl / src / test / java / org / opendaylight / protocol / pcep / impl / PCEPTlvParserTest.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.protocol.pcep.impl;
9
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12
13 import java.util.List;
14
15 import org.junit.Test;
16 import org.opendaylight.protocol.concepts.Ipv4Util;
17 import org.opendaylight.protocol.concepts.Ipv6Util;
18 import org.opendaylight.protocol.pcep.impl.tlv.LSPIdentifierTlvParser;
19 import org.opendaylight.protocol.pcep.impl.tlv.LspDbVersionTlvParser;
20 import org.opendaylight.protocol.pcep.impl.tlv.LspSymbolicNameTlvParser;
21 import org.opendaylight.protocol.pcep.impl.tlv.LspUpdateErrorTlvParser;
22 import org.opendaylight.protocol.pcep.impl.tlv.NoPathVectorTlvParser;
23 import org.opendaylight.protocol.pcep.impl.tlv.OFListTlvParser;
24 import org.opendaylight.protocol.pcep.impl.tlv.OrderTlvParser;
25 import org.opendaylight.protocol.pcep.impl.tlv.OverloadedDurationTlvParser;
26 import org.opendaylight.protocol.pcep.impl.tlv.PCEStatefulCapabilityTlvParser;
27 import org.opendaylight.protocol.pcep.impl.tlv.PredundancyGroupTlvParser;
28 import org.opendaylight.protocol.pcep.impl.tlv.RSVPErrorSpecTlvParser;
29 import org.opendaylight.protocol.pcep.impl.tlv.ReqMissingTlvParser;
30 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NoPathVectorTlv;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OfId;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersion;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersionBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.error.code.tlv.LspErrorCode;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.error.code.tlv.LspErrorCodeBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.LspIdentifiers;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.LspIdentifiersBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4CaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6CaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6Builder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfList;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfListBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.OrderBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDurationBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.tlvs.NoPathVectorBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.predundancy.group.id.tlv.PredundancyGroupId;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.RsvpErrorSpec;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.RsvpErrorSpecBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.rsvp.error.spec.error.type.RsvpCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.rsvp.error.spec.error.type.UserCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.rsvp.error.spec.error.type.rsvp._case.RsvpErrorBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.rsvp.error.spec.error.type.user._case.UserErrorBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.StatefulBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathName;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathNameBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.Ipv4ExtendedTunnelId;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.Ipv6ExtendedTunnelId;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.LspId;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.TunnelId;
71
72 import com.google.common.collect.Lists;
73 import com.google.common.primitives.UnsignedLong;
74
75 public class PCEPTlvParserTest {
76
77         private static final byte[] statefulBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02 };
78         private static final byte[] DbVersionBytes = { (byte) 0xff, (byte) 0x00, (byte) 0xff, (byte) 0xaa, (byte) 0xb2, (byte) 0xf5,
79                         (byte) 0xf2, (byte) 0xcf };
80         private static final byte[] noPathVectorBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xa7 };
81         private static final byte[] overloadedBytes = { (byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff };
82         private static final byte[] symbolicNameBytes = { (byte) 0x4d, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x65,
83                         (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x6d,
84                         (byte) 0x62, (byte) 0x6f, (byte) 0x6c, (byte) 0x69, (byte) 0x63, (byte) 0x20, (byte) 0x6e, (byte) 0x61, (byte) 0x6d,
85                         (byte) 0x65 };
86         private static final byte[] lspUpdateErrorBytes = { (byte) 0x25, (byte) 0x68, (byte) 0x95, (byte) 0x03 };
87         private static final byte[] lspIdentifiers4Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0xFF, (byte) 0xFF,
88                         (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
89         private static final byte[] lspIdentifiers6Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC,
90                         (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
91                         (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0xFF, (byte) 0xFF, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
92                         (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x01,
93                         (byte) 0x23, (byte) 0x45, (byte) 0x67 };
94         private static final byte[] rsvpErrorBytes = { (byte) 0x06, (byte) 0x01, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
95                         (byte) 0x02, (byte) 0x92, (byte) 0x16, (byte) 0x02 };
96         private static final byte[] rsvpError6Bytes = { (byte) 0x06, (byte) 0x02, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
97                         (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a,
98                         (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x02, (byte) 0xd5, (byte) 0xc5, (byte) 0xd9 };
99         private static final byte[] userErrorBytes = { (byte) 0xc2, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x39,
100                         (byte) 0x05, (byte) 0x09, (byte) 0x00, (byte) 0x26, (byte) 0x75, (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x20,
101                         (byte) 0x64, (byte) 0x65, (byte) 0x73, (byte) 0x63 };
102         private static final byte[] reqMissingBytes = { (byte) 0xF7, (byte) 0x82, (byte) 0x35, (byte) 0x17 };
103         private static final byte[] orderBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00, (byte) 0x00,
104                         (byte) 0x01 };
105         private static final byte[] ofListBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
106         private static final byte[] predundancyBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
107
108         @Test
109         public void testStatefulTlv() throws PCEPDeserializerException {
110                 final PCEStatefulCapabilityTlvParser parser = new PCEStatefulCapabilityTlvParser();
111                 final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.FALSE).setIncludeDbVersion(Boolean.TRUE).build();
112                 assertEquals(tlv, parser.parseTlv(statefulBytes));
113                 assertArrayEquals(statefulBytes, parser.serializeTlv(tlv));
114         }
115
116         @Test
117         public void testStateDbVersionTlv() throws PCEPDeserializerException {
118                 final LspDbVersionTlvParser parser = new LspDbVersionTlvParser();
119                 final LspDbVersion tlv = new LspDbVersionBuilder().setVersion(UnsignedLong.fromLongBits(0xFF00FFAAB2F5F2CFL).bigIntegerValue()).build();
120                 assertEquals(tlv, parser.parseTlv(DbVersionBytes));
121                 assertArrayEquals(DbVersionBytes, parser.serializeTlv(tlv));
122         }
123
124         @Test
125         public void testNoPathVectorTlv() throws PCEPDeserializerException {
126                 final NoPathVectorTlvParser parser = new NoPathVectorTlvParser();
127                 final NoPathVectorTlv tlv = new NoPathVectorBuilder().setFlags(
128                                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NoPathVectorTlv.Flags(false, true, false, true, false, true, true, true)).build();
129                 assertEquals(tlv, parser.parseTlv(noPathVectorBytes));
130                 assertArrayEquals(noPathVectorBytes, parser.serializeTlv(tlv));
131         }
132
133         @Test
134         public void testOverloadedDurationTlv() throws PCEPDeserializerException {
135                 final OverloadedDurationTlvParser parser = new OverloadedDurationTlvParser();
136                 final OverloadDuration tlv = new OverloadDurationBuilder().setDuration(0x7FFFFFFFL).build();
137                 assertEquals(tlv, parser.parseTlv(overloadedBytes));
138                 assertArrayEquals(overloadedBytes, parser.serializeTlv(tlv));
139         }
140
141         @Test
142         public void testSymbolicNameTlv() throws PCEPDeserializerException {
143                 final LspSymbolicNameTlvParser parser = new LspSymbolicNameTlvParser();
144                 final SymbolicPathName tlv = new SymbolicPathNameBuilder().setPathName(
145                                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SymbolicPathName("Med test of symbolic name".getBytes())).build();
146                 assertEquals(tlv, parser.parseTlv(symbolicNameBytes));
147                 assertArrayEquals(symbolicNameBytes, parser.serializeTlv(tlv));
148         }
149
150         @Test
151         public void testLspErrorCodeTlv() throws PCEPDeserializerException {
152                 final LspUpdateErrorTlvParser parser = new LspUpdateErrorTlvParser();
153                 final LspErrorCode tlv = new LspErrorCodeBuilder().setErrorCode(627610883L).build();
154                 assertEquals(tlv, parser.parseTlv(lspUpdateErrorBytes));
155                 assertArrayEquals(lspUpdateErrorBytes, parser.serializeTlv(tlv));
156         }
157
158         @Test
159         public void testLspIdentifiers4Tlv() throws PCEPDeserializerException {
160                 final LSPIdentifierTlvParser parser = new LSPIdentifierTlvParser();
161                 final Ipv4Builder afi = new Ipv4Builder();
162                 afi.setIpv4TunnelSenderAddress(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }));
163                 afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
164                                 (byte) 0x78 })));
165                 final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(
166                                 new LspId(65535L)).setTunnelId(new TunnelId(4660)).build();
167                 assertEquals(tlv, parser.parseTlv(lspIdentifiers4Bytes));
168                 assertArrayEquals(lspIdentifiers4Bytes, parser.serializeTlv(tlv));
169         }
170
171         @Test
172         public void testLspIdentifiers6Tlv() throws PCEPDeserializerException {
173                 final LSPIdentifierTlvParser parser = new LSPIdentifierTlvParser();
174                 final Ipv6Builder afi = new Ipv6Builder();
175                 afi.setIpv6TunnelSenderAddress(Ipv6Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
176                                 (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A,
177                                 (byte) 0xBC, (byte) 0xDE, (byte) 0xF0 }));
178                 afi.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
179                                 (byte) 0x78, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67,
180                                 (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67 })));
181                 final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv6CaseBuilder().setIpv6(afi.build()).build()).setLspId(
182                                 new LspId(4660L)).setTunnelId(new TunnelId(65535)).build();
183                 assertEquals(tlv, parser.parseTlv(lspIdentifiers6Bytes));
184                 assertArrayEquals(lspIdentifiers6Bytes, parser.serializeTlv(tlv));
185         }
186
187         @Test
188         public void testRSVPError4SpecTlv() throws PCEPDeserializerException {
189                 final RSVPErrorSpecTlvParser parser = new RSVPErrorSpecTlvParser();
190                 final RsvpErrorBuilder builder = new RsvpErrorBuilder();
191                 builder.setNode(new IpAddress(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
192                 builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.ErrorSpec.Flags(false, true));
193                 builder.setCode((short) 146);
194                 builder.setValue(5634);
195                 final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
196                 assertEquals(tlv, parser.parseTlv(rsvpErrorBytes));
197                 assertArrayEquals(rsvpErrorBytes, parser.serializeTlv(tlv));
198         }
199
200         @Test
201         public void testRSVPError6SpecTlv() throws PCEPDeserializerException {
202                 final RSVPErrorSpecTlvParser parser = new RSVPErrorSpecTlvParser();
203                 final RsvpErrorBuilder builder = new RsvpErrorBuilder();
204                 builder.setNode(new IpAddress(Ipv6Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
205                                 (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a,
206                                 (byte) 0xbc, (byte) 0xde, (byte) 0xf0 })));
207                 builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.ErrorSpec.Flags(false, true));
208                 builder.setCode((short) 213);
209                 builder.setValue(50649);
210                 final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
211                 assertEquals(tlv, parser.parseTlv(rsvpError6Bytes));
212                 assertArrayEquals(rsvpError6Bytes, parser.serializeTlv(tlv));
213         }
214
215         @Test
216         public void testUserErrorSpecTlv() throws PCEPDeserializerException {
217                 final RSVPErrorSpecTlvParser parser = new RSVPErrorSpecTlvParser();
218                 final UserErrorBuilder builder = new UserErrorBuilder();
219                 builder.setEnterprise(new EnterpriseNumber(12345L));
220                 builder.setSubOrg((short) 5);
221                 builder.setValue(38);
222                 builder.setDescription("user desc");
223                 final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new UserCaseBuilder().setUserError(builder.build()).build()).build();
224                 assertEquals(tlv, parser.parseTlv(userErrorBytes));
225                 assertArrayEquals(userErrorBytes, parser.serializeTlv(tlv));
226         }
227
228         @Test
229         public void testReqMissingTlv() throws PCEPDeserializerException {
230                 final ReqMissingTlvParser parser = new ReqMissingTlvParser();
231                 final ReqMissing tlv = new ReqMissingBuilder().setRequestId(new RequestId(0xF7823517L)).build();
232                 assertEquals(tlv, parser.parseTlv(reqMissingBytes));
233                 assertArrayEquals(reqMissingBytes, parser.serializeTlv(tlv));
234         }
235
236         @Test
237         public void testOrderTlv() throws PCEPDeserializerException {
238                 final OrderTlvParser parser = new OrderTlvParser();
239                 final Order tlv = new OrderBuilder().setDelete(0xFFFFFFFFL).setSetup(0x00000001L).build();
240                 assertEquals(tlv, parser.parseTlv(orderBytes));
241                 assertArrayEquals(orderBytes, parser.serializeTlv(tlv));
242         }
243
244         @Test
245         public void testOFListTlv() throws PCEPDeserializerException {
246                 final OFListTlvParser parser = new OFListTlvParser();
247                 final List<OfId> ids = Lists.newArrayList();
248                 ids.add(new OfId(0x1234));
249                 ids.add(new OfId(0x5678));
250                 final OfList tlv = new OfListBuilder().setCodes(ids).build();
251                 assertEquals(tlv, parser.parseTlv(ofListBytes));
252                 assertArrayEquals(ofListBytes, parser.serializeTlv(tlv));
253         }
254
255         @Test
256         public void testPredundancyTlv() throws PCEPDeserializerException {
257                 final PredundancyGroupTlvParser parser = new PredundancyGroupTlvParser();
258                 final PredundancyGroupId tlv = new PredundancyGroupIdBuilder().setIdentifier(predundancyBytes).build();
259                 assertEquals(tlv, parser.parseTlv(predundancyBytes));
260                 assertArrayEquals(predundancyBytes, parser.serializeTlv(tlv));
261         }
262 }