Search in sources :

Example 16 with WriteTransaction

use of org.opendaylight.mdsal.binding.api.WriteTransaction in project netvirt by opendaylight.

the class InterVpnLinkTestCatalog method populateIvpnLinks.

public static void populateIvpnLinks(DataBroker broker2, List<InterVpnLinkDataComposite> ivpnLinks) throws ExecutionException, InterruptedException {
    for (InterVpnLinkDataComposite ivpnLink : ivpnLinks) {
        WriteTransaction writeTx1 = broker2.newWriteOnlyTransaction();
        writeTx1.merge(LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkPath(ivpnLink.getInterVpnLinkName()), ivpnLink.getInterVpnLinkConfig());
        writeTx1.commit().get();
        WriteTransaction writeTx2 = broker2.newWriteOnlyTransaction();
        writeTx2.merge(LogicalDatastoreType.OPERATIONAL, InterVpnLinkUtil.getInterVpnLinkStateIid(ivpnLink.getInterVpnLinkName()), ivpnLink.getInterVpnLinkState());
        writeTx2.commit().get();
    }
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite)

Example 17 with WriteTransaction

use of org.opendaylight.mdsal.binding.api.WriteTransaction in project netvirt by opendaylight.

the class PolicyRouteGroupProgrammer method programPolicyClassifierGroups.

public void programPolicyClassifierGroups(String policyClassifier, List<BigInteger> localDpIds, List<BigInteger> remoteDpIds, int addOrRemove) {
    if (remoteDpIds == null || remoteDpIds.isEmpty()) {
        LOG.debug("No remote DPNs found for policy classifier {}", policyClassifier);
        return;
    }
    coordinator.enqueueJob(policyClassifier, () -> {
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        remoteDpIds.forEach(remoteDpId -> programPolicyClassifierGroups(policyClassifier, localDpIds, remoteDpId, tx, addOrRemove));
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction)

Example 18 with WriteTransaction

use of org.opendaylight.mdsal.binding.api.WriteTransaction in project netvirt by opendaylight.

the class PolicyRouteGroupProgrammer method programPolicyClassifierGroupBuckets.

public void programPolicyClassifierGroupBuckets(String policyClassifier, List<TunnelInterface> tunnelInterfaces, BigInteger dpId, int bucketId, int addOrRemove) {
    coordinator.enqueueJob(policyClassifier, () -> {
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        programPolicyClassifierGroupBuckets(policyClassifier, tunnelInterfaces, dpId, bucketId, addOrRemove, tx);
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction)

Example 19 with WriteTransaction

use of org.opendaylight.mdsal.binding.api.WriteTransaction in project netvirt by opendaylight.

the class PolicyRouteGroupProgrammer method programPolicyClassifierGroupBuckets.

public void programPolicyClassifierGroupBuckets(String policyClassifier, List<String> underlayNetworks, int addOrRemove) {
    if (underlayNetworks == null) {
        return;
    }
    coordinator.enqueueJob(policyClassifier, () -> {
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        for (int idx = 0; idx < underlayNetworks.size(); idx++) {
            final int bucketId = idx;
            String underlayNetwork = underlayNetworks.get(idx);
            List<DpnToInterface> dpnToInterfaceList = policyServiceUtil.getUnderlayNetworkDpnToInterfaces(underlayNetwork);
            dpnToInterfaceList.forEach(dpnToInterface -> {
                BigInteger dpId = dpnToInterface.getDpId();
                List<TunnelInterface> tunnelInterfaces = dpnToInterface.getTunnelInterface();
                programPolicyClassifierGroupBuckets(policyClassifier, tunnelInterfaces, dpId, bucketId, addOrRemove, tx);
            });
        }
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface) BigInteger(java.math.BigInteger) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Example 20 with WriteTransaction

use of org.opendaylight.mdsal.binding.api.WriteTransaction in project netvirt by opendaylight.

the class PolicyRouteFlowProgrammer method addPolicyClassifierGroup.

private void addPolicyClassifierGroup(String policyClassifierName, BigInteger localDpId, BigInteger remoteDpId, int addOrRemove, long groupId) {
    coordinator.enqueueJob(policyClassifierName, () -> {
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        policyFlowUtil.updateGroupToTx(localDpId, groupId, PolicyIdManager.getPolicyClassifierGroupKey(policyClassifierName, remoteDpId), GroupTypes.GroupFf, addOrRemove, tx);
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction)

Aggregations

WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)23 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)6 List (java.util.List)5 ArrayList (java.util.ArrayList)4 Optional (java.util.Optional)4 Collectors.toList (java.util.stream.Collectors.toList)4 Inject (javax.inject.Inject)4 Singleton (javax.inject.Singleton)4 NonNull (org.eclipse.jdt.annotation.NonNull)4 Nullable (org.eclipse.jdt.annotation.Nullable)4 DataTreeEventCallbackRegistrar (org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar)4 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)4 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)4 ActionNxLoadInPort (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort)4 ActionSetFieldEthernetDestination (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetDestination)4 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)4 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 Inet4Address (java.net.Inet4Address)3 InetAddress (java.net.InetAddress)3 UnknownHostException (java.net.UnknownHostException)3