use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIf_ip_access_group.
@Override
public void exitIf_ip_access_group(If_ip_access_groupContext ctx) {
String name = ctx.name.getText();
int line = ctx.name.getStart().getLine();
if (ctx.IN() != null || ctx.INGRESS() != null) {
for (Interface currentInterface : _currentInterfaces) {
currentInterface.setIncomingFilter(name);
currentInterface.setIncomingFilterLine(line);
}
} else if (ctx.OUT() != null || ctx.EGRESS() != null) {
for (Interface currentInterface : _currentInterfaces) {
currentInterface.setOutgoingFilter(name);
currentInterface.setOutgoingFilterLine(line);
}
} else {
throw new BatfishException("bad direction");
}
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterRoa_interface.
@Override
public void enterRoa_interface(Roa_interfaceContext ctx) {
String ifaceName = ctx.iname.getText();
String canonicalIfaceName = getCanonicalInterfaceName(ifaceName);
Interface iface = _configuration.getInterfaces().get(canonicalIfaceName);
if (iface == null) {
_w.redFlag("OSPF: Interface: '" + ifaceName + "' not declared before OSPF process");
iface = addInterface(canonicalIfaceName, ctx.iname, false);
}
// whatever
for (InterfaceAddress address : iface.getAllAddresses()) {
Prefix prefix = address.getPrefix();
OspfNetwork network = new OspfNetwork(prefix, _currentOspfArea);
_currentOspfProcess.getNetworks().add(network);
}
_currentOspfInterface = iface.getName();
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method addInterface.
private Interface addInterface(String name, Interface_nameContext ctx, boolean explicit) {
Interface newInterface = _configuration.getInterfaces().get(name);
if (newInterface == null) {
newInterface = new Interface(name, _configuration);
initInterface(newInterface, _configuration.getVendor());
_configuration.getInterfaces().put(name, newInterface);
initInterface(newInterface, ctx);
} else {
_w.pedantic("Interface: '" + name + "' altered more than once");
}
newInterface.setDeclaredNames(new ImmutableSortedSet.Builder<String>(naturalOrder()).addAll(newInterface.getDeclaredNames()).add(ctx.getText()).build());
if (explicit) {
_currentInterfaces.add(newInterface);
}
return newInterface;
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRoi_cost.
@Override
public void exitRoi_cost(Roi_costContext ctx) {
Interface iface = _configuration.getInterfaces().get(_currentOspfInterface);
int cost = toInteger(ctx.cost);
iface.setOspfCost(cost);
}
use of org.batfish.representation.cisco.Interface in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitIf_ip_helper_address.
@Override
public void exitIf_ip_helper_address(If_ip_helper_addressContext ctx) {
for (Interface iface : _currentInterfaces) {
Ip dhcpRelayAddress = toIp(ctx.address);
iface.getDhcpRelayAddresses().add(dhcpRelayAddress);
}
}
Aggregations