use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method createLspAndSendReport.
private void createLspAndSendReport(final long plspId, final PCCTunnel tunnel, final PCCSession session, final Optional<Boolean> isSync, final Optional<Srp> srp) {
final boolean delegation = hasDelegation(tunnel, session);
if (delegation) {
tunnel.cancelTimeouts();
}
final String destinationAddress = getDestinationAddress(tunnel.getLspState().getEro().getSubobject(), this.address);
final Tlvs tlvs = createLspTlvs(plspId, true, destinationAddress, this.address, this.address, Optional.of(tunnel.getPathName()), this.syncOptimization.incrementLspDBVersion());
final boolean sync = isSync.isPresent() ? isSync.get() : this.syncOptimization.isSyncNeedIt();
final Lsp lsp = createLsp(plspId, sync, Optional.fromNullable(tlvs), delegation, false);
final Pcrpt pcrtp = createPcRtpMessage(lsp, srp, tunnel.getLspState());
session.sendReport(pcrtp);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method sendToAll.
private void sendToAll(final PCCTunnel tunnel, final PlspId plspId, final List<Subobject> subobjects, final Srp srp, final Path path, final Lsp lsp) {
for (final PCCSession session : this.sessions.values()) {
final boolean isDelegated = hasDelegation(tunnel, session);
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.of(subobjects));
final Pcrpt pcRpt = createPcRtpMessage(new LspBuilder(lsp).setPlspId(plspId).setOperational(OperationalStatus.Up).setDelegate(isDelegated).setSync(true).addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(tunnel.getType() == LspType.PCE_LSP).build()).setTlvs(tlvs).build(), Optional.fromNullable(srp), path);
session.sendReport(pcRpt);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp in project bgpcep by opendaylight.
the class CInitiated00PCInitiateMessageParser method getValidRequest.
protected Requests getValidRequest(final List<Object> objects) {
final RequestsBuilder builder = new RequestsBuilder();
builder.setSrp((Srp) objects.get(0));
objects.remove(0);
builder.setLsp((Lsp) objects.get(0));
objects.remove(0);
final List<Metrics> metrics = Lists.newArrayList();
Object obj;
State state = State.INIT;
while (!objects.isEmpty() && !state.equals(State.END)) {
obj = objects.get(0);
state = insertObject(state, obj, builder, metrics);
if (!state.equals(State.END)) {
objects.remove(0);
}
}
builder.setMetrics(metrics);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testGetValidReportsNegative.
@Test
public void testGetValidReportsNegative() {
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 Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).build();
final Ero ero = new EroBuilder().build();
final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
final Reports validReports = codec.getValidReports(objects, new ArrayList<>());
assertNull(validReports);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp 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());
}
Aggregations