Search in sources :

Example 41 with Monitoring

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring in project genius by opendaylight.

the class HwVTEPInterfaceStateUpdateHelper method startBfdMonitoring.

public static List<ListenableFuture<Void>> startBfdMonitoring(ManagedNewTransactionRunner txRunner, InstanceIdentifier<Tunnels> tunnelsInstanceIdentifier, Tunnels tunnelsNew) {
    LOG.debug("starting bfd monitoring for the hwvtep {}", tunnelsInstanceIdentifier);
    TunnelsBuilder tunnelsBuilder = new TunnelsBuilder();
    tunnelsBuilder.setKey(new TunnelsKey(tunnelsNew.getLocalLocatorRef(), tunnelsNew.getRemoteLocatorRef()));
    tunnelsBuilder.setLocalLocatorRef(tunnelsNew.getLocalLocatorRef());
    tunnelsBuilder.setRemoteLocatorRef(tunnelsNew.getLocalLocatorRef());
    List<BfdParams> bfdParams = new ArrayList<>();
    SouthboundUtils.fillBfdParameters(bfdParams, null);
    tunnelsBuilder.setBfdParams(bfdParams);
    return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.put(LogicalDatastoreType.CONFIGURATION, tunnelsInstanceIdentifier, tunnelsBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS)));
}
Also used : Logger(org.slf4j.Logger) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) OperStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus) TunnelsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey) BfdStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatus) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) BfdParams(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) LoggerFactory(org.slf4j.LoggerFactory) InterfaceManagerCommonUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ArrayList(java.util.ArrayList) Tunnels(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) TunnelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder) SouthboundUtils(org.opendaylight.genius.interfacemanager.renderer.hwvtep.utilities.SouthboundUtils) InterfaceMetaUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils) Collections(java.util.Collections) ArrayList(java.util.ArrayList) TunnelsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey) BfdParams(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams) TunnelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder)

Example 42 with Monitoring

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring in project genius by opendaylight.

the class OvsInterfaceConfigAddHelper method addTunnelConfiguration.

private void addTunnelConfiguration(ParentRefs parentRefs, Interface interfaceNew, IfTunnel ifTunnel, WriteTransaction defaultConfigShardTransaction, WriteTransaction defaultOperShardTransaction, List<ListenableFuture<Void>> futures) {
    if (parentRefs == null) {
        LOG.warn("ParentRefs for interface: {} Not Found. " + "Creation of Tunnel OF-Port not supported when dpid not provided.", interfaceNew.getName());
        return;
    }
    BigInteger dpId = parentRefs.getDatapathNodeIdentifier();
    if (dpId == null) {
        LOG.warn("dpid for interface: {} Not Found. No DPID provided. " + "Creation of OF-Port not supported.", interfaceNew.getName());
        return;
    }
    LOG.info("adding tunnel configuration for interface {}", interfaceNew.getName());
    if (ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeLogicalGroup.class)) {
        futures.add(addLogicalTunnelGroup(interfaceNew, defaultOperShardTransaction));
        return;
    }
    boolean createTunnelPort = true;
    final String tunnelName;
    if (SouthboundUtils.isOfTunnel(ifTunnel)) {
        BridgeEntry bridgeEntry = interfaceMetaUtils.getBridgeEntryFromConfigDS(dpId);
        createTunnelPort = bridgeEntry == null || bridgeEntry.getBridgeInterfaceEntry() == null || bridgeEntry.getBridgeInterfaceEntry().isEmpty();
        tunnelName = SouthboundUtils.generateOfTunnelName(dpId, ifTunnel);
        interfaceManagerCommonUtils.createInterfaceChildEntry(tunnelName, interfaceNew.getName(), defaultConfigShardTransaction);
        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState = interfaceManagerCommonUtils.getInterfaceState(tunnelName);
        if (interfaceState != null) {
            coordinator.enqueueJob(tunnelName, () -> ovsInterfaceStateAddHelper.addState(interfaceNew.getName(), interfaceState));
        }
    } else {
        tunnelName = interfaceNew.getName();
    }
    String parentInterface = parentRefs.getParentInterface();
    if (ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class) && !Strings.isNullOrEmpty(parentInterface)) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: createInterfaceChildEntry for {} in logical group {}", tunnelName, parentInterface);
        interfaceManagerCommonUtils.createInterfaceChildEntry(parentInterface, tunnelName, defaultConfigShardTransaction);
    }
    LOG.debug("creating bridge interfaceEntry in ConfigDS {}", dpId);
    interfaceMetaUtils.createBridgeInterfaceEntryInConfigDS(dpId, interfaceNew.getName());
    // create bridge on switch, if switch is connected
    BridgeRefEntry bridgeRefEntry = interfaceMetaUtils.getBridgeRefEntryFromOperDS(dpId);
    if (bridgeRefEntry != null && bridgeRefEntry.getBridgeReference() != null) {
        LOG.debug("creating bridge interface on dpn {}", dpId);
        InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid = (InstanceIdentifier<OvsdbBridgeAugmentation>) bridgeRefEntry.getBridgeReference().getValue();
        if (createTunnelPort) {
            southboundUtils.addPortToBridge(bridgeIid, interfaceNew, tunnelName);
        }
        // if TEP is already configured on switch, start LLDP monitoring and
        // program tunnel ingress flow
        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceNew.getName());
        if (ifState != null) {
            NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
            if (ncId != null) {
                long portNo = IfmUtil.getPortNumberFromNodeConnectorId(ncId);
                interfaceManagerCommonUtils.addTunnelIngressFlow(ifTunnel, dpId, portNo, interfaceNew.getName(), ifState.getIfIndex());
                ListenableFuture<Void> future = FlowBasedServicesUtils.bindDefaultEgressDispatcherService(txRunner, interfaceNew, Long.toString(portNo), interfaceNew.getName(), ifState.getIfIndex());
                futures.add(future);
                Futures.addCallback(future, new FutureCallback<Void>() {

                    @Override
                    public void onSuccess(@Nullable Void result) {
                        // start LLDP monitoring for the tunnel interface
                        alivenessMonitorUtils.startLLDPMonitoring(ifTunnel, interfaceNew.getName());
                    }

                    @Override
                    public void onFailure(@Nonnull Throwable throwable) {
                        LOG.error("Unable to add tunnel monitoring", throwable);
                    }
                }, MoreExecutors.directExecutor());
            }
        }
    }
}
Also used : Collections(java.util.Collections) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) OvsdbBridgeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation) BigInteger(java.math.BigInteger)

