Search in sources :

Example 6 with Ipv6NextHopCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder in project bgpcep by opendaylight.

the class NextHopUtilTest method testSerializeNextHop.

@Test
public void testSerializeNextHop() {
    CNextHop hop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(IPV4).build()).build();
    final ByteBuf buffer = Unpooled.buffer();
    NextHopUtil.serializeNextHop(hop, buffer);
    assertArrayEquals(IPV4B, ByteArray.readAllBytes(buffer));
    hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(IPV6).build()).build();
    buffer.clear();
    NextHopUtil.serializeNextHop(hop, buffer);
    assertArrayEquals(IPV6B, ByteArray.readAllBytes(buffer));
    hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(IPV6).setLinkLocal(IPV6L).build()).build();
    buffer.clear();
    NextHopUtil.serializeNextHop(hop, buffer);
    assertArrayEquals(IPV6LB, ByteArray.readAllBytes(buffer));
    buffer.clear();
    hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setLinkLocal(IPV6L).build()).build();
    buffer.clear();
    try {
        NextHopUtil.serializeNextHop(hop, buffer);
        fail("Exception should happen");
    } catch (final IllegalArgumentException e) {
        assertEquals("Ipv6 Next Hop is missing Global address.", e.getMessage());
    }
}
Also used : Ipv4NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder) Ipv6NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder) Ipv4NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder) CNextHop(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.CNextHop) ByteBuf(io.netty.buffer.ByteBuf) Ipv6NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder) Test(org.junit.Test)

Example 7 with Ipv6NextHopCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder in project bgpcep by opendaylight.

the class NextHopParserSerializerTest method testSerializeIpv6LinkNextHopCase.

@Test
public void testSerializeIpv6LinkNextHopCase() throws BGPParsingException {
    this.hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(IPV6).setLinkLocal(IPV6L).build()).build();
    this.buffer.clear();
    this.ipv6NextHopParserSerializer.serializeNextHop(this.hop, this.buffer);
    assertArrayEquals(IPV6LB, ByteArray.readAllBytes(this.buffer));
    final CNextHop parsedHop = this.ipv6NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(IPV6LB));
    assertTrue(parsedHop instanceof Ipv6NextHopCase);
    assertEquals(this.hop, parsedHop);
}
Also used : Ipv6NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder) CNextHop(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.CNextHop) Ipv6NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder) Ipv6NextHopCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase) Test(org.junit.Test)

Aggregations

Ipv6NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder)7 Ipv6NextHopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder)7 Test (org.junit.Test)5 CNextHop (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.CNextHop)5 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)4 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)3 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder)3 Ipv4NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder)3 Ipv6NextHopCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase)3 Ipv4NextHopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)2 DestinationIpv6Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.prefixes.DestinationIpv6Builder)2 Ipv6PrefixesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.prefixes.destination.ipv6.Ipv6PrefixesBuilder)2 DestinationIpv6CaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6CaseBuilder)2 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder)2 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)2 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder)2