import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
import org.opendaylight.protocol.rsvp.parser.spi.RROSubobjectParser;
import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
+import org.opendaylight.protocol.rsvp.parser.spi.subobjects.PathKeyUtils;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId;
public static void serializeSubobject(final SubobjectContainer 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);
+ RROSubobjectUtil.formatSubobject(TYPE, PathKeyUtils.serializePathKey(pkcase.getPathKey()), buffer);
}
@Override
import io.netty.buffer.Unpooled;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKeySubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKeyBuilder;
import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
.build();
}
- public static ByteBuf serializePathKey(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk) {
+ public static ByteBuf serializePathKey(final PathKeySubobject pk) {
final ByteBuf body = Unpooled.buffer();
final PathKey pathKey = pk.getPathKey();
checkArgument(pathKey != null, "PathKey is mandatory.");