use of org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07RSVPErrorSpecTlvParser in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testUserErrorSpecTlv.
@Test
public void testUserErrorSpecTlv() throws PCEPDeserializerException {
final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
final UserErrorBuilder builder = new UserErrorBuilder();
builder.setEnterprise(new EnterpriseNumber(12345L));
builder.setSubOrg((short) 5);
builder.setValue(38);
builder.setDescription("user desc");
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new UserCaseBuilder().setUserError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(userErrorBytes, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(userErrorBytes, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07RSVPErrorSpecTlvParser in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testRSVPError6SpecTlv.
@Test
public void testRSVPError6SpecTlv() throws PCEPDeserializerException {
final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
final RsvpErrorBuilder builder = new RsvpErrorBuilder();
builder.setNode(new IpAddress(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0 }))));
builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true));
builder.setCode((short) 213);
builder.setValue(50649);
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(rsvpError6Bytes, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(rsvpError6Bytes, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07RSVPErrorSpecTlvParser in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testRSVPError4SpecTlv.
@Test
public void testRSVPError4SpecTlv() throws PCEPDeserializerException {
final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
final RsvpErrorBuilder builder = new RsvpErrorBuilder();
builder.setNode(new IpAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true));
builder.setCode((short) 146);
builder.setValue(5634);
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(rsvpErrorBytes, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(rsvpErrorBytes, ByteArray.getAllBytes(buff));
}
Aggregations