Search in sources :

Example 1 with LeafADRouteKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.LeafADRouteKey in project bgpcep by opendaylight.

the class LeafADHandler method serializeBody.

@Override
protected ByteBuf serializeBody(final LeafADCase mvpn) {
    final LeafAD leaf = mvpn.getLeafAD();
    final ByteBuf nlriByteBuf = Unpooled.buffer();
    final LeafADRouteKey key = leaf.getLeafADRouteKey();
    final MvpnChoice keyCase;
    if (key instanceof InterAsIPmsiADCase) {
        keyCase = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.InterAsIPmsiADCaseBuilder((InterAsIPmsiADCase) key).build();
    } else {
        keyCase = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.SPmsiADCaseBuilder((SPmsiADCase) key).build();
    }
    nlriByteBuf.writeBytes(SimpleMvpnNlriRegistry.getInstance().serializeMvpn(keyCase));
    final ByteBuf orig = IpAddressUtil.bytesWOLengthFor(leaf.getOrigRouteIp());
    checkArgument(orig.readableBytes() > 0);
    nlriByteBuf.writeBytes(orig);
    return nlriByteBuf;
}
Also used : InterAsIPmsiADCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.InterAsIPmsiADCase) InterAsIPmsiADCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.InterAsIPmsiADCaseBuilder) LeafAD(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.LeafAD) ByteBuf(io.netty.buffer.ByteBuf) LeafADRouteKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.LeafADRouteKey) SPmsiADCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.SPmsiADCaseBuilder) MvpnChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice)

Example 2 with LeafADRouteKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.LeafADRouteKey in project bgpcep by opendaylight.

the class LeafADHandler method parseMvpn.

@Override
public LeafADCase parseMvpn(final ByteBuf buffer) {
    final NlriType type = NlriType.forValue(buffer.readUnsignedByte());
    final short length = buffer.readUnsignedByte();
    final MvpnChoice key = SimpleMvpnNlriRegistry.getInstance().parseMvpn(type, buffer.readSlice(length));
    final LeafADRouteKey routeKey;
    if (type == NlriType.InterAsIPmsiAD) {
        routeKey = new InterAsIPmsiADCaseBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.InterAsIPmsiADCase) key).build();
    } else {
        routeKey = new SPmsiADCaseBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.SPmsiADCase) key).build();
    }
    return new LeafADCaseBuilder().setLeafAD(new LeafADBuilder().setLeafADRouteKey(routeKey).setOrigRouteIp(IpAddressUtil.addressForByteBufWOLength(buffer)).build()).build();
}
Also used : InterAsIPmsiADCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.InterAsIPmsiADCaseBuilder) LeafADBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.LeafADBuilder) LeafADRouteKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.LeafADRouteKey) LeafADCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.LeafADCaseBuilder) NlriType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType) SPmsiADCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.SPmsiADCaseBuilder) MvpnChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice)

Aggregations

LeafADRouteKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.LeafADRouteKey)2 InterAsIPmsiADCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.InterAsIPmsiADCaseBuilder)2 SPmsiADCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.SPmsiADCaseBuilder)2 MvpnChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice)2 ByteBuf (io.netty.buffer.ByteBuf)1 NlriType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType)1 LeafAD (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.LeafAD)1 LeafADBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.LeafADBuilder)1 InterAsIPmsiADCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.leaf.a.d.grouping.leaf.a.d.leaf.a.d.route.key.InterAsIPmsiADCase)1 LeafADCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.LeafADCaseBuilder)1