Search in sources :

Example 21 with Uint64

use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.

the class VpnNodeListener method makeTableMissFlow.

private void makeTableMissFlow(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId, int addOrRemove) throws ExecutionException, InterruptedException {
    final Uint64 cookieTableMiss = Uint64.valueOf("1030000", 16).intern();
    // Instruction to goto L3 InterfaceTable
    List<InstructionInfo> instructions = Collections.singletonList(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
    List<MatchInfo> matches = new ArrayList<>();
    FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_LFIB_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "Table Miss", 0, 0, cookieTableMiss, matches, instructions);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        LOG.debug("Invoking MDSAL to install Table Miss Entry");
        mdsalManager.addFlow(confTx, flowEntityLfib);
    } else {
        mdsalManager.removeFlow(confTx, flowEntityLfib);
    }
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Uint64(org.opendaylight.yangtools.yang.common.Uint64) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 22 with Uint64

use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.

the class VpnNodeListener method add.

@Override
public void add(InstanceIdentifier<Node> identifier, Node add) {
    Uint64 dpId = MDSALUtil.getDpnIdFromNodeName(add.getId());
    if (!connectedDpnIds.contains(dpId)) {
        connectedDpnIds.add(dpId);
    }
    processNodeAdd(dpId);
}
Also used : Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 23 with Uint64

use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.

the class VpnServiceElanDpnInterfacesListener method add.

@Override
public void add(InstanceIdentifier<DpnInterfaces> identifier, DpnInterfaces dpnInterfaces) {
    Uint64 dpnId = dpnInterfaces.getDpId();
    String elanInstanceName = identifier.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
    ElanInstance elanInstance = vpnUtil.getElanInstanceByName(elanInstanceName);
    if (!VpnUtil.isVlan(elanInstance)) {
        return;
    }
    String vpnName = vpnUtil.getVpnNameFromElanIntanceName(elanInstanceName);
    if (vpnName == null) {
        return;
    }
    vpnUtil.addRouterPortToElanForVlanInDpn(vpnName, dpnId);
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 24 with Uint64

use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.

the class VpnInterfaceManager method update.

@Override
public void update(final InstanceIdentifier<VpnInterface> identifier, final VpnInterface original, final VpnInterface update) {
    LOG.trace("Received VpnInterface update event: original={}, update={}", original, update);
    LOG.info("update: VPN Interface update event - intfName {} on dpn {} oldVpn {} newVpn {}", update.getName(), update.getDpnId(), original.getVpnInstanceNames(), update.getVpnInstanceNames());
    if (original.equals(update)) {
        LOG.info("update: original {} update {} are same. No update required.", original, update);
        return;
    }
    final String vpnInterfaceName = update.getName();
    final Uint64 dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
    LOG.info("VPN Interface update event - intfName {}", vpnInterfaceName);
    // handles switching between <internal VPN - external VPN>
    jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterfaceName, () -> {
        List<ListenableFuture<?>> futures = new ArrayList<>();
        if (handleVpnInstanceUpdateForVpnInterface(identifier, original, update, futures)) {
            LOG.info("update: handled Instance update for VPNInterface {} on dpn {} from oldVpn(s) {} " + "to newVpn(s) {}", original.getName(), dpnId, VpnHelper.getVpnInterfaceVpnInstanceNamesString(new ArrayList<>(original.nonnullVpnInstanceNames().values())), VpnHelper.getVpnInterfaceVpnInstanceNamesString(new ArrayList<>(update.nonnullVpnInstanceNames().values())));
            return emptyList();
        }
        updateVpnInstanceAdjChange(original, update, vpnInterfaceName, futures);
        return futures;
    });
}
Also used : ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 25 with Uint64

use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.

the class SubnetRouteInterfaceStateChangeListener method add.

@Override
public void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
    LOG.trace("{} add: Received interface {} up event", LOGGING_PREFIX, intrf);
    if (L2vlan.class.equals(intrf.getType())) {
        LOG.trace("SubnetRouteInterfaceListener add: Received interface {} up event", intrf);
        if (Interface.OperStatus.Up.equals(intrf.getOperStatus())) {
            List<Uuid> subnetIdList = getSubnetId(intrf);
            if (subnetIdList.isEmpty()) {
                LOG.trace("SubnetRouteInterfaceListener add: Port {} doesn't exist in configDS", intrf.getName());
                return;
            }
            for (Uuid subnetId : subnetIdList) {
                jobCoordinator.enqueueJob("SUBNETROUTE-" + subnetId, () -> {
                    String interfaceName = intrf.getName();
                    Uint64 dpnId = Uint64.ZERO;
                    LOG.info("{} add: Received port UP event for interface {} subnetId {}", LOGGING_PREFIX, interfaceName, subnetId);
                    try {
                        dpnId = InterfaceUtils.getDpIdFromInterface(intrf);
                    } catch (NullPointerException e) {
                        LOG.error("{} add: Unable to obtain dpnId for interface {} in subnet {}," + " subnetroute inclusion for this interface failed", LOGGING_PREFIX, interfaceName, subnetId, e);
                    }
                    List<ListenableFuture<Void>> futures = new ArrayList<>();
                    try {
                        InstanceIdentifier<VpnInterface> id = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
                        Optional<VpnInterface> cfgVpnInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
                        if (!cfgVpnInterface.isPresent()) {
                            return futures;
                        }
                        vpnSubnetRouteHandler.onInterfaceUp(dpnId, intrf.getName(), subnetId);
                        LOG.info("{} add: Processed interface {} up event", LOGGING_PREFIX, intrf.getName());
                    } catch (InterruptedException | ExecutionException e) {
                        LOG.error("add: Failed to read data store for interface {} dpn {}", interfaceName, dpnId);
                    }
                    return futures;
                });
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ExecutionException(java.util.concurrent.ExecutionException) 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