Search in sources :

Example 1 with Interface

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);
}
Also used : PsFromInterface(org.batfish.representation.juniper.PsFromInterface) Interface(org.batfish.representation.juniper.Interface)

Example 2 with Interface

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);
    }
}
Also used : BatfishException(org.batfish.common.BatfishException) PsThenNextHopIp(org.batfish.representation.juniper.PsThenNextHopIp) FwThenNextIp(org.batfish.representation.juniper.FwThenNextIp) Ip(org.batfish.datamodel.Ip) PsFromInterface(org.batfish.representation.juniper.PsFromInterface) Interface(org.batfish.representation.juniper.Interface)

Example 3 with Interface

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);
    }
}
Also used : PsFromInterface(org.batfish.representation.juniper.PsFromInterface) Interface(org.batfish.representation.juniper.Interface)

Example 4 with Interface

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());
}
Also used : PsFromInterface(org.batfish.representation.juniper.PsFromInterface) Interface(org.batfish.representation.juniper.Interface)

Example 5 with Interface

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);
}
Also used : PsFromInterface(org.batfish.representation.juniper.PsFromInterface) Interface(org.batfish.representation.juniper.Interface)

Aggregations

Interface (org.batfish.representation.juniper.Interface)10 PsFromInterface (org.batfish.representation.juniper.PsFromInterface)10 NodeDevice (org.batfish.representation.juniper.NodeDevice)2 BatfishException (org.batfish.common.BatfishException)1 Ip (org.batfish.datamodel.Ip)1 Interface_idContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.Interface_idContext)1 FwThenNextIp (org.batfish.representation.juniper.FwThenNextIp)1 PsFrom (org.batfish.representation.juniper.PsFrom)1 PsThenNextHopIp (org.batfish.representation.juniper.PsThenNextHopIp)1