Search in sources :

Example 46 with 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 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);
}
Also used : LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) Lsp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1Builder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 47 with 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);
    }
}
Also used : PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.PathBuilder) Timeout(io.netty.util.Timeout)

Example 48 with Tunnel

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);
}
Also used : TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) PcepTunnelTopologyConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.config.rev171127.PcepTunnelTopologyConfig) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 49 with Tunnel

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);
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.reported.lsp.Path) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) ReportedLspKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLspKey)

Example 50 with Tunnel

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");
    }
}
Also used : BigInteger(java.math.BigInteger) TunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder)

Aggregations

BigInteger (java.math.BigInteger)45 ArrayList (java.util.ArrayList)43 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)27 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)23 ExecutionException (java.util.concurrent.ExecutionException)19 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)17 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)17 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)17 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)16 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)15 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)14 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)12 List (java.util.List)12 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)12 Test (org.junit.Test)8 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)8 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)7 IfTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)7 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)7