Bug 7048 - Update to OF port does not change 220 flow
[genius.git] / interfacemanager / interfacemanager-impl / src / main / java / org / opendaylight / genius / interfacemanager / IfmUtil.java
index 1907e6e9aa4a409b43c6017a740da9c3c78e6e4b..31584dae6c10052c2eb11424cc41e71953ae0954 100755 (executable)
@@ -93,18 +93,18 @@ public class IfmUtil {
                     .put(TunnelTypeVxlanGpe.class, InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE)
                     .build();
 
-    public static String getDpnFromNodeConnectorId(NodeConnectorId portId) {
+    public static BigInteger getDpnFromNodeConnectorId(NodeConnectorId portId) {
         /*
          * NodeConnectorId is of form 'openflow:dpnid:portnum'
          */
         String[] split = portId.getValue().split(IfmConstants.OF_URI_SEPARATOR);
-        return split[1];
+        return new BigInteger(split[1]);
     }
 
     public static BigInteger getDpnFromInterface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState){
         NodeConnectorId ncId = getNodeConnectorIdFromInterface(ifState);
         if(ncId != null){
-            return new BigInteger(getDpnFromNodeConnectorId(ncId));
+            return getDpnFromNodeConnectorId(ncId);
         }
         return null;
     }
@@ -216,9 +216,9 @@ public class IfmUtil {
         return result;
     }
 
-    public static List<Action> getEgressActionsForInterface(String interfaceName, Long tunnelKey,
+    public static List<Action> getEgressActionsForInterface(String interfaceName, Long tunnelKey, Integer actionKey,
                                                             DataBroker dataBroker, Boolean isDefaultEgress) {
-        List<ActionInfo> listActionInfo = getEgressActionInfosForInterface(interfaceName, tunnelKey, 0, dataBroker, isDefaultEgress);
+        List<ActionInfo> listActionInfo = getEgressActionInfosForInterface(interfaceName, tunnelKey, actionKey==null?0:actionKey, dataBroker, isDefaultEgress);
         List<Action> actionsList = new ArrayList<>();
         for (ActionInfo actionInfo : listActionInfo) {
             actionsList.add(actionInfo.buildAction());
@@ -231,7 +231,7 @@ public class IfmUtil {
         List<Instruction> instructions = new ArrayList<>();
         List<Action> actionList = MDSALUtil.buildActions(getEgressActionInfosForInterface(
                 interfaceName, tunnelKey, 0, dataBroker, isDefaultEgress));
-        instructions.add(MDSALUtil.buildWriteActionsInstruction(actionList));
+        instructions.add(MDSALUtil.buildApplyActionsInstruction(actionList));
         return  instructions;
     }
 
@@ -487,10 +487,10 @@ public class IfmUtil {
     }
 
     public static void unbindService(DataBroker dataBroker, String interfaceName, InstanceIdentifier<BoundServices>
-            boundServicesInstanceIdentifier, Class<? extends ServiceModeBase> serviceMode){
+            boundServicesInstanceIdentifier, String parentInterface){
         LOG.info("Unbinding Service from : {}", interfaceName);
         DataStoreJobCoordinator dataStoreJobCoordinator = DataStoreJobCoordinator.getInstance();
-        dataStoreJobCoordinator.enqueueJob(interfaceName,
+        dataStoreJobCoordinator.enqueueJob(parentInterface,
                 () -> {
                     WriteTransaction t = dataBroker.newWriteOnlyTransaction();
                     t.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);