Пример #1
0
 def setUpClass(cls):
     importModelFile(
         os.environ['CAIRIS_SRC'] +
         '/../examples/exemplars/ACME_Water/ACME_Water.xml', 1, 'test')
     importLocationsFile(
         os.environ['CAIRIS_SRC'] +
         '/../examples/exemplars/ACME_Water/PooleWWTW.xml', 'test')
Пример #2
0
    def testModelCreation(self):
        b = Borg()
        b.get_dbproxy().classModel('Psychosis')
        b.get_dbproxy().classModel('Psychosis', '', True)
        b.get_dbproxy().classModel('Psychosis', 'Clinical data', True)
        b.get_dbproxy().goalModel('Psychosis')
        b.get_dbproxy().goalModel('Psychosis',
                                  'Process clinical data on NeuroGrid')
        b.get_dbproxy().responsibilityModel('Psychosis')
        b.get_dbproxy().responsibilityModel('Psychosis', 'Data Consumer')
        b.get_dbproxy().obstacleModel('Psychosis')
        b.get_dbproxy().obstacleModel('Psychosis',
                                      'Unauthorised portal access')
        b.get_dbproxy().taskModel('Psychosis')
        b.get_dbproxy().taskModel('Psychosis', 'Upload data')
        b.get_dbproxy().riskAnalysisModel('Psychosis')
        b.get_dbproxy().riskAnalysisModel('Psychosis', 'risk',
                                          'Unauthorised Certificate Access')
        b.get_dbproxy().riskObstacleModel('Unauthorised Certificate Access',
                                          'Psychosis')
        b.get_dbproxy().assumptionPersonaModel('Claire')
        b.get_dbproxy().textualArgumentationModel('Claire', 'Activities')

        importModelFile(
            os.environ['CAIRIS_SRC'] +
            '/../examples/exemplars/ACME_Water/ACME_Water.xml', 1, 'test')
        importLocationsFile(
            os.environ['CAIRIS_SRC'] +
            '/../examples/exemplars/ACME_Water/PooleWWTW.xml', 'test')
        b.get_dbproxy().locationsRiskModel('PooleWWTW', 'Day')
Пример #3
0
def file_import(importFile, mFormat, overwriteFlag, session_id=None):
    if overwriteFlag == None:
        overwriteFlag = 1

    from cairis.mio.ModelImport import importSecurityPatternsFile, importAttackPattern, importTVTypeFile, importDirectoryFile, importRequirementsFile, importRiskAnalysisFile, importUsabilityFile, importAssociationsFile, importProjectFile, importDomainValuesFile, importComponentViewFile, importSynopsesFile, importProcessesFile, importAssetsFile, importLocationsFile, importModelFile, importMisusabilityFile, importDataflowsFile, importStoriesFile

    try:
        ET.fromstring(open(importFile).read())
    except ET.ParseError as e:
        raise ARMException('Error parsing ' + importFile + ': ' + str(e))

    msgStr = ''
    if (mFormat == 'securitypattern' or mFormat == 'Security Pattern'):
        msgStr += importSecurityPatternsFile(importFile, session_id)
    elif (mFormat == 'attackpattern' or mFormat == 'Attack Pattern'):
        msgStr += importAttackPattern(importFile, session_id)
    elif (mFormat == 'tvtypes' or mFormat == 'Threat and Vulnerability Types'):
        msgStr += importTVTypeFile(importFile, int(overwriteFlag), session_id)
    elif (mFormat == 'directory'
          or mFormat == 'Threat and Vulnerability Directory'):
        msgStr += importDirectoryFile(importFile, int(overwriteFlag),
                                      session_id)
    elif (mFormat == 'requirements' or mFormat == 'Requirements'):
        msgStr += importRequirementsFile(importFile, session_id)
    elif (mFormat == 'riskanalysis' or mFormat == 'Risk Analysis'):
        msgStr += importRiskAnalysisFile(importFile, session_id)
    elif (mFormat == 'usability' or mFormat == 'Usability'):
        msgStr += importUsabilityFile(importFile, session_id)
    elif (mFormat == 'misusability' or mFormat == 'Misusability'):
        msgStr += importMisusabilityFile(importFile, session_id)
    elif (mFormat == 'associations' or mFormat == 'Associations'):
        msgStr += importAssociationsFile(importFile, session_id)
    elif (mFormat == 'project' or mFormat == 'Project data'):
        msgStr += importProjectFile(importFile, session_id)
    elif (mFormat == 'domainvalues' or mFormat == 'Domain Values'):
        msgStr += importDomainValuesFile(importFile, session_id)
    elif (mFormat == 'architecturalpattern'
          or mFormat == 'Architectural Pattern'):
        msgStr += importComponentViewFile(importFile, session_id)
    elif (mFormat == 'synopses' or mFormat == 'Synopses'):
        msgStr += importSynopsesFile(importFile, session_id)
    elif (mFormat == 'processes' or mFormat == 'Processes'):
        msgStr += importProcessesFile(importFile, session_id)
    elif (mFormat == 'assets' or mFormat == 'Assets'):
        msgStr += importAssetsFile(importFile, session_id)
    elif (mFormat == 'locations' or mFormat == 'Locations'):
        msgStr += importLocationsFile(importFile, session_id)
    elif (mFormat == 'dataflows' or mFormat == 'Dataflows'):
        msgStr += importDataflowsFile(importFile, session_id)
    elif (mFormat == 'stories' or mFormat == 'Stories'):
        msgStr += importStoriesFile(importFile, session_id)
    elif (mFormat == 'all' or mFormat == 'Model'
          or mFormat == 'Model file (.xml)'):
        msgStr += importModelFile(importFile, int(overwriteFlag), session_id)
    else:
        raise ARMException('Input model type ' + mFormat + ' not recognised')
    return 0
