Search in sources :

Example 6 with SubnetToDhcpPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort in project netvirt by opendaylight.

the class DhcpDesignatedDpnListener method add.

@Override
protected void add(InstanceIdentifier<DesignatedSwitchForTunnel> identifier, DesignatedSwitchForTunnel add) {
    LOG.debug("Add for DesignatedSwitchForTunnel : {}", add);
    BigInteger designatedDpnId = BigInteger.valueOf(add.getDpId());
    IpAddress tunnelRemoteIpAddress = add.getTunnelRemoteIpAddress();
    String elanInstanceName = add.getElanInstanceName();
    dhcpExternalTunnelManager.updateLocalCache(designatedDpnId, tunnelRemoteIpAddress, elanInstanceName);
    dhcpExternalTunnelManager.installRemoteMcastMac(designatedDpnId, tunnelRemoteIpAddress, elanInstanceName);
    LOG.trace("Configuring DHCP Arp Flows for Designated dpn {} Elan {}", designatedDpnId, elanInstanceName);
    java.util.Optional<SubnetToDhcpPort> subnetDhcpData = dhcpExternalTunnelManager.getSubnetDhcpPortData(elanInstanceName);
    if (subnetDhcpData.isPresent()) {
        dhcpExternalTunnelManager.configureDhcpArpRequestResponseFlow(designatedDpnId, elanInstanceName, true, tunnelRemoteIpAddress, subnetDhcpData.get().getPortFixedip(), subnetDhcpData.get().getPortMacaddress());
    }
}
Also used : SubnetToDhcpPort(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 7 with SubnetToDhcpPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort in project netvirt by opendaylight.

the class DhcpDesignatedDpnListener method update.

@Override
protected void update(InstanceIdentifier<DesignatedSwitchForTunnel> identifier, DesignatedSwitchForTunnel original, DesignatedSwitchForTunnel update) {
    LOG.debug("Update for DesignatedSwitchForTunnel original {}, update {}", original, update);
    dhcpExternalTunnelManager.removeFromLocalCache(BigInteger.valueOf(original.getDpId()), original.getTunnelRemoteIpAddress(), original.getElanInstanceName());
    BigInteger designatedDpnId = BigInteger.valueOf(update.getDpId());
    IpAddress tunnelRemoteIpAddress = update.getTunnelRemoteIpAddress();
    String elanInstanceName = update.getElanInstanceName();
    dhcpExternalTunnelManager.updateLocalCache(designatedDpnId, tunnelRemoteIpAddress, elanInstanceName);
    dhcpExternalTunnelManager.installRemoteMcastMac(designatedDpnId, tunnelRemoteIpAddress, elanInstanceName);
    java.util.Optional<SubnetToDhcpPort> subnetDhcpData = dhcpExternalTunnelManager.getSubnetDhcpPortData(elanInstanceName);
    if (subnetDhcpData.isPresent()) {
        LOG.trace("Removing Designated DPN {} DHCP Arp Flows for Elan {}.", original.getDpId(), original.getElanInstanceName());
        dhcpExternalTunnelManager.configureDhcpArpRequestResponseFlow(BigInteger.valueOf(original.getDpId()), original.getElanInstanceName(), false, original.getTunnelRemoteIpAddress(), subnetDhcpData.get().getPortFixedip(), subnetDhcpData.get().getPortMacaddress());
        LOG.trace("Configuring DHCP Arp Flows for Designated dpn {} Elan {}", designatedDpnId, elanInstanceName);
        dhcpExternalTunnelManager.configureDhcpArpRequestResponseFlow(designatedDpnId, elanInstanceName, true, tunnelRemoteIpAddress, subnetDhcpData.get().getPortFixedip(), subnetDhcpData.get().getPortMacaddress());
    }
}
Also used : SubnetToDhcpPort(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 8 with SubnetToDhcpPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort in project netvirt by opendaylight.

the class DhcpExternalTunnelManager method updateCacheAndInstallNewFlows.

public void updateCacheAndInstallNewFlows(List<BigInteger> listOfDpns, Pair<IpAddress, String> pair, WriteTransaction tx) {
    BigInteger 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());
    }
}
Also used : SubnetToDhcpPort(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort) BigInteger(java.math.BigInteger)

Aggregations

SubnetToDhcpPort (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort)8 BigInteger (java.math.BigInteger)6 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)4 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Callable (java.util.concurrent.Callable)2 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)2 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)2 IInterfaceManager (org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager)2 DhcpExternalTunnelManager (org.opendaylight.netvirt.dhcpservice.DhcpExternalTunnelManager)2 DhcpManager (org.opendaylight.netvirt.dhcpservice.DhcpManager)2 DhcpServiceUtils (org.opendaylight.netvirt.dhcpservice.DhcpServiceUtils)2 IElanService (org.opendaylight.netvirt.elanmanager.api.IElanService)2 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)2 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)2