use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testGetValidReportsPositive.
@Test
public void testGetValidReportsPositive() {
final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspId lspId = new LspId(1L);
final TunnelId tunnelId = new TunnelId(1);
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ero ero = new EroBuilder().build();
final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder in project bgpcep by opendaylight.
the class PCEPExplicitRouteObjectParser method parseObject.
@Override
public Ero parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
// Explicit approval of empty ERO
Preconditions.checkArgument(buffer != null, "Array of bytes is mandatory. Can't be null.");
final EroBuilder builder = new EroBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setSubobject(parseSubobjects(buffer));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder in project bgpcep by opendaylight.
the class PCCSessionListenerTest method createUpdMsg.
private static Pcupd createUpdMsg(final boolean delegation) {
final PcupdMessageBuilder msgBuilder = new PcupdMessageBuilder();
final UpdatesBuilder updsBuilder = new UpdatesBuilder();
updsBuilder.setLsp(new LspBuilder().setDelegate(delegation).setPlspId(new PlspId(1L)).build());
final PathBuilder pathBuilder = new PathBuilder();
pathBuilder.setEro(new EroBuilder().setSubobject(Lists.newArrayList(new SubobjectBuilder().setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("127.0.0.2/32"))).build()).build()).build())).build());
updsBuilder.setPath(pathBuilder.build());
updsBuilder.setSrp(new SrpBuilder().setOperationId(new SrpIdNumber(0L)).build());
msgBuilder.setUpdates(Lists.newArrayList(updsBuilder.build()));
return new PcupdBuilder().setPcupdMessage(msgBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder in project bgpcep by opendaylight.
the class SrObjectParserTest method testSrEroSerializerWithUpdateLspAugmentation.
@Test
public void testSrEroSerializerWithUpdateLspAugmentation() throws PCEPDeserializerException {
final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
final EroBuilder builder = new EroBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder srEroSubBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder();
srEroSubBuilder.setCFlag(false);
srEroSubBuilder.setMFlag(false);
srEroSubBuilder.setSidType(SidType.Ipv4NodeId);
srEroSubBuilder.setSid(123456L);
srEroSubBuilder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroSubBuilder.build()).setLoose(false);
builder.setSubobject(Lists.newArrayList(subobjBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
parser.serializeObject(builder.build(), buffer);
assertArrayEquals(srEroObjectBytes, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder in project bgpcep by opendaylight.
the class TopologyProviderTest method createSrEroObject.
private static Ero createSrEroObject(final String nai) {
final SrEroTypeBuilder srEroBuilder = new SrEroTypeBuilder();
srEroBuilder.setCFlag(false);
srEroBuilder.setMFlag(false);
srEroBuilder.setSidType(SidType.Ipv4NodeId);
srEroBuilder.setSid(123456L);
srEroBuilder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address(nai))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroBuilder.build()).setLoose(false);
final List<Subobject> subobjects = Lists.newArrayList(subobjBuilder.build());
return new EroBuilder().setProcessingRule(false).setIgnore(false).setSubobject(subobjects).build();
}
Aggregations