Search in sources :

Example 1 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project bgpcep by opendaylight.

the class BGPPeerBuilder method createPeer.

static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments, final InetSocketAddress localAddress, final BGPSessionListener sessionListener, final BgpParameters bgpParameters) {
    final AsNumber as = arguments.getAs();
    final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new BgpId(localAddress.getAddress().getHostAddress()), as, Collections.singletonList(bgpParameters), Optional.empty());
    final BGPPeerRegistry strictBGPPeerRegistry = dispatcher.getBGPPeerRegistry();
    if (arguments.getInitiateConnection()) {
        for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
            strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
            addFutureListener(localAddress, ((BGPDispatcherImpl) dispatcher).createClient(localAddress, remoteAddress, RETRY_TIMER, true));
        }
    } else {
        for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
            strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
        }
        addFutureListener(localAddress, dispatcher.createServer(localAddress));
    }
    LOG.debug("Listener {} received proposal {}", sessionListener, proposal);
}
Also used : BGPSessionPreferences(org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId) BGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry) StrictBGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry) InetSocketAddress(java.net.InetSocketAddress) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)

Example 2 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project bgpcep by opendaylight.

the class CreateTunnelInstructionExecutor method buildArguments.

private Arguments buildArguments(final TerminationPoint sp, final TerminationPoint dp) {
    final ArgumentsBuilder args = new ArgumentsBuilder();
    if (this.p2pTunnelInput.getBandwidth() != null) {
        args.setBandwidth(new BandwidthBuilder().setBandwidth(this.p2pTunnelInput.getBandwidth()).build());
    }
    if (this.p2pTunnelInput.getClassType() != null) {
        args.setClassType(new ClassTypeBuilder().setClassType(this.p2pTunnelInput.getClassType()).build());
    }
    args.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(buildAddressFamily(sp, dp)).build());
    args.setEro(TunelProgrammingUtil.buildEro(this.p2pTunnelInput.getExplicitHops()));
    args.setLspa(new LspaBuilder(this.p2pTunnelInput).build());
    final AdministrativeStatus adminStatus = this.p2pTunnelInput.augmentation(PcepCreateP2pTunnelInput1.class).getAdministrativeStatus();
    if (adminStatus != null) {
        args.addAugmentation(new Arguments2Builder().setLsp(new LspBuilder().setAdministrative(adminStatus == AdministrativeStatus.Active).build()).build());
    }
    return args.build();
}
Also used : LspaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.lspa.object.LspaBuilder) Arguments2Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Arguments2Builder) PcepCreateP2pTunnelInput1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcepCreateP2pTunnelInput1) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.add.lsp.args.ArgumentsBuilder) AdministrativeStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.AdministrativeStatus) ClassTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.classtype.object.ClassTypeBuilder) EndpointsObjBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObjBuilder) BandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.BandwidthBuilder)

Example 3 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method _addMDFlow.

/**
 * Adds a flow.
 *
 * @param ci arguments: switchId flowType tableNum, e.g.: addMDFlow openflow:1 f1 42
 */
public void _addMDFlow(final CommandInterpreter ci) {
    final NodeBuilder tn = createTestNode(ci.nextArgument());
    final String flowtype = ci.nextArgument();
    FlowBuilder tf;
    if (flowtype.equals("fTM")) {
        tf = createtablemiss();
    } else {
        tf = createTestFlow(tn, flowtype, ci.nextArgument());
    }
    writeFlow(ci, tf, tn);
}
Also used : FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)

Example 4 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project genius by opendaylight.

the class ItmTepInstanceRecoveryHandler method recoverTep.

