Search in sources :

Example 31 with VpnInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance in project netvirt by opendaylight.

the class NeutronvpnManager method associateNetworksToVpn.

/**
 * Parses and associates networks list with given VPN.
 *
 * @param vpnId Uuid of given VPN.
 * @param networks List list of network Ids (Uuid), which will be associated.
 * @return list of formatted strings with detailed error messages.
 */
@Nonnull
protected List<String> associateNetworksToVpn(@Nonnull Uuid vpnId, @Nonnull List<Uuid> networks) {
    List<String> failedNwList = new ArrayList<>();
    HashSet<Uuid> passedNwList = new HashSet<>();
    if (networks.isEmpty()) {
        LOG.error("associateNetworksToVpn: Failed as given networks list is empty, VPN Id: {}", vpnId.getValue());
        failedNwList.add(String.format("Failed to associate networks with VPN %s as given networks list is empty", vpnId.getValue()));
        return failedNwList;
    }
    VpnInstance vpnInstance = VpnHelper.getVpnInstance(dataBroker, vpnId.getValue());
    if (vpnInstance == null) {
        LOG.error("associateNetworksToVpn: Can not find vpnInstance for VPN {} in ConfigDS", vpnId.getValue());
        failedNwList.add(String.format("Failed to associate network: can not found vpnInstance for VPN %s " + "in ConfigDS", vpnId.getValue()));
        return failedNwList;
    }
    try {
        if (isVpnOfTypeL2(vpnInstance) && neutronEvpnUtils.isVpnAssociatedWithNetwork(vpnInstance)) {
            LOG.error("associateNetworksToVpn: EVPN {} supports only one network to be associated with", vpnId.getValue());
            failedNwList.add(String.format("Failed to associate network: EVPN %s supports only one network to be " + "associated with", vpnId.getValue()));
            return failedNwList;
        }
        for (Uuid nw : networks) {
            Network network = neutronvpnUtils.getNeutronNetwork(nw);
            if (network == null) {
                LOG.error("associateNetworksToVpn: Network {} not found in ConfigDS", nw.getValue());
                failedNwList.add(String.format("Failed to associate network: network %s not found in ConfigDS", nw.getValue()));
                continue;
            }
            NetworkProviderExtension providerExtension = network.getAugmentation(NetworkProviderExtension.class);
            if (providerExtension.getSegments() != null && providerExtension.getSegments().size() > 1) {
                LOG.error("associateNetworksToVpn: MultiSegmented network {} not supported in BGPVPN {}", nw.getValue(), vpnId.getValue());
                failedNwList.add(String.format("Failed to associate multisegmented network %s with BGPVPN %s", nw.getValue(), vpnId.getValue()));
                continue;
            }
            Uuid networkVpnId = neutronvpnUtils.getVpnForNetwork(nw);
            if (networkVpnId != null) {
                LOG.error("associateNetworksToVpn: Network {} already associated with another VPN {}", nw.getValue(), networkVpnId.getValue());
                failedNwList.add(String.format("Failed to associate network %s as it is already associated to " + "another VPN %s", nw.getValue(), networkVpnId.getValue()));
                continue;
            }
            if (neutronvpnUtils.getIsExternal(network)) {
                if (associateExtNetworkToVpn(vpnId, network)) {
                    passedNwList.add(nw);
                    continue;
                } else {
                    LOG.error("associateNetworksToVpn: Failed to associate Provider Network {} with VPN {}", nw.getValue(), vpnId.getValue());
                    failedNwList.add(String.format("Failed to associate Provider Network %s with VPN %s", nw.getValue(), vpnId.getValue()));
                    continue;
                }
            }
            List<Uuid> networkSubnets = neutronvpnUtils.getSubnetIdsFromNetworkId(nw);
            if (networkSubnets == null) {
                passedNwList.add(nw);
                continue;
            }
            for (Uuid subnet : networkSubnets) {
                Uuid subnetVpnId = neutronvpnUtils.getVpnForSubnet(subnet);
                if (subnetVpnId != null) {
                    LOG.error("associateNetworksToVpn: Failed to associate subnet {} with VPN {} as it is already " + "associated", subnet.getValue(), subnetVpnId.getValue());
                    failedNwList.add(String.format("Failed to associate subnet %s with VPN %s as it is already " + "associated", subnet.getValue(), vpnId.getValue()));
                    continue;
                }
                Subnetmap sm = neutronvpnUtils.getSubnetmap(subnet);
                if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToAdd(sm, vpnId)) {
                    neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), NeutronvpnUtils.getIpVersionFromString(sm.getSubnetIp()), true);
                }
                LOG.debug("associateNetworksToVpn: Add subnet {} to VPN {}", subnet.getValue(), vpnId.getValue());
                addSubnetToVpn(vpnId, subnet, null);
                passedNwList.add(nw);
            }
        }
    } catch (ReadFailedException e) {
        LOG.error("associateNetworksToVpn: Failed to associate VPN {} with networks {}: ", vpnId.getValue(), networks, e);
        failedNwList.add(String.format("Failed to associate VPN %s with networks %s: %s", vpnId.getValue(), networks, e));
    }
    LOG.info("associateNetworksToVpn: update VPN {} with networks list: {}", vpnId.getValue(), passedNwList.toString());
    updateVpnMaps(vpnId, null, null, null, new ArrayList<Uuid>(passedNwList));
    return failedNwList;
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) VpnInstance(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance) ArrayList(java.util.ArrayList) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) NetworkProviderExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) HashSet(java.util.HashSet) Nonnull(javax.annotation.Nonnull)

