Search in sources :

Example 11 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project netvirt by opendaylight.

the class EvpnMacVrfUtils method removeEvpnDmacFlow.

public void removeEvpnDmacFlow(InstanceIdentifier<MacVrfEntry> instanceIdentifier, MacVrfEntry macVrfEntry) {
    String elanName = getElanNameByMacvrfiid(instanceIdentifier);
    if (elanName == null) {
        LOG.error("Error : elanName is null for iid {}", instanceIdentifier);
        return;
    }
    List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
    // if (checkEvpnAttachedToNet(elanName)) {
    // TODO(Riyaz) : Check if accessing first nexthop address is right
    String nexthopIP = macVrfEntry.getRoutePaths().get(0).getNexthopAddress();
    IpAddress ipAddress = new IpAddress(new Ipv4Address(nexthopIP));
    Long elanTag = getElanTagByMacvrfiid(instanceIdentifier);
    if (elanTag == null) {
        return;
    }
    String macToRemove = macVrfEntry.getMac();
    jobCoordinator.enqueueJob(macToRemove, () -> {
        List<ListenableFuture<Void>> futures = new ArrayList<>();
        dpnInterfaceLists.forEach(dpnInterfaces -> {
            BigInteger dpId = dpnInterfaces.getDpId();
            ElanEvpnFlowUtils.EvpnDmacFlowBuilder dmacFlowBuilder = new ElanEvpnFlowUtils.EvpnDmacFlowBuilder();
            dmacFlowBuilder.setDpId(dpId).setNexthopIP(ipAddress.toString()).setElanTag(elanTag).setDstMacAddress(macToRemove);
            LOG.info("REMOVE: Deleting DMAC Flows for external MAC. elanTag {}, dpId {}," + "nexthopIP {}, macToRemove {}", elanTag, dpId, nexthopIP, macToRemove);
            futures.addAll(elanEvpnFlowUtils.evpnDeleteDmacFlowsToExternalMac(dmacFlowBuilder.build()));
        });
        return futures;
    }, ElanConstants.JOB_MAX_RETRIES);
}
Also used : DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 12 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project netvirt by opendaylight.

the class ElanInterfaceManager method setBCGrouponOtherDpns.

@SuppressWarnings("checkstyle:IllegalCatch")
private void setBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId, int elanTag, long groupId) {
    int bucketId = 0;
    ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
    if (elanDpns != null) {
        List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
        for (DpnInterfaces dpnInterface : dpnInterfaces) {
            List<Bucket> remoteListBucketInfo = new ArrayList<>();
            if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
                List<Action> listAction = new ArrayList<>();
                int actionKey = 0;
                listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
                remoteListBucketInfo.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
                bucketId++;
                for (DpnInterfaces otherFes : dpnInterfaces) {
                    if (elanUtils.isDpnPresent(otherFes.getDpId()) && !Objects.equals(otherFes.getDpId(), dpnInterface.getDpId()) && otherFes.getInterfaces() != null && !otherFes.getInterfaces().isEmpty()) {
                        try {
                            List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnInterface.getDpId(), otherFes.getDpId(), elanUtils.isOpenstackVniSemanticsEnforced() ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
                            if (!remoteListActionInfo.isEmpty()) {
                                remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
                                bucketId++;
                            }
                        } catch (Exception ex) {
                            LOG.error("setElanBCGrouponOtherDpns failed due to Exception caught; " + "Logical Group Interface not found between source Dpn - {}, " + "destination Dpn - {} ", dpnInterface.getDpId(), otherFes.getDpId(), ex);
                            return;
                        }
                    }
                }
                List<Bucket> elanL2GwDevicesBuckets = elanL2GatewayMulticastUtils.getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnInterface.getDpId(), bucketId);
                remoteListBucketInfo.addAll(elanL2GwDevicesBuckets);
                if (remoteListBucketInfo.isEmpty()) {
                    LOG.debug("No ITM is present on Dpn - {} ", dpnInterface.getDpId());
                    continue;
                }
                Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(remoteListBucketInfo));
                LOG.trace("Installing remote bc group {} on dpnId {}", group, dpnInterface.getDpId());
                mdsalManager.syncInstallGroup(dpnInterface.getDpId(), group);
            }
        }
        try {
            Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
        } catch (InterruptedException e1) {
            LOG.warn("Error while waiting for remote BC group on other DPNs for ELAN {} to install", elanInfo);
        }
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) 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) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) ElanException(org.opendaylight.netvirt.elan.ElanException) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup)

Example 13 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project netvirt by opendaylight.

the class VpnFootprintService method publishAddNotification.

private void publishAddNotification(final BigInteger dpnId, final String vpnName, final String rd) {
    LOG.debug("publishAddNotification: Sending notification for add dpn {} in vpn {} rd {} event ", dpnId, vpnName, rd);
    AddEventData data = new AddEventDataBuilder().setVpnName(vpnName).setRd(rd).setDpnId(dpnId).build();
    AddDpnEvent event = new AddDpnEventBuilder().setAddEventData(data).build();
    final ListenableFuture<?> eventFuture = notificationPublishService.offerNotification(event);
    Futures.addCallback(eventFuture, new FutureCallback<Object>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.error("publishAddNotification: Error in notifying listeners for add dpn {} in vpn {} rd {} event ", dpnId, vpnName, rd, error);
        }

        @Override
        public void onSuccess(Object arg) {
            LOG.info("publishAddNotification: Successful in notifying listeners for add dpn {} in vpn {} rd {}" + " event ", dpnId, vpnName, rd);
        }
    }, MoreExecutors.directExecutor());
}
Also used : AddEventDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.add.dpn.event.AddEventDataBuilder) AddDpnEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AddDpnEvent) AddEventData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.add.dpn.event.AddEventData) AddDpnEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AddDpnEventBuilder)

