@Override public void enterSyp_disable(Syp_disableContext ctx) { // line is disabled so remove it from list of lines _currentLogicalSystem.getJf().getLines().remove(_currentLine.getName()); }
@Override public void enterSy_ports(Sy_portsContext ctx) { String name = ctx.porttype.getText(); // aux and console ports should already exist unless they've been disabled, if disabled don't // add it to juniperFamily's lines _currentLine = firstNonNull(_currentLogicalSystem.getJf().getLines().get(name), new Line(name)); }
@Override public void enterSy_services_linetype(Sy_services_linetypeContext ctx) { String name = ctx.linetype.getText(); _currentLogicalSystem.getJf().getLines().computeIfAbsent(name, Line::new); _currentLine = _currentLogicalSystem.getJf().getLines().get(name); // if system authentication order defined, set the current line's authentication login list to // the system authentication order if (_currentLogicalSystem.getJf().getSystemAuthenticationOrder() != null && _currentLine.getAaaAuthenticationLoginList() == null) { _currentLine.setAaaAuthenticationLoginList( new AaaAuthenticationLoginList( _currentLogicalSystem.getJf().getSystemAuthenticationOrder().getMethods(), true)); } }
@Override public void exitSy_authentication_order(Sy_authentication_orderContext ctx) { if (_currentLine == null) { // in system hierarchy for (Line line : _currentLogicalSystem.getJf().getLines().values()) { if (line.getAaaAuthenticationLoginList() == null || line.getAaaAuthenticationLoginList().isDefault()) { // line has no login list or has default login list, give it the system's login list line.setAaaAuthenticationLoginList( new AaaAuthenticationLoginList(_currentAuthenticationOrder.getMethods(), true)); } } } _currentAuthenticationOrder = null; }
@Override public TableAnswerElement answer() { AaaAuthenticationLoginQuestion question = (AaaAuthenticationLoginQuestion) _question; TableAnswerElement answerElement = create(question); Set<String> specifiedNodes = question.getNodes().getMatchingNodes(_batfish); SortedMap<String, Configuration> configs = _batfish.loadConfigurations(); configs.forEach( (configName, config) -> { if (specifiedNodes.contains(configName)) { Row row = null; if (config.getVendorFamily().getCisco() != null) { row = getRow(configName, config.getVendorFamily().getCisco().getLines().values()); } else if (config.getVendorFamily().getJuniper() != null) { row = getRow(configName, config.getVendorFamily().getJuniper().getLines().values()); } if (row != null) { answerElement.addRow(row); } } }); answerElement.setSummary(answerElement.computeSummary(question.getAssertion())); return answerElement; }