Search in sources :

Example 56 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class VrfEntryListener method removeFibEntries.

// This method is temporary. Eventually Factory design pattern will be used to get
// right VrfEntryhandle and invoke its methods.
private void removeFibEntries(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
    if (VrfEntry.EncapType.Vxlan.equals(vrfEntry.getEncapType())) {
        LOG.info("EVPN flows to be deleted");
        EvpnVrfEntryHandler evpnVrfEntryHandler = new EvpnVrfEntryHandler(dataBroker, this, bgpRouteVrfEntryHandler, nextHopManager, jobCoordinator, elanManager, fibUtil);
        evpnVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
        closeables.add(evpnVrfEntryHandler);
        return;
    }
    RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
    if (routerInt != null) {
        // ping responder for router interfaces
        routerInterfaceVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
        return;
    }
    if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
        deleteFibEntries(identifier, vrfEntry);
        return;
    }
    if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
        bgpRouteVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
        return;
    }
}
Also used : RouterInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface)

Example 57 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class VrfEntryListener method addFibEntries.

// This method is temporary. Eventually Factory design pattern will be used to get
// right VrfEntryhandle and invoke its methods.
private void addFibEntries(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
    if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
        bgpRouteVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
        return;
    }
    if (VrfEntry.EncapType.Vxlan.equals(vrfEntry.getEncapType())) {
        LOG.info("EVPN flows need to be programmed.");
        EvpnVrfEntryHandler evpnVrfEntryHandler = new EvpnVrfEntryHandler(dataBroker, this, bgpRouteVrfEntryHandler, nextHopManager, jobCoordinator, elanManager, fibUtil);
        evpnVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
        closeables.add(evpnVrfEntryHandler);
        return;
    }
    RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
    if (routerInt != null) {
        // ping responder for router interfaces
        routerInterfaceVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
        return;
    }
    if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
        createFibEntries(identifier, vrfEntry);
        return;
    }
}
Also used : RouterInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface)

Example 58 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class IfMgr method addSubnet.

/**
 * Add Subnet.
 *
 * @param snetId subnet id
 * @param name subnet name
 * @param tenantId tenant id
 * @param gatewayIp gateway ip address
 * @param ipVersion IP Version "IPv4 or IPv6"
 * @param subnetCidr subnet CIDR
 * @param ipV6AddressMode Address Mode of IPv6 Subnet
 * @param ipV6RaMode RA Mode of IPv6 Subnet.
 */
public void addSubnet(Uuid snetId, String name, Uuid tenantId, IpAddress gatewayIp, String ipVersion, IpPrefix subnetCidr, String ipV6AddressMode, String ipV6RaMode) {
    // in expanded form and are used during Neighbor Discovery Support.
    if (gatewayIp != null) {
        Ipv6Address addr = new Ipv6Address(InetAddresses.forString(gatewayIp.getIpv6Address().getValue()).getHostAddress());
        gatewayIp = new IpAddress(addr);
    }
    VirtualSubnet snet = VirtualSubnet.builder().subnetUUID(snetId).tenantID(tenantId).name(name).gatewayIp(gatewayIp).subnetCidr(subnetCidr).ipVersion(ipVersion).ipv6AddressMode(ipV6AddressMode).ipv6RAMode(ipV6RaMode).build();
    vsubnets.put(snetId, snet);
    List<VirtualPort> intfList = unprocessedSubnetIntfs.remove(snetId);
    if (intfList == null) {
        LOG.debug("No unprocessed interfaces for the subnet {}", snetId);
        return;
    }
    synchronized (intfList) {
        for (VirtualPort intf : intfList) {
            if (intf != null) {
                intf.setSubnet(snetId, snet);
                snet.addInterface(intf);
                VirtualRouter rtr = intf.getRouter();
                if (rtr != null) {
                    rtr.addSubnet(snet);
                }
            }
        }
    }
}
Also used : IVirtualPort(org.opendaylight.netvirt.ipv6service.api.IVirtualPort) IVirtualSubnet(org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) IVirtualRouter(org.opendaylight.netvirt.ipv6service.api.IVirtualRouter)

Example 59 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class Ipv6NdUtilServiceImpl method sendNeighborSolicitation.