Example 32 with VpnInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance in project netvirt by opendaylight.

the class NeutronvpnManager method checkAlarmExtraRoutes.

/**
 * This method setup or down an alarm about extra route fault.
 * When extra routes are configured, through a router, if the number of nexthops is greater than the number of
 * available RDs, then an alarm and an error is generated.<br>
 * <b>Be careful</b> the routeList could be changed.
 *
 * @param vpnId the vpnId of vpn to control.
 * @param routeList the list of router to check, it could be modified.
 */
private void checkAlarmExtraRoutes(Uuid vpnId, List<Routes> routeList) {
    if (!neutronvpnAlarm.isAlarmEnabled()) {
        LOG.debug("checkAlarmExtraRoutes is not enable for vpnId {} routeList {}", vpnId, routeList);
        return;
    }
    VpnInstance vpnInstance = neutronvpnUtils.getVpnInstance(dataBroker, vpnId);
    if (vpnInstance == null || routeList == null || routeList.isEmpty() || !neutronvpnAlarm.isAlarmEnabled()) {
        LOG.debug("checkAlarmExtraRoutes have args null as following : vpnId {} routeList {}", vpnId, routeList);
        return;
    }
    List<Routes> routesError = new ArrayList();
    for (Routes route : routeList) {
        // count  the number of nexthops for each same route.getDestingation().getValue()
        String destination = String.valueOf(route.getDestination().getValue());
        String nextHop = String.valueOf(route.getNexthop().getValue());
        List<String> nextHopList = new ArrayList();
        nextHopList.add(nextHop);
        int nbNextHops = 0;
        for (Routes routeTmp : routeList) {
            String routeDest = String.valueOf(routeTmp.getDestination().getValue());
            if (!destination.equals(routeDest)) {
                continue;
            }
            String routeNextH = String.valueOf(routeTmp.getNexthop().getValue());
            if (nextHop.equals(routeNextH)) {
                continue;
            }
            nbNextHops++;
            nextHopList.add(new String(routeTmp.getNexthop().getValue()));
        }
        final List<String> rdList = new ArrayList();
        if (vpnInstance.getIpv4Family() != null && vpnInstance.getIpv4Family().getRouteDistinguisher() != null) {
            vpnInstance.getIpv4Family().getRouteDistinguisher().stream().forEach(rd -> {
                if (rd != null) {
                    rdList.add(rd);
                }
            });
        }
        if (vpnInstance.getIpv6Family() != null && vpnInstance.getIpv6Family().getRouteDistinguisher() != null) {
            vpnInstance.getIpv6Family().getRouteDistinguisher().stream().forEach(rd -> {
                if (rd != null && !rdList.contains(rd)) {
                    rdList.add(rd);
                }
            });
        }
        // 1. VPN Instance Name
        String typeAlarm = "for vpnId: " + vpnId + " have exceeded next hops for prefixe";
        // 2. Router ID
        Uuid routerUuid = neutronvpnUtils.getRouterforVpn(vpnId);
        StringBuilder detailsAlarm = new StringBuilder("routerUuid: ");
        detailsAlarm.append(routerUuid == null ? vpnId.toString() : routerUuid.getValue());
        // 3. List of RDs associated with the VPN
        detailsAlarm.append(" List of RDs associated with the VPN: ");
        for (String s : rdList) {
            detailsAlarm.append(s);
            detailsAlarm.append(", ");
        }
        // 4. Prefix in question
        detailsAlarm.append(" for prefix: ");
        detailsAlarm.append(route.getDestination().getValue());
        // 5. List of NHs for the prefix
        detailsAlarm.append(" for nextHops: ");
        for (String s : nextHopList) {
            detailsAlarm.append(s);
            detailsAlarm.append(", ");
        }
        if (rdList.size() < nbNextHops) {
            neutronvpnAlarm.raiseNeutronvpnAlarm(typeAlarm, detailsAlarm.toString());
            LOG.error("there are too many next hops for prefixe in vpn {}", vpnId);
            routesError.add(route);
        } else {
            neutronvpnAlarm.clearNeutronvpnAlarm(typeAlarm, detailsAlarm.toString());
        }
    }
    // in routesError there are a few route raised in alarm, so they have not to be used
    routeList.removeAll(routesError);
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) VpnInstance(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance) ArrayList(java.util.ArrayList) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes)

