Program: 132167
Project: 132167
Buggy source:
private void configureSffFlows(RenderedServicePath rsp,boolean isAddFlow){
  RenderedServicePathHop servicePathHopPrev=null;
  Long sfpId=0L;
  sfpId=rsp.getPathId();
  Iterator<RenderedServicePathHop> servicePathHopIter=rsp.getRenderedServicePathHop().iterator();
  String curSFFName=null;
  RenderedServicePathHop servicePathHopCur=null;
  while (servicePathHopIter.hasNext()) {
    servicePathHopCur=servicePathHopIter.next();
    curSFFName=servicePathHopCur.getServiceFunctionForwarder();
    this.sfcL2FlowProgrammer.setNodeInfo(curSFFName);
    this.sfcL2FlowProgrammer.configureIngressTransportFlow(isAddFlow);
    this.sfcL2FlowProgrammer.configureSffNextHopDefaultFlow(isAddFlow);
    ServiceFunctionForwarder curSff=SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(curSFFName);
    List<SffDataPlaneLocator> curSffDataPlanelocatorList=curSff.getSffDataPlaneLocator();
    for (    SffDataPlaneLocator curSffDataPlanelocator : curSffDataPlanelocatorList) {
      LocatorType curSFFLocatorType=curSffDataPlanelocator.getDataPlaneLocator().getLocatorType();
      if (curSFFLocatorType.getImplementedInterface().equals(Mac.class)) {
        int curSFFVlan=((MacAddressLocator)curSffDataPlanelocator.getDataPlaneLocator().getLocatorType()).getVlanId();
        this.sfcL2FlowProgrammer.configureIngressFlow(curSFFVlan,isAddFlow);
      }
    }
    ServiceFunction curSF=SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(servicePathHopCur.getServiceFunctionName());
    List<SfDataPlaneLocator> curSfDataPlaneLocatorList=curSF.getSfDataPlaneLocator();
    for (    SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
      LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
      if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
        int curSFVlan=((MacAddressLocator)curSfDataPlanelocator.getLocatorType()).getVlanId();
        this.sfcL2FlowProgrammer.configureIngressFlow(curSFVlan,isAddFlow);
      }
    }
    if (servicePathHopPrev == null) {
      installDefaultNextHopEntry(rsp.getPathId(),servicePathHopCur,isAddFlow);
    }
 else {
      String prevSFSrcMac=null;
      ServiceFunction prevSF;
      ServiceFunctionForwarder prevSFF;
      List<SfDataPlaneLocator> prevSFDataPlaneLocatorList;
      prevSFF=SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(servicePathHopPrev.getServiceFunctionForwarder());
      prevSF=SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(servicePathHopPrev.getServiceFunctionName());
      prevSFDataPlaneLocatorList=prevSF.getSfDataPlaneLocator();
      if (servicePathHopPrev.getServiceFunctionForwarder().equals(curSFFName)) {
        for (        SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
          LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
          if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
            MacAddressLocator macAddressLocator;
            macAddressLocator=(MacAddressLocator)curSFLocatorType;
            String dstMac=macAddressLocator.getMac().getValue();
            int dstVlan=macAddressLocator.getVlanId();
            for (            SfDataPlaneLocator prevSFDataPlanelocator : prevSFDataPlaneLocatorList) {
              LocatorType prevSFLocatorType=prevSFDataPlanelocator.getLocatorType();
              if (prevSFLocatorType.getImplementedInterface().equals(Mac.class)) {
                prevSFSrcMac=((MacAddressLocator)prevSFLocatorType).getMac().getValue();
                this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),prevSFSrcMac,dstMac,dstVlan,isAddFlow);
              }
            }
            break;
          }
        }
      }
 else {
        for (        SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
          LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
          if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
            MacAddressLocator macAddressLocator;
            macAddressLocator=(MacAddressLocator)curSFLocatorType;
            String dstMac=macAddressLocator.getMac().getValue();
            int dstVlan=macAddressLocator.getVlanId();
            for (            SffDataPlaneLocator curSffDataPlanelocator : curSffDataPlanelocatorList) {
              String srcMacSff=((MacAddressLocator)curSffDataPlanelocator.getDataPlaneLocator().getLocatorType()).getMac().getValue();
              this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),srcMacSff,dstMac,dstVlan,isAddFlow);
            }
            break;
          }
        }
        List<SffDataPlaneLocator> prevSFFDataPlanelocatorList=prevSFF.getSffDataPlaneLocator();
        for (        SffDataPlaneLocator prevSFFDataPlanelocator : prevSFFDataPlanelocatorList) {
          LocatorType curSFFLocatorType=prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType();
          if (curSFFLocatorType.getImplementedInterface().equals(Mac.class)) {
            String dstMacSff=((MacAddressLocator)prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType()).getMac().getValue();
            int dstVlanSff=((MacAddressLocator)prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType()).getVlanId();
            this.sfcL2FlowProgrammer.setNodeInfo(servicePathHopPrev.getServiceFunctionForwarder());
            for (            SfDataPlaneLocator prevSFDataPlanelocator : prevSFDataPlaneLocatorList) {
              LocatorType prevSFLocatorType=prevSFDataPlanelocator.getLocatorType();
              if (prevSFLocatorType.getImplementedInterface().equals(Mac.class)) {
                prevSFSrcMac=((MacAddressLocator)prevSFLocatorType).getMac().getValue();
                this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),prevSFSrcMac,dstMacSff,dstVlanSff,isAddFlow);
              }
            }
            break;
          }
        }
      }
    }
    servicePathHopPrev=servicePathHopCur;
    servicePathHopCur=null;
  }
}

