Search in sources :

Example 1 with RedirectIpv4Builder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder in project bgpcep by opendaylight.

the class RedirectIpv4EcHandler method parseExtendedCommunity.

@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
    final RedirectIpv4Builder builder = new RedirectIpv4Builder();
    builder.setGlobalAdministrator(Ipv4Util.addressForByteBuf(buffer));
    builder.setLocalAdministrator(buffer.readUnsignedShort());
    return new RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(builder.build()).build();
}
Also used : RedirectIpv4ExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder) RedirectIpv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.redirect.ipv4.extended.community.RedirectIpv4Builder)

Example 2 with RedirectIpv4Builder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testRedirectIpv4Parser.

@Test
public void testRedirectIpv4Parser() throws BGPDocumentedException, BGPParsingException {
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(new RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4AddressNoZone("127.0.0.1")).setLocalAdministrator(Uint16.valueOf(126)).build()).build()).setTransitive(true).build();
    final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_IPV4));
    Assert.assertEquals(expected, parsed);
}
Also used : RedirectIpv4ExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) RedirectIpv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) Test(org.junit.Test)

Example 3 with RedirectIpv4Builder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testredirectIpv4Serializer.

@Test
public void testredirectIpv4Serializer() throws BGPDocumentedException, BGPParsingException {
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4AddressNoZone("127.0.0.1")).setLocalAdministrator(Uint16.valueOf(126)).build()).build()).setTransitive(true).build();
    final ByteBuf output = Unpooled.buffer(REDIRECT_IPV4.length);
    this.registry.serializeExtendedCommunity(expected, output);
    Assert.assertArrayEquals(REDIRECT_IPV4, output.array());
}
Also used : Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) ByteBuf(io.netty.buffer.ByteBuf) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) RedirectIpv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)2 RedirectIpv4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ipv4.extended.community.RedirectIpv4Builder)2 ExtendedCommunities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities)2 ExtendedCommunitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 RedirectIpv4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.redirect.ipv4.extended.community.RedirectIpv4Builder)1 RedirectIpv4ExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder)1 RedirectIpv4ExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder)1