Search in sources :

Example 1 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project openstack4j by ContainX.

the class BaseOpenStackService method getServiceVersion.

@SuppressWarnings("rawtypes")
protected int getServiceVersion() {
    OSClientSession session = OSClientSession.getCurrent();
    if (session.getAuthVersion() == AuthVersion.V3) {
        SortedSet<? extends Service> services = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType());
        Service service = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    } else {
        SortedSet<? extends Access.Service> services = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType());
        Access.Service service = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    }
}
Also used : Access(org.openstack4j.model.identity.v2.Access) Service(org.openstack4j.model.identity.v3.Service)

Example 2 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Example 3 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project netvirt by opendaylight.

the class ElanInterfaceManager method addElanInterface.

List<ListenableFuture<Void>> addElanInterface(ElanInterface elanInterface, InterfaceInfo interfaceInfo, ElanInstance elanInstance) throws ElanException {
    Preconditions.checkNotNull(elanInstance, "elanInstance cannot be null");
    Preconditions.checkNotNull(interfaceInfo, "interfaceInfo cannot be null");
    Preconditions.checkNotNull(elanInterface, "elanInterface cannot be null");
    String interfaceName = elanInterface.getName();
    String elanInstanceName = elanInterface.getElanInstanceName();
    Elan elanInfo = ElanUtils.getElanByName(broker, elanInstanceName);
    WriteTransaction tx = broker.newWriteOnlyTransaction();
    if (elanInfo == null) {
        List<String> elanInterfaces = new ArrayList<>();
        elanInterfaces.add(interfaceName);
        ElanUtils.updateOperationalDataStore(idManager, elanInstance, elanInterfaces, tx);
    } else {
        createElanStateList(elanInstanceName, interfaceName, tx);
    }
    boolean isFirstInterfaceInDpn = false;
    // Specific actions to the DPN where the ElanInterface has been added,
    // for example, programming the
    // External tunnel table if needed or adding the ElanInterface to the
    // DpnInterfaces in the operational DS.
    BigInteger dpId = interfaceInfo.getDpId();
    DpnInterfaces dpnInterfaces = null;
    if (dpId != null && !dpId.equals(ElanConstants.INVALID_DPN)) {
        InstanceIdentifier<DpnInterfaces> elanDpnInterfaces = ElanUtils.getElanDpnInterfaceOperationalDataPath(elanInstanceName, dpId);
        Optional<DpnInterfaces> existingElanDpnInterfaces = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaces);
        if (!existingElanDpnInterfaces.isPresent()) {
            isFirstInterfaceInDpn = true;
            // ELAN's 1st ElanInterface added to this DPN
            dpnInterfaces = createElanInterfacesList(elanInstanceName, interfaceName, dpId, tx);
            // table, but only if Elan has VNI
            if (isVxlanNetworkOrVxlanSegment(elanInstance)) {
                setExternalTunnelTable(dpId, elanInstance);
            }
            elanL2GatewayUtils.installElanL2gwDevicesLocalMacsInDpn(dpId, elanInstance, interfaceName);
        } else {
            List<String> elanInterfaces = existingElanDpnInterfaces.get().getInterfaces();
            elanInterfaces.add(interfaceName);
            if (elanInterfaces.size() == 1) {
                // 1st dpn interface
                elanL2GatewayUtils.installElanL2gwDevicesLocalMacsInDpn(dpId, elanInstance, interfaceName);
            }
            dpnInterfaces = updateElanDpnInterfacesList(elanInstanceName, dpId, elanInterfaces, tx);
        }
    }
    // add code to install Local/Remote BC group, unknow DMAC entry,
    // terminating service table flow entry
    // call bindservice of interfacemanager to create ingress table flow
    // enty.
    // Add interface to the ElanInterfaceForwardingEntires Container
    createElanInterfaceTablesList(interfaceName, tx);
    List<ListenableFuture<Void>> futures = new ArrayList<>();
    futures.add(ElanUtils.waitForTransactionToComplete(tx));
    installEntriesForFirstInterfaceonDpn(elanInstance, interfaceInfo, dpnInterfaces, isFirstInterfaceInDpn);
    // for internal vlan networks
    if (ElanUtils.isVlan(elanInstance) && !elanInstance.isExternal()) {
        if (interfaceManager.isExternalInterface(interfaceName)) {
            LOG.debug("adding vlan prv intf {} to elan {} BC group", interfaceName, elanInstanceName);
            handleExternalInterfaceEvent(elanInstance, dpnInterfaces, dpId);
        }
    }
    if (isFirstInterfaceInDpn && isVxlanNetworkOrVxlanSegment(elanInstance)) {
        // update the remote-DPNs remoteBC group entry with Tunnels
        LOG.trace("update remote bc group for elan {} on other DPNs for newly added dpn {}", elanInstance, dpId);
        setElanAndEtreeBCGrouponOtherDpns(elanInstance, dpId);
    }
    String jobKey = ElanUtils.getElanInterfaceJobKey(interfaceName);
    InterfaceAddWorkerOnElanInterface addWorker = new InterfaceAddWorkerOnElanInterface(jobKey, elanInterface, interfaceInfo, elanInstance, isFirstInterfaceInDpn, this);
    jobCoordinator.enqueueJob(jobKey, addWorker, ElanConstants.JOB_MAX_RETRIES);
    return futures;
}
Also used : ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ArrayList(java.util.ArrayList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) BigInteger(java.math.BigInteger) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Example 4 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project netvirt by opendaylight.