Example 33 with VpnInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance in project netvirt by opendaylight.

the class NeutronvpnManager method deleteL3VPN.

/**
 * It handles the invocations to the neutronvpn:deleteL3VPN RPC method.
 */
@Override
public Future<RpcResult<DeleteL3VPNOutput>> deleteL3VPN(DeleteL3VPNInput input) {
    DeleteL3VPNOutputBuilder opBuilder = new DeleteL3VPNOutputBuilder();
    SettableFuture<RpcResult<DeleteL3VPNOutput>> result = SettableFuture.create();
    List<RpcError> errorList = new ArrayList<>();
    int failurecount = 0;
    int warningcount = 0;
    List<Uuid> vpns = input.getId();
    for (Uuid vpn : vpns) {
        RpcError error;
        String msg;
        try {
            InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class, new VpnInstanceKey(vpn.getValue())).build();
            Optional<VpnInstance> optionalVpn = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdentifier);
            if (optionalVpn.isPresent()) {
                removeVpn(vpn);
            } else {
                errorList.add(RpcResultBuilder.newWarning(ErrorType.PROTOCOL, "invalid-value", formatAndLog(LOG::warn, "VPN with vpnid: {} does not exist", vpn.getValue())));
                warningcount++;
            }
        } catch (ReadFailedException ex) {
            errorList.add(RpcResultBuilder.newError(ErrorType.APPLICATION, formatAndLog(LOG::error, "Deletion of L3VPN failed when deleting for uuid {}", vpn.getValue()), ex.getMessage()));
            failurecount++;
        }
    }
    // if none succeeds; result is failure
    if (failurecount + warningcount == vpns.size()) {
        result.set(RpcResultBuilder.<DeleteL3VPNOutput>failed().withRpcErrors(errorList).build());
    } else {
        List<String> errorResponseList = new ArrayList<>();
        if (!errorList.isEmpty()) {
            for (RpcError rpcError : errorList) {
                errorResponseList.add("ErrorType: " + rpcError.getErrorType() + ", ErrorTag: " + rpcError.getTag() + ", ErrorMessage: " + rpcError.getMessage());
            }
        } else {
            errorResponseList.add("Operation successful with no errors");
        }
        opBuilder.setResponse(errorResponseList);
        result.set(RpcResultBuilder.<DeleteL3VPNOutput>success().withResult(opBuilder.build()).build());
    }
    return result;
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) VpnInstance(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RpcError(org.opendaylight.yangtools.yang.common.RpcError) ArrayList(java.util.ArrayList) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) DeleteL3VPNOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.DeleteL3VPNOutputBuilder) VpnInstanceKey(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstanceKey)

