Search in sources :

Example 1 with AaaAccountingCommands

use of org.batfish.datamodel.vendor_family.cisco.AaaAccountingCommands in project batfish by batfish.

the class CiscoControlPlaneExtractor method enterAaa_accounting_commands_line.

@Override
public void enterAaa_accounting_commands_line(Aaa_accounting_commands_lineContext ctx) {
    Map<String, AaaAccountingCommands> commands = _configuration.getCf().getAaa().getAccounting().getCommands();
    Set<String> levels = new TreeSet<>();
    if (ctx.levels != null) {
        List<SubRange> range = toRange(ctx.levels);
        for (SubRange subRange : range) {
            for (int i = subRange.getStart(); i <= subRange.getEnd(); i++) {
                String level = Integer.toString(i);
                levels.add(level);
            }
        }
    } else {
        levels.add(AaaAccounting.DEFAULT_COMMANDS);
    }
    List<AaaAccountingCommands> currentAaaAccountingCommands = new ArrayList<>();
    for (String level : levels) {
        AaaAccountingCommands c = commands.computeIfAbsent(level, k -> new AaaAccountingCommands());
        currentAaaAccountingCommands.add(c);
    }
    _currentAaaAccountingCommands = currentAaaAccountingCommands;
}
Also used : AaaAccountingCommands(org.batfish.datamodel.vendor_family.cisco.AaaAccountingCommands) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) SubRange(org.batfish.datamodel.SubRange)

Aggregations

ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 SubRange (org.batfish.datamodel.SubRange)1 AaaAccountingCommands (org.batfish.datamodel.vendor_family.cisco.AaaAccountingCommands)1