/**
   * Create Initiator Target LUN Mapping as an extension in volume object
   *
   * @param volume - volume in which ITL to be added
   * @param exportMask - exportMask in which the volume is to be added
   * @param targetLunId - integer value of host LUN id on which volume is accessible.
   */
  private void storeITLMappingInVolume(
      Map<URI, Integer> volumeToTargetLunMap, ExportMask exportMask) {
    log.debug("START - createITLMappingInVolume");
    for (URI volumeURI : volumeToTargetLunMap.keySet()) {
      Integer targetLunId = volumeToTargetLunMap.get(volumeURI);
      Volume volume = dbClient.queryObject(Volume.class, volumeURI);

      StringSetMap zoningMap = exportMask.getZoningMap();
      Set<String> zoningMapKeys = zoningMap.keySet();
      int initiatorIndex = 0;
      for (String initiator : zoningMapKeys) {
        Initiator initiatorObj = dbClient.queryObject(Initiator.class, URI.create(initiator));
        String initiatorWWPN =
            initiatorObj.getInitiatorPort().replaceAll(CinderConstants.COLON, "");
        StringSet targetPorts = zoningMap.get(initiator);
        int targetIndex = 0;
        for (String target : targetPorts) {
          StoragePort targetPort = dbClient.queryObject(StoragePort.class, URI.create(target));
          String targetPortWWN =
              targetPort.getPortNetworkId().replaceAll(CinderConstants.COLON, "");

          // Format is - <InitiatorWWPN>-<TargetWWPN>-<LunId>
          String itl = initiatorWWPN + "-" + targetPortWWN + "-" + String.valueOf(targetLunId);

          // ITL keys will be formed as ITL-00, ITL-01, ITL-10, ITL-11 so on
          String itlKey =
              CinderConstants.PREFIX_ITL
                  + String.valueOf(initiatorIndex)
                  + String.valueOf(targetIndex);
          log.info(String.format("Adding ITL %s with key %s", itl, itlKey));
          StringMap extensionsMap = volume.getExtensions();
          if (null == extensionsMap) {
            extensionsMap = new StringMap();
            extensionsMap.put(itlKey, itl);
            volume.setExtensions(extensionsMap);
          } else {
            volume.getExtensions().put(itlKey, itl);
          }

          targetIndex++;
        }

        initiatorIndex++;
      }

      dbClient.updateAndReindexObject(volume);
    }

    log.debug("END - createITLMappingInVolume");
  }
 /**
  * Remove the list of ITLs from the volume extensions
  *
  * @param volume
  * @return
  */
 private void removeITLsFromVolume(Volume volume) {
   StringMap extensions = volume.getExtensions();
   Set<Map.Entry<String, String>> mapEntries = extensions.entrySet();
   for (Iterator<Map.Entry<String, String>> it = mapEntries.iterator(); it.hasNext(); ) {
     Map.Entry<String, String> entry = it.next();
     if (entry.getKey().startsWith(CinderConstants.PREFIX_ITL)) {
       it.remove();
     }
   }
 }