Example 34 with VpnInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance in project netvirt by opendaylight.

the class VpnInstanceListener method addVpnInstance.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void addVpnInstance(VpnInstance value, WriteTransaction writeConfigTxn, WriteTransaction writeOperTxn) {
    VpnAfConfig config = value.getIpv4Family();
    String vpnInstanceName = value.getVpnInstanceName();
    long vpnId = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, vpnInstanceName);
    if (vpnId == 0) {
        LOG.error("{} addVpnInstance: Unable to fetch label from Id Manager. Bailing out of adding operational" + " data for Vpn Instance {}", LOGGING_PREFIX_ADD, value.getVpnInstanceName());
        return;
    }
    LOG.info("{} addVpnInstance: VPN Id {} generated for VpnInstanceName {}", LOGGING_PREFIX_ADD, vpnId, vpnInstanceName);
    String primaryRd = VpnUtil.getPrimaryRd(value);
    org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance vpnInstanceToVpnId = VpnUtil.getVpnInstanceToVpnId(vpnInstanceName, vpnId, primaryRd);
    if (writeConfigTxn != null) {
        writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName), vpnInstanceToVpnId, WriteTransaction.CREATE_MISSING_PARENTS);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName), vpnInstanceToVpnId);
    }
    VpnIds vpnIdToVpnInstance = VpnUtil.getVpnIdToVpnInstance(vpnId, value.getVpnInstanceName(), primaryRd, VpnUtil.isBgpVpn(vpnInstanceName, primaryRd));
    if (writeConfigTxn != null) {
        writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId), vpnIdToVpnInstance, WriteTransaction.CREATE_MISSING_PARENTS);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId), vpnIdToVpnInstance);
    }
    try {
        String cachedTransType = fibManager.getConfTransType();
        if (cachedTransType.equals("Invalid")) {
            try {
                fibManager.setConfTransType("L3VPN", "VXLAN");
            } catch (Exception e) {
                LOG.error("{} addVpnInstance: Exception caught setting the L3VPN tunnel transportType for vpn {}", LOGGING_PREFIX_ADD, vpnInstanceName, e);
            }
        } else {
            LOG.debug("{} addVpnInstance: Configured tunnel transport type for L3VPN {} as {}", LOGGING_PREFIX_ADD, vpnInstanceName, cachedTransType);
        }
    } catch (Exception e) {
        LOG.error("{} addVpnInstance: Error when trying to retrieve tunnel transport type for L3VPN {}", LOGGING_PREFIX_ADD, vpnInstanceName, e);
    }
    VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder().setVrfId(primaryRd).setVpnId(vpnId).setVpnInstanceName(vpnInstanceName).setVpnState(VpnInstanceOpDataEntry.VpnState.Created).setIpv4Configured(false).setIpv6Configured(false);
    if (VpnUtil.isBgpVpn(vpnInstanceName, primaryRd)) {
        List<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget> opVpnTargetList = new ArrayList<>();
        builder.setBgpvpnType(VpnInstanceOpDataEntry.BgpvpnType.BGPVPNExternal);
        if (value.getL3vni() != null) {
            builder.setL3vni(value.getL3vni());
        }
        if (value.getType() == VpnInstance.Type.L2) {
            builder.setType(VpnInstanceOpDataEntry.Type.L2);
        }
        VpnTargets vpnTargets = config.getVpnTargets();
        if (vpnTargets != null) {
            List<VpnTarget> vpnTargetList = vpnTargets.getVpnTarget();
            if (vpnTargetList != null) {
                for (VpnTarget vpnTarget : vpnTargetList) {
                    VpnTargetBuilder vpnTargetBuilder = new VpnTargetBuilder().setKey(new VpnTargetKey(vpnTarget.getKey().getVrfRTValue())).setVrfRTType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget.VrfRTType.forValue(vpnTarget.getVrfRTType().getIntValue())).setVrfRTValue(vpnTarget.getVrfRTValue());
                    opVpnTargetList.add(vpnTargetBuilder.build());
                }
            }
        }
        VpnTargetsBuilder vpnTargetsBuilder = new VpnTargetsBuilder().setVpnTarget(opVpnTargetList);
        builder.setVpnTargets(vpnTargetsBuilder.build());
        List<String> rds = config.getRouteDistinguisher();
        builder.setRd(rds);
    } else {
        builder.setBgpvpnType(VpnInstanceOpDataEntry.BgpvpnType.VPN);
    }
    if (writeOperTxn != null) {
        writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd), builder.build(), true);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd), builder.build());
    }
    LOG.info("{} addVpnInstance: VpnInstanceOpData populated successfully for vpn {} rd {}", LOGGING_PREFIX_ADD, vpnInstanceName, primaryRd);
}
Also used : VpnTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetKey) ArrayList(java.util.ArrayList) VpnAfConfig(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnAfConfig) VpnTarget(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.af.config.vpntargets.VpnTarget) VpnTargetBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetBuilder) VpnInstanceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryBuilder) VpnIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds) VpnTargets(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.af.config.VpnTargets) ExecutionException(java.util.concurrent.ExecutionException) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) VpnTargetsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnTargetsBuilder)

