Search in sources :

Example 1 with Updates

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates in project netvirt by opendaylight.

the class InterVpnLinkUtil method updateInterVpnLinkState.

/**
 * Updates inter-VPN link state.
 *
 * @param broker dataBroker service reference
 * @param vpnLinkName The name of the InterVpnLink
 * @param state Sets the state of the InterVpnLink to Active or Error
 * @param newFirstEndpointState Updates the lportTag and/or DPNs of the 1st endpoint of the InterVpnLink
 * @param newSecondEndpointState Updates the lportTag and/or DPNs of the 2nd endpoint of the InterVpnLink
 * @param interVpnLinkCache the InterVpnLinkCache
 */
public static void updateInterVpnLinkState(DataBroker broker, String vpnLinkName, InterVpnLinkState.State state, FirstEndpointState newFirstEndpointState, SecondEndpointState newSecondEndpointState, InterVpnLinkCache interVpnLinkCache) {
    Optional<InterVpnLinkState> optOldVpnLinkState = getInterVpnLinkState(broker, vpnLinkName);
    if (optOldVpnLinkState.isPresent()) {
        InterVpnLinkState newVpnLinkState = new InterVpnLinkStateBuilder(optOldVpnLinkState.get()).setState(state).setFirstEndpointState(newFirstEndpointState).setSecondEndpointState(newSecondEndpointState).build();
        VpnUtil.syncUpdate(broker, LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkStateIid(vpnLinkName), newVpnLinkState);
        interVpnLinkCache.addInterVpnLinkStateToCaches(newVpnLinkState);
    } else {
        InterVpnLinkState newIVpnLinkState = new InterVpnLinkStateBuilder().setKey(new InterVpnLinkStateKey(vpnLinkName)).setInterVpnLinkName(vpnLinkName).setFirstEndpointState(newFirstEndpointState).setSecondEndpointState(newSecondEndpointState).setState(InterVpnLinkState.State.Active).build();
        VpnUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkStateIid(vpnLinkName), newIVpnLinkState);
        interVpnLinkCache.addInterVpnLinkStateToCaches(newIVpnLinkState);
    }
}
Also used : InterVpnLinkState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkState) InterVpnLinkStateKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkStateKey) InterVpnLinkStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkStateBuilder)

Example 2 with Updates

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates in project netvirt by opendaylight.

the class ElanServiceChainHandler method programElanScfPipeline.

/**
 * Programs the needed flows for sending traffic to the SCF pipeline when
 * it is comming from an L2-GW (ELAN) and also for handing over that
 * traffic from SCF to ELAN when the packets does not match any Service
 * Chain.
 *
 * @param elanName Name of the ELAN to be considered
 * @param tableId Table id, in the SCF Pipeline, to which the traffic must
 *        go to.
 * @param scfTag Tag of the ServiceChain
 * @param elanLportTag LPortTag of the ElanPseudoPort that participates in
 *        the ServiceChain
 * @param addOrRemove States if the flows must be created or removed
 */