Пример #4
0
def file_import(importFile, mFormat, overwriteFlag, session_id=None):
    if overwriteFlag == None:
        overwriteFlag = 1

    if (os.access(importFile, os.R_OK)) == False:
        raise ARMException("Cannot access " + importFile)

    from cairis.mio.ModelImport import importSecurityPatternsFile, importAttackPattern, importTVTypeFile, importDirectoryFile, importRequirementsFile, importRiskAnalysisFile, importUsabilityFile, importAssociationsFile, importProjectFile, importDomainValuesFile, importComponentViewFile, importSynopsesFile, importProcessesFile, importAssetsFile, importLocationsFile, importModelFile, importMisusabilityFile, importDataflowsFile

    msgStr = ''
    if (mFormat == 'securitypattern' or mFormat == 'Security Pattern'):
        msgStr += importSecurityPatternsFile(importFile, session_id=session_id)
    elif (mFormat == 'attackpattern' or mFormat == 'Attack Pattern'):
        msgStr += importAttackPattern(importFile, session_id)
    elif (mFormat == 'tvtypes' or mFormat == 'Threat and Vulnerability Types'):
        msgStr += importTVTypeFile(importFile, int(overwriteFlag), session_id)
    elif (mFormat == 'directory'
          or mFormat == 'Threat and Vulnerability Directory'):
        msgStr += importDirectoryFile(importFile, int(overwriteFlag),
                                      session_id)
    elif (mFormat == 'requirements' or mFormat == 'Requirements'):
        msgStr += importRequirementsFile(importFile, session_id)
    elif (mFormat == 'riskanalysis' or mFormat == 'Risk Analysis'):
        msgStr += importRiskAnalysisFile(importFile, session_id)
    elif (mFormat == 'usability' or mFormat == 'Usability'):
        msgStr += importUsabilityFile(importFile, session_id)
    elif (mFormat == 'misusability' or mFormat == 'Misusability'):
        msgStr += importMisusabilityFile(importFile, session_id)
    elif (mFormat == 'associations' or mFormat == 'Associations'):
        msgStr += importAssociationsFile(importFile, session_id)
    elif (mFormat == 'project' or mFormat == 'Project data'):
        msgStr += importProjectFile(importFile, session_id)
    elif (mFormat == 'domainvalues' or mFormat == 'Domain Values'):
        msgStr += importDomainValuesFile(importFile, session_id)
    elif (mFormat == 'architecturalpattern'
          or mFormat == 'Architectural Pattern'):
        msgStr += importComponentViewFile(importFile, session_id)
    elif (mFormat == 'synopses' or mFormat == 'Synopses'):
        msgStr += importSynopsesFile(importFile, session_id)
    elif (mFormat == 'processes' or mFormat == 'Processes'):
        msgStr += importProcessesFile(importFile, session_id)
    elif (mFormat == 'assets' or mFormat == 'Assets'):
        msgStr += importAssetsFile(importFile, session_id)
    elif (mFormat == 'locations' or mFormat == 'Locations'):
        msgStr += importLocationsFile(importFile, session_id)
    elif (mFormat == 'dataflows' or mFormat == 'Dataflows'):
        msgStr += importDataflowsFile(importFile, session_id)
    elif (mFormat == 'all' or mFormat == 'Model'):
        msgStr += importModelFile(importFile, int(overwriteFlag), session_id)
    else:
        raise ARMException('Input model type ' + mFormat + ' not recognised')
    return 0
