use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcc.id.req.object.PccIdReq in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method getMonitoring.
protected MonitoringRequest getMonitoring(final List<Object> objects) {
final MonitoringRequestBuilder builder = new MonitoringRequestBuilder();
if (!objects.isEmpty() && objects.get(0) instanceof Monitoring) {
builder.setMonitoring((Monitoring) objects.get(0));
objects.remove(0);
} else {
return null;
}
if (!objects.isEmpty() && objects.get(0) instanceof PccIdReq) {
builder.setPccIdReq((PccIdReq) objects.get(0));
objects.remove(0);
}
final List<PceIdList> pceIdList = new ArrayList<>();
while (!objects.isEmpty() && objects.get(0) instanceof PceId) {
pceIdList.add(new PceIdListBuilder().setPceId((PceId) objects.get(0)).build());
objects.remove(0);
}
if (!pceIdList.isEmpty()) {
builder.setPceIdList(pceIdList);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcc.id.req.object.PccIdReq in project bgpcep by opendaylight.
the class AbstractPccIdReqObjectParser method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof PccIdReq, "Wrong instance of PCEPObject. Passed %s. Needed PccIdReqObject.", object.getClass());
final PccIdReq pccIdReq = (PccIdReq) object;
if (pccIdReq.getIpAddress().getIpv4Address() != null) {
final ByteBuf body = Unpooled.buffer(Ipv4Util.IP4_LENGTH);
ByteBufWriteUtil.writeIpv4Address(pccIdReq.getIpAddress().getIpv4Address(), body);
ObjectUtil.formatSubobject(IPV4_TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
} else if (pccIdReq.getIpAddress().getIpv6Address() != null) {
final ByteBuf body = Unpooled.buffer(Ipv6Util.IPV6_LENGTH);
ByteBufWriteUtil.writeIpv6Address(pccIdReq.getIpAddress().getIpv6Address(), body);
ObjectUtil.formatSubobject(IPV6_TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
}
Aggregations