Search in sources :

Example 16 with ExtendedCommunitiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testredirectIpv6NhSerializer.

@Test
public void testredirectIpv6NhSerializer() 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.RedirectIpNhExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(new RedirectIpNhExtendedCommunityBuilder().setNextHopAddress(new IpAddressNoZone(new Ipv6AddressNoZone("2001::1"))).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
    final ByteBuf output = Unpooled.buffer(REDIRECT_NH_IPV6.length);
    this.registry.serializeExtendedCommunity(expected, output);
    Assert.assertArrayEquals(REDIRECT_NH_IPV6, output.array());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Ipv6AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone) RedirectIpNhExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ip.nh.extended.community.RedirectIpNhExtendedCommunityBuilder) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) IpAddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) RedirectIpNhExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder) Test(org.junit.Test)

Example 17 with ExtendedCommunitiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder 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)

Example 18 with ExtendedCommunitiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testTrafficMarkingParser.

@Test
public void testTrafficMarkingParser() throws BGPDocumentedException, BGPParsingException {
    final TrafficMarkingExtendedCommunityCase trafficMarking = new TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(new TrafficMarkingExtendedCommunityBuilder().setGlobalAdministrator(new Dscp(Uint8.valueOf(63))).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficMarking).setTransitive(true).build();
    final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(TRAFFIC_MARKING));
    Assert.assertEquals(expected, parsed);
}
Also used : TrafficMarkingExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder) TrafficMarkingExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder) TrafficMarkingExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCase) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) Dscp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) Test(org.junit.Test)

Example 19 with ExtendedCommunitiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testRedirect2bParser.

@Test
public void testRedirect2bParser() throws BGPDocumentedException, BGPParsingException {
    final RedirectExtendedCommunityCase redirect = new RedirectExtendedCommunityCaseBuilder().setRedirectExtendedCommunity(new RedirectExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(35))).setLocalAdministrator(new byte[] { 4, 2, 8, 7 }).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
    final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_2BYTES));
    Assert.assertEquals(expected, parsed);
}
Also used : RedirectExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectExtendedCommunityCase) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities) RedirectExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectExtendedCommunityCaseBuilder) ShortAsNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ShortAsNumber) RedirectExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.extended.community.RedirectExtendedCommunityBuilder) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder) Test(org.junit.Test)

Example 20 with ExtendedCommunitiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder 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

ExtendedCommunitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunitiesBuilder)30 Test (org.junit.Test)27 ExtendedCommunities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities)24 ByteBuf (io.netty.buffer.ByteBuf)13 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)8 ShortAsNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ShortAsNumber)6 RouteAttributeContainer (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer)5 Statement (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement)5 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)5 IPV4UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST)4 IpAddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone)4 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)4 RedirectIpNhExtendedCommunityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ip.nh.extended.community.RedirectIpNhExtendedCommunityBuilder)4 RedirectIpNhExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder)4 As4SpecificCommonBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.as._4.spec.common.As4SpecificCommonBuilder)4 As4RouteOriginExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.As4RouteOriginExtendedCommunityCaseBuilder)4 ArrayList (java.util.ArrayList)3 As4RouteOriginExtendedCommunityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.as._4.route.origin.extended.community._case.As4RouteOriginExtendedCommunityBuilder)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)2 Dscp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp)2