Search in sources :

Example 31 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class L2GatewayConnectionListener method loadL2GwDeviceCache.

private void loadL2GwDeviceCache(TypedReadTransaction tx) {
    allNodes = (Map<InstanceIdentifier<Node>, Node>) readAllConfigNodes(tx).stream().collect(toMap(TO_NODE_PATH, Function.identity()));
    LOG.trace("Loading all config nodes");
    Set<InstanceIdentifier<Node>> allIids = allNodes.keySet();
    Map<String, List<InstanceIdentifier<Node>>> psNodesByDeviceName = allIids.stream().filter(IS_PS_NODE).collect(groupingBy(GET_DEVICE_NAME, toList()));
    // Process HA nodes
    createHANodes(allIids);
    // Process non HA nodes there will be only one ps node iid for each device for non ha nodes
    psNodesByDeviceName.values().stream().filter(psIids -> psIids.size() == 1).map(psIids -> psIids.get(0)).forEach(psIid -> {
        Node psNode = allNodes.get(psIid);
        Node globalNode = allNodes.get(TO_GLOBAL_PATH.apply(psNode));
        if (globalNode != null) {
            addL2DeviceToCache(psIid, globalNode, psNode);
        }
    });
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) LoggerFactory(org.slf4j.LoggerFactory) ConfigMcastCache(org.opendaylight.netvirt.elan.cache.ConfigMcastCache) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) RecoverableListener(org.opendaylight.serviceutils.srm.RecoverableListener) PreDestroy(javax.annotation.PreDestroy) HwvtepHAUtil(org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil) Collectors.toMap(java.util.stream.Collectors.toMap) TypedReadTransaction(org.opendaylight.mdsal.binding.util.TypedReadTransaction) Map(java.util.Map) PhysicalSwitchAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation) ResourceBatchingManager(org.opendaylight.genius.utils.batching.ResourceBatchingManager) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) ItmExternalTunnelCache(org.opendaylight.netvirt.elan.cache.ItmExternalTunnelCache) Set(java.util.Set) List(java.util.List) RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) L2gatewayConnections(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.L2gatewayConnections) L2GatewayCache(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayCache) L2gatewayConnection(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnection) L2GatewayServiceRecoveryHandler(org.opendaylight.netvirt.elan.l2gw.recovery.impl.L2GatewayServiceRecoveryHandler) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) Singleton(javax.inject.Singleton) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) BiPredicate(java.util.function.BiPredicate) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) L2GatewayConnectionInstanceRecoveryHandler(org.opendaylight.netvirt.elan.l2gw.recovery.impl.L2GatewayConnectionInstanceRecoveryHandler) HwvtepSouthboundUtils(org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils) Logger(org.slf4j.Logger) AbstractClusteredAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractClusteredAsyncDataTreeChangeListener) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Scheduler(org.opendaylight.netvirt.elan.utils.Scheduler) ServiceRecoveryRegistry(org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry) HwvtepHACache(org.opendaylight.genius.utils.hwvtep.HwvtepHACache) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) Collectors.toList(java.util.stream.Collectors.toList) L2GatewayConnectionUtils(org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) TunnelIps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps) Collections(java.util.Collections) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList)

Example 32 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class L2GwValidateCli method verifyL2GatewayConnections.

private void verifyL2GatewayConnections() {
    boolean isValid = true;
    for (L2gatewayConnection l2gatewayConnection : l2gatewayConnections) {
        Uuid l2GatewayDeiceUuid = l2gatewayConnection.getL2gatewayId();
        if (l2GatewayDeiceUuid != null) {
            L2gateway l2gateway = uuidToL2Gateway.get(l2GatewayDeiceUuid);
            String logicalSwitchName = l2gatewayConnection.getNetworkId().getValue();
            Map<DevicesKey, Devices> devices = l2gateway.nonnullDevices();
            for (Devices device : devices.values()) {
                L2GatewayDevice l2GatewayDevice = l2GatewayCache.get(device.getDeviceName());
                isValid = verifyL2GatewayDevice(l2gateway, device, l2GatewayDevice);
                if (!isValid) {
                    continue;
                }
                NodeId nodeId = new NodeId(l2GatewayDevice.getHwvtepNodeId());
                InstanceIdentifier<Node> nodeIid = topoIid.child(Node.class, new NodeKey(nodeId));
                isValid = verfiyLogicalSwitch(logicalSwitchName, nodeIid);
                if (isValid) {
                    isValid = verifyMcastMac(logicalSwitchName, nodeIid);
                    verifyVlanBindings(nodeIid, logicalSwitchName, device, l2gatewayConnection.getSegmentId());
                    L2GatewayDevice elanL2gatewayDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(logicalSwitchName, nodeId.getValue());
                    if (elanL2gatewayDevice == null) {
                        pw.println("Failed elan l2gateway device not found for network " + logicalSwitchName + " and device " + device.getDeviceName() + " " + l2GatewayDevice.getHwvtepNodeId() + " l2gw connection id " + l2gatewayConnection.getUuid());
                    }
                }
            }
        }
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Devices(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices) DevicesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.DevicesKey) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) L2gateway(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gateway) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) L2gatewayConnection(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnection)