Example 35 with VpnInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance in project netvirt by opendaylight.

the class VpnInstanceListener method remove.

@Override
protected void remove(InstanceIdentifier<VpnInstance> identifier, VpnInstance del) {
    LOG.trace("{} remove: VPN event key: {}, value: {}", LOGGING_PREFIX_DELETE, identifier, del);
    final String vpnName = del.getVpnInstanceName();
    Optional<VpnInstanceOpDataEntry> vpnOpValue;
    String primaryRd = VpnUtil.getPrimaryRd(del);
    // TODO(vpnteam): Entire code would need refactoring to listen only on the parent object - VPNInstance
    try {
        vpnOpValue = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd));
    } catch (ReadFailedException e) {
        LOG.error("{} remove: Exception when attempting to retrieve VpnInstanceOpDataEntry for VPN {}. ", LOGGING_PREFIX_DELETE, vpnName, e);
        return;
    }
    if (!vpnOpValue.isPresent()) {
        LOG.error("{} remove: Unable to retrieve VpnInstanceOpDataEntry for VPN {}. ", LOGGING_PREFIX_DELETE, vpnName);
        return;
    } else {
        jobCoordinator.enqueueJob("VPN-" + vpnName, () -> {
            VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder().setVrfId(primaryRd).setVpnState(VpnInstanceOpDataEntry.VpnState.PendingDelete);
            InstanceIdentifier<VpnInstanceOpDataEntry> id = VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd);
            WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
            writeTxn.merge(LogicalDatastoreType.OPERATIONAL, id, builder.build());
            LOG.info("{} call: Operational status set to PENDING_DELETE for vpn {} with rd {}", LOGGING_PREFIX_DELETE, vpnName, primaryRd);
            return Collections.singletonList(writeTxn.submit());
        }, SystemPropertyReader.getDataStoreJobCoordinatorMaxRetries());
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) VpnInstanceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryBuilder)

Aggregations

ArrayList (java.util.ArrayList)39 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)23 VpnInstance (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance)19 BigInteger (java.math.BigInteger)18 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)17 VpnToDpnList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList)16 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)15 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)14 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)14 VpnInterface (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface)13 VpnInstanceNames (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.vpn._interface.VpnInstanceNames)13 VpnInterfaceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)13 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)12 List (java.util.List)10 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes)9 Optional (com.google.common.base.Optional)7 PostConstruct (javax.annotation.PostConstruct)7 Inject (javax.inject.Inject)7 Singleton (javax.inject.Singleton)7 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)7