Search in sources :

Example 6 with Interface

use of org.batfish.representation.cisco.Interface in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIf_ip_address.

@Override
public void exitIf_ip_address(If_ip_addressContext ctx) {
    InterfaceAddress address;
    if (ctx.prefix != null) {
        address = new InterfaceAddress(ctx.prefix.getText());
    } else {
        Ip ip = new Ip(ctx.ip.getText());
        Ip mask = new Ip(ctx.subnet.getText());
        address = new InterfaceAddress(ip, mask);
    }
    for (Interface currentInterface : _currentInterfaces) {
        currentInterface.setAddress(address);
    }
    if (ctx.STANDBY() != null) {
        Ip standbyIp = toIp(ctx.standby_address);
        InterfaceAddress standbyAddress = new InterfaceAddress(standbyIp, address.getNetworkBits());
        for (Interface currentInterface : _currentInterfaces) {
            currentInterface.setStandbyAddress(standbyAddress);
        }
    }
}
Also used : InterfaceAddress(org.batfish.datamodel.InterfaceAddress) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 7 with Interface

use of org.batfish.representation.cisco.Interface in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIf_ip_policy.

@Override
public void exitIf_ip_policy(If_ip_policyContext ctx) {
    String policyName = ctx.name.getText();
    int policyLine = ctx.name.getLine();
    for (Interface currentInterface : _currentInterfaces) {
        currentInterface.setRoutingPolicy(policyName);
        currentInterface.setRoutingPolicyLine(policyLine);
    }
}
Also used : VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 8 with Interface

use of org.batfish.representation.cisco.Interface in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIf_vrf_member.

@Override
public void exitIf_vrf_member(If_vrf_memberContext ctx) {
    String name = ctx.name.getText();
    for (Interface currentInterface : _currentInterfaces) {
        currentInterface.setVrf(name);
        initVrf(name);
    }
}
Also used : VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 9 with Interface

use of org.batfish.representation.cisco.Interface in project batfish by batfish.

the class CiscoControlPlaneExtractor method enterInterface_is_stanza.

@Override
public void enterInterface_is_stanza(Interface_is_stanzaContext ctx) {
    String ifaceName = ctx.iname.getText();
    String canonicalIfaceName = getCanonicalInterfaceName(ifaceName);
    Interface iface = _configuration.getInterfaces().get(canonicalIfaceName);
    if (iface == null) {
        iface = addInterface(canonicalIfaceName, ctx.iname, false);
    }
    iface.setIsisInterfaceMode(IsisInterfaceMode.ACTIVE);
    _currentIsisInterface = iface;
}
Also used : VrrpInterface(org.batfish.representation.cisco.VrrpInterface) Interface(org.batfish.representation.cisco.Interface)

Example 10 with Interface

use of org.batfish.representation.cisco.Interface in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIf_ip_address_secondary.

@Override
public void exitIf_ip_address_secondary(If_ip_address_secondaryContext ctx) {
    Ip ip;
    Ip mask;
    InterfaceAddress address;
    if (ctx.prefix != null) {
        address = new InterfaceAddress(ctx.prefix.getText());
    } else {
        ip = new Ip(ctx.ip.getText());
        mask = new Ip(ctx.subnet.getText());
        address = new InterfaceAddress(ip, mask.numSubnetBits());
    }
    for (Interface currentInterface : _currentInterfaces) {
        currentInterface.getSecondaryAddresses().add(address);
    }
}
Also used : InterfaceAddress(org.batfish.datamodel.InterfaceAddress) 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