Search in sources :

Example 46 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.

the class AbstractSnatService method addSnatMissEntry.

protected void addSnatMissEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId, Uint32 routerId, String routerName, Uint64 primarySwitchId) {
    LOG.debug("installSnatMissEntry : Installing SNAT miss entry in switch {}", dpnId);
    List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
    String ifNamePrimary = NatUtil.getTunnelInterfaceName(dpnId, primarySwitchId, itmManager);
    List<BucketInfo> listBucketInfo = new ArrayList<>();
    if (ifNamePrimary != null) {
        LOG.debug("installSnatMissEntry : On Non- Napt switch , Primary Tunnel interface is {}", ifNamePrimary);
        listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager, interfaceManager, ifNamePrimary, routerId, true);
    }
    BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
    listBucketInfo.add(0, bucketPrimary);
    LOG.debug("installSnatMissEntry : installSnatMissEntry called for dpnId {} with primaryBucket {} ", dpnId, listBucketInfo.get(0));
    // Install the select group
    Uint32 groupId = NatUtil.getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, getGroupIdKey(routerName));
    if (groupId != NatConstants.INVALID_ID) {
        GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId.longValue(), routerName, GroupTypes.GroupAll, listBucketInfo);
        LOG.debug("installing the PSNAT to NAPTSwitch GroupEntity:{} with GroupId: {}", groupEntity, groupId);
        mdsalManager.addGroup(confTx, groupEntity);
        // Add the flow to send the packet to the group only after group is available in Config datastore
        eventCallbacks.onAddOrUpdate(LogicalDatastoreType.CONFIGURATION, NatUtil.getGroupInstanceId(dpnId, groupId), (unused, newGroupId) -> {
            LOG.info("group {} is created in the config", groupId);
            LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, innerConfTx -> addSnatMissFlowForGroup(innerConfTx, dpnId, routerId, groupId)), LOG, "Error adding flow for the group {}", groupId);
            return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
        }, Duration.ofSeconds(5), iid -> LOG.error("groupId {} not found in config datastore", groupId));
    } else {
        LOG.error("installSnatMissEntry: Unable to get groupId for routerName:{}", routerName);
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) LoggerFactory(org.slf4j.LoggerFactory) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) AdjacenciesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.AdjacenciesBuilder) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) Duration(java.time.Duration) LearntVpnVipToPortDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortDataBuilder) VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInterfaces) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) VpnInterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInterfacesBuilder) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ActionNxLoadMetadata(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) NatDataUtil(org.opendaylight.netvirt.natservice.ha.NatDataUtil) Objects(java.util.Objects) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) IVpnFootprintService(org.opendaylight.netvirt.vpnmanager.api.IVpnFootprintService) ExternalIps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) NWUtil(org.opendaylight.genius.mdsalutil.NWUtil) SnatServiceListener(org.opendaylight.netvirt.natservice.api.SnatServiceListener) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) Uint64(org.opendaylight.yangtools.yang.common.Uint64) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) LearntVpnVipToPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortData) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) ArrayList(java.util.ArrayList) MatchIpv4Destination(org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) Uint32(org.opendaylight.yangtools.yang.common.Uint32) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Logger(org.slf4j.Logger) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) VpnInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterfaceBuilder) ExpectedDataObjectNotFoundException(org.opendaylight.genius.datastoreutils.ExpectedDataObjectNotFoundException) GroupEntity(org.opendaylight.genius.mdsalutil.GroupEntity) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) Collections(java.util.Collections) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) ItmRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService) GroupEntity(org.opendaylight.genius.mdsalutil.GroupEntity) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Example 47 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.

the class NetworkL2gwDeviceInfoCli method process.