Fixed version (ground truth):
private void configureSffFlows(RenderedServicePath rsp,boolean isAddFlow){
  RenderedServicePathHop servicePathHopPrev=null;
  Long sfpId=0L;
  sfpId=rsp.getPathId();
  Iterator<RenderedServicePathHop> servicePathHopIter=rsp.getRenderedServicePathHop().iterator();
  String curSFFName=null;
  RenderedServicePathHop servicePathHopCur=null;
  while (servicePathHopIter.hasNext()) {
    servicePathHopCur=servicePathHopIter.next();
    curSFFName=servicePathHopCur.getServiceFunctionForwarder();
    LOG.info("String_Node_Str",servicePathHopCur.getHopNumber(),servicePathHopCur.getServiceFunctionName(),curSFFName);
    this.sfcL2FlowProgrammer.setNodeInfo(curSFFName);
    this.sfcL2FlowProgrammer.configureIngressTransportFlow(isAddFlow);
    this.sfcL2FlowProgrammer.configureSffNextHopDefaultFlow(isAddFlow);
    ServiceFunctionForwarder curSff=SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(curSFFName);
    List<SffDataPlaneLocator> curSffDataPlanelocatorList=curSff.getSffDataPlaneLocator();
    for (    SffDataPlaneLocator curSffDataPlanelocator : curSffDataPlanelocatorList) {
      LocatorType curSFFLocatorType=curSffDataPlanelocator.getDataPlaneLocator().getLocatorType();
      if (curSFFLocatorType.getImplementedInterface().equals(Mac.class)) {
        int curSFFVlan=((MacAddressLocator)curSffDataPlanelocator.getDataPlaneLocator().getLocatorType()).getVlanId();
        this.sfcL2FlowProgrammer.configureIngressFlow(curSFFVlan,isAddFlow);
      }
    }
    ServiceFunction curSF=SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(servicePathHopCur.getServiceFunctionName());
    List<SfDataPlaneLocator> curSfDataPlaneLocatorList=curSF.getSfDataPlaneLocator();
    for (    SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
      LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
      if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
        int curSFVlan=((MacAddressLocator)curSfDataPlanelocator.getLocatorType()).getVlanId();
        this.sfcL2FlowProgrammer.configureIngressFlow(curSFVlan,isAddFlow);
      }
    }
    if (servicePathHopPrev == null) {
      installDefaultNextHopEntry(rsp.getPathId(),servicePathHopCur,isAddFlow);
    }
 else {
      String prevSFSrcMac=null;
      ServiceFunction prevSF;
      ServiceFunctionForwarder prevSFF;
      List<SfDataPlaneLocator> prevSFDataPlaneLocatorList;
      prevSFF=SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(servicePathHopPrev.getServiceFunctionForwarder());
      prevSF=SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(servicePathHopPrev.getServiceFunctionName());
      prevSFDataPlaneLocatorList=prevSF.getSfDataPlaneLocator();
      if (servicePathHopPrev.getServiceFunctionForwarder().equals(curSFFName)) {
        for (        SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
          LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
          if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
            MacAddressLocator macAddressLocator;
            macAddressLocator=(MacAddressLocator)curSFLocatorType;
            String dstMac=macAddressLocator.getMac().getValue();
            int dstVlan=macAddressLocator.getVlanId();
            for (            SfDataPlaneLocator prevSFDataPlanelocator : prevSFDataPlaneLocatorList) {
              LocatorType prevSFLocatorType=prevSFDataPlanelocator.getLocatorType();
              if (prevSFLocatorType.getImplementedInterface().equals(Mac.class)) {
                prevSFSrcMac=((MacAddressLocator)prevSFLocatorType).getMac().getValue();
                this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),prevSFSrcMac,dstMac,dstVlan,isAddFlow);
              }
            }
            break;
          }
        }
      }
 else {
        for (        SfDataPlaneLocator curSfDataPlanelocator : curSfDataPlaneLocatorList) {
          LocatorType curSFLocatorType=curSfDataPlanelocator.getLocatorType();
          if (curSFLocatorType.getImplementedInterface().equals(Mac.class)) {
            MacAddressLocator macAddressLocator;
            macAddressLocator=(MacAddressLocator)curSFLocatorType;
            String dstMac=macAddressLocator.getMac().getValue();
            int dstVlan=macAddressLocator.getVlanId();
            for (            SffDataPlaneLocator curSffDataPlanelocator : curSffDataPlanelocatorList) {
              String srcMacSff=((MacAddressLocator)curSffDataPlanelocator.getDataPlaneLocator().getLocatorType()).getMac().getValue();
              this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),srcMacSff,dstMac,dstVlan,isAddFlow);
            }
            break;
          }
        }
        List<SffDataPlaneLocator> prevSFFDataPlanelocatorList=prevSFF.getSffDataPlaneLocator();
        for (        SffDataPlaneLocator prevSFFDataPlanelocator : prevSFFDataPlanelocatorList) {
          LocatorType curSFFLocatorType=prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType();
          if (curSFFLocatorType.getImplementedInterface().equals(Mac.class)) {
            String dstMacSff=((MacAddressLocator)prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType()).getMac().getValue();
            int dstVlanSff=((MacAddressLocator)prevSFFDataPlanelocator.getDataPlaneLocator().getLocatorType()).getVlanId();
            this.sfcL2FlowProgrammer.setNodeInfo(servicePathHopPrev.getServiceFunctionForwarder());
            for (            SfDataPlaneLocator prevSFDataPlanelocator : prevSFDataPlaneLocatorList) {
              LocatorType prevSFLocatorType=prevSFDataPlanelocator.getLocatorType();
              if (prevSFLocatorType.getImplementedInterface().equals(Mac.class)) {
                prevSFSrcMac=((MacAddressLocator)prevSFLocatorType).getMac().getValue();
                this.sfcL2FlowProgrammer.configureNextHopFlow(rsp.getPathId(),prevSFSrcMac,dstMacSff,dstVlanSff,isAddFlow);
              }
            }
            break;
          }
        }
      }
    }
    servicePathHopPrev=servicePathHopCur;
    servicePathHopCur=null;
  }
}