@Override
public Future<RpcResult<Void>> sendNeighborSolicitation(SendNeighborSolicitationInput ndInput) {
    RpcResultBuilder<Void> failureBuilder = RpcResultBuilder.failed();
    RpcResultBuilder<Void> successBuilder = RpcResultBuilder.success();
    Ipv6Address targetIpv6Address = null;
    Ipv6Address srcIpv6Address;
    String interfaceName = null;
    String macAddr = null;
    BigInteger dpnId;
    int localErrorCount = 0;
    targetIpv6Address = ndInput.getTargetIpAddress();
    for (InterfaceAddress interfaceAddress : ndInput.getInterfaceAddress()) {
        try {
            interfaceName = interfaceAddress.getInterface();
            srcIpv6Address = interfaceAddress.getSrcIpAddress();
            GetPortFromInterfaceOutput portResult = getPortFromInterface(interfaceName);
            checkNotNull(portResult);
            dpnId = portResult.getDpid();
            Long portid = portResult.getPortno();
            checkArgument(null != dpnId && BigInteger.ZERO != dpnId, DPN_NOT_FOUND_ERROR, interfaceName);
            NodeConnectorRef nodeRef = MDSALUtil.getNodeConnRef(dpnId, portid.toString());
            checkNotNull(nodeRef, NODE_CONNECTOR_NOT_FOUND_ERROR, interfaceName);
            if (interfaceAddress.getSrcMacAddress() != null) {
                macAddr = interfaceAddress.getSrcMacAddress().getValue();
            }
            checkNotNull(macAddr, FAILED_TO_GET_SRC_MAC_FOR_INTERFACE, interfaceName, nodeRef.getValue());
            ipv6NeighborSolicitation.transmitNeighborSolicitation(dpnId, nodeRef, new MacAddress(macAddr), srcIpv6Address, targetIpv6Address);
        } catch (NullPointerException | IllegalArgumentException e) {
            LOG.trace("Failed to send Neighbor Solicitation for {} on interface {}", ndInput.getTargetIpAddress(), interfaceName);
            failureBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE + interfaceName, e);
            successBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE + interfaceName, e);
            localErrorCount++;
        }
    }
    if (localErrorCount == ndInput.getInterfaceAddress().size()) {
        // Failed to send IPv6 Neighbor Solicitation on all the interfaces, return failure.
        return Futures.immediateFuture(failureBuilder.build());
    }
    return Futures.immediateFuture(successBuilder.build());
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) InterfaceAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.interfaces.InterfaceAddress) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) BigInteger(java.math.BigInteger) GetPortFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceOutput) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Example 60 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class AclInstanceRecoveryHandler method recoverService.

@Override
public void recoverService(String entityId) {
    LOG.info("Recover ACL instance {}", entityId);
    Uuid aclId = new Uuid(entityId);
    Collection<AclInterface> aclInterfaces = aclDataUtil.getInterfaceList(aclId);
    for (AclInterface aclInterface : aclInterfaces) {
        String aclInterfaceId = aclInterface.getInterfaceId();
        Optional<Interface> interfaceOptional = AclServiceUtils.getInterface(dataBroker, aclInterfaceId);
        if (interfaceOptional.isPresent()) {
            Interface interfaceBefore = interfaceOptional.get();
            LOG.debug("Starting Recovery of acl Instance {} for interface {}", entityId, interfaceBefore.getName());
            InterfaceAcl interfaceAclBefore = interfaceBefore.getAugmentation(InterfaceAcl.class);
            List<Uuid> sgList = new ArrayList<>(interfaceAclBefore.getSecurityGroups());
            sgList.remove(aclId);
            InterfaceAcl interfaceAclAfter = new InterfaceAclBuilder(interfaceAclBefore).setSecurityGroups(sgList).build();
            Interface interfaceAfter = new InterfaceBuilder(interfaceBefore).addAugmentation(InterfaceAcl.class, interfaceAclAfter).build();
            aclInterfaceListener.update(null, interfaceBefore, interfaceAfter);
            aclInterfaceListener.update(null, interfaceAfter, interfaceBefore);
        } else {
            LOG.error("Interfaces not present for aclInterface {} ", aclInterfaceId);
        }
    }
}
Also used : AclInterface(org.opendaylight.netvirt.aclservice.api.utils.AclInterface) InterfaceAclBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAclBuilder) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ArrayList(java.util.ArrayList) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) InterfaceAcl(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl) AclInterface(org.opendaylight.netvirt.aclservice.api.utils.AclInterface) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) ServiceRecoveryInterface(org.opendaylight.genius.srm.ServiceRecoveryInterface)

Aggregations

ArrayList (java.util.ArrayList)26 BigInteger (java.math.BigInteger)24 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)23 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)10 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)9 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)7 HashSet (java.util.HashSet)7 ExecutionException (java.util.concurrent.ExecutionException)7 HashMap (java.util.HashMap)4 List (java.util.List)4 Test (org.junit.Test)4 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)4 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)4 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)4 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)4 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)4 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)4 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)4