Search in sources :

Example 81 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 netconf by opendaylight.

the class NetconfTopologyRPCProvider method deleteDevice.

@Override
public final ListenableFuture<RpcResult<DeleteDeviceOutput>> deleteDevice(final DeleteDeviceInput input) {
    final NodeId nodeId = new NodeId(input.getNodeId());
    final InstanceIdentifier<Node> niid = topologyPath.child(Node.class, new NodeKey(nodeId));
    final WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
    wtx.delete(LogicalDatastoreType.CONFIGURATION, niid);
    final SettableFuture<RpcResult<DeleteDeviceOutput>> rpcFuture = SettableFuture.create();
    wtx.commit().addCallback(new FutureCallback<CommitInfo>() {

        @Override
        public void onSuccess(final CommitInfo result) {
            LOG.info("delete-device RPC: Removed netconf node successfully.");
            rpcFuture.set(RpcResultBuilder.success(new DeleteDeviceOutputBuilder().build()).build());
        }

        @Override
        public void onFailure(final Throwable exception) {
            LOG.error("delete-device RPC: Unable to remove netconf node.", exception);
            rpcFuture.setException(exception);
        }
    }, MoreExecutors.directExecutor());
    return rpcFuture;
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) NetconfNode(org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CommitInfo(org.opendaylight.mdsal.common.api.CommitInfo) DeleteDeviceOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.DeleteDeviceOutputBuilder) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

Example 82 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 genius by opendaylight.

the class ItmExternalTunnelAddWorker method wireUp.

// for tunnels from TOR device
private boolean wireUp(String topoId, String srcNodeid, IpAddress srcIp, String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, WriteTransaction transaction) {
    IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
    IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
    String parentIf = ItmUtils.getHwParentIf(topoId, srcNodeid);
    String tunTypeStr = tunType.getName();
    String tunnelIfName = ItmUtils.getTrunkInterfaceName(parentIf, new String(srcIp.getValue()), new String(dstIp.getValue()), tunTypeStr);
    LOG.debug(" Creating ExternalTrunk Interface with parameters Name - {}, parent I/f name - {}, " + "source IP - {}, destination IP - {} gateway IP - {}", tunnelIfName, parentIf, srcIp, dstIp, gwyIpAddress);
    Interface hwTunnelIf = ItmUtils.buildHwTunnelInterface(tunnelIfName, String.format("%s %s", tunType.getName(), "Trunk Interface"), true, topoId, srcNodeid, tunType, srcIp, dstIp, gwyIpAddress, monitorEnabled, monitorProtocol, monitorInterval);
    InstanceIdentifier<Interface> ifIID = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(tunnelIfName)).build();
    LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", ifIID, hwTunnelIf);
    ItmUtils.ITM_CACHE.addInterface(hwTunnelIf);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, ifIID, hwTunnelIf, true);
    // also update itm-state ds?
    InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dstNodeId), getExternalTunnelKey(srcNodeid), tunType));
    ExternalTunnel tnl = ItmUtils.buildExternalTunnel(getExternalTunnelKey(srcNodeid), getExternalTunnelKey(dstNodeId), tunType, tunnelIfName);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, path, tnl, true);
    ItmUtils.ITM_CACHE.addExternalTunnel(tnl);
    return true;
}
Also used : ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 83 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 ElanL2GatewayMulticastUtils method handleMcastForElanL2GwDeviceDelete.

/**
 * Handle mcast for elan l2 gw device delete.
 *
 * @param elanName
 *            the elan instance name
 * @param l2GatewayDevice
 *            the l2 gateway device
 * @return the listenable future
 */
public List<ListenableFuture<Void>> handleMcastForElanL2GwDeviceDelete(String elanName, L2GatewayDevice l2GatewayDevice) {
    ListenableFuture<Void> deleteTepFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
        tx.delete(LogicalDatastoreType.CONFIGURATION, buildExternalTepPath(elanName, l2GatewayDevice.getTunnelIp()));
    });
    ListenableFuture<Void> updateMcastMacsFuture = updateMcastMacsForAllElanDevices(elanName, l2GatewayDevice, false);
    ListenableFuture<Void> deleteRemoteMcastMacFuture = deleteRemoteMcastMac(new NodeId(l2GatewayDevice.getHwvtepNodeId()), elanName);
    return Arrays.asList(updateMcastMacsFuture, deleteRemoteMcastMacFuture, deleteTepFuture);
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)

Example 84 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 ElanDmacUtils method installDmacFlowsToExternalRemoteMac.

/**
 * Installs a Flow in the specified DPN's DMAC table. The flow is for a MAC
 * that is connected remotely in an External Device (TOR) and that is
 * accessible through an external tunnel. It also installs the flow for
 * dropping the packet if it came over an ITM tunnel (that is, if the
 * Split-Horizon flag is set)
 *
 * @param dpnId
 *            Id of the DPN where the flow must be installed
 * @param extDeviceNodeId
 *            the ext device node id
 * @param elanTag
 *            the elan tag
 * @param vni
 *            the vni
 * @param macAddress
 *            the mac address
 * @param displayName
 *            the display name
 * @param interfaceName
 *            the interface name
 *
 * @return the dmac flows
 * @throws ElanException in case of issues creating the flow objects
 */
public List<ListenableFuture<Void>> installDmacFlowsToExternalRemoteMac(BigInteger dpnId, String extDeviceNodeId, Long elanTag, Long vni, String macAddress, String displayName, String interfaceName) throws ElanException {
    synchronized (ElanUtils.getElanMacDPNKey(elanTag, macAddress, dpnId)) {
        Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName);
        ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
        Flow dropFlow = buildDmacFlowDropIfPacketComingFromTunnel(dpnId, extDeviceNodeId, elanTag, macAddress);
        ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(dropFlow, dpnId), dropFlow);
        installEtreeDmacFlowsToExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName, interfaceName);
    }
    return Collections.emptyList();
}
Also used : Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 85 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 HwvtepPhysicalSwitchListener method handleAdd.

/**
 * Handle add.
 *
 * @param l2GwDevice
 *            the l2 gw device
 */
private void handleAdd(L2GatewayDevice l2GwDevice) {
    final String psName = l2GwDevice.getDeviceName();
    final String hwvtepNodeId = l2GwDevice.getHwvtepNodeId();
    Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
    for (final IpAddress tunnelIpAddr : tunnelIps) {
        if (L2GatewayConnectionUtils.isGatewayAssociatedToL2Device(l2GwDevice)) {
            LOG.debug("L2Gateway {} associated for {} physical switch; creating ITM tunnels for {}", l2GwDevice.getL2GatewayIds(), psName, tunnelIpAddr);
            l2gwServiceProvider.provisionItmAndL2gwConnection(l2GwDevice, psName, hwvtepNodeId, tunnelIpAddr);
        } else {
            LOG.info("l2gw.provision.skip {}:{}", hwvtepNodeId, psName);
        }
    }
    elanClusterUtils.runOnlyInOwnerNode("Stale entry cleanup", () -> {
        InstanceIdentifier<Node> globalNodeIid = HwvtepSouthboundUtils.createInstanceIdentifier(new NodeId(hwvtepNodeId));
        InstanceIdentifier<Node> psIid = HwvtepSouthboundUtils.createInstanceIdentifier(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepNodeId), psName));
        staleVlanBindingsCleaner.scheduleStaleCleanup(psName, globalNodeIid, psIid);
    });
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

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