use of org.batfish.representation.cisco.CiscoSourceNat in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIf_ip_nat_source.
@Override
public void exitIf_ip_nat_source(If_ip_nat_sourceContext ctx) {
CiscoSourceNat nat = new CiscoSourceNat();
if (ctx.acl != null) {
String acl = ctx.acl.getText();
int aclLine = ctx.acl.getStart().getLine();
nat.setAclName(acl);
nat.setAclNameLine(aclLine);
_configuration.referenceStructure(CiscoStructureType.IP_ACCESS_LIST, acl, CiscoStructureUsage.IP_NAT_SOURCE_ACCESS_LIST, aclLine);
}
if (ctx.pool != null) {
String pool = ctx.pool.getText();
int poolLine = ctx.pool.getStart().getLine();
nat.setNatPool(pool);
nat.setNatPoolLine(poolLine);
_configuration.referenceStructure(CiscoStructureType.NAT_POOL, pool, CiscoStructureUsage.IP_NAT_SOURCE_POOL, poolLine);
}
for (Interface iface : _currentInterfaces) {
if (iface.getSourceNats() == null) {
iface.setSourceNats(new ArrayList<>(1));
}
iface.getSourceNats().add(nat);
}
}
Aggregations