Fix for FibManager's vpnManager dependency issue
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / InterfaceManager.java
index a1cc4972589eee098b9d2b3cb32bca552c571e52..7737e0104d80596ff32c7c92bad34fb83db54095 100644 (file)
@@ -282,6 +282,7 @@ public class InterfaceManager extends AbstractDataChangeListener<Interface> impl
                     Node node = getNodeFromDataStore(delInterface);
                     if((node != null) &&(node.getNodeConnector().isEmpty())) {
                         dbDpnEndpoints.remove(node.getId());
+                        LOG.trace("dbDpnEndpoints: {}",dbDpnEndpoints);
                     }
                 }
             }
@@ -390,7 +391,6 @@ public class InterfaceManager extends AbstractDataChangeListener<Interface> impl
 
     void processPortUpdate(NodeConnector oldPort, NodeConnector update) {
         //TODO: Currently nothing to do here.
-        LOG.trace("ifMap: {}, dpnMap: {}", mapNcToInterfaceName, dbDpnEndpoints);
     }
 
     void processPortDelete(NodeConnector port) {
@@ -411,7 +411,7 @@ public class InterfaceManager extends AbstractDataChangeListener<Interface> impl
             org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder ifaceBuilder =
                             new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder();
             if (stateIf.isPresent()) {
-                stateIface = ifaceBuilder.setOperStatus(opStatus).build();
+                stateIface = ifaceBuilder.setOperStatus(opStatus).setKey(IfmUtil.getStateInterfaceKeyFromName(ifName)).build();
                 LOG.trace("Setting OperStatus for {} to {} in OPERATIONAL DS", ifName, opStatus);
                 asyncUpdate(LogicalDatastoreType.OPERATIONAL, id, stateIface, DEFAULT_CALLBACK);
             }
@@ -488,13 +488,12 @@ public class InterfaceManager extends AbstractDataChangeListener<Interface> impl
         Class<? extends InterfaceType> ifType = iface.getType();
         long dpn = this.getDpnForInterface(ifName);
         long portNo = this.getPortNumForInterface(iface).longValue();
-
         if (iface.isEnabled()) {
 
             if(ifType.isAssignableFrom(L2vlan.class)) {
                 IfL2vlan vlanIface = iface.getAugmentation(IfL2vlan.class);
-                long vlanVid = vlanIface.getVlanId();
                 LOG.trace("L2Vlan: {}",vlanIface);
+                long vlanVid = (vlanIface == null) ? 0 : vlanIface.getVlanId();
                 if (vlanVid != 0) {
                     listActionInfo.add(new ActionInfo(ActionType.push_vlan, new String[] {}));
                     listActionInfo.add(new ActionInfo(ActionType.set_field_vlan_vid,
@@ -536,7 +535,7 @@ public class InterfaceManager extends AbstractDataChangeListener<Interface> impl
         } catch (Exception e) {
             LOG.error("OFPort for Interface {} not found", iface.getName());
         }
-        return null;
+        return 0L;
     }
 
 }