Beispiel #1
0
def file_export(modelFormat = 'all', outputFile = None, persona = None, task = None, envName = None, session_id = None):
  from cairis.mio.ModelExport import exportModel,exportRedmineScenarios,exportRedmineRequirements,exportRedmineUseCases,exportArchitecture,exportAttackPatterns,exportGRL
  msgStr = ''
  if (modelFormat == 'all'):
    msgStr += exportModel(outputFile,session_id)
  elif (modelFormat == 'scenarios'):
    msgStr += exportRedmineScenarios(outputFile,session_id)
  elif (modelFormat == 'requirements'):
    msgStr += exportRedmineRequirements(outputFile,session_id)
  elif (modelFormat == 'usecases'):
    msgStr += exportRedmineUseCases(outputFile,session_id)
  elif (modelFormat == 'architecture'):
    msgStr += exportArchitecture(outputFile,session_id)
  elif (modelFormat == 'attackpatterns'):
    msgStr += exportAttackPatterns(outputFile,session_id)
  elif (modelFormat == 'GRL'):
    personaNames = []
    personaNames.extend(persona)
    taskNames = []
    taskNames.extend(task)

    if len(personaNames) == 0:
      raise ARMException('Persona name not specified for GRL export')
    elif len(taskNames) == 0:
      raise ARMException('Task name not specified for GRL export')
    elif envName == None:
      raise ARMException('Environment name not specified for GRL export')
    else:
      msgStr += exportGRL(outputFile,personaNames,taskNames,envName,session_id)
  else:
    raise ARMException('Export model type ' + modelFormat + ' not recognised')
  return msgStr
Beispiel #2
0
def file_export(modelFormat = 'all', outputFile = None, persona = None, task = None, envName = None, session_id = None):
  from cairis.mio.ModelExport import exportModel,exportRedmineScenarios,exportRedmineRequirements,exportRedmineUseCases,exportArchitecture,exportAttackPatterns,exportGRL,exportSecurityPatterns
  msgStr = ''
  if (modelFormat == 'all'):
    msgStr += exportModel(outputFile,session_id)
  elif (modelFormat == 'scenarios'):
    msgStr += exportRedmineScenarios(outputFile,session_id)
  elif (modelFormat == 'requirements'):
    msgStr += exportRedmineRequirements(outputFile,session_id)
  elif (modelFormat == 'usecases'):
    msgStr += exportRedmineUseCases(outputFile,session_id)
  elif (modelFormat == 'architecture'):
    msgStr += exportArchitecture(outputFile,session_id)
  elif (modelFormat == 'attackpatterns'):
    msgStr += exportAttackPatterns(outputFile,session_id)
  elif (modelFormat == 'securitypatterns'):
    msgStr += exportSecurityPatterns(outputFile,session_id)
  elif (modelFormat == 'GRL'):
    personaNames = []
    personaNames.extend(persona)
    taskNames = []
    taskNames.extend(task)

    if len(personaNames) == 0:
      raise ARMException('Persona name not specified for GRL export')
    elif len(taskNames) == 0:
      raise ARMException('Task name not specified for GRL export')
    elif envName == None:
      raise ARMException('Environment name not specified for GRL export')
    else:
      msgStr += exportGRL(outputFile,personaNames,taskNames,envName,session_id)
  else:
    raise ARMException('Export model type ' + modelFormat + ' not recognised')
  return msgStr
Beispiel #3
0
def file_export(modelFormat="all", outputFile=None, persona=None, task=None, envName=None, session_id=None):
    from cairis.mio.ModelExport import (
        exportModel,
        exportRedmineScenarios,
        exportRedmineRequirements,
        exportRedmineUseCases,
        exportArchitecture,
        exportAttackPatterns,
        exportGRL,
    )

    msgStr = ""
    if modelFormat == "all":
        msgStr += exportModel(outputFile, session_id)
    elif modelFormat == "scenarios":
        msgStr += exportRedmineScenarios(outputFile, session_id)
    elif modelFormat == "requirements":
        msgStr += exportRedmineRequirements(outputFile, session_id)
    elif modelFormat == "usecases":
        msgStr += exportRedmineUseCases(outputFile, session_id)
    elif modelFormat == "architecture":
        msgStr += exportArchitecture(outputFile, session_id)
    elif modelFormat == "attackpatterns":
        msgStr += exportAttackPatterns(outputFile, session_id)
    elif modelFormat == "GRL":
        personaNames = []
        personaNames.extend(persona)
        taskNames = []
        taskNames.extend(task)

        if len(personaNames) == 0:
            raise ARMException("Persona name not specified for GRL export")
        elif len(taskNames) == 0:
            raise ARMException("Task name not specified for GRL export")
        elif envName == None:
            raise ARMException("Environment name not specified for GRL export")
        else:
            msgStr += exportGRL(outputFile, personaNames, taskNames, envName, session_id)
    else:
        raise ARMException("Export model type " + modelFormat + " not recognised")
    return msgStr
Beispiel #4
0
 def testExportRedmineScenarios(self):
     outFile = '/tmp/exportedScenarios.txt'
     self.assertEqual(exportRedmineScenarios(outFile),
                      'Exported 32 scenarios.')
     self.assertEqual(os.path.isfile(outFile), True)
Beispiel #5
0
 def testExportRedmineScenarios(self):
   outFile = '/tmp/exportedScenarios.txt'
   self.assertEqual(exportRedmineScenarios(outFile),'Exported 32 scenarios.')
   self.assertEqual(os.path.isfile(outFile),True)