the class ElanInstanceManager method remove.

@Override
protected void remove(InstanceIdentifier<ElanInstance> identifier, ElanInstance deletedElan) {
    LOG.trace("Remove ElanInstance - Key: {}, value: {}", identifier, deletedElan);
    String elanName = deletedElan.getElanInstanceName();
    // check the elan Instance present in the Operational DataStore
    Elan existingElan = ElanUtils.getElanByName(broker, elanName);
    long elanTag = deletedElan.getElanTag();
    // Cleaning up the existing Elan Instance
    if (existingElan != null) {
        List<String> elanInterfaces = existingElan.getElanInterfaces();
        if (elanInterfaces != null && !elanInterfaces.isEmpty()) {
            for (String elanInterfaceName : elanInterfaces) {
                InstanceIdentifier<ElanInterface> elanInterfaceId = ElanUtils.getElanInterfaceConfigurationDataPathId(elanInterfaceName);
                InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterfaceName);
                elanInterfaceManager.removeElanInterface(deletedElan, elanInterfaceName, interfaceInfo);
                ElanUtils.delete(broker, LogicalDatastoreType.CONFIGURATION, elanInterfaceId);
            }
        }
        ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInstanceOperationalDataPath(elanName));
        Optional<ElanDpnInterfacesList> elanDpnInterfaceList = MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanDpnOperationDataPath(elanName));
        if (elanDpnInterfaceList.isPresent()) {
            ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, getElanDpnOperationDataPath(elanName));
        }
        ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInfoEntriesOperationalDataPath(elanTag));
    }
    elanInterfaceCache.getInterfaceNames(elanName).forEach(elanInterfaceName -> jobCoordinator.enqueueJob(ElanUtils.getElanInterfaceJobKey(elanInterfaceName), () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
        LOG.info("Deleting the elanInterface present under ConfigDS:{}", elanInterfaceName);
        ElanUtils.delete(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(elanInterfaceName));
        elanInterfaceManager.unbindService(elanInterfaceName, tx);
        LOG.info("unbind the Interface:{} service bounded to Elan:{}", elanInterfaceName, elanName);
    })), ElanConstants.JOB_MAX_RETRIES));
    // Release tag
    ElanUtils.releaseId(idManager, ElanConstants.ELAN_ID_POOL_NAME, elanName);
    if (deletedElan.getAugmentation(EtreeInstance.class) != null) {
        removeEtreeInstance(deletedElan);
    }
}
Also used : EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) LoggerFactory(org.slf4j.LoggerFactory) ElanInterfaceCache(org.opendaylight.netvirt.elan.cache.ElanInterfaceCache) Singleton(javax.inject.Singleton) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) Optional(com.google.common.base.Optional) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) ElanInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) Logger(org.slf4j.Logger) Collections.emptyList(java.util.Collections.emptyList) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) AsyncDataTreeChangeListenerBase(org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ListenableFutures(org.opendaylight.infrautils.utils.concurrent.ListenableFutures) List(java.util.List) ElanException(org.opendaylight.netvirt.elan.ElanException) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) PostConstruct(javax.annotation.PostConstruct) Collections(java.util.Collections) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Example 5 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project netvirt by opendaylight.

