Search in sources :

Example 1 with OspfWildcardNetwork

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

the class CiscoControlPlaneExtractor method exitRo_network.

@Override
public void exitRo_network(Ro_networkContext ctx) {
    Ip address;
    Ip wildcard;
    if (ctx.prefix != null) {
        Prefix prefix = Prefix.parse(ctx.prefix.getText());
        address = prefix.getStartIp();
        wildcard = prefix.getPrefixWildcard();
    } else {
        address = toIp(ctx.ip);
        wildcard = toIp(ctx.wildcard);
    }
    if (_configuration.getVendor() == ConfigurationFormat.CISCO_ASA) {
        wildcard = wildcard.inverted();
    }
    long area;
    if (ctx.area_int != null) {
        area = toLong(ctx.area_int);
    } else if (ctx.area_ip != null) {
        area = toIp(ctx.area_ip).asLong();
    } else {
        throw new BatfishException("bad area");
    }
    OspfWildcardNetwork network = new OspfWildcardNetwork(address, wildcard, area);
    _currentOspfProcess.getWildcardNetworks().add(network);
}
Also used : BatfishException(org.batfish.common.BatfishException) RedFlagBatfishException(org.batfish.common.RedFlagBatfishException) OspfWildcardNetwork(org.batfish.representation.cisco.OspfWildcardNetwork) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) Prefix(org.batfish.datamodel.Prefix)

Aggregations

BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 Ip (org.batfish.datamodel.Ip)1 Prefix (org.batfish.datamodel.Prefix)1 OspfWildcardNetwork (org.batfish.representation.cisco.OspfWildcardNetwork)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1