@Test public void testAnswer() { TestBatfish batfish = new TestBatfish(); ConversionWarningAnswerer answerer = new ConversionWarningAnswerer(new ConversionWarningQuestion(), batfish); TableAnswerElement answer = answerer.answer(batfish.getSnapshot()); assertThat( answer.getRows(), equalTo( new Rows() .add( Row.of( COL_NODE, new Node("node1"), COL_TYPE, ImmutableList.of(Warnings.TAG_UNIMPLEMENTED), COL_COMMENT, "unimplemented1")) .add( Row.of( COL_NODE, new Node("node2"), COL_TYPE, ImmutableList.of(Warnings.TAG_RED_FLAG), COL_COMMENT, "redflag2")))); }
@Override public TableAnswerElement answer(NetworkSnapshot snapshot) { ConvertConfigurationAnswerElement ccae = _batfish.loadConvertConfigurationAnswerElementOrReparse(snapshot); Map<String, Warnings> warnings = ccae.getWarnings(); Rows rows = new Rows(); warnings.forEach( (nodeName, nodeWarnings) -> { for (Warning w : nodeWarnings.getRedFlagWarnings()) { rows.add(getRow(nodeName, w)); } for (Warning w : nodeWarnings.getUnimplementedWarnings()) { rows.add(getRow(nodeName, w)); } }); TableAnswerElement answerElement = new TableAnswerElement(TABLE_METADATA); answerElement.postProcessAnswer(_question, rows.getData()); return answerElement; }
ConversionWarningAnswerer extends Answerer { @Override public TableAnswerElement answer(NetworkSnapshot snapshot) { ConvertConfigurationAnswerElement ccae = _batfish.loadConvertConfigurationAnswerElementOrReparse(snapshot); Map<String, Warnings> warnings = ccae.getWarnings(); Rows rows = new Rows(); warnings.forEach( (nodeName, nodeWarnings) -> { for (Warning w : nodeWarnings.getRedFlagWarnings()) { rows.add(getRow(nodeName, w)); } for (Warning w : nodeWarnings.getUnimplementedWarnings()) { rows.add(getRow(nodeName, w)); } }); TableAnswerElement answerElement = new TableAnswerElement(TABLE_METADATA); answerElement.postProcessAnswer(_question, rows.getData()); return answerElement; } }
ConversionWarningAnswerer extends Answerer { @Override public TableAnswerElement answer(NetworkSnapshot snapshot) { ConvertConfigurationAnswerElement ccae = _batfish.loadConvertConfigurationAnswerElementOrReparse(snapshot); Map<String, Warnings> warnings = ccae.getWarnings(); Rows rows = new Rows(); warnings.forEach( (nodeName, nodeWarnings) -> { for (Warning w : nodeWarnings.getRedFlagWarnings()) { rows.add(getRow(nodeName, w)); } for (Warning w : nodeWarnings.getUnimplementedWarnings()) { rows.add(getRow(nodeName, w)); } }); TableAnswerElement answerElement = new TableAnswerElement(TABLE_METADATA); answerElement.postProcessAnswer(_question, rows.getData()); return answerElement; } ConversionWarningAnswerer(ConversionWarningQuestion question, IBatfish batfish); }
ConversionWarningAnswerer extends Answerer { @Override public TableAnswerElement answer(NetworkSnapshot snapshot) { ConvertConfigurationAnswerElement ccae = _batfish.loadConvertConfigurationAnswerElementOrReparse(snapshot); Map<String, Warnings> warnings = ccae.getWarnings(); Rows rows = new Rows(); warnings.forEach( (nodeName, nodeWarnings) -> { for (Warning w : nodeWarnings.getRedFlagWarnings()) { rows.add(getRow(nodeName, w)); } for (Warning w : nodeWarnings.getUnimplementedWarnings()) { rows.add(getRow(nodeName, w)); } }); TableAnswerElement answerElement = new TableAnswerElement(TABLE_METADATA); answerElement.postProcessAnswer(_question, rows.getData()); return answerElement; } ConversionWarningAnswerer(ConversionWarningQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot); }
ConversionWarningAnswerer extends Answerer { @Override public TableAnswerElement answer(NetworkSnapshot snapshot) { ConvertConfigurationAnswerElement ccae = _batfish.loadConvertConfigurationAnswerElementOrReparse(snapshot); Map<String, Warnings> warnings = ccae.getWarnings(); Rows rows = new Rows(); warnings.forEach( (nodeName, nodeWarnings) -> { for (Warning w : nodeWarnings.getRedFlagWarnings()) { rows.add(getRow(nodeName, w)); } for (Warning w : nodeWarnings.getUnimplementedWarnings()) { rows.add(getRow(nodeName, w)); } }); TableAnswerElement answerElement = new TableAnswerElement(TABLE_METADATA); answerElement.postProcessAnswer(_question, rows.getData()); return answerElement; } ConversionWarningAnswerer(ConversionWarningQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot);  }