use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method removeDesignatedSwitchForExternalTunnel.
public void removeDesignatedSwitchForExternalTunnel(BigInteger dpnId, IpAddress tunnelIp, String elanInstanceName) {
DesignatedSwitchForTunnelKey designatedSwitchForTunnelKey = new DesignatedSwitchForTunnelKey(elanInstanceName, tunnelIp);
InstanceIdentifier<DesignatedSwitchForTunnel> instanceIdentifier = InstanceIdentifier.builder(DesignatedSwitchesForExternalTunnels.class).child(DesignatedSwitchForTunnel.class, designatedSwitchForTunnelKey).build();
LOG.trace("Removing from CONFIG DS tunnelIp {}, elanInstanceName {}, dpnId {}", tunnelIp, elanInstanceName, dpnId);
MDSALUtil.syncDelete(broker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
removeFromLocalCache(dpnId, tunnelIp, elanInstanceName);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method installRemoteMcastMac.
public void installRemoteMcastMac(final BigInteger designatedDpnId, final IpAddress tunnelIp, final String elanInstanceName) {
if (designatedDpnId.equals(DhcpMConstants.INVALID_DPID)) {
return;
}
jobCoordinator.enqueueJob(getJobKey(elanInstanceName), () -> {
if (!entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
LOG.info("Installing remote McastMac is not executed for this node.");
return Collections.emptyList();
}
LOG.info("Installing remote McastMac");
L2GatewayDevice device = getDeviceFromTunnelIp(tunnelIp);
if (device == null) {
LOG.error("Unable to get L2Device for tunnelIp {} and elanInstanceName {}", tunnelIp, elanInstanceName);
return Collections.emptyList();
}
String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(designatedDpnId), device.getHwvtepNodeId());
if (tunnelInterfaceName != null) {
Interface tunnelInterface = interfaceManager.getInterfaceInfoFromConfigDataStore(tunnelInterfaceName);
if (tunnelInterface == null) {
LOG.trace("Tunnel Interface is not present {}", tunnelInterfaceName);
return Collections.emptyList();
}
return Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> putRemoteMcastMac(tx, elanInstanceName, device, tunnelInterface.getAugmentation(IfTunnel.class).getTunnelSource())));
}
return Collections.emptyList();
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method getTunnelIpBasedOnElan.
public IpAddress getTunnelIpBasedOnElan(String elanInstanceName, String vmMacAddress) {
LOG.trace("DhcpExternalTunnelManager getTunnelIpBasedOnElan elanInstanceName {}", elanInstanceName);
IpAddress tunnelIp = null;
for (Entry<Pair<IpAddress, String>, Set<String>> entry : availableVMCache.entrySet()) {
Pair<IpAddress, String> pair = entry.getKey();
LOG.trace("DhcpExternalTunnelManager getTunnelIpBasedOnElan left {} right {}", pair.getLeft(), pair.getRight());
if (pair.getRight().trim().equalsIgnoreCase(elanInstanceName.trim())) {
Set<String> listExistingVmMacAddress = entry.getValue();
if (listExistingVmMacAddress != null && !listExistingVmMacAddress.isEmpty() && listExistingVmMacAddress.contains(vmMacAddress)) {
tunnelIp = pair.getLeft();
break;
}
}
}
LOG.trace("DhcpExternalTunnelManager getTunnelIpBasedOnElan returned tunnelIP {}", tunnelIp);
return tunnelIp;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method writeDesignatedSwitchForExternalTunnel.
public void writeDesignatedSwitchForExternalTunnel(BigInteger dpnId, IpAddress tunnelIp, String elanInstanceName) {
DesignatedSwitchForTunnelKey designatedSwitchForTunnelKey = new DesignatedSwitchForTunnelKey(elanInstanceName, tunnelIp);
InstanceIdentifier<DesignatedSwitchForTunnel> instanceIdentifier = InstanceIdentifier.builder(DesignatedSwitchesForExternalTunnels.class).child(DesignatedSwitchForTunnel.class, designatedSwitchForTunnelKey).build();
DesignatedSwitchForTunnel designatedSwitchForTunnel = new DesignatedSwitchForTunnelBuilder().setDpId(dpnId.longValue()).setElanInstanceName(elanInstanceName).setTunnelRemoteIpAddress(tunnelIp).setKey(designatedSwitchForTunnelKey).build();
LOG.trace("Writing into CONFIG DS tunnelIp {}, elanInstanceName {}, dpnId {}", tunnelIp, elanInstanceName, dpnId);
MDSALUtil.syncUpdate(broker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier, designatedSwitchForTunnel);
updateLocalCache(dpnId, tunnelIp, elanInstanceName);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress in project netvirt by opendaylight.
the class DhcpInterfaceConfigListener method remove.
@Override
protected void remove(InstanceIdentifier<Interface> identifier, Interface del) {
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(del.getName()), () -> {
IfTunnel tunnelInterface = del.getAugmentation(IfTunnel.class);
IfL2vlan vlanInterface = del.getAugmentation(IfL2vlan.class);
String interfaceName = del.getName();
if (tunnelInterface != null && !tunnelInterface.isInternal()) {
IpAddress tunnelIp = tunnelInterface.getTunnelDestination();
ParentRefs interfce = del.getAugmentation(ParentRefs.class);
if (interfce != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Calling handleTunnelStateDown for tunnelIp {} and interface {}", tunnelIp, interfaceName);
}
return dhcpExternalTunnelManager.handleTunnelStateDown(tunnelIp, interfce.getDatapathNodeIdentifier());
}
}
if (vlanInterface != null) {
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> DhcpServiceUtils.unbindDhcpService(interfaceName, tx)));
}
return Collections.emptyList();
}, DhcpMConstants.RETRY_COUNT);
}
Aggregations