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;
}
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;
}
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);
}
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();
}
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);
});
}
Aggregations