use of org.batfish.representation.juniper.PsFromInterface in project batfish by batfish.
the class ConfigurationBuilder method exitPopsf_interface.
@Override
public void exitPopsf_interface(Popsf_interfaceContext ctx) {
String name = getInterfaceName(ctx.id);
int definitionLine = ctx.id.name.getLine();
String unit = null;
if (ctx.id.unit != null) {
unit = ctx.id.unit.getText();
definitionLine = ctx.id.unit.getLine();
}
String unitFullName = name + "." + unit;
Map<String, Interface> interfaces = _configuration.getInterfaces();
Interface iface = interfaces.get(name);
if (iface == null) {
iface = new Interface(name, definitionLine);
iface.setRoutingInstance(_currentRoutingInstance.getName());
interfaces.put(name, iface);
}
PsFrom from;
if (unit != null) {
Map<String, Interface> units = iface.getUnits();
iface = units.get(unitFullName);
if (iface == null) {
iface = new Interface(unitFullName, definitionLine);
iface.setRoutingInstance(_currentRoutingInstance.getName());
units.put(unitFullName, iface);
}
from = new PsFromInterface(unitFullName);
} else {
from = new PsFromInterface(name);
}
_currentPsTerm.getFroms().add(from);
}
Aggregations