Search in sources :

Example 21 with Interface

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");
    }
}
Also used : BatfishException(org.batfish.common.BatfishException) RedFlagBatfishException(org.batfish.common.RedFlagBatfishException) VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 22 with Interface

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();
}
Also used : InterfaceAddress(org.batfish.datamodel.InterfaceAddress) OspfNetwork(org.batfish.representation.cisco.OspfNetwork) Prefix(org.batfish.datamodel.Prefix) VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 23 with Interface

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

Example 24 with Interface

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

Example 25 with Interface

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);
    }
}
Also used : Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Aggregations

Interface (org.batfish.representation.cisco.Interface)25 VrrpInterface (org.batfish.representation.cisco.VrrpInterface)25 Ip (org.batfish.datamodel.Ip)6 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)6 VrrpGroup (org.batfish.representation.cisco.VrrpGroup)4 InterfaceAddress (org.batfish.datamodel.InterfaceAddress)3 Token (org.antlr.v4.runtime.Token)1 BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 Prefix (org.batfish.datamodel.Prefix)1 CiscoSourceNat (org.batfish.representation.cisco.CiscoSourceNat)1 OspfNetwork (org.batfish.representation.cisco.OspfNetwork)1