use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class DhcpMcastMacListener method add.
@Override
public void add(@NonNull InstanceIdentifier<RemoteMcastMacs> identifier, @NonNull RemoteMcastMacs remoteMcastMacs) {
String elanInstanceName = getElanName(remoteMcastMacs);
IpAddress tunnelIp = dhcpL2GwUtil.getHwvtepNodeTunnelIp(identifier.firstIdentifierOf(Node.class));
if (tunnelIp == null) {
LOG.error("Could not find tunnelIp for {}", identifier);
return;
}
List<Uint64> dpns = DhcpServiceUtils.getListOfDpns(dataBroker);
Uint64 designatedDpnId = externalTunnelManager.designateDpnId(tunnelIp, elanInstanceName, dpns);
if (designatedDpnId == null || designatedDpnId.equals(DhcpMConstants.INVALID_DPID)) {
LOG.error("Unable to designate a DPN for {}", identifier);
}
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class DhcpAllocationPoolListener method remove.
@Override
public void remove(InstanceIdentifier<AllocationPool> key, AllocationPool dataObjectModification) {
String networkId = key.firstKeyOf(Network.class).getNetworkId();
dhcpAllocationPoolManager.releaseIdAllocationPool(networkId, dataObjectModification);
Map<Uint64, List<String>> elanDpnInterfacesByName = dhcpAllocationPoolManager.getElanDpnInterfacesByName(dataBroker, networkId);
elanDpnInterfacesByName.values().forEach(interfaceNames -> interfaceNames.forEach(interfaceName -> {
DhcpAllocationPoolRemoveJob job = new DhcpAllocationPoolRemoveJob(txRunner, interfaceName);
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), job, DhcpMConstants.RETRY_COUNT);
}));
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method updateCacheAndInstallNewFlows.
public void updateCacheAndInstallNewFlows(List<Uint64> listOfDpns, Pair<IpAddress, String> pair, TypedReadWriteTransaction<Configuration> tx) throws ExecutionException, InterruptedException {
Uint64 newDesignatedDpn = chooseDpn(pair.getLeft(), pair.getRight(), listOfDpns);
if (newDesignatedDpn.equals(DhcpMConstants.INVALID_DPID)) {
return;
}
Set<String> setOfVmMacs = tunnelIpElanNameToVmMacCache.get(pair);
if (setOfVmMacs != null && !setOfVmMacs.isEmpty()) {
LOG.trace("Updating DHCP flows for VMs {} with new designated DPN {}", setOfVmMacs, newDesignatedDpn);
installDhcpFlowsForVms(newDesignatedDpn, setOfVmMacs, tx);
}
java.util.Optional<SubnetToDhcpPort> subnetDhcpData = getSubnetDhcpPortData(pair.getRight());
if (subnetDhcpData.isPresent()) {
configureDhcpArpRequestResponseFlow(newDesignatedDpn, pair.getRight(), true, pair.getLeft(), subnetDhcpData.get().getPortFixedip(), subnetDhcpData.get().getPortMacaddress());
}
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class DhcpInterfaceEventListener method update.
@Override
public void update(InstanceIdentifier<Interface> identifier, Interface original, Interface update) {
// We're only interested in Vlan and Tunnel ports
if (!L2vlan.class.equals(update.getType()) && !Tunnel.class.equals(update.getType())) {
return;
}
if ((original.getOperStatus().getIntValue() ^ update.getOperStatus().getIntValue()) == 0) {
LOG.trace("Interface operstatus is same orig {} updated {}", original, update);
return;
}
List<String> ofportIds = update.getLowerLayerIf();
if (ofportIds == null || ofportIds.isEmpty()) {
return;
}
NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
Uint64 dpnId = DhcpServiceUtils.getDpnIdFromNodeConnectorId(nodeConnectorId);
String interfaceName = update.getName();
OperStatus updatedOperStatus = update.getOperStatus();
if (original.getOperStatus().equals(OperStatus.Up) && updatedOperStatus.equals(OperStatus.Unknown)) {
updatedOperStatus = OperStatus.Down;
}
DhcpInterfaceUpdateJob job = new DhcpInterfaceUpdateJob(dhcpExternalTunnelManager, dataBroker, interfaceName, dpnId, updatedOperStatus, interfaceManager);
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), job, DhcpMConstants.RETRY_COUNT);
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class DhcpInterfaceEventListener method add.
@Override
public void add(InstanceIdentifier<Interface> identifier, Interface add) {
// We're only interested in Vlan and Tunnel ports
if (!L2vlan.class.equals(add.getType()) && !Tunnel.class.equals(add.getType())) {
return;
}
String interfaceName = add.getName();
LOG.trace("DhcpInterfaceAddJob to be created for interface {}", interfaceName);
List<String> ofportIds = add.getLowerLayerIf();
if (ofportIds == null || ofportIds.isEmpty()) {
return;
}
if (!Tunnel.class.equals(add.getType())) {
Port port = dhcpManager.getNeutronPort(interfaceName);
if (NeutronConstants.IS_DHCP_PORT.test(port)) {
return;
}
dhcpPortCache.put(interfaceName, port);
}
NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
Uint64 dpnId = DhcpServiceUtils.getDpnIdFromNodeConnectorId(nodeConnectorId);
DhcpInterfaceAddJob job = new DhcpInterfaceAddJob(dhcpManager, dhcpExternalTunnelManager, dataBroker, add, dpnId, interfaceManager, elanService, itmRpcService);
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), job, DhcpMConstants.RETRY_COUNT);
}
Aggregations