import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv6ExtendedTunnelId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class PCEPTlvParserTest {
@Test
public void testLspErrorCodeTlv() throws PCEPDeserializerException {
final Stateful07LspUpdateErrorTlvParser parser = new Stateful07LspUpdateErrorTlvParser();
- final LspErrorCode tlv = new LspErrorCodeBuilder().setErrorCode(627610883L).build();
+ 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);
public void testLspIdentifiers4Tlv() throws PCEPDeserializerException {
final Stateful07LSPIdentifierIpv4TlvParser parser = new Stateful07LSPIdentifierIpv4TlvParser();
final Ipv4Builder afi = new Ipv4Builder();
- afi.setIpv4TunnelSenderAddress(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(
+ afi.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(
new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
- afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.noZoneAddressForByteBuf(
+ afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForByteBuf(
Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
- afi.setIpv4TunnelEndpointAddress(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(
+ afi.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(
new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(
- new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(new LspId(65535L))
- .setTunnelId(new TunnelId(4660)).build();
+ new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(new LspId(Uint32.valueOf(65535)))
+ .setTunnelId(new TunnelId(Uint16.valueOf(4660))).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(LSP_IDENTIFIERS4_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
public void testLspIdentifiers6Tlv() throws PCEPDeserializerException {
final Stateful07LSPIdentifierIpv6TlvParser parser = new Stateful07LSPIdentifierIpv6TlvParser();
final Ipv6Builder afi = new Ipv6Builder();
- afi.setIpv6TunnelSenderAddress(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(
+ 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.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(
+ 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.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(
+ 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,
})));
final LspIdentifiers tlv = new LspIdentifiersBuilder()
.setAddressFamily(new Ipv6CaseBuilder().setIpv6(afi.build()).build())
- .setLspId(new LspId(4660L)).setTunnelId(new TunnelId(65535)).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);
@Test
public void testRSVPError4SpecTlv() throws PCEPDeserializerException {
final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
- final RsvpErrorBuilder builder = new RsvpErrorBuilder();
- builder.setNode(new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(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 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))));
@Test
public void testRSVPError6SpecTlv() throws PCEPDeserializerException {
final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
- final RsvpErrorBuilder builder = new RsvpErrorBuilder();
- builder.setNode(new IpAddressNoZone(Ipv6Util.noZoneAddressForByteBuf(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 RsvpErrorBuilder builder = new RsvpErrorBuilder()
+ .setNode(new IpAddressNoZone(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
+ }))))
+ .setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec
+ .Flags(false, true))
+ .setCode(Uint8.valueOf(213))
+ .setValue(Uint16.valueOf(50649));
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder()
.setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(RSVP_ERROR6_BYTES, 4))));
@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 UserErrorBuilder builder = new UserErrorBuilder()
+ .setEnterprise(new EnterpriseNumber(Uint32.valueOf(12345)))
+ .setSubOrg(Uint8.valueOf(5))
+ .setValue(Uint16.valueOf(38))
+ .setDescription("user desc");
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder()
.setErrorType(new UserCaseBuilder().setUserError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(USER_ERROR_BYTES, 4))));
};
final PathBindingTlvParser parser = new PathBindingTlvParser();
final PathBindingBuilder builder = new PathBindingBuilder();
- builder.setBindingTypeValue(new MplsLabelBuilder().setMplsLabel(new MplsLabel(688_374L)).build());
+ builder.setBindingTypeValue(new MplsLabelBuilder().setMplsLabel(new MplsLabel(Uint32.valueOf(688374))).build());
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(builder.build(), buff);
assertArrayEquals(pathBindingBytes, ByteArray.readAllBytes(buff));
};
final PathBindingTlvParser parser = new PathBindingTlvParser();
final PathBindingBuilder builder = new PathBindingBuilder();
- builder.setBindingTypeValue(
- new MplsLabelEntryBuilder()
- .setTrafficClass((short) 6)
- .setTimeToLive((short) 173)
+ builder.setBindingTypeValue(new MplsLabelEntryBuilder()
+ .setTrafficClass(Uint8.valueOf(6))
+ .setTimeToLive(Uint8.valueOf(173))
.setBottomOfStack(true)
- .setLabel(new MplsLabel(688_374L)).build());
+ .setLabel(new MplsLabel(Uint32.valueOf(688374))).build());
final PathBinding tlv = builder.build();
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);