/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2016 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,
*/
package org.opendaylight.vpnservice.interfacemgr.renderer.ovs.confighelpers;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.idmanager.IdManager;
import org.opendaylight.vpnservice.interfacemgr.IfmUtil;
import org.opendaylight.vpnservice.interfacemgr.commons.AlivenessMonitorUtils;
import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
public class OvsInterfaceConfigAddHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceConfigAddHelper.class);
private static void addVlanConfiguration(Interface interfaceNew, ParentRefs parentRefs, DataBroker dataBroker, IdManagerService idManager,
List<ListenableFuture<Void>> futures) {
IfL2vlan ifL2vlan = interfaceNew.getAugmentation(IfL2vlan.class);
- if (ifL2vlan == null || IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode()) {
+ if (ifL2vlan == null || (IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode() && IfL2vlan.L2vlanMode.Transparent != ifL2vlan.getL2vlanMode())) {
return;
}
WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
- InterfaceManagerCommonUtils.createInterfaceChildEntry(transaction,
- parentRefs.getParentInterface(), interfaceNew.getName());
+ if(!InterfaceManagerCommonUtils.createInterfaceChildEntryIfNotPresent(dataBroker, transaction,
+ parentRefs.getParentInterface(), interfaceNew.getName())){
+ return;
+ }
+ LOG.debug("adding vlan configuration for {}",interfaceNew.getName());
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState =
InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(parentRefs.getParentInterface(), dataBroker);
if (ifState == null) {
+ LOG.debug("could not retrieve interface state corresponding to {}",interfaceNew.getName());
futures.add(transaction.submit());
return;
}
InterfaceParentEntry interfaceParentEntry =
InterfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryKey, dataBroker);
if (interfaceParentEntry == null || interfaceParentEntry.getInterfaceChildEntry() == null) {
+ LOG.debug("could not retrieve interface parent info for {}",interfaceNew.getName());
futures.add(transaction.submit());
return;
}