use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports in project netvirt by opendaylight.
the class OpenflowRenderer method renderPath.
@Override
// FindBugs reports "Useless object stored in variable flows" however it doesn't recognize the usage of forEach.
@SuppressFBWarnings("UC_USELESS_OBJECT")
public void renderPath(NodeId nodeId, Long nsp, short nsi, short nsl, String firstHopIp) {
List<Flow> flows = new ArrayList<>();
if (firstHopIp != null) {
Long port = geniusProvider.getEgressVxlanPortForNode(OpenFlow13Provider.getDpnIdFromNodeId(nodeId)).orElse(null);
if (port == null) {
LOG.error("OpenflowRenderer: cant get egressPort for nodeId [{}]", nodeId.getValue());
return;
}
Flow flow;
flow = openFlow13Provider.createEgressClassifierTransportEgressRemoteFlow(nodeId, nsp, port, firstHopIp);
flows.add(flow);
} else {
Flow flow;
flow = openFlow13Provider.createEgressClassifierTransportEgressLocalFlow(nodeId, nsp);
flows.add(flow);
}
short egressNsi = (short) (nsi - nsl);
flows.add(openFlow13Provider.createIngressClassifierFilterChainEgressFlow(nodeId, nsp, egressNsi));
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> flows.forEach(flow -> this.openFlow13Provider.appendFlowForCreate(nodeId, flow, tx))), LOG, "Error rendering a path");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports in project bgpcep by opendaylight.
the class StatisticsReportHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
Preconditions.checkArgument(message instanceof StatsReportsMessage, "An instance of Statistics Reports message is required");
final StatsReportsMessage statsReport = (StatsReportsMessage) message;
serializeTlvs(statsReport.getTlvs(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportMissedLsp.
/**
* Reports Missed Lsp when DbVersion doesnt match.
*/
private void reportMissedLsp(final PCCSession session) {
for (long missedLsp = this.syncOptimization.getRemoteLspDbVersionValue().longValue() + 1; missedLsp <= this.syncOptimization.getLocalLspDbVersionValue().longValue(); missedLsp++) {
final PlspId plspId = new PlspId(missedLsp);
final PCCTunnel tunnel = this.tunnels.get(plspId);
createLspAndSendReport(missedLsp, tunnel, session, Optional.absent(), NO_SRP);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method makeBeforeBreak.
private List<Path> makeBeforeBreak(final ReportedLspBuilder rlb, final ReportedLsp previous, final String name, final boolean remove) {
// just one path should be reported
Preconditions.checkState(rlb.getPath().size() == 1);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId reportedLspId = rlb.getPath().get(0).getLspId();
final List<Path> updatedPaths;
// remove existing tunnel's paths now, as explicit path remove will not come
if (!remove && reportedLspId.getValue() == 0) {
updatedPaths = new ArrayList<>();
LOG.debug("Remove previous paths {} to this lsp name {}", previous.getPath(), name);
} else {
// check previous report for existing paths
updatedPaths = new ArrayList<>(previous.getPath());
LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
for (final Path path : previous.getPath()) {
// we found reported path in previous reports
if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
LOG.debug("Match on lsp-id {}", path.getLspId().getValue());
// path that was reported previously and does have the same lsp-id, path will be updated
final boolean r = updatedPaths.remove(path);
LOG.trace("Request removed? {}", r);
}
}
}
// if the path does not exist in previous report, add it to path list, it's a new ERO
// only one path will be added
// lspId is 0 means confirmation message that shouldn't be added (because we have no means of deleting it later)
LOG.trace("Adding new path {} to {}", rlb.getPath(), updatedPaths);
updatedPaths.addAll(rlb.getPath());
if (remove) {
if (reportedLspId.getValue() == 0) {
// if lsp-id also 0, remove all paths
LOG.debug("Removing all paths.");
updatedPaths.clear();
} else {
// path is marked to be removed
LOG.debug("Removing path {} from {}", rlb.getPath(), updatedPaths);
final boolean r = updatedPaths.removeAll(rlb.getPath());
LOG.trace("Request removed? {}", r);
}
}
LOG.debug("Setting new paths {} to lsp {}", updatedPaths, name);
return updatedPaths;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports in project bgpcep by opendaylight.
the class Stateful07PCReportMessageParser method serializeReport.
private void serializeReport(final Reports report, final ByteBuf buffer) {
if (report.getSrp() != null) {
serializeObject(report.getSrp(), buffer);
}
serializeObject(report.getLsp(), buffer);
final Path p = report.getPath();
if (p != null) {
serializeObject(p.getEro(), buffer);
serializeObject(p.getLspa(), buffer);
serializeObject(p.getBandwidth(), buffer);
serializeObject(p.getReoptimizationBandwidth(), buffer);
if (p.getMetrics() != null) {
for (final Metrics m : p.getMetrics()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeObject(p.getIro(), buffer);
serializeObject(p.getRro(), buffer);
}
}
Aggregations