+/*
+ * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.vpnservice;
public class VpnConstants {
public static final long VPN_IDPOOL_START = 1L;
public static final String VPN_IDPOOL_SIZE = "65535";
public static final short LPORT_INGRESS_TABLE = 0;
+ public static final short LFIB_TABLE = 20;
public static final short FIB_TABLE = 21;
public static final short DEFAULT_FLOW_PRIORITY = 10;
public static final long INVALID_ID = -1;
*/
package org.opendaylight.vpnservice;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.rev150331.L3tunnel;
+
import java.math.BigInteger;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.FutureCallback;
-
import org.opendaylight.bgpmanager.api.IBgpManager;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
Adjacencies aug = VpnUtil.getVpnInterfaceAugmentation(value);
VpnInterface opInterface = VpnUtil.getVpnInterface(intfName, intf.getVpnInstanceName(), aug);
InstanceIdentifier<VpnInterface> interfaceId = VpnUtil.getVpnInterfaceIdentifier(intfName);
- asyncWrite(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface, DEFAULT_CALLBACK);
+ syncWrite(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface, DEFAULT_CALLBACK);
for (Adjacency nextHop : nextHops) {
String key = nextHop.getIpAddress();
long label = getUniqueId(key);
int priority = VpnConstants.DEFAULT_FLOW_PRIORITY;
short gotoTableId = VpnConstants.FIB_TABLE;
+ if(intf.getType().equals(L3tunnel.class)){
+ gotoTableId = VpnConstants.LFIB_TABLE;
+ }
List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
mkInstructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] {
Futures.addCallback(tx.submit(), callback);
}
+ private <T extends DataObject> void syncWrite(LogicalDatastoreType datastoreType,
+ InstanceIdentifier<T> path, T data, FutureCallback<Void> callback) {
+ WriteTransaction tx = broker.newWriteOnlyTransaction();
+ tx.put(datastoreType, path, data, true);
+ tx.submit();
+ }
+
synchronized Collection<Long> getDpnsForVpn(long vpnId) {
Collection<Long> dpnIds = vpnToDpnsDb.get(vpnId);
if(dpnIds != null) {