Search in sources :

Example 11 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6 in project netvirt by opendaylight.

the class Ipv6ServiceInterfaceEventListener method remove.

@Override
protected void remove(InstanceIdentifier<Interface> key, Interface del) {
    LOG.debug("Port removed {}, {}", key, del);
    if (!L2vlan.class.equals(del.getType())) {
        return;
    }
    // In ipv6service, we are only interested in the notification for NeutronPort, so we skip other notifications
    List<String> ofportIds = del.getLowerLayerIf();
    if (ofportIds == null || ofportIds.isEmpty() || !isNeutronPort(del.getName())) {
        return;
    }
    Uuid portId = new Uuid(del.getName());
    VirtualPort port = ifMgr.obtainV6Interface(portId);
    if (port == null) {
        LOG.info("Port {} does not include IPv6Address, skipping.", portId);
        return;
    }
    if (port.getServiceBindingStatus()) {
        jobCoordinator.enqueueJob("IPv6-" + String.valueOf(portId), () -> {
            // Unbind Service
            ipv6ServiceUtils.unbindIpv6Service(portId.getValue());
            port.setServiceBindingStatus(false);
            return Collections.emptyList();
        }, SystemPropertyReader.getDataStoreJobCoordinatorMaxRetries());
    }
}
Also used : L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)

Example 12 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6 in project netvirt by opendaylight.

the class NeutronPortChangeListener method add.

@Override
protected void add(InstanceIdentifier<Port> identifier, Port port) {
    if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_GATEWAY)) {
        // Todo: revisit when IPv6 north-south support is implemented.
        LOG.info("IPv6Service (TODO): Skipping router_gateway port {} for add event", port);
        return;
    }
    LOG.debug("Add port notification handler is invoked for port {} ", port);
    List<FixedIps> ipList = port.getFixedIps();
    for (FixedIps fixedip : ipList) {
        if (fixedip.getIpAddress().getIpv4Address() != null) {
            continue;
        }
        addInterfaceInfo(port, fixedip);
    }
}
Also used : FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)

Example 13 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6 in project netvirt by opendaylight.

the class NeutronPortChangeListener method addInterfaceInfo.

protected void addInterfaceInfo(Port port, FixedIps fixedip) {
    if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
        LOG.info("IPv6: addInterfaceInfo is invoked for a router interface {}, fixedIp: {}", port, fixedip);
        // Add router interface
        ifMgr.addRouterIntf(port.getUuid(), new Uuid(port.getDeviceId()), fixedip.getSubnetId(), port.getNetworkId(), fixedip.getIpAddress(), port.getMacAddress().getValue(), port.getDeviceOwner());
    } else {
        LOG.info("IPv6: addInterfaceInfo is invoked for a host interface {}, fixedIp: {}", port, fixedip);
        // Add host interface
        ifMgr.addHostIntf(port.getUuid(), fixedip.getSubnetId(), port.getNetworkId(), fixedip.getIpAddress(), port.getMacAddress().getValue(), port.getDeviceOwner());
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)

Example 14 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6 in project netvirt by opendaylight.

the class VpnUtil method isAdjacencyEligibleToVpnInternet.

public static boolean isAdjacencyEligibleToVpnInternet(DataBroker dataBroker, Adjacency adjacency) {
    // returns true if BGPVPN Internet and adjacency is IPv6, false otherwise
    boolean adjacencyEligible = true;
    if (adjacency.getAdjacencyType() == AdjacencyType.ExtraRoute) {
        if (FibHelper.isIpv6Prefix(adjacency.getIpAddress())) {
            return adjacencyEligible;
        }
        return false;
    } else if (adjacency.getSubnetId() == null) {
        return adjacencyEligible;
    }
    Subnetmap sn = VpnUtil.getSubnetmapFromItsUuid(dataBroker, adjacency.getSubnetId());
    if (sn != null && sn.getInternetVpnId() != null) {
        adjacencyEligible = false;
    }
    return adjacencyEligible;
}
Also used : Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)

Example 15 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6 in project netvirt by opendaylight.

the class DhcpNeutronPortListener method update.