public void programElanScfPipeline(String elanName, short tableId, long scfTag, int elanLportTag, int addOrRemove) {
    LOG.info("programElanScfPipeline:  elanName={}   scfTag={}   elanLportTag={}    addOrRemove={}", elanName, scfTag, elanLportTag, addOrRemove);
    // There are 3 rules to be considered:
    // 1. LportDispatcher To Scf. Matches on elanPseudoPort + SI=1. Goes to DL Subscriber table
    // 2. LportDispatcher From Scf. Matches on elanPseudoPort + SI=3. Goes to ELAN DMAC
    // 3. ExtTunnelTable From L2GwDevice. Matches on VNI + SI=1. Sets ElanPseudoPort tag and goes
    // to LportDispatcher table.
    // And these rules must be programmed in all the Elan footprint
    // Find the ElanInstance
    Optional<ElanInstance> elanInstance = ElanServiceChainUtils.getElanInstanceByName(broker, elanName);
    if (!elanInstance.isPresent()) {
        LOG.debug("Could not find an Elan Instance with name={}", elanName);
        return;
    }
    Collection<BigInteger> elanDpnsOpc = ElanServiceChainUtils.getElanDpnsByName(broker, elanName);
    if (elanDpnsOpc.isEmpty()) {
        LOG.debug("Could not find any DPN related to Elan {}", elanName);
        return;
    }
    // updates map which stores relationship between elan and elanLPortTag and scfTag
    ElanServiceChainUtils.updateElanToLportTagMap(broker, elanName, elanLportTag, scfTag, addOrRemove);
    Long vni = elanInstance.get().getSegmentationId();
    if (vni == null) {
        LOG.warn("There is no VNI for elan {}. VNI is mandatory. Returning", elanName);
        return;
    }
    int elanTag = elanInstance.get().getElanTag().intValue();
    LOG.debug("elanName={}  ->  vni={}  elanTag={}", elanName, vni, elanTag);
    // Program ExtTunnelTable.
    for (BigInteger dpnId : elanDpnsOpc) {
        ElanServiceChainUtils.programLPortDispatcherToScf(mdsalManager, dpnId, elanTag, elanLportTag, tableId, scfTag, addOrRemove);
        ElanServiceChainUtils.programLPortDispatcherFromScf(mdsalManager, dpnId, elanLportTag, elanTag, addOrRemove);
        ElanServiceChainUtils.programExternalTunnelTable(mdsalManager, dpnId, elanLportTag, vni, elanTag, addOrRemove);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) BigInteger(java.math.BigInteger)

Example 3 with Updates

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates in project bgpcep by opendaylight.

the class PCCTunnelManagerImplTest method createUpdate.

private static Updates createUpdate(final long plspId, final Optional<Boolean> delegate) {
    final UpdatesBuilder updsBuilder = new UpdatesBuilder();
    final LspBuilder lsp = new LspBuilder().setPlspId(new PlspId(plspId));
    if (delegate.isPresent()) {
        lsp.setDelegate(Boolean.TRUE);
    }
    updsBuilder.setLsp(lsp.build());
    final PathBuilder pathBuilder = new PathBuilder();
    pathBuilder.setEro(ERO);
    updsBuilder.setPath(pathBuilder.build());
    updsBuilder.setSrp(new SrpBuilder().setOperationId(new SrpIdNumber(0L)).build());
    return updsBuilder.build();
}
Also used : PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.updates.PathBuilder) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) UpdatesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.UpdatesBuilder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 4 with Updates

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates in project bgpcep by opendaylight.

the class PCCSessionListener method onMessage.

@Override
public void onMessage(final PCEPSession psession, final Message message) {
    LOG.trace("Received message: {}", message);
    if (this.errorMode) {
        // random error message
        psession.sendMessage(createErrorMessage(message));
        return;
    }
    if (message instanceof Pcupd) {
        final Updates upd = ((Pcupd) message).getPcupdMessage().getUpdates().get(0);
        this.tunnelManager.onMessagePcupd(upd, this);
    } else if (message instanceof Pcinitiate) {
        this.tunnelManager.onMessagePcInitiate(((Pcinitiate) message).getPcinitiateMessage().getRequests().get(0), this);
    }
}
Also used : Pcupd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcupd) Updates(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates) Pcinitiate(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate)

Example 5 with Updates

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method handledDbTriggeredResync.

private void handledDbTriggeredResync(final Updates update, final PCCSession session) {
    this.syncOptimization.setResynchronizingState(Boolean.TRUE);
    final SrpIdNumber operationId = update.getSrp().getOperationId();
    if (update.getLsp().getPlspId().getValue() == 0) {
        reportAllKnownLsp(Optional.of(operationId), session);
    } else {
        reportLsp(update.getLsp().getPlspId(), operationId, session);
    }
    sendEndOfSynchronization(session, Optional.of(operationId));
    this.syncOptimization.setResynchronizingState(Boolean.FALSE);
}
Also used : SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)

Aggregations

Updates (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates)5 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)4 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 ByteBuf (io.netty.buffer.ByteBuf)2 BigInteger (java.math.BigInteger)2 List (java.util.List)2 Test (org.junit.Test)2 Counter (org.opendaylight.infrautils.metrics.Counter)2 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)2 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)2 Pcupd (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcupd)2 PcupdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcupdBuilder)2 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)2 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)2 PcupdMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.PcupdMessageBuilder)2 UpdatesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.UpdatesBuilder)2 Srp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp)2