use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testStatefulTlvSyncOptimizationExtension.
@Test
public void testStatefulTlvSyncOptimizationExtension() throws PCEPDeserializerException {
final SyncOptimizationsCapabilityTlvParser parser = new SyncOptimizationsCapabilityTlvParser();
final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Stateful1Builder().setTriggeredInitialSync(Boolean.TRUE).setDeltaLspSyncCapability(Boolean.TRUE).setIncludeDbVersion(Boolean.TRUE).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(STATEFUL_SYNC_OPT_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(STATEFUL_SYNC_OPT_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testRSVPError4SpecTlv.
@Test
public void testRSVPError4SpecTlv() throws PCEPDeserializerException {
final StatefulRSVPErrorSpecTlvParser parser = new StatefulRSVPErrorSpecTlvParser();
final RsvpErrorBuilder builder = new RsvpErrorBuilder().setNode(new IpAddressNoZone(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })))).setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true)).setCode(Uint8.valueOf(146)).setValue(Uint16.valueOf(5634));
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(RSVP_ERROR_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(RSVP_ERROR_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testLspIdentifiers6Tlv.
@Test
public void testLspIdentifiers6Tlv() throws PCEPDeserializerException {
final StatefulLSPIdentifierIpv6TlvParser parser = new StatefulLSPIdentifierIpv6TlvParser();
final Ipv6Builder afi = new Ipv6Builder();
afi.setIpv6TunnelSenderAddress(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 })));
afi.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67 }))));
afi.setIpv6TunnelEndpointAddress(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 })));
final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv6CaseBuilder().setIpv6(afi.build()).build()).setLspId(new LspId(Uint32.valueOf(4660))).setTunnelId(new TunnelId(Uint16.MAX_VALUE)).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(LSP_IDENTIFIERS6_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(LSP_IDENTIFIERS6_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testPathBindingTlvMplsLabelEntry.
@Test
public void testPathBindingTlvMplsLabelEntry() {
final byte[] pathBindingBytes = { 0x00, 0x1f, 0x00, 0x06, 0x00, 0x01, (byte) 0xA8, (byte) 0x0F, (byte) 0x6D, (byte) 0xAD, 0x00, 0x00 };
final PathBindingTlvParser parser = new PathBindingTlvParser();
final PathBindingBuilder builder = new PathBindingBuilder();
builder.setBindingTypeValue(new MplsLabelEntryBuilder().setTrafficClass(Uint8.valueOf(6)).setTimeToLive(Uint8.valueOf(173)).setBottomOfStack(true).setLabel(new MplsLabel(Uint32.valueOf(688374))).build());
final PathBinding tlv = builder.build();
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(pathBindingBytes, ByteArray.readAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testLspErrorCodeTlv.
@Test
public void testLspErrorCodeTlv() throws PCEPDeserializerException {
final StatefulLspUpdateErrorTlvParser parser = new StatefulLspUpdateErrorTlvParser();
final LspErrorCode tlv = new LspErrorCodeBuilder().setErrorCode(Uint32.valueOf(627610883)).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(LSP_UPDATE_ERROR_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(LSP_UPDATE_ERROR_BYTES, ByteArray.getAllBytes(buff));
}
Aggregations