use of org.batfish.representation.cisco.Interface 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);
}
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterIf_description.
@Override
public void enterIf_description(If_descriptionContext ctx) {
Token descriptionToken = ctx.description_line().text;
String description = descriptionToken != null ? descriptionToken.getText().trim() : "";
for (Interface currentInterface : _currentInterfaces) {
currentInterface.setDescription(description);
}
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIf_ip_vrf_forwarding.
@Override
public void exitIf_ip_vrf_forwarding(If_ip_vrf_forwardingContext ctx) {
String name = ctx.name.getText();
for (Interface currentInterface : _currentInterfaces) {
currentInterface.setVrf(name);
initVrf(name);
}
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIf_switchport.
@Override
public void exitIf_switchport(If_switchportContext ctx) {
if (ctx.NO() != null) {
for (Interface iface : _currentInterfaces) {
iface.setSwitchportMode(SwitchportMode.NONE);
iface.setSwitchport(false);
}
} else {
for (Interface iface : _currentInterfaces) {
iface.setSwitchportMode(SwitchportMode.ACCESS);
iface.setSwitchport(true);
}
}
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIfvrrp_authentication.
@Override
public void exitIfvrrp_authentication(Ifvrrp_authenticationContext ctx) {
String hashedAuthenticationText = CommonUtil.sha256Digest(ctx.text.getText() + CommonUtil.salt());
final int line = ctx.getStart().getLine();
for (Interface iface : _currentInterfaces) {
String ifaceName = iface.getName();
VrrpGroup vrrpGroup = _configuration.getVrrpGroups().computeIfAbsent(ifaceName, n -> new VrrpInterface(ifaceName, line)).getVrrpGroups().computeIfAbsent(_currentVrrpGroupNum, VrrpGroup::new);
vrrpGroup.setAuthenticationTextHash(hashedAuthenticationText);
}
}
Aggregations