Example 43 with Monitoring

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring in project genius by opendaylight.

the class OvsInterfaceConfigRemoveHelper method removeTunnelConfiguration.

private void removeTunnelConfiguration(ParentRefs parentRefs, String interfaceName, IfTunnel ifTunnel, WriteTransaction defaultOperationalShardTransaction) {
    LOG.info("removing tunnel configuration for interface {}", interfaceName);
    BigInteger dpId = null;
    if (parentRefs != null) {
        dpId = parentRefs.getDatapathNodeIdentifier();
    }
    if (dpId == null) {
        return;
    }
    OvsdbBridgeRef ovsdbBridgeRef = interfaceMetaUtils.getOvsdbBridgeRef(dpId);
    BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpId);
    InstanceIdentifier<BridgeEntry> bridgeEntryIid = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
    BridgeEntry bridgeEntry = interfaceMetaUtils.getBridgeEntryFromConfigDS(bridgeEntryIid);
    if (bridgeEntry == null) {
        LOG.debug("Bridge Entry not present for dpn: {}", dpId);
        return;
    }
    List<BridgeInterfaceEntry> bridgeInterfaceEntries = bridgeEntry.getBridgeInterfaceEntry();
    if (bridgeInterfaceEntries == null) {
        LOG.debug("Bridge Interface Entries not present for dpn : {}", dpId);
        return;
    }
    String tunnelName = SouthboundUtils.isOfTunnel(ifTunnel) ? SouthboundUtils.generateOfTunnelName(dpId, ifTunnel) : interfaceName;
    boolean deleteTunnel = canDeleteTunnelPort(bridgeInterfaceEntries, ifTunnel);
    if (ovsdbBridgeRef != null && deleteTunnel) {
        southboundUtils.removeTerminationEndPoint(ovsdbBridgeRef.getValue(), tunnelName);
    }
    if (SouthboundUtils.isOfTunnel(ifTunnel)) {
        if (deleteTunnel) {
            interfaceManagerCommonUtils.deleteParentInterfaceEntry(tunnelName);
        } else {
            interfaceManagerCommonUtils.deleteInterfaceChildEntry(tunnelName, interfaceName);
        }
    }
    // delete tunnel ingress flow
    removeTunnelIngressFlow(interfaceName, ifTunnel, dpId);
    // delete bridge to tunnel interface mappings
    interfaceMetaUtils.deleteBridgeInterfaceEntry(bridgeEntryKey, bridgeInterfaceEntries, bridgeEntryIid, interfaceName);
    int lportTag = interfaceMetaUtils.removeLportTagInterfaceMap(defaultOperationalShardTransaction, interfaceName);
    cleanUpInterfaceWithUnknownState(interfaceName, parentRefs, ifTunnel, defaultOperationalShardTransaction);
    // stop LLDP monitoring for the tunnel interface
    alivenessMonitorUtils.stopLLDPMonitoring(ifTunnel, interfaceName);
    if (ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
        removeMultipleVxlanTunnelsConfiguration(interfaceName, parentRefs);
    } else if (ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeLogicalGroup.class)) {
        removeLogicalTunnelGroup(dpId, interfaceName, lportTag, defaultOperationalShardTransaction);
    }
}
Also used : BridgeEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey) TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) BigInteger(java.math.BigInteger) OvsdbBridgeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef) BridgeInterfaceEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.bridge.entry.BridgeInterfaceEntry)

