Search in sources :

Example 6 with SubobjectType

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

the class XROUnnumberedInterfaceSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof UnnumberedCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", type.getClass());
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    body.writeZero(RESERVED);
    final Attribute attribute = subobject.getAttribute();
    body.writeByte(attribute != null ? attribute.getIntValue() : 0);
    serializeUnnumeredInterface(((UnnumberedCase) type).getUnnumbered(), body);
    XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
Also used : Attribute(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute) SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType) UnnumberedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase) ByteBuf(io.netty.buffer.ByteBuf)

Example 7 with SubobjectType

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

the class AbstractEROPathKeySubobjectParser method serializeSubobject.

@Override
public final void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof PathKeyCase, "Unknown subobject instance. Passed %s. Needed PathKey.", type.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) type).getPathKey();
    final PathKey pathKey = pk.getPathKey();
    checkArgument(pathKey != null, "PathKey is mandatory.");
    final byte[] pceID = pk.getPceId().getValue();
    checkArgument(pceID.length == PCE_ID_F_LENGTH || pceID.length == PCE128_ID_F_LENGTH, "PceId 32/128 Bit required.");
    final ByteBuf body = Unpooled.buffer();
    ByteBufUtils.write(body, pathKey.getValue());
    body.writeBytes(pceID);
    EROSubobjectUtil.formatSubobject(pceID.length == PCE_ID_F_LENGTH ? TYPE_32 : TYPE_128, subobject.getLoose(), 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) SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType)

Example 8 with SubobjectType

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

the class XROPathKey128SubobjectParser method serializeSubobject.

public static void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof PathKeyCase, "Unknown subobject instance. Passed %s. Needed PathKey.", type.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) type).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());
    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) SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType) PceId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)7 SubobjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType)6 Attribute (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute)3 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)2 IpPrefixSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject)2 PathKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey)2 SubobjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.SubobjectType)2 IpPrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase)2 PathKeyCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase)2 BitArray (org.opendaylight.protocol.util.BitArray)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 SrSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject)1 PceId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId)1 SrlgId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId)1 SrlgSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject)1 UnnumberedSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.UnnumberedSubobject)1 UnnumberedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.UnnumberedCase)1 SrlgCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase)1 UnnumberedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase)1