private void recoverTep(String entityId) throws InterruptedException {
    List<DPNTEPsInfo> tepsToRecover = new ArrayList<>();
    DPNTEPsInfo dpnTepsToRecover = extractDPNTepsInfo(entityId);
    if (dpnTepsToRecover == null) {
        LOG.error("Please Enter appropriate arguments for Tep Recovery.");
        return;
    } else {
        tepsToRecover.add(dpnTepsToRecover);
        // Delete the transportZone and re create it
        // Get the transport zone from the transport zone name
        TransportZone oldTz = ItmUtils.getTransportZoneFromConfigDS(tzName, dataBroker);
        if (oldTz != null) {
            ItmTepRemoveWorker tepRemoveWorker = new ItmTepRemoveWorker(tepsToRecover, null, oldTz, dataBroker, imdsalApiManager, itmInternalTunnelDeleteWorker, dpntePsInfoCache);
            LOG.trace("Deleting transportzone {}", tzName);
            jobCoordinator.enqueueJob(tzName, tepRemoveWorker);
            ItmTepAddWorker tepAddWorker = new ItmTepAddWorker(tepsToRecover, null, dataBroker, imdsalApiManager, itmConfig, itmInternalTunnelAddWorker, itmExternalTunnelAddWorker, dpntePsInfoCache);
            LOG.trace("Re-creating transportzone {}", tzName);
            jobCoordinator.enqueueJob(tzName, tepAddWorker);
        }
    }
}
Also used : ItmTepRemoveWorker(org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker) ArrayList(java.util.ArrayList) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) ItmTepAddWorker(org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)

Example 5 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project genius by opendaylight.

the class ItmTepInstanceRecoveryHandler method extractDPNTepsInfo.

private DPNTEPsInfo extractDPNTepsInfo(String entityId) {
    String[] params = entityId.split(":");
    if (params.length < 2) {
        LOG.error("Not enough arguments..Exiting...");
        return null;
    } else if (params.length > 2) {
        LOG.info("Ignoring extra parameter and proceeding...");
    }
    // ToDo:- Need to add more validations
    this.tzName = params[0];
    String ipAddress = params[1];
    transportZone = ItmUtils.getTransportZoneFromConfigDS(tzName, dataBroker);
    if (transportZone == null) {
        LOG.error("Transportzone name {} is not valid.", tzName);
        return null;
    }
    for (Subnets sub : transportZone.getSubnets()) {
        if (sub.getVteps() == null || sub.getVteps().isEmpty()) {
            LOG.error("Transport Zone {} subnet {} has no vteps", transportZone.getZoneName(), sub.getPrefix());
        }
        for (Vteps vtep : sub.getVteps()) {
            if (ipAddress.equals(String.valueOf(vtep.getIpAddress().getValue()))) {
                List<TzMembership> zones = ItmUtils.createTransportZoneMembership(tzName);
                LOG.trace("Transportzone {} found match for tep {} to be recovered", transportZone.getZoneName(), ipAddress);
                // OfTunnels is false byDefault
                TunnelEndPoints tunnelEndPoints = ItmUtils.createTunnelEndPoints(vtep.getDpnId(), IpAddressBuilder.getDefaultInstance(ipAddress), vtep.getPortname(), false, sub.getVlanId(), sub.getPrefix(), sub.getGatewayIp(), zones, transportZone.getTunnelType(), itmConfig.getDefaultTunnelTos());
                List<TunnelEndPoints> teps = new ArrayList<>();
                teps.add(tunnelEndPoints);
                return ItmUtils.createDPNTepInfo(vtep.getDpnId(), teps);
            }
        }
    }
    return null;
}
Also used : TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) ArrayList(java.util.ArrayList) TzMembership(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.tunnel.end.points.TzMembership)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)2 ArrayList (java.util.ArrayList)2 Optional (java.util.Optional)2 InetAddress (java.net.InetAddress)1 Test (org.junit.Test)1 SingleTransactionDataBroker.syncReadOptional (org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker.syncReadOptional)1 ItmTepAddWorker (org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)1 ItmTepRemoveWorker (org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker)1 AbstractConcurrentDataBrokerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest)1 StrictBGPPeerRegistry (org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry)1 BGPDispatcher (org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher)1 BGPPeerRegistry (org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry)1 BGPSessionPreferences (org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences)1 BGPSessionListener (org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)1 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)1 TunnelEndPoints (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints)1 TzMembership (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.tunnel.end.points.TzMembership)1 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)1