import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils;
import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceMetaUtils;
import org.opendaylight.vpnservice.interfacemgr.renderer.ovs.utilities.SouthboundUtils;
+import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.utilities.FlowBasedServicesUtils;
import org.opendaylight.vpnservice.mdsalutil.NwConstants;
import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
removeTunnelConfiguration(alivenessMonitorService, parentRefs, dataBroker, interfaceOld,
idManager, mdsalApiManager, futures);
}else {
- removeVlanConfiguration(dataBroker, interfaceOld, t);
+ removeVlanConfiguration(dataBroker, parentRefs, interfaceOld, t);
futures.add(t.submit());
}
return futures;
}
- private static void removeVlanConfiguration(DataBroker dataBroker, Interface interfaceOld, WriteTransaction t) {
+ private static void removeVlanConfiguration(DataBroker dataBroker, ParentRefs parentRefs, Interface interfaceOld, WriteTransaction transaction) {
+ LOG.debug("removing vlan configuration for {}",interfaceOld.getName());
+ IfL2vlan ifL2vlan = interfaceOld.getAugmentation(IfL2vlan.class);
+ if (ifL2vlan == null || ifL2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Trunk) {
+ return;
+ }
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState =
InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceOld.getName(), dataBroker);
if (ifState == null) {
+ LOG.debug("could not fetch interface state corresponding to {}",interfaceOld.getName());
return;
}
- String ncStr = ifState.getLowerLayerIf().get(0);
- NodeConnectorId nodeConnectorId = new NodeConnectorId(ncStr);
- NodeConnector nodeConnector =
- InterfaceManagerCommonUtils.getNodeConnectorFromInventoryOperDS(nodeConnectorId, dataBroker);
- if(nodeConnector != null) {
- FlowCapableNodeConnector flowCapableNodeConnector =
- nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
- //State state = flowCapableNodeConnector.getState();
- OperStatus operStatus = flowCapableNodeConnector == null ? OperStatus.Down : OperStatus.Up;
-
- if (ifState.getOperStatus() != operStatus) {
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifStateId =
- IfmUtil.buildStateInterfaceId(interfaceOld.getName());
- InterfaceBuilder ifaceBuilder = new InterfaceBuilder();
- ifaceBuilder.setOperStatus(operStatus);
- ifaceBuilder.setKey(IfmUtil.getStateInterfaceKeyFromName(interfaceOld.getName()));
- t.merge(LogicalDatastoreType.OPERATIONAL, ifStateId, ifaceBuilder.build());
- }
- }
- IfL2vlan ifL2vlan = interfaceOld.getAugmentation(IfL2vlan.class);
- if (ifL2vlan == null || ifL2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Trunk) {
- return;
- }
-
+ InterfaceManagerCommonUtils.updateOperStatus(interfaceOld.getName(), OperStatus.Down, transaction);
+ NodeConnectorId ncId = new NodeConnectorId(ifState.getLowerLayerIf().get(0));
+ BigInteger dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId));
+ FlowBasedServicesUtils.removeIngressFlow(interfaceOld.getName(), dpId, transaction);
+ InterfaceManagerCommonUtils.deleteParentInterfaceEntry(transaction, parentRefs.getParentInterface());
// For Vlan-Trunk Interface, remove the trunk-member operstates as well...
- InterfaceKey interfaceKey = new InterfaceKey(interfaceOld.getName());
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface =
- InterfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey, dataBroker);
- if (iface == null) {
- return;
- }
- InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(iface.getName());
+ InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(interfaceOld.getName());
InterfaceParentEntry interfaceParentEntry =
InterfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryKey, dataBroker);
- if (interfaceParentEntry == null) {
- return;
- }
-
- List<InterfaceChildEntry> interfaceChildEntries = interfaceParentEntry.getInterfaceChildEntry();
- if (interfaceChildEntries == null) {
+ if (interfaceParentEntry == null || interfaceParentEntry.getInterfaceChildEntry() == null) {
return;
}
//FIXME: If the no. of child entries exceeds 100, perform txn updates in batches of 100.
- for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifChildStateId =
- IfmUtil.buildStateInterfaceId(interfaceChildEntry.getChildInterface());
- t.delete(LogicalDatastoreType.OPERATIONAL, ifChildStateId);
+ for (InterfaceChildEntry interfaceChildEntry : interfaceParentEntry.getInterfaceChildEntry()) {
+ LOG.debug("removing interface state for vlan trunk member {}",interfaceChildEntry.getChildInterface());
+ InterfaceManagerCommonUtils.deleteStateEntry(interfaceChildEntry.getChildInterface(), transaction);
+ FlowBasedServicesUtils.removeIngressFlow(interfaceChildEntry.getChildInterface(), dpId, transaction);
}
}
DataBroker dataBroker, Interface interfaceOld,
IdManagerService idManager, IMdsalApiManager mdsalApiManager,
List<ListenableFuture<Void>> futures) {
-
+ LOG.debug("removing tunnel configuration for {}",interfaceOld.getName());
WriteTransaction t = dataBroker.newWriteOnlyTransaction();
BigInteger dpId = null;
if (parentRefs != null) {
InterfaceMetaUtils.getBridgeRefEntryFromOperDS(bridgeRefEntryIid, dataBroker);
if (bridgeRefEntry != null) {
+ LOG.debug("removing termination point for {}",interfaceOld.getName());
InstanceIdentifier<?> bridgeIid = bridgeRefEntry.getBridgeReference().getValue();
InstanceIdentifier<TerminationPoint> tpIid = SouthboundUtils.createTerminationPointInstanceIdentifier(
InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), interfaceOld.getName());
t.delete(LogicalDatastoreType.CONFIGURATION, tpIid);
// delete tunnel ingress flow
+ LOG.debug("removing tunnel ingress flow for {}",interfaceOld.getName());
NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(interfaceOld, dataBroker);
long portNo = Long.valueOf(IfmUtil.getPortNoFromNodeConnectorId(ncId));
InterfaceManagerCommonUtils.makeTunnelIngressFlow(futures, mdsalApiManager,
interfaceOld.getAugmentation(IfTunnel.class),
- dpId, portNo, interfaceOld,
+ dpId, portNo, interfaceOld, -1,
NwConstants.DEL_FLOW);
}