use of org.batfish.grammar.cisco.CiscoParser.S_serviceContext in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitS_service.
@Override
public void exitS_service(S_serviceContext ctx) {
List<String> words = ctx.words.stream().map(w -> w.getText()).collect(Collectors.toList());
boolean enabled = ctx.NO() == null;
Iterator<String> i = words.iterator();
SortedMap<String, Service> currentServices = _configuration.getCf().getServices();
while (i.hasNext()) {
String name = i.next();
Service s = currentServices.computeIfAbsent(name, k -> new Service());
if (enabled) {
s.setEnabled(true);
} else if (!enabled && !i.hasNext()) {
s.disable();
}
currentServices = s.getSubservices();
}
}
Aggregations