public static List<ListenableFuture<Void>> removeConfiguration(DataBroker dataBroker, ParentRefs parentRefs,
Interface interfaceOld, IfL2vlan ifL2vlan,
IdManagerService idManager) {
+ LOG.debug("remove vlan member configuration {}",interfaceOld.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
WriteTransaction t = dataBroker.newWriteOnlyTransaction();
InterfaceParentEntry interfaceParentEntry =
InterfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryIid, dataBroker);
+ if(interfaceParentEntry == null){
+ return futures;
+ }
+
+ //Delete the interface child information
List<InterfaceChildEntry> interfaceChildEntries = interfaceParentEntry.getInterfaceChildEntry();
+ InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(interfaceOld.getName());
+ InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryIid =
+ InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
+ t.delete(LogicalDatastoreType.CONFIGURATION, interfaceChildEntryIid);
+ //If this is the last child, remove the interface parent info as well.
if (interfaceChildEntries.size() <= 1) {
t.delete(LogicalDatastoreType.CONFIGURATION, interfaceParentEntryIid);
- } else {
- InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(interfaceOld.getName());
- InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryIid =
- InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
- t.delete(LogicalDatastoreType.CONFIGURATION, interfaceChildEntryIid);
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState =
}
} */
- String ncStr = ifState.getLowerLayerIf().get(0);
- NodeConnectorId nodeConnectorId = new NodeConnectorId(ncStr);
- BigInteger dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId));
+ LOG.debug("delete vlan member interface state {}",interfaceOld.getName());
+ BigInteger dpId = IfmUtil.getDpnFromInterface(ifState);
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifStateId =
IfmUtil.buildStateInterfaceId(interfaceOld.getName());
t.delete(LogicalDatastoreType.OPERATIONAL, ifStateId);
- FlowBasedServicesUtils.removeIngressFlow(interfaceOld, dpId, t);
+ FlowBasedServicesUtils.removeIngressFlow(interfaceOld.getName(), dpId, t);
}
futures.add(t.submit());