use of org.batfish.representation.juniper.Interface in project batfish by batfish.
the class ConfigurationBuilder method exitSeipv_bind_interface.
@Override
public void exitSeipv_bind_interface(Seipv_bind_interfaceContext ctx) {
Interface iface = initInterface(ctx.interface_id());
int line = ctx.interface_id().getStart().getLine();
_currentIpsecVpn.setBindInterface(iface);
_currentIpsecVpn.setBindInterfaceLine(line);
}
use of org.batfish.representation.juniper.Interface in project batfish by batfish.
the class ConfigurationBuilder method enterOa_interface.
@Override
public void enterOa_interface(Oa_interfaceContext ctx) {
Map<String, Interface> interfaces = _configuration.getInterfaces();
String unitFullName = null;
if (ctx.ALL() != null) {
_currentOspfInterface = _currentRoutingInstance.getGlobalMasterInterface();
} else if (ctx.ip != null) {
Ip ip = new Ip(ctx.ip.getText());
for (Interface iface : interfaces.values()) {
for (Interface unit : iface.getUnits().values()) {
if (unit.getAllAddressIps().contains(ip)) {
_currentOspfInterface = unit;
unitFullName = unit.getName();
}
}
}
if (_currentOspfInterface == null) {
throw new BatfishException("Could not find interface with ip address: " + ip);
}
} else {
_currentOspfInterface = initInterface(ctx.id);
unitFullName = _currentOspfInterface.getName();
}
Ip currentArea = new Ip(_currentArea.getName());
if (ctx.oai_passive() != null) {
_currentOspfInterface.getOspfPassiveAreas().add(currentArea);
} else {
Ip interfaceActiveArea = _currentOspfInterface.getOspfActiveArea();
if (interfaceActiveArea != null && !currentArea.equals(interfaceActiveArea)) {
throw new BatfishException("Interface: \"" + unitFullName + "\" assigned to multiple active areas");
}
_currentOspfInterface.setOspfActiveArea(currentArea);
}
}
use of org.batfish.representation.juniper.Interface in project batfish by batfish.
the class ConfigurationBuilder method enterI_unit.
@Override
public void enterI_unit(I_unitContext ctx) {
String unit = ctx.num.getText();
int definitionLine = ctx.num.getLine();
String unitFullName = _currentMasterInterface.getName() + "." + unit;
Map<String, Interface> units = _currentMasterInterface.getUnits();
_currentInterface = units.get(unitFullName);
if (_currentInterface == null) {
_currentInterface = new Interface(unitFullName, definitionLine);
_currentInterface.setRoutingInstance(_currentRoutingInstance.getName());
_currentInterface.setParent(_currentMasterInterface);
units.put(unitFullName, _currentInterface);
}
}
use of org.batfish.representation.juniper.Interface in project batfish by batfish.
the class ConfigurationBuilder method exitRi_interface.
@Override
public void exitRi_interface(Ri_interfaceContext ctx) {
Interface iface = initInterface(ctx.id);
iface.setRoutingInstance(_currentRoutingInstance.getName());
}
use of org.batfish.representation.juniper.Interface in project batfish by batfish.
the class ConfigurationBuilder method enterIs_interface.
@Override
public void enterIs_interface(Is_interfaceContext ctx) {
Map<String, Interface> interfaces = _configuration.getInterfaces();
String unitFullName = null;
String name = getInterfaceName(ctx.id);
int definitionLine = ctx.id.name.getLine();
String unit = null;
if (ctx.id.unit != null) {
unit = ctx.id.unit.getText();
}
unitFullName = name + "." + unit;
_currentIsisInterface = interfaces.get(name);
if (_currentIsisInterface == null) {
_currentIsisInterface = new Interface(name, definitionLine);
_currentIsisInterface.setRoutingInstance(_currentRoutingInstance.getName());
interfaces.put(name, _currentIsisInterface);
}
if (unit != null) {
definitionLine = ctx.id.unit.getLine();
Map<String, Interface> units = _currentIsisInterface.getUnits();
_currentIsisInterface = units.get(unitFullName);
if (_currentIsisInterface == null) {
_currentIsisInterface = new Interface(unitFullName, definitionLine);
_currentIsisInterface.setRoutingInstance(_currentRoutingInstance.getName());
units.put(unitFullName, _currentIsisInterface);
}
}
_currentIsisInterface.getIsisSettings().setEnabled(true);
}
Aggregations