Example 44 with Monitoring

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring in project genius by opendaylight.

the class OvsInterfaceConfigUpdateHelper method handleTunnelMonitorUpdates.

/*
     * if the tunnel monitoring attributes have changed, handle it based on the
     * tunnel type. As of now internal vxlan tunnels use LLDP monitoring and
     * external tunnels use BFD monitoring.
     */
private void handleTunnelMonitorUpdates(WriteTransaction transaction, Interface interfaceNew, Interface interfaceOld) {
    LOG.debug("tunnel monitoring attributes modified for interface {}", interfaceNew.getName());
    // update termination point on switch, if switch is connected
    BridgeRefEntry bridgeRefEntry = interfaceMetaUtils.getBridgeReferenceForInterface(interfaceNew);
    IfTunnel ifTunnel = interfaceNew.getAugmentation(IfTunnel.class);
    if (SouthboundUtils.isMonitorProtocolBfd(ifTunnel) && interfaceMetaUtils.bridgeExists(bridgeRefEntry)) {
        SouthboundUtils.updateBfdParamtersForTerminationPoint(bridgeRefEntry.getBridgeReference().getValue(), interfaceNew.getAugmentation(IfTunnel.class), interfaceNew.getName(), transaction);
    } else {
        // update lldp tunnel monitoring attributes for an internal vxlan
        // tunnel interface
        alivenessMonitorUtils.handleTunnelMonitorUpdates(interfaceOld, interfaceNew);
    }
}
Also used : BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)

Example 45 with Monitoring

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring in project bgpcep by opendaylight.

the class BmpMonitoringStationImpl method closeServiceInstance.

@Override
public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
    LOG.info("BMP Monitor Singleton Service {} instance closed, Monitor Id {}", getIdentifier().getName(), monitorId.getValue());
    if (channel != null) {
        channel.close().addListener((ChannelFutureListener) future -> {
            Preconditions.checkArgument(future.isSuccess(), "Channel failed to close: %s", future.cause());
            BmpMonitoringStationImpl.this.sessionManager.close();
        });
    }
    final DOMDataTreeWriteTransaction wTx = domDataBroker.newWriteOnlyTransaction();
    wTx.delete(LogicalDatastoreType.OPERATIONAL, yangMonitorId);
    LOG.info("BMP monitoring station {} closed.", monitorId.getValue());
    return wTx.commit();
}
Also used : DOMDataTreeWriteTransaction(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction) MonitoredRouter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev200120.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter) BindingCodecTree(org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree) BmpMonitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.BmpMonitor) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) Monitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor) InetAddress(java.net.InetAddress) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) ServiceGroupIdentifier(org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier) IetfInetUtil(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil) Objects.requireNonNull(java.util.Objects.requireNonNull) ChannelFutureListener(io.netty.channel.ChannelFutureListener) Map(java.util.Map) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) CommitInfo(org.opendaylight.mdsal.common.api.CommitInfo) ClusterSingletonServiceProvider(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider) MonitorId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.MonitorId) Logger(org.slf4j.Logger) Collection(java.util.Collection) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) InetSocketAddress(java.net.InetSocketAddress) QName(org.opendaylight.yangtools.yang.common.QName) ChannelFuture(io.netty.channel.ChannelFuture) Channel(io.netty.channel.Channel) ExecutionException(java.util.concurrent.ExecutionException) Ipv4Util(org.opendaylight.protocol.util.Ipv4Util) BmpMonitoringStation(org.opendaylight.protocol.bmp.impl.spi.BmpMonitoringStation) DOMDataBroker(org.opendaylight.mdsal.dom.api.DOMDataBroker) BmpDispatcher(org.opendaylight.protocol.bmp.api.BmpDispatcher) ImmutableNodes(org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) Preconditions(com.google.common.base.Preconditions) InetAddresses(com.google.common.net.InetAddresses) RIBExtensionConsumerContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext) Router(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.routers.Router) FluentFuture(com.google.common.util.concurrent.FluentFuture) DOMDataTreeWriteTransaction(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction)

Aggregations

ArrayList (java.util.ArrayList)16 Optional (com.google.common.base.Optional)11 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)10 Logger (org.slf4j.Logger)10 LoggerFactory (org.slf4j.LoggerFactory)10 List (java.util.List)9 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)9 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)9 Collections (java.util.Collections)8 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)8 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)8 FutureCallback (com.google.common.util.concurrent.FutureCallback)7 ExecutionException (java.util.concurrent.ExecutionException)7 Inject (javax.inject.Inject)7 Singleton (javax.inject.Singleton)7 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)7 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)7 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)7 EtherTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)7