Search in sources :

Example 1 with PathKeyCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.

the class RROPathKey128SubobjectParser method serializeSubobject.

public static void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
    final ByteBuf body = Unpooled.buffer();
    final PathKey pathKey = pk.getPathKey();
    checkArgument(pathKey != null, "PathKey is mandatory.");
    ByteBufUtils.write(body, pathKey.getValue());
    final PceId pceId = pk.getPceId();
    checkArgument(pceId != null, "PceId is mandatory.");
    body.writeBytes(pceId.getValue());
    RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) PathKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey) PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase) PceId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId)

Example 2 with PathKeyCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.

the class XROPathKey32SubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance. Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
    final ByteBuf body = Unpooled.buffer();
    checkArgument(pk.getPceId() != null, "PceId is mandatory.");
    final byte[] pceId = pk.getPceId().getValue();
    if (pceId.length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
        XROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
    }
    final PathKey pathKey = pk.getPathKey();
    checkArgument(pathKey != null, "PathKey is mandatory.");
    ByteBufUtils.write(body, pathKey.getValue());
    checkArgument(pceId.length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
    body.writeBytes(pceId);
    XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) PathKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey) PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase)

Example 3 with PathKeyCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.

the class RROPathKey128SubobjectParser method serializeSubobject.

public static void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
    RROSubobjectUtil.formatSubobject(TYPE, PathKeyUtils.serializePathKey(pkcase.getPathKey()), buffer);
}
Also used : PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase)

Example 4 with PathKeyCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.

the class EROPathKey32SubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance.Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
    final ByteBuf body = serializePathKey(pk);
    if (pk.getPceId().getValue().length == PCE_ID_F_LENGTH) {
        EROSubobjectUtil.formatSubobject(TYPE, subobject.getLoose(), body, buffer);
    } else if (pk.getPceId().getValue().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
        EROSubobjectUtil.formatSubobject(EROPathKey128SubobjectParser.TYPE, subobject.getLoose(), body, buffer);
    }
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase)

Example 5 with PathKeyCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.

the class RROPathKey32SubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance.Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
    final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
    final ByteBuf body = Unpooled.buffer();
    checkArgument(pk.getPceId() != null, "PceId is mandatory.");
    final byte[] pceId = pk.getPceId().getValue();
    if (pceId.length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
        RROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
    }
    final PathKey pathKey = pk.getPathKey();
    checkArgument(pathKey != null, "PathKey is mandatory.");
    checkArgument(pceId.length == PCE_ID_F_LENGTH, "PathKey 32Bit is mandatory.");
    ByteBufUtils.write(body, pathKey.getValue());
    body.writeBytes(pceId);
    RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) PathKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey) PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)8 PathKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey)6 PathKeyCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase)6 PathKeyCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.PathKeyCase)4 PceId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId)3 SubobjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType)2 ArrayList (java.util.ArrayList)1 Subobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject)1 PathKeyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.key.object.PathKeyBuilder)1 PathKeys (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.key.object.path.key.PathKeys)1 PathKeysBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.key.object.path.key.PathKeysBuilder)1