"Modified question is no longer valid, likely due to invalid parameters", e); if (modifiedQuestion.getDifferential() && _currDeltaTestrig == null) { _logger.output(DIFF_NOT_READY_MSG); return false; questionFile.toFile().deleteOnExit(); boolean result = answerFile(questionFile, modifiedQuestion.getDifferential(), isDelta, outWriter); if (questionFile != null) { CommonUtil.deleteIfExists(questionFile);
Answerer innerAnswerer = _batfish.createAnswerer(innerQuestion); AnswerElement innerAnswer = (innerQuestion.getDifferential()) ? innerAnswerer.answerDiff() : innerAnswerer.answer();
/** * This procedure proceeds as follows: * * <ul> * <li>First, compute the inner answer * <li>Then, run {@link #computeAnswerTable(String, JsonPathToTableQuestion)}, which produces a * set of result minus exclusions * </ul> */ @Override public TableAnswerElement answer() { JsonPathToTableQuestion question = (JsonPathToTableQuestion) _question; Question innerQuestion = question.getInnerQuestion(); Answerer innerAnswerer = _batfish.createAnswerer(innerQuestion); AnswerElement innerAnswer = (innerQuestion.getDifferential()) ? innerAnswerer.answerDiff() : innerAnswerer.answer(); String innerAnswerStr = null; try { innerAnswerStr = BatfishObjectMapper.writeStringWithNulls(innerAnswer); } catch (IOException e) { throw new BatfishException("Could not get JSON string from inner answer", e); } TableAnswerElement answer = computeAnswerTable(innerAnswerStr, question); return answer; }
@Override public AnswerElement answerDiff() { // if the inner question is differential, use answer() (so we are not taking diff of diff) JsonPathQuestion question = (JsonPathQuestion) _question; Question innerQuestion = question._innerQuestion; if (innerQuestion.getDifferential()) { return answer(); } _batfish.pushBaseSnapshot(); _batfish.checkSnapshotOutputReady(); _batfish.popSnapshot(); _batfish.pushDeltaSnapshot(); _batfish.checkSnapshotOutputReady(); _batfish.popSnapshot(); _batfish.pushBaseSnapshot(); JsonPathAnswerer beforeAnswerer = (JsonPathAnswerer) create(_question, _batfish); JsonPathAnswerElement before = beforeAnswerer.answer(); _batfish.popSnapshot(); _batfish.pushDeltaSnapshot(); JsonPathAnswerer afterAnswerer = (JsonPathAnswerer) create(_question, _batfish); JsonPathAnswerElement after = afterAnswerer.answer(); _batfish.popSnapshot(); return new JsonPathDiffAnswerElement(before, after); }
boolean diff = question.getDifferential(); boolean diffActive = _settings.getDiffActive() && !diff; _settings.setDiffActive(diffActive); try (ActiveSpan getAnswerSpan = GlobalTracer.get().buildSpan("Get answer").startActive()) { assert getAnswerSpan != null; // avoid not used warning if (question.getDifferential()) { answerElement = Answerer.create(question, this).answerDiff(); } else {