Search in sources :

Example 1 with RedirectAs4Builder

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

the class FSExtendedCommunitiesTest method testredirect4bSerializer.

@Test
public void testredirect4bSerializer() throws BGPDocumentedException, BGPParsingException {
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(Uint32.valueOf(6548))).setLocalAdministrator(Uint16.valueOf(126)).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
    final ByteBuf output = Unpooled.buffer(REDIRECT_AS_4BYTES.length);
    this.registry.serializeExtendedCommunity(expected, output);
    Assert.assertArrayEquals(REDIRECT_AS_4BYTES, output.array());
}
Also used : RedirectAs4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder) ByteBuf(io.netty.buffer.ByteBuf) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) ShortAsNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ShortAsNumber) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) RedirectAs4ExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder) Test(org.junit.Test)

Example 2 with RedirectAs4Builder

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

the class RedirectAsFourOctetEcHandler method parseExtendedCommunity.

@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
    final RedirectAs4Builder builder = new RedirectAs4Builder();
    builder.setGlobalAdministrator(new AsNumber(buffer.readUnsignedInt()));
    builder.setLocalAdministrator(buffer.readUnsignedShort());
    return new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(builder.build()).build();
}
Also used : RedirectAs4ExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder) RedirectAs4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.redirect.as4.extended.community.RedirectAs4Builder) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)

Example 3 with RedirectAs4Builder

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

the class FSExtendedCommunitiesTest method testRedirect4bParser.

@Test
public void testRedirect4bParser() throws BGPDocumentedException, BGPParsingException {
    final RedirectAs4ExtendedCommunityCase redirect = new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(Uint32.valueOf(6548))).setLocalAdministrator(Uint16.valueOf(126)).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
    final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
    Assert.assertEquals(expected, parsed);
}
Also used : ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) RedirectAs4ExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder) RedirectAs4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder) RedirectAs4ExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase) ShortAsNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ShortAsNumber) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) Test(org.junit.Test)

Aggregations

AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)3 Test (org.junit.Test)2 RedirectAs4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder)2 RedirectAs4ExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder)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 ShortAsNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ShortAsNumber)2 ByteBuf (io.netty.buffer.ByteBuf)1 RedirectAs4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.redirect.as4.extended.community.RedirectAs4Builder)1 RedirectAs4ExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder)1 RedirectAs4ExtendedCommunityCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase)1