use of com.ge.verdict.attackdefensecollector.model.CyberOr in project VERDICT by ge-high-assurance.
the class AttackDefenseCollector method performInference.
/**
* Perform inference on the loaded model. Factored out because it is used in both the CSV and
* VDM approaches. Must be called after systems and cyber relations are loaded.
*/
private void performInference() {
int inferenceCounter = 0;
for (SystemModel system : sysNameToSystemModelMap.values()) {
// because we don't want to infer cyber relations for a system with subcomponents
if (system.getCyberRels().isEmpty() && system.getInternalIncomingConnections().isEmpty() && system.getInternalOutgoingConnections().isEmpty()) {
Logger.println("Inferring cyber relations for system " + system.getName());
// anyway because it can't be traced.
for (ConnectionModel outgoing : system.getOutgoingConnections()) {
if (!system.getIncomingConnections().isEmpty()) {
// For each of C, I, A, we have X -> X
for (CIA cia : CIA.values()) {
CyberExpr condition = new CyberOr(system.getIncomingConnections().stream().map(incoming -> new PortConcern(incoming.getDestinationPortName(), cia)).collect(Collectors.toList()));
system.addCyberRel(new CyberRel("_inference" + (inferenceCounter++), condition, new PortConcern(outgoing.getSourcePortName(), cia)));
}
// We also have I -> A
system.addCyberRel(new CyberRel("_inference" + (inferenceCounter++), new CyberOr(system.getIncomingConnections().stream().map(incoming -> new PortConcern(incoming.getDestinationPortName(), CIA.I)).collect(Collectors.toList())), new PortConcern(outgoing.getSourcePortName(), CIA.A)));
}
}
}
}
}
Aggregations