Search in sources :

Example 61 with Uint64

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);
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 62 with Uint64

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);
    }));
}
Also used : Network(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network) DhcpAllocationPool(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.DhcpAllocationPool) Uint64(org.opendaylight.yangtools.yang.common.Uint64) Logger(org.slf4j.Logger) DhcpMConstants(org.opendaylight.netvirt.dhcpservice.api.DhcpMConstants) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) LoggerFactory(org.slf4j.LoggerFactory) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) PreDestroy(javax.annotation.PreDestroy) List(java.util.List) AllocationPool(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.network.AllocationPool) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) DhcpAllocationPoolRemoveJob(org.opendaylight.netvirt.dhcpservice.jobs.DhcpAllocationPoolRemoveJob) Map(java.util.Map) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) Entry(java.util.Map.Entry) BigInteger(java.math.BigInteger) DhcpAllocationPoolAddJob(org.opendaylight.netvirt.dhcpservice.jobs.DhcpAllocationPoolAddJob) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) DhcpAllocationPoolRemoveJob(org.opendaylight.netvirt.dhcpservice.jobs.DhcpAllocationPoolRemoveJob) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network) List(java.util.List) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 63 with Uint64

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());
    }
}
Also used : SubnetToDhcpPort(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 64 with Uint64

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);
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) OperStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus) DhcpInterfaceUpdateJob(org.opendaylight.netvirt.dhcpservice.jobs.DhcpInterfaceUpdateJob) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 65 with Uint64

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);
}
Also used : Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) DhcpInterfaceAddJob(org.opendaylight.netvirt.dhcpservice.jobs.DhcpInterfaceAddJob) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Aggregations

Uint64 (org.opendaylight.yangtools.yang.common.Uint64)306 ArrayList (java.util.ArrayList)119 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)104 ExecutionException (java.util.concurrent.ExecutionException)86 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)66 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)65 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)64 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)64 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)64 Logger (org.slf4j.Logger)63 LoggerFactory (org.slf4j.LoggerFactory)63 Inject (javax.inject.Inject)59 Singleton (javax.inject.Singleton)59 List (java.util.List)58 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)58 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)54 Optional (java.util.Optional)49 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)48 Collections (java.util.Collections)48 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)48