the class ElanInterfaceManager method removeElanInterface.

public List<ListenableFuture<Void>> removeElanInterface(ElanInstance elanInfo, String interfaceName, InterfaceInfo interfaceInfo) {
    String elanName = elanInfo.getElanInstanceName();
    boolean isLastElanInterface = false;
    boolean isLastInterfaceOnDpn = false;
    BigInteger dpId = null;
    long elanTag = elanInfo.getElanTag();
    // We use two transaction so we don't suffer on multiple shards (interfaces and flows)
    WriteTransaction interfaceTx = broker.newWriteOnlyTransaction();
    Elan elanState = removeElanStateForInterface(elanInfo, interfaceName, interfaceTx);
    if (elanState == null) {
        interfaceTx.cancel();
        return Collections.emptyList();
    }
    WriteTransaction flowTx = broker.newWriteOnlyTransaction();
    List<String> elanInterfaces = elanState.getElanInterfaces();
    if (elanInterfaces.isEmpty()) {
        isLastElanInterface = true;
    }
    if (interfaceInfo != null) {
        dpId = interfaceInfo.getDpId();
        DpnInterfaces dpnInterfaces = removeElanDpnInterfaceFromOperationalDataStore(elanName, dpId, interfaceName, elanTag, interfaceTx);
        /*
             * If there are not elan ports, remove the unknown dmac, terminating
             * service table flows, remote/local bc group
             */
        if (dpnInterfaces == null || dpnInterfaces.getInterfaces() == null || dpnInterfaces.getInterfaces().isEmpty()) {
            // No more Elan Interfaces in this DPN
            LOG.debug("deleting the elan: {} present on dpId: {}", elanInfo.getElanInstanceName(), dpId);
            if (!elanUtils.isOpenstackVniSemanticsEnforced()) {
                removeDefaultTermFlow(dpId, elanInfo.getElanTag());
            }
            removeUnknownDmacFlow(dpId, elanInfo, flowTx, elanInfo.getElanTag());
            removeEtreeUnknownDmacFlow(dpId, elanInfo, flowTx);
            removeElanBroadcastGroup(elanInfo, interfaceInfo, flowTx);
            removeLocalBroadcastGroup(elanInfo, interfaceInfo, flowTx);
            removeEtreeBroadcastGrups(elanInfo, interfaceInfo, flowTx);
            if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
                if (elanUtils.isOpenstackVniSemanticsEnforced()) {
                    elanUtils.removeTerminatingServiceAction(dpId, elanUtils.getVxlanSegmentationId(elanInfo).intValue());
                }
                unsetExternalTunnelTable(dpId, elanInfo);
            }
            isLastInterfaceOnDpn = true;
        } else {
            setupLocalBroadcastGroups(elanInfo, dpnInterfaces, interfaceInfo);
        }
    }
    List<ListenableFuture<Void>> futures = new ArrayList<>();
    futures.add(ElanUtils.waitForTransactionToComplete(interfaceTx));
    futures.add(ElanUtils.waitForTransactionToComplete(flowTx));
    if (isLastInterfaceOnDpn && dpId != null && isVxlanNetworkOrVxlanSegment(elanInfo)) {
        setElanAndEtreeBCGrouponOtherDpns(elanInfo, dpId);
    }
    InterfaceRemoveWorkerOnElanInterface removeInterfaceWorker = new InterfaceRemoveWorkerOnElanInterface(interfaceName, elanInfo, interfaceInfo, this, isLastElanInterface);
    jobCoordinator.enqueueJob(ElanUtils.getElanInterfaceJobKey(interfaceName), removeInterfaceWorker, ElanConstants.JOB_MAX_RETRIES);
    return futures;
}
Also used : ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Aggregations

ArrayList (java.util.ArrayList)36 BigInteger (java.math.BigInteger)33 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)21 ExecutionException (java.util.concurrent.ExecutionException)19 CoreException (org.eclipse.core.runtime.CoreException)18 List (java.util.List)15 Test (org.junit.Test)15 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)15 Logger (org.slf4j.Logger)14 LoggerFactory (org.slf4j.LoggerFactory)14 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)13 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)12 BoundServices (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)12 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)10 ServerPort (org.eclipse.wst.server.core.ServerPort)9 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)9 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)9 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)9