use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VerdictLustreTranslatorTest method testUnmarshalFromLustre.
@Ignore
@Test
public void testUnmarshalFromLustre() throws IOException {
File testFile = new File("src/test/resources/vdm-model.lus");
Model testModel = VerdictLustreTranslator.unmarshalFromLustre(testFile);
Model controlModel = VdmTest.createControlModel();
Assertions.assertThat(testModel).usingRecursiveComparison().isEqualTo(controlModel);
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class App method main.
public static void main(String[] args) throws URISyntaxException {
// inputs
if (args.length != 3) {
File jarFile = new File(App.class.getProtectionDomain().getCodeSource().getLocation().toURI());
LOGGER.error("Usage: java -jar {} <input file> <STEM output folder> <Soteria++ output folder>", jarFile.getName());
} else {
if (isValidXMLFile(args[0])) {
if (isValidDir(args[1]) && isValidDir(args[2])) {
File inputFile = new File(args[0]);
// Translate VDM to Mbas inputs
Model model = VDM2CSV.unmarshalFromXml(inputFile);
VDM2CSV.marshalToMbasInputs(model, args[0], args[1], args[2]);
}
}
}
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class App method main.
/*
private static String[] enable_bm(String[] array) {
String[] result = Arrays.copyOf(array, array.length + 1);
result[array.length] = "-B";
return result;
}*/
public static void main(String[] args) throws IOException {
Options options = createOptions();
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
File inputFile = null;
File outputFile = null;
Model verdictDataModel = null;
VDMInstrumentor threat_instrumentor = null;
try {
CommandLine cmdLine = parser.parse(options, args);
// Load VDM model
if (cmdLine.hasOption("i")) {
String inputPath = cmdLine.getOptionValue("i");
LOGGER.info(inputPath);
inputFile = new File(inputPath);
verdictDataModel = VdmTranslator.unmarshalFromXml(inputFile);
threat_instrumentor = new VDMInstrumentor(verdictDataModel);
}
if (cmdLine.hasOption("o")) {
String outputPath = cmdLine.getOptionValue("o");
LOGGER.info(outputPath);
outputFile = new File(outputPath);
threat_instrumentor.instrument(verdictDataModel, cmdLine);
// else {
// LOGGER.info("Benign (Default)");
// }
VdmTranslator.marshalToXml(verdictDataModel, outputFile);
}
} catch (ParseException exp) {
LOGGER.error("Error:");
LOGGER.error(exp.getMessage());
formatter.printHelp("VERDICT-Instrumentor", options);
System.exit(-1);
}
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VerdictLustreTranslator method unmarshalFromLustre.
/**
* Unmarshal a Verdict data model from a Lustre file.
*
* @param inputFile Lustre file to unmarshal from
* @return Verdict data model from Lustre file
*/
public static Model unmarshalFromLustre(File inputFile) {
// Parse the Lustre file into a parse tree
LustreParser.ProgramContext programContext = VerdictLustreTranslator.parseFromLustre(inputFile);
// Extract any data from the parse tree with our listener
VerdictLustreListener extractor = new VerdictLustreListener(inputFile);
ParseTreeWalker.DEFAULT.walk(extractor, programContext);
// Return the model extracted from the parse tree
Model model = extractor.getModel();
return model;
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class MBASSynthesisHandler method runAadl2CsvWithSynthesis.
/**
* Calls Aadl2Csv translator with synthesis enabled
* @param dir
* @param vdmFile
* @param stemOutputDir
* @param soteriaOutputDir
*/
public static void runAadl2CsvWithSynthesis(File dir, File vdmFile, String stemOutputDir, String soteriaOutputDir) {
Agree2Vdm agree2vdm = new Agree2Vdm();
Model model = agree2vdm.execute(dir);
VdmTranslator.marshalToXml(model, vdmFile);
Vdm2Csv vdm2csv = new Vdm2Csv(true);
vdm2csv.execute(model, stemOutputDir, soteriaOutputDir, dir.getName());
}
Aggregations