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 addL2DeviceToCache.
void addL2DeviceToCache(InstanceIdentifier<Node> psIid, Node globalNode, Node psNode) {
LOG.trace("Adding device to cache {}", psNode.getNodeId().getValue());
String deviceName = HwvtepHAUtil.getPsName(psIid);
L2GatewayDevice l2GwDevice = l2GatewayCache.addOrGet(deviceName);
l2GwDevice.setConnected(true);
l2GwDevice.setHwvtepNodeId(globalNode.getNodeId().getValue());
List<TunnelIps> tunnelIps = psNode.getAugmentation(PhysicalSwitchAugmentation.class) != null ? psNode.getAugmentation(PhysicalSwitchAugmentation.class).getTunnelIps() : null;
if (tunnelIps != null) {
for (TunnelIps tunnelIp : tunnelIps) {
IpAddress tunnelIpAddr = tunnelIp.getTunnelIpsKey();
l2GwDevice.addTunnelIp(tunnelIpAddr);
}
}
}
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 DhcpExternalTunnelManager method putRemoteMcastMac.
private WriteTransaction putRemoteMcastMac(WriteTransaction transaction, String elanName, L2GatewayDevice device, IpAddress internalTunnelIp) {
Optional<Node> optionalNode = getNode(broker, device.getHwvtepNodeId());
Node dstNode = optionalNode.get();
if (dstNode == null) {
LOG.trace("could not get device node {} ", device.getHwvtepNodeId());
return null;
}
RemoteMcastMacs macs = createRemoteMcastMac(dstNode, elanName, internalTunnelIp);
HwvtepUtils.putRemoteMcastMac(transaction, dstNode.getNodeId(), macs);
return transaction;
}
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 DhcpExternalTunnelManager method configureDhcpArpRequestResponseFlow.
public void configureDhcpArpRequestResponseFlow(BigInteger dpnId, String elanInstanceName, boolean addFlow, IpAddress tunnelIp, String dhcpIpAddress, String dhcpMacAddress) {
L2GatewayDevice device = getDeviceFromTunnelIp(tunnelIp);
if (device == null) {
LOG.error("Unable to get L2Device for tunnelIp {} and elanInstanceName {}", tunnelIp, elanInstanceName);
}
jobCoordinator.enqueueJob(getJobKey(elanInstanceName), () -> {
if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(dpnId), device.getHwvtepNodeId());
int lportTag = interfaceManager.getInterfaceInfo(tunnelInterfaceName).getInterfaceTag();
InstanceIdentifier<ElanInstance> elanIdentifier = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).build();
Optional<ElanInstance> optElan = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, elanIdentifier);
if (optElan.isPresent()) {
LOG.trace("Configuring the SR-IOV Arp request/response flows for LPort {} ElanTag {}.", lportTag, optElan.get().getElanTag());
Uuid nwUuid = new Uuid(elanInstanceName);
String strVni = DhcpServiceUtils.getSegmentationId(nwUuid, broker);
BigInteger vni = strVni != null ? new BigInteger(strVni) : BigInteger.ZERO;
if (!vni.equals(BigInteger.ZERO)) {
if (addFlow) {
LOG.trace("Installing the SR-IOV DHCP Arp flow for DPN {} Port Ip {}, Lport {}.", dpnId, dhcpIpAddress, lportTag);
installDhcpArpRequestFlows(dpnId, vni, dhcpIpAddress, lportTag, optElan.get().getElanTag());
installDhcpArpResponderFlows(dpnId, tunnelInterfaceName, lportTag, elanInstanceName, dhcpIpAddress, dhcpMacAddress);
} else {
LOG.trace("Uninstalling the SR-IOV DHCP Arp flows for DPN {} Port Ip {}, Lport {}.", dpnId, dhcpIpAddress, lportTag);
uninstallDhcpArpRequestFlows(dpnId, vni, dhcpIpAddress, lportTag);
uninstallDhcpArpResponderFlows(dpnId, tunnelInterfaceName, lportTag, dhcpIpAddress);
}
}
}
}
return null;
});
}
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 L2GatewayListener method removeL2Device.
private void removeL2Device(Devices l2Device, L2gateway input) {
final String l2DeviceName = l2Device.getDeviceName();
L2GatewayDevice l2GwDevice = l2GatewayCache.get(l2DeviceName);
if (l2GwDevice != null) {
// Also, do not delete device from cache if it's connected
if (L2GatewayUtils.isLastL2GatewayBeingDeleted(l2GwDevice)) {
if (l2GwDevice.isConnected()) {
l2GwDevice.removeL2GatewayId(input.getUuid());
// Delete ITM tunnels
final String hwvtepId = l2GwDevice.getHwvtepNodeId();
final Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
jobCoordinator.enqueueJob(hwvtepId, () -> {
if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
LOG.info("Deleting ITM Tunnels for {} connected to cluster node owner", l2DeviceName);
for (IpAddress tunnelIp : tunnelIps) {
L2GatewayUtils.deleteItmTunnels(itmRpcService, hwvtepId, l2DeviceName, tunnelIp);
}
} else {
LOG.info("ITM Tunnels are not deleted on the cluster node as this is not owner for {}", l2DeviceName);
}
return null;
});
} else {
l2GatewayCache.remove(l2DeviceName);
// Cleaning up the config DS
NodeId nodeId = new NodeId(l2GwDevice.getHwvtepNodeId());
NodeId psNodeId = HwvtepSouthboundUtils.createManagedNodeId(nodeId, l2DeviceName);
// FIXME: These should be removed
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(nodeId));
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(psNodeId));
}
} else {
l2GwDevice.removeL2GatewayId(input.getUuid());
LOG.trace("ITM tunnels are not deleted for {} as this device has other L2gateway associations", l2DeviceName);
}
} else {
LOG.error("Unable to find L2 Gateway details for {}", l2DeviceName);
}
}
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 L2GatewayListener method add.
@Override
protected void add(final InstanceIdentifier<L2gateway> identifier, final L2gateway input) {
LOG.info("Adding L2gateway with ID: {}", input.getUuid());
List<Devices> l2Devices = input.getDevices();
for (Devices l2Device : l2Devices) {
LOG.trace("Adding L2gateway device: {}", l2Device);
addL2Device(l2Device, input);
}
}
Aggregations