@Override
protected void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
    LOG.trace("Port changed to {}", update);
    // With Ipv6 changes we can get ipv4 subnets later. The below check is to support such scenario.
    if (original.getFixedIps().size() < update.getFixedIps().size()) {
        final String interfaceName = update.getUuid().getValue();
        List<FixedIps> updatedFixedIps = update.getFixedIps();
        // Need to check only the newly added fixed ip.
        updatedFixedIps.removeAll(original.getFixedIps());
        Subnet subnet = dhcpManager.getNeutronSubnet(updatedFixedIps);
        if (null == subnet || !subnet.isEnableDhcp()) {
            LOG.trace("Subnet is null/not ipv4 or not enabled {}", subnet);
            return;
        }
        // Binding the DHCP service for an existing port because of subnet change.
        jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
            LOG.debug("Binding DHCP service for interface {}", interfaceName);
            DhcpServiceUtils.bindDhcpService(interfaceName, NwConstants.DHCP_TABLE, tx);
        })), DhcpMConstants.RETRY_COUNT);
        jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), () -> {
            BigInteger dpnId = interfaceManager.getDpnForInterface(interfaceName);
            if (dpnId == null || dpnId.equals(DhcpMConstants.INVALID_DPID)) {
                LOG.trace("Unable to install the DHCP flow since dpn is not available");
                return Collections.emptyList();
            }
            return Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> dhcpManager.installDhcpEntries(dpnId, DhcpServiceUtils.getAndUpdateVmMacAddress(tx, interfaceName, dhcpManager), tx)));
        }, DhcpMConstants.RETRY_COUNT);
    }
    if (!isVnicTypeDirectOrMacVtap(update)) {
        LOG.trace("Port updated is normal {}", update.getUuid());
        if (isVnicTypeDirectOrMacVtap(original)) {
            LOG.trace("Original Port was direct/macvtap {} so removing flows and cache entry if any", update.getUuid());
            removePort(original);
        }
        return;
    }
    if (!isVnicTypeDirectOrMacVtap(original)) {
        LOG.trace("Original port was normal and updated is direct. Calling addPort()");
        addPort(update);
        return;
    }
    String macOriginal = getMacAddress(original);
    String macUpdated = getMacAddress(update);
    String segmentationIdOriginal = DhcpServiceUtils.getSegmentationId(original.getNetworkId(), broker);
    String segmentationIdUpdated = DhcpServiceUtils.getSegmentationId(update.getNetworkId(), broker);
    if (macOriginal != null && !macOriginal.equalsIgnoreCase(macUpdated) && segmentationIdOriginal != null && !segmentationIdOriginal.equalsIgnoreCase(segmentationIdUpdated)) {
        LOG.trace("Mac/segment id has changed");
        dhcpExternalTunnelManager.removeVniMacToPortCache(new BigInteger(segmentationIdOriginal), macOriginal);
        dhcpExternalTunnelManager.updateVniMacToPortCache(new BigInteger(segmentationIdUpdated), macUpdated, update);
    }
}
Also used : Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports) DhcpMConstants(org.opendaylight.netvirt.dhcpservice.api.DhcpMConstants) LoggerFactory(org.slf4j.LoggerFactory) PortBindingExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension) IElanService(org.opendaylight.netvirt.elanmanager.api.IElanService) Singleton(javax.inject.Singleton) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) Inject(javax.inject.Inject) AsyncClusteredDataTreeChangeListenerBase(org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase) PreDestroy(javax.annotation.PreDestroy) ArpReponderInputBuilder(org.opendaylight.netvirt.elan.arp.responder.ArpResponderInput.ArpReponderInputBuilder) NeutronConstants(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronConstants) Locale(java.util.Locale) ArpResponderUtil(org.opendaylight.netvirt.elan.arp.responder.ArpResponderUtil) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) BigInteger(java.math.BigInteger) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Named(javax.inject.Named) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) DhcpserviceConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.config.rev150710.DhcpserviceConfig) Logger(org.slf4j.Logger) Subnet(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Consumer(java.util.function.Consumer) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) PostConstruct(javax.annotation.PostConstruct) Collections(java.util.Collections) ArpResponderInput(org.opendaylight.netvirt.elan.arp.responder.ArpResponderInput) BigInteger(java.math.BigInteger) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) Subnet(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet)

Aggregations

Test (org.junit.Test)64 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)36 ArrayList (java.util.ArrayList)30 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)21 ByteBuf (io.netty.buffer.ByteBuf)20 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)16 BigInteger (java.math.BigInteger)15 InetAddress (java.net.InetAddress)13 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)13 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)13 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)13 List (java.util.List)10 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 Inet6Address (java.net.Inet6Address)9 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)9 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 Ipv6 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6)9 Ipv6SrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCaseBuilder)9 Ipv6SrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.src._case.Ipv6SrcBuilder)9