Example 33 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class ElanInterfaceStateClusteredListener method handleExternalTunnelUpdate.

private void handleExternalTunnelUpdate(String interfaceName, Interface update) {
    ExternalTunnel externalTunnel = elanUtils.getExternalTunnel(interfaceName, LogicalDatastoreType.CONFIGURATION);
    if (externalTunnel != null) {
        LOG.debug("handling external tunnel update event for ext device dst {}  src {} ", externalTunnel.getDestinationDevice(), externalTunnel.getSourceDevice());
        elanInterfaceManager.handleExternalTunnelStateEvent(externalTunnel, update);
    } else {
        LOG.trace("External tunnel not found with interfaceName: {}", interfaceName);
    }
}
Also used : ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)

Example 34 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class L2GwValidateCli method verifyConfigVsOperationalDiff.

/**
 * Checks the diff between config and operational topology nodes and prints it to the file if any.
 * This will tell what is present in the controller config and not in the device
 */
private void verifyConfigVsOperationalDiff() {
    for (Node cfgNode : configNodes.values()) {
        InstanceIdentifier<Node> nodeId = topoIid.child(Node.class, cfgNode.key());
        compareNodes(cfgNode, operationalNodes.get(nodeId), false, CONFIGURATION);
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 35 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project openflowplugin by opendaylight.

the class SyncPlanPushStrategyIncrementalImpl method addMissingMeters.

ListenableFuture<RpcResult<Void>> addMissingMeters(final NodeId nodeId, final InstanceIdentifier<FlowCapableNode> nodeIdent, final ItemSyncBox<Meter> syncBox, final SyncCrudCounters counters) {
    if (syncBox.isEmpty()) {
        LOG.trace("no meters configured for node: {} -> SKIPPING", nodeId.getValue());
        return RpcResultBuilder.<Void>success().buildFuture();
    }
    final CrudCounts meterCrudCounts = counters.getMeterCrudCounts();
    final List<ListenableFuture<RpcResult<AddMeterOutput>>> allResults = new ArrayList<>();
    final List<ListenableFuture<RpcResult<UpdateMeterOutput>>> allUpdateResults = new ArrayList<>();
    for (Meter meter : syncBox.getItemsToPush()) {
        final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdent.child(Meter.class, meter.key());
        LOG.debug("adding meter {} - absent on device {}", meter.getMeterId(), nodeId);
        allResults.add(meterForwarder.add(meterIdent, meter, nodeIdent));
        meterCrudCounts.incAdded();
    }
    for (ItemSyncBox.ItemUpdateTuple<Meter> meterTuple : syncBox.getItemsToUpdate()) {
        final Meter existingMeter = meterTuple.getOriginal();
        final Meter updated = meterTuple.getUpdated();
        final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdent.child(Meter.class, updated.key());
        LOG.trace("meter {} - needs update on device {}", updated.getMeterId(), nodeId);
        allUpdateResults.add(meterForwarder.update(meterIdent, existingMeter, updated, nodeIdent));
        meterCrudCounts.incUpdated();
    }
    final ListenableFuture<RpcResult<Void>> singleVoidAddResult = Futures.transform(Futures.allAsList(allResults), ReconcileUtil.createRpcResultCondenser("meter add"), MoreExecutors.directExecutor());
    final ListenableFuture<RpcResult<Void>> singleVoidUpdateResult = Futures.transform(Futures.allAsList(allUpdateResults), ReconcileUtil.createRpcResultCondenser("meter update"), MoreExecutors.directExecutor());
    return Futures.transform(Futures.allAsList(singleVoidUpdateResult, singleVoidAddResult), ReconcileUtil.createRpcResultCondenser("meter add/update"), MoreExecutors.directExecutor());
}
Also used : ItemSyncBox(org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox) UpdateMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput) Meter(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter) ArrayList(java.util.ArrayList) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CrudCounts(org.opendaylight.openflowplugin.applications.frsync.util.CrudCounts) MeterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey) AddMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Aggregations

ArrayList (java.util.ArrayList)50 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)34 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)30 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)25 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)24 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)24 List (java.util.List)21 ExecutionException (java.util.concurrent.ExecutionException)18 Collection (java.util.Collection)16 Map (java.util.Map)16 Collections (java.util.Collections)15 HashMap (java.util.HashMap)15 Test (org.junit.Test)14 BigInteger (java.math.BigInteger)13 Set (java.util.Set)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)12 Logger (org.slf4j.Logger)12 LoggerFactory (org.slf4j.LoggerFactory)12