use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method addTunnel.
protected void addTunnel(final Requests request, final PCCSession session) {
final PlspId plspId = new PlspId(this.plspIDsCounter.incrementAndGet());
final PCCTunnel tunnel = new PCCTunnel(request.getLsp().getTlvs().getSymbolicPathName().getPathName().getValue(), session.getId(), LspType.PCE_LSP, reqToRptPath(request));
sendToAll(tunnel, plspId, request.getEro().getSubobject(), createSrp(request.getSrp().getOperationId().getValue()), tunnel.getLspState(), new LspBuilder(request.getLsp()).addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(true).build()).build());
this.tunnels.put(plspId, tunnel);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method startStateTimeout.
private void startStateTimeout(final PCCTunnel tunnel, final PlspId plspId) {
if (this.stateTimeout > -1) {
final Timeout newStateTimeout = this.timer.newTimeout(timeout -> {
if (tunnel.getType() == LspType.PCE_LSP) {
PCCTunnelManagerImpl.this.tunnels.remove(plspId);
// report tunnel removal to all
sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(0), new PathBuilder().build(), createLsp(plspId.getValue(), false, Optional.absent(), false, true));
}
}, this.stateTimeout, TimeUnit.SECONDS);
tunnel.setStateTimeout(newStateTimeout);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class TunnelProviderDeployer method createTunnelTopologyProvider.
private synchronized void createTunnelTopologyProvider(final Topology topology) {
if (!filterPcepTopologies(topology.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topology.getTopologyId();
if (this.pcepTunnelServices.containsKey(topology.getTopologyId())) {
LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
return;
}
LOG.debug("Create Tunnel Topology {}", topologyId);
final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
final String pcepTopoID = StringUtils.substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();
final PCEPTunnelClusterSingletonService tunnelTopoCss = new PCEPTunnelClusterSingletonService(this.dependencies, pcepTopoRef, topologyId);
this.pcepTunnelServices.put(topology.getTopologyId(), tunnelTopoCss);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method updateLsp.
/**
* Update an LSP in the data store.
*
* @param ctx Message context
* @param id Revision-specific LSP identifier
* @param lspName LSP name
* @param rlb Reported LSP builder
* @param solicited True if the update was solicited
* @param remove True if this is an LSP path removal
*/
protected final synchronized void updateLsp(final MessageContext ctx, final L id, final String lspName, final ReportedLspBuilder rlb, final boolean solicited, final boolean remove) {
final String name;
if (lspName == null) {
name = this.lsps.get(id);
if (name == null) {
LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
return;
}
} else {
name = lspName;
}
LOG.debug("Saved LSP {} with name {}", id, name);
this.lsps.put(id, name);
final ReportedLsp previous = this.lspData.get(name);
// if no previous report about the lsp exist, just proceed
if (previous != null) {
final List<Path> updatedPaths = makeBeforeBreak(rlb, previous, name, remove);
// if all paths or the last path were deleted, delete whole tunnel
if (updatedPaths.isEmpty()) {
LOG.debug("All paths were removed, removing LSP with {}.", id);
removeLsp(ctx, id);
return;
}
rlb.setPath(updatedPaths);
}
rlb.setKey(new ReportedLspKey(name));
rlb.setName(name);
// If this is an unsolicited update. We need to make sure we retain the metadata already present
if (solicited) {
this.nodeState.setLspMetadata(name, rlb.getMetadata());
} else {
rlb.setMetadata(this.nodeState.getLspMetadata(name));
}
final ReportedLsp rl = rlb.build();
ctx.trans.put(LogicalDatastoreType.OPERATIONAL, this.pccIdentifier.child(ReportedLsp.class, rlb.getKey()), rl);
LOG.debug("LSP {} updated to MD-SAL", name);
this.lspData.put(name, rl);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project openflowplugin by opendaylight.
the class TunnelIdEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final byte[] tunnelId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(tunnelId);
final TunnelBuilder tunnelBuilder = new TunnelBuilder().setTunnelId(new BigInteger(1, tunnelId));
if (hasMask) {
final byte[] tunnelMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(tunnelMask);
tunnelBuilder.setTunnelMask(new BigInteger(1, tunnelMask));
}
if (Objects.isNull(builder.getTunnel())) {
builder.setTunnel(tunnelBuilder.build());
} else {
throwErrorOnMalformed(builder, "tunnel");
}
}
Aggregations