use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.success._case.success.Paths in project bgpcep by opendaylight.
the class GlobalStateCliUtils method displayRibOperationalState.
static void displayRibOperationalState(@NonNull final String ribId, @NonNull final Global global, @NonNull final PrintStream stream) {
final State globalState = global.getState();
final ShellTable table = new ShellTable();
table.column("Attribute").alignLeft();
table.column("Value").alignLeft();
addHeader(table, "RIB state");
table.addRow().addContent("Router Id", ribId);
table.addRow().addContent("As", globalState.getAs());
table.addRow().addContent("Total Paths", globalState.getTotalPaths());
table.addRow().addContent("Total Prefixes", globalState.getTotalPrefixes());
global.getAfiSafis().nonnullAfiSafi().values().forEach(afiSafi -> displayAfiSafi(afiSafi, table));
table.print(stream);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.success._case.success.Paths in project bgpcep by opendaylight.
the class GlobalStateCliUtils method displayAfiSafi.
private static void displayAfiSafi(final AfiSafi afiSafi, final ShellTable table) {
final GlobalAfiSafiStateAugmentation state = afiSafi.getState().augmentation(GlobalAfiSafiStateAugmentation.class);
addHeader(table, "AFI/SAFI state");
table.addRow().addContent("Family", afiSafi.getAfiSafiName().getSimpleName());
if (state == null) {
return;
}
table.addRow().addContent("Total Paths", state.getTotalPaths());
table.addRow().addContent("Total Prefixes", state.getTotalPrefixes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.success._case.success.Paths in project bgpcep by opendaylight.
the class PCEPReplyMessageParser method handleEros.
private Result handleEros(final Queue<Object> objects) {
final SuccessBuilder builder = new SuccessBuilder();
final List<Paths> paths = new ArrayList<>();
for (Object obj = objects.peek(); obj != null && !(obj instanceof PceId); obj = objects.peek()) {
final PathsBuilder pBuilder = new PathsBuilder();
if (obj instanceof Ero) {
pBuilder.setEro((Ero) obj);
objects.remove();
}
final List<VendorInformationObject> vendorInfoObjects = addVendorInformationObjects(objects);
if (!vendorInfoObjects.isEmpty()) {
builder.setVendorInformationObject(vendorInfoObjects);
}
this.parsePath(pBuilder, objects);
paths.add(pBuilder.build());
}
builder.setPaths(paths);
return new SuccessCaseBuilder().setSuccess(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.success._case.success.Paths in project bgpcep by opendaylight.
the class PCEPReplyMessageParser method serializeSuccess.
private void serializeSuccess(final SuccessCase success, final ByteBuf buffer) {
if (success == null || success.getSuccess() == null) {
return;
}
for (final Paths p : success.getSuccess().nonnullPaths()) {
serializeObject(p.getEro(), buffer);
serializeObject(p.getLspa(), buffer);
serializeObject(p.getOf(), buffer);
serializeObject(p.getBandwidth(), buffer);
for (final Metrics m : p.nonnullMetrics()) {
serializeObject(m.getMetric(), buffer);
}
serializeObject(p.getIro(), buffer);
}
serializeVendorInformationObjects(success.getSuccess().getVendorInformationObject(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.success._case.success.Paths in project bgpcep by opendaylight.
the class PCEPValidatorTest method testReplyMsgWithTwoEros.
@Test
public void testReplyMsgWithTwoEros() throws IOException, PCEPDeserializerException {
// Success Reply with two EROs: the first one is followed by Bandwidth Object and one Metric Object
final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(this.objectRegistry);
final PcrepMessageBuilder builder = new PcrepMessageBuilder();
final List<Replies> replies = new ArrayList<>();
final BandwidthBuilder bwBuilder = new BandwidthBuilder();
bwBuilder.setIgnore(false);
bwBuilder.setProcessingRule(false);
bwBuilder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x47, (byte) 0x74, (byte) 0x24, (byte) 0x00 }));
RepliesBuilder repliesBuilder = new RepliesBuilder();
repliesBuilder = new RepliesBuilder();
repliesBuilder.setRp(this.rpTrue);
final List<Paths> paths = new ArrayList<>();
final PathsBuilder paBuilder1 = new PathsBuilder().setEro(this.ero).setBandwidth(bwBuilder.build()).setMetrics(Lists.newArrayList(this.metrics));
paths.add(paBuilder1.build());
final PathsBuilder paBuilder2 = new PathsBuilder();
paBuilder2.setEro(this.ero);
paths.add(paBuilder2.build());
repliesBuilder.setResult(new SuccessCaseBuilder().setSuccess(new SuccessBuilder().setPaths(paths).build()).build()).build();
replies.add(repliesBuilder.build());
builder.setReplies(replies);
ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.7.bin"));
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
}
Aggregations