Example 14 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project netvirt by opendaylight.

the class VpnFootprintService method publishRemoveNotification.

private void publishRemoveNotification(final BigInteger dpnId, final String vpnName, final String rd) {
    LOG.debug("publishRemoveNotification: Sending notification for remove dpn {} in vpn {} rd {} event ", dpnId, vpnName, rd);
    RemoveEventData data = new RemoveEventDataBuilder().setVpnName(vpnName).setRd(rd).setDpnId(dpnId).build();
    RemoveDpnEvent event = new RemoveDpnEventBuilder().setRemoveEventData(data).build();
    final ListenableFuture<?> eventFuture = notificationPublishService.offerNotification(event);
    Futures.addCallback(eventFuture, new FutureCallback<Object>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.error("publishRemoveNotification: Error in notifying listeners for remove dpn {} in vpn {} rd {}" + " event ", dpnId, vpnName, rd, error);
        }

        @Override
        public void onSuccess(Object arg) {
            LOG.info("publishRemoveNotification: Successful in notifying listeners for remove dpn {} in vpn {}" + " rd {} event ", dpnId, vpnName, rd);
        }
    }, MoreExecutors.directExecutor());
}
Also used : RemoveDpnEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.RemoveDpnEventBuilder) RemoveEventDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.remove.dpn.event.RemoveEventDataBuilder) RemoveEventData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.remove.dpn.event.RemoveEventData) RemoveDpnEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.RemoveDpnEvent)

Example 15 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project netvirt by opendaylight.

the class AlivenessMonitorUtils method startArpMonitoring.

public static void startArpMonitoring(MacEntry macEntry, Long arpMonitorProfileId, AlivenessMonitorService alivenessMonitorService, DataBroker dataBroker, INeutronVpnManager neutronVpnService, IInterfaceManager interfaceManager) {
    if (interfaceManager.isExternalInterface(macEntry.getInterfaceName())) {
        LOG.debug("ARP monitoring is currently not supported through external interfaces," + "skipping ARP monitoring from interface {} for IP {} (last known MAC {})", macEntry.getInterfaceName(), macEntry.getIpAddress().getHostAddress(), macEntry.getMacAddress());
        return;
    }
    Optional<IpAddress> gatewayIpOptional = VpnUtil.getGatewayIpAddressFromInterface(macEntry.getInterfaceName(), neutronVpnService);
    if (!gatewayIpOptional.isPresent()) {
        LOG.error("Error while retrieving GatewayIp for interface{}", macEntry.getInterfaceName());
        return;
    }
    final IpAddress gatewayIp = gatewayIpOptional.get();
    Optional<String> gatewayMacOptional = VpnUtil.getGWMacAddressFromInterface(macEntry, gatewayIp, dataBroker);
    if (!gatewayMacOptional.isPresent()) {
        LOG.error("Error while retrieving GatewayMac for interface{}", macEntry.getInterfaceName());
        return;
    }
    final PhysAddress gatewayMac = new PhysAddress(gatewayMacOptional.get());
    if (arpMonitorProfileId == null || arpMonitorProfileId.equals(0L)) {
        Optional<Long> profileIdOptional = allocateProfile(alivenessMonitorService, ArpConstants.FAILURE_THRESHOLD, ArpConstants.ARP_CACHE_TIMEOUT_MILLIS, ArpConstants.MONITORING_WINDOW, EtherTypes.Arp);
        if (!profileIdOptional.isPresent()) {
            LOG.error("Error while allocating Profile Id for alivenessMonitorService");
            return;
        }
        arpMonitorProfileId = profileIdOptional.get();
    }
    IpAddress targetIp = new IpAddress(new Ipv4Address(macEntry.getIpAddress().getHostAddress()));
    MonitorStartInput arpMonitorInput = new MonitorStartInputBuilder().setConfig(new ConfigBuilder().setSource(new SourceBuilder().setEndpointType(getSourceEndPointType(macEntry.getInterfaceName(), gatewayIp, gatewayMac)).build()).setDestination(new DestinationBuilder().setEndpointType(getEndPointIpAddress(targetIp)).build()).setMode(MonitoringMode.OneOne).setProfileId(arpMonitorProfileId).build()).build();
    try {
        Future<RpcResult<MonitorStartOutput>> result = alivenessMonitorService.monitorStart(arpMonitorInput);
        RpcResult<MonitorStartOutput> rpcResult = result.get();
        long monitorId;
        if (rpcResult.isSuccessful()) {
            monitorId = rpcResult.getResult().getMonitorId();
            createOrUpdateInterfaceMonitorIdMap(monitorId, macEntry);
            LOG.trace("Started ARP monitoring with id {}", monitorId);
        } else {
            LOG.warn("RPC Call to start monitoring returned with Errors {}", rpcResult.getErrors());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Exception when starting monitoring", e);
    }
}
Also used : MonitorStartOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorStartOutput) SourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.params.SourceBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) MonitorStartInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorStartInput) DestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.params.DestinationBuilder) ConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.ConfigBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ExecutionException(java.util.concurrent.ExecutionException) MonitorStartInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorStartInputBuilder) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Aggregations

RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)81 ArrayList (java.util.ArrayList)65 ExecutionException (java.util.concurrent.ExecutionException)61 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)41 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)30 BigInteger (java.math.BigInteger)29 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)25 List (java.util.List)24 Optional (com.google.common.base.Optional)23 Test (org.junit.Test)22 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)22 RpcError (org.opendaylight.yangtools.yang.common.RpcError)20 Logger (org.slf4j.Logger)20 LoggerFactory (org.slf4j.LoggerFactory)20 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)19 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)17 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)17 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)16 Nonnull (javax.annotation.Nonnull)15 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)15