@SuppressWarnings("checkstyle:HiddenField")
void process(NodeId hwvtepNodeId, String elanName) {
    Node hwvtepConfigNode = configNodes.get(hwvtepNodeId);
    session.getConsole().println("Config Data >>");
    printLocalUcastMacs(hwvtepConfigNode, elanName);
    session.getConsole().println("Operational Data >>");
    Node hwvtepOpNode = opNodes.get(hwvtepNodeId);
    printLocalUcastMacs(hwvtepOpNode, elanName);
    session.getConsole().println("Config Data >>");
    printLocalMcastMacs(hwvtepConfigNode, elanName);
    session.getConsole().println("Operational Data >>");
    printLocalMcastMacs(hwvtepOpNode, elanName);
    session.getConsole().println("Config Data >>");
    printRemoteUcastMacs(hwvtepConfigNode, elanName);
    session.getConsole().println("Operational Data >>");
    printRemoteUcastMacs(hwvtepOpNode, elanName);
    session.getConsole().println("Config Data >>");
    printRemoteMcastMacs(hwvtepConfigNode, elanName);
    session.getConsole().println("Operational Data >>");
    printRemoteMcastMacs(hwvtepOpNode, elanName);
    Node hwvtepConfigPsNode = configPSNodes.get(hwvtepNodeId);
    session.getConsole().println("Config Data >>");
    printVlanBindings(hwvtepConfigPsNode, elanName);
    session.getConsole().println("Operational Data >>");
    Node hwvtepOpPsNode = opPSNodes.get(hwvtepNodeId);
    printVlanBindings(hwvtepOpPsNode, elanName);
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 48 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.

the class ElanBridgeManager method prepareIntegrationBridge.

private void prepareIntegrationBridge(Node ovsdbNode, Node brIntNode) {
    if (southboundUtils.getBridgeFromConfig(ovsdbNode, INTEGRATION_BRIDGE) == null) {
        LOG.debug("br-int in operational but not config, copying into config");
        copyBridgeToConfig(brIntNode);
    }
    Map<String, String> providerMappings = getOpenvswitchOtherConfigMap(ovsdbNode, PROVIDER_MAPPINGS_KEY);
    for (String value : providerMappings.values()) {
        if (southboundUtils.extractTerminationPointAugmentation(brIntNode, value) != null) {
            LOG.debug("prepareIntegrationBridge: port {} already exists on {}", value, INTEGRATION_BRIDGE);
            continue;
        }
        Node exBridgeNode = southboundUtils.readBridgeNode(ovsdbNode, value);
        if (exBridgeNode != null) {
            LOG.debug("prepareIntegrationBridge: bridge {} found. Patching to {}", value, INTEGRATION_BRIDGE);
            patchBridgeToBrInt(brIntNode, exBridgeNode, value);
        } else {
            LOG.debug("prepareIntegrationBridge: adding interface {} to {}", value, INTEGRATION_BRIDGE);
            if (!addPortToBridge(brIntNode, INTEGRATION_BRIDGE, value)) {
                LOG.error("Failed to add {} port to {}", value, brIntNode);
            }
        }
    }
    if (!addControllerToBridge(ovsdbNode, INTEGRATION_BRIDGE)) {
        LOG.error("Failed to set controller to existing integration bridge {}", brIntNode);
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 49 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.

the class VpnFloatingIpHandler method removeFromFloatingIpPortInfo.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeFromFloatingIpPortInfo(Uuid floatingIpId) {
    InstanceIdentifier id = buildfloatingIpIdToPortMappingIdentifier(floatingIpId);
    try {
        Optional<FloatingIpIdToPortMapping> optFloatingIpIdToPortMapping = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
        if (optFloatingIpIdToPortMapping.isPresent() && optFloatingIpIdToPortMapping.get().isFloatingIpDeleted()) {
            LOG.debug("Deleting floating IP UUID {} to Floating IP neutron port mapping from Floating " + "IP Port Info Config DS", floatingIpId.getValue());
            MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
        }
    } catch (Exception e) {
        LOG.error("removeFromFloatingIpPortInfo : Deleting floating IP UUID {} to Floating IP neutron port " + "mapping from Floating IP Port Info Config DS failed", floatingIpId.getValue(), e);
    }
}
Also used : InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) FloatingIpIdToPortMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMapping) ExecutionException(java.util.concurrent.ExecutionException)

Example 50 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.

the class BgpConfigurationManager method onUpdatePushRoute.

/* onUpdatePushRoute
     * Get Stale fibDSWriter map, and compare current route/fibDSWriter entry.
     *  - Entry compare shall include NextHop, Label.
     *  - If entry matches: delete from STALE Map. NO Change to FIB Config DS.
     *  - If entry not found, add to FIB Config DS.
     *  - If entry found, but either Label/NextHop doesn't match.
     *      - Update FIB Config DS with modified values.
     *      - delete from Stale Map.
     */
public void onUpdatePushRoute(protocol_type protocolType, String rd, String prefix, int plen, String nextHop, String macaddress, Uint32 label, Uint32 l2label, String routermac, af_afi afi) {
    PrefixUpdateEvent prefixUpdateEvent = new PrefixUpdateEvent(protocolType, rd, prefix, plen, nextHop, macaddress, label, l2label, routermac, afi);
    bgpUpdatesHistory.addToHistory(TransactionType.ADD, prefixUpdateEvent);
    boolean addroute = false;
    boolean macupdate = false;
    Uint32 l3vni = Uint32.ZERO;
    VrfEntry.EncapType encapType = VrfEntry.EncapType.Mplsgre;
    if (protocolType.equals(protocol_type.PROTOCOL_EVPN)) {
        encapType = VrfEntry.EncapType.Vxlan;
        VpnInstanceOpDataEntry vpnInstanceOpDataEntry = bgpUtil.getVpnInstanceOpData(rd);
        if (vpnInstanceOpDataEntry != null) {
            if (vpnInstanceOpDataEntry.getType() == VpnInstanceOpDataEntry.Type.L2) {
                LOG.info("Got RT2 route for RD {} l3label {} l2label {} from tep {} with mac {} remote RD {}", vpnInstanceOpDataEntry.getVpnInstanceName(), label, l2label, nextHop, macaddress, rd);
                addTepToElanDS(rd, nextHop, macaddress, l2label);
                macupdate = true;
            } else {
                l3vni = vpnInstanceOpDataEntry.getL3vni();
            }
        } else {
            LOG.error("No corresponding vpn instance found for rd {}. Aborting.", rd);
            return;
        }
    }
    if (!staledFibEntriesMap.isEmpty()) {
        // restart Scenario, as MAP is not empty.
        Map<String, Uint32> map = staledFibEntriesMap.get(rd);
        if (map != null) {
            String prefixNextHop = appendNextHopToPrefix(prefix + "/" + plen, nextHop);
            Uint32 labelInStaleMap = map.get(prefixNextHop);
            if (null == labelInStaleMap) {
                // New Entry, which happened to be added during restart.
                addroute = true;
            } else {
                map.remove(prefixNextHop);
                if (isRouteModified(label, labelInStaleMap)) {
                    LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
                    // Existing entry, where in Label got modified during restart
                    addroute = true;
                }
            }
        } else {
            LOG.debug("rd {} map is null while processing prefix {} ", rd, prefix);
            addroute = true;
        }
    } else {
        LOG.debug("Route add ** {} ** {}/{} ** {} ** {} ", rd, prefix, plen, nextHop, label);
        addroute = true;
    }
    if (macupdate) {
        LOG.info("ADD: Adding Mac Fib entry rd {} mac{} nexthop {} l2vni {}", rd, macaddress, nextHop, l2label);
        fibDSWriter.addMacEntryToDS(rd, macaddress, prefix, Collections.singletonList(nextHop), encapType, l2label, routermac, RouteOrigin.BGP);
        LOG.info("ADD: Added Mac Fib entry rd {} prefix {} nexthop {} label {}", rd, macaddress, nextHop, l2label);
    } else if (addroute) {
        LOG.info("ADD: Adding Fib entry rd {} prefix {} nexthop {} label {} afi {}", rd, prefix, nextHop, label, afi);
        // TODO: modify addFibEntryToDS signature
        List<String> nextHopList = Collections.singletonList(nextHop);
        fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nextHopList, encapType, label, l3vni, routermac, RouteOrigin.BGP);
        LOG.info("ADD: Added Fib entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, label);
        String vpnName = bgpUtil.getVpnNameFromRd(rd);
        if (vpnName != null) {
            vpnLinkService.leakRouteIfNeeded(vpnName, prefix, nextHopList, label, RouteOrigin.BGP, NwConstants.ADD_FLOW);
        }
    }
}
Also used : MacVrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntry) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) ArrayList(java.util.ArrayList) List(java.util.List) DcgwTepList(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.DcgwTepList) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Aggregations

ArrayList (java.util.ArrayList)61 ExecutionException (java.util.concurrent.ExecutionException)47 Test (org.junit.Test)46 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)34 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)26 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)26 BigInteger (java.math.BigInteger)25 Logger (org.slf4j.Logger)25 LoggerFactory (org.slf4j.LoggerFactory)25 List (java.util.List)24 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)24 ByteBuf (io.netty.buffer.ByteBuf)21 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)21 Collections (java.util.Collections)20 Map (java.util.Map)18 Singleton (javax.inject.Singleton)18 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)18 Inject (javax.inject.Inject)17 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)17