Пример #5
0
 def testModelCreation(self):
   b = Borg()  
   b.get_dbproxy().classModel('Psychosis')
   b.get_dbproxy().classModel('Psychosis','',True)
   b.get_dbproxy().classModel('Psychosis','Clinical data',True)
   b.get_dbproxy().goalModel('Psychosis')
   b.get_dbproxy().goalModel('Psychosis','Process clinical data on NeuroGrid')
   b.get_dbproxy().responsibilityModel('Psychosis')
   b.get_dbproxy().responsibilityModel('Psychosis','Data Consumer')
   b.get_dbproxy().obstacleModel('Psychosis')
   b.get_dbproxy().obstacleModel('Psychosis','Unauthorised portal access')
   b.get_dbproxy().taskModel('Psychosis')
   b.get_dbproxy().taskModel('Psychosis','Upload data')
   b.get_dbproxy().riskAnalysisModel('Psychosis')
   b.get_dbproxy().riskAnalysisModel('Psychosis','risk','Unauthorised Certificate Access')
   b.get_dbproxy().riskObstacleModel('Unauthorised Certificate Access','Psychosis')
   b.get_dbproxy().assumptionPersonaModel('Claire')
   b.get_dbproxy().textualArgumentationModel('Claire','Activities')
   
   importModelFile(os.environ['CAIRIS_SRC'] + '/../examples/exemplars/ACME_Water/ACME_Water.xml',1,'test')
   importLocationsFile(os.environ['CAIRIS_SRC'] + '/../examples/exemplars/ACME_Water/PooleWWTW.xml','test')
   b.get_dbproxy().locationsRiskModel('PooleWWTW','Day')
Пример #6
0
def file_import(importFile,mFormat,overwriteFlag,session_id = None):
  if overwriteFlag == None:
    overwriteFlag = 1

  if (os.access(importFile, os.R_OK)) == False:
    raise ARMException("Cannot access " + importFile)

  from cairis.mio.ModelImport import importSecurityPatternsFile, importAttackPattern,importTVTypeFile,importDirectoryFile,importRequirementsFile, importRiskAnalysisFile, importUsabilityFile, importAssociationsFile, importProjectFile, importDomainValuesFile, importComponentViewFile, importSynopsesFile,importProcessesFile,importAssetsFile,importLocationsFile,importModelFile,importMisusabilityFile,importDataflowsFile

  msgStr = ''
  if (mFormat == 'securitypattern' or mFormat == 'Security Pattern'):
    msgStr += importSecurityPatternsFile(importFile,session_id = session_id)
  elif (mFormat == 'attackpattern' or mFormat == 'Attack Pattern'):
    msgStr += importAttackPattern(importFile,session_id)
  elif (mFormat == 'tvtypes' or mFormat == 'Threat and Vulnerability Types'):
    msgStr += importTVTypeFile(importFile,int(overwriteFlag),session_id)
  elif (mFormat == 'directory' or mFormat == 'Threat and Vulnerability Directory'):
    msgStr += importDirectoryFile(importFile,int(overwriteFlag),session_id)
  elif (mFormat == 'requirements' or mFormat == 'Requirements'):
    msgStr += importRequirementsFile(importFile,session_id)
  elif (mFormat == 'riskanalysis' or mFormat == 'Risk Analysis'):
    msgStr += importRiskAnalysisFile(importFile,session_id)
  elif (mFormat == 'usability' or mFormat == 'Usability'):
    msgStr += importUsabilityFile(importFile,session_id)
  elif (mFormat == 'misusability' or mFormat == 'Misusability'):
    msgStr += importMisusabilityFile(importFile,session_id)
  elif (mFormat == 'associations' or mFormat == 'Associations'):
    msgStr += importAssociationsFile(importFile,session_id)
  elif (mFormat == 'project' or mFormat == 'Project data'):
    msgStr += importProjectFile(importFile,session_id)
  elif (mFormat == 'domainvalues' or mFormat == 'Domain Values'):
    msgStr += importDomainValuesFile(importFile,session_id)
  elif (mFormat == 'architecturalpattern' or mFormat == 'Architectural Pattern'):
    msgStr += importComponentViewFile(importFile,session_id)
  elif (mFormat == 'synopses' or mFormat == 'Synopses'):
    msgStr += importSynopsesFile(importFile,session_id)
  elif (mFormat == 'processes' or mFormat == 'Processes'):
    msgStr += importProcessesFile(importFile,session_id)
  elif (mFormat == 'assets' or mFormat == 'Assets'):
    msgStr += importAssetsFile(importFile,session_id)
  elif (mFormat == 'locations' or mFormat == 'Locations'):
    msgStr += importLocationsFile(importFile,session_id)
  elif (mFormat == 'dataflows' or mFormat == 'Dataflows'):
    msgStr += importDataflowsFile(importFile,session_id)
  elif (mFormat == 'all' or mFormat == 'Model'):
    msgStr += importModelFile(importFile,int(overwriteFlag),session_id)
  else:
    raise ARMException('Input model type ' + mFormat + ' not recognised')
  return 0
Пример #7
0
 def setUpClass(cls):
   importModelFile(os.environ['CAIRIS_SRC'] + '/../examples/exemplars/ACME_Water/ACME_Water.xml',1,'test')
   importLocationsFile(os.environ['CAIRIS_SRC'] + '/../examples/exemplars/ACME_Water/PooleWWTW.xml','test')