Search in sources :

Example 1 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 SrRroSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(Subobject subobject, ByteBuf buffer) {
    final SubobjectType subobjType = subobject.getSubobjectType();
    checkArgument(subobjType instanceof SrSubobject, "Unknown subobject instance. Passed %s. Needed SrSubobject.", subobjType.getClass());
    final SrSubobject srSubobject = (SrSubobject) subobjType;
    final ByteBuf body = serializeSubobject(srSubobject);
    RROSubobjectUtil.formatSubobject(this.type, body, buffer);
}
Also used : SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.SubobjectType) SrSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 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 RROUnnumberedInterfaceSubobjectParser 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 BitArray flags = new BitArray(FLAGS_SIZE);
    flags.set(LPA_F_OFFSET, subobject.getProtectionAvailable());
    flags.set(LPIU_F_OFFSET, subobject.getProtectionInUse());
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    flags.toByteBuf(body);
    body.writeZero(RESERVED);
    final UnnumberedSubobject specObj = ((UnnumberedCase) type).getUnnumbered();
    ByteBufUtils.writeMandatory(body, specObj.getRouterId(), "RouterId");
    ByteBufUtils.writeMandatory(body, specObj.getInterfaceId(), "InterfaceId");
    RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Also used : SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.SubobjectType) UnnumberedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.subobject.type.UnnumberedCase) BitArray(org.opendaylight.protocol.util.BitArray) ByteBuf(io.netty.buffer.ByteBuf) UnnumberedSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.UnnumberedSubobject)

Example 3 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 XROIpv4PrefixSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", type.getClass());
    final IpPrefixSubobject specObj = ((IpPrefixCase) type).getIpPrefix();
    final IpPrefix prefix = specObj.getIpPrefix();
    final Ipv6Prefix ipv6Prefix = prefix.getIpv6Prefix();
    if (ipv6Prefix != null) {
        XROIpv6PrefixSubobjectParser.serializeSubobject(buffer, subobject, ipv6Prefix);
        return;
    }
    final ByteBuf body = Unpooled.buffer(CONTENT4_LENGTH);
    checkArgument(prefix.getIpv4Prefix() != null, "Ipv4Prefix is mandatory.");
    Ipv4Util.writeIpv4Prefix(prefix.getIpv4Prefix(), body);
    final Attribute attribute = subobject.getAttribute();
    checkArgument(attribute != null, "Attribute is mandatory.");
    body.writeByte(attribute.getIntValue());
    XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
Also used : IpPrefixSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject) IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) IpPrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase) 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) ByteBuf(io.netty.buffer.ByteBuf) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)

Example 4 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 XROIpv6PrefixSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", type.getClass());
    final IpPrefixSubobject specObj = ((IpPrefixCase) type).getIpPrefix();
    final Ipv6Prefix ipv6Prefix = specObj.getIpPrefix().getIpv6Prefix();
    checkArgument(ipv6Prefix != null, "Ipv6Prefix is mandatory.");
    serializeSubobject(buffer, subobject, ipv6Prefix);
}
Also used : IpPrefixSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject) IpPrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase) SubobjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)

Example 5 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 XROSrlgSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    final SubobjectType type = subobject.getSubobjectType();
    checkArgument(type instanceof SrlgCase, "Unknown subobject instance. Passed %s. Needed SrlgCase.", type.getClass());
    final SrlgSubobject specObj = ((SrlgCase) type).getSrlg();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    final SrlgId srlgId = specObj.getSrlgId();
    checkArgument(srlgId != null, "SrlgId is mandatory.");
    ByteBufUtils.write(body, srlgId.getValue());
    final Attribute attribute = subobject.getAttribute();
    checkArgument(attribute != null, "Attribute is mandatory.");
    body.writeByte(0);
    body.writeByte(attribute.getIntValue());
    XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
Also used : SrlgCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase) 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) ByteBuf(io.netty.buffer.ByteBuf) SrlgSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId)

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