Search in sources :

Example 1 with VrfRouteImportExtendedCommunityCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCase in project bgpcep by opendaylight.

the class VrfRouteImportHandler method serializeExtendedCommunity.

@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
    Preconditions.checkArgument(extendedCommunity instanceof VrfRouteImportExtendedCommunityCase, "The extended community %s is not VrfRouteImportExtendedCommunityCase type.", extendedCommunity);
    final VrfRouteImportExtendedCommunity inet4SpecificExtendedCommunity = ((VrfRouteImportExtendedCommunityCase) extendedCommunity).getVrfRouteImportExtendedCommunity();
    serializeCommon(inet4SpecificExtendedCommunity.getInet4SpecificExtendedCommunityCommon(), byteAggregator);
}
Also used : VrfRouteImportExtendedCommunity(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.vrf.route._import.extended.community._case.VrfRouteImportExtendedCommunity) VrfRouteImportExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCase)

Example 2 with VrfRouteImportExtendedCommunityCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCase in project bgpcep by opendaylight.

the class VrfRouteImportHandlerTest method testHandler.

@Test
public void testHandler() {
    final VrfRouteImportExtendedCommunityCase expected = new VrfRouteImportExtendedCommunityCaseBuilder().setVrfRouteImportExtendedCommunity(new VrfRouteImportExtendedCommunityBuilder().setInet4SpecificExtendedCommunityCommon(new Inet4SpecificExtendedCommunityCommonBuilder().setGlobalAdministrator(new Ipv4AddressNoZone("12.51.2.5")).setLocalAdministrator(new byte[] { 21, 45 }).build()).build()).build();
    final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
    assertEquals(expected, exComm);
    final ByteBuf output = Unpooled.buffer(INPUT.length);
    this.handler.serializeExtendedCommunity(expected, output);
    Assert.assertArrayEquals(INPUT, output.array());
    assertEquals(11, this.handler.getSubType());
}
Also used : Inet4SpecificExtendedCommunityCommonBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.inet4.specific.extended.community.common.Inet4SpecificExtendedCommunityCommonBuilder) VrfRouteImportExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.vrf.route._import.extended.community._case.VrfRouteImportExtendedCommunityBuilder) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) VrfRouteImportExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCase) ExtendedCommunity(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.ExtendedCommunity) VrfRouteImportExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCaseBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

VrfRouteImportExtendedCommunityCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCase)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 ExtendedCommunity (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.ExtendedCommunity)1 VrfRouteImportExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.VrfRouteImportExtendedCommunityCaseBuilder)1 VrfRouteImportExtendedCommunity (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.vrf.route._import.extended.community._case.VrfRouteImportExtendedCommunity)1 VrfRouteImportExtendedCommunityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.vrf.route._import.extended.community._case.VrfRouteImportExtendedCommunityBuilder)1 Inet4SpecificExtendedCommunityCommonBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.inet4.specific.extended.community.common.Inet4SpecificExtendedCommunityCommonBuilder)1