コード例 #1
0
ファイル: cexport.py プロジェクト: failys/cairis
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
コード例 #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
コード例 #3
0
ファイル: cexport.py プロジェクト: failys/cairis
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
コード例 #4
0
 def testExportModel(self):
     outFile = '/tmp/exportedModel.xml'
     self.assertEqual(exportModel(outFile), 'Exported model')
     self.assertEqual(os.path.isfile(outFile), True)
コード例 #5
0
 def testExportModel(self):
   outFile = '/tmp/exportedModel.xml'
   self.assertEqual(exportModel(outFile),'Exported model')
   self.assertEqual(os.path.isfile(outFile),True)