use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class SrEroSubobjectParserTest method testSrEroSubobjectIpv6NodeIdNAI.
@Test
public void testSrEroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder().setNaiType(NaiType.Ipv6NodeId).setSid(Uint32.valueOf(123456)).setCFlag(false).setMFlag(false).setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv6AddressNoZone("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV6_NODEID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV6_NODEID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectIpv6NodeIdNAI.
@Test
public void testSrRroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder().setNaiType(NaiType.Ipv6NodeId).setCFlag(false).setMFlag(false).setSid(Uint32.valueOf(123456)).setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv6AddressNoZone("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(SR_RROR_SUBOBJECT_WITH_IPV6_NODEID, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RROR_SUBOBJECT_WITH_IPV6_NODEID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class SrObjectParserTest method testSrEroSerializerWithUpdateLspAugmentation.
@Test
public void testSrEroSerializerWithUpdateLspAugmentation() throws PCEPDeserializerException {
final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
final EroBuilder builder = new EroBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder srEroSubBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder().setCFlag(false).setMFlag(false).setNaiType(NaiType.Ipv4NodeId).setSid(Uint32.valueOf(123456)).setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroSubBuilder.build()).setLoose(false);
builder.setSubobject(Lists.newArrayList(subobjBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
parser.serializeObject(builder.build(), buffer);
assertArrayEquals(SR_ERO_OBJECT_BYTES, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class PEDistinguisherLabelsAttributeHandlerTest method buildPEDistinguisherLabelsAttributAttribute.
private static Attributes buildPEDistinguisherLabelsAttributAttribute() {
final List<PeDistinguisherLabelAttribute> peAtt = new ArrayList<>(2);
peAtt.add(new PeDistinguisherLabelAttributeBuilder().setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.1"))).setMplsLabel(new MplsLabel(Uint32.ONE)).build());
peAtt.add(new PeDistinguisherLabelAttributeBuilder().setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.2"))).setMplsLabel(new MplsLabel(Uint32.TWO)).build());
return new AttributesBuilder().addAugmentation(new PeDistinguisherLabelsAttributeAugmentationBuilder().setPeDistinguisherLabelsAttribute(new PeDistinguisherLabelsAttributeBuilder().setPeDistinguisherLabelAttribute(peAtt).build()).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class IPAddressesAndPrefixesTest method testToInetSocketAddress.
@Test
public void testToInetSocketAddress() {
final InetSocketAddress isa = Ipv4Util.toInetSocketAddress(new IpAddressNoZone(new Ipv4AddressNoZone("123.42.13.8")), new PortNumber(Uint16.TEN));
assertEquals(10, isa.getPort());
assertEquals("123.42.13.8", InetAddresses.toAddrString(isa.getAddress()));
final InetSocketAddress isa2 = Ipv4Util.toInetSocketAddress(new IpAddressNoZone(new Ipv6AddressNoZone("2001:db8:1:2::")), new PortNumber(Uint16.TEN));
assertEquals(10, isa2.getPort());
assertEquals("2001:db8:1:2::", InetAddresses.toAddrString(isa2.getAddress()));
}
Aggregations