Search in sources :

Example 1 with BgpNetwork

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

the class CiscoControlPlaneExtractor method exitNetwork_bgp_tail.

@Override
public void exitNetwork_bgp_tail(Network_bgp_tailContext ctx) {
    Prefix prefix;
    if (ctx.prefix != null) {
        prefix = Prefix.parse(ctx.prefix.getText());
    } else {
        Ip address = toIp(ctx.ip);
        Ip mask = (ctx.mask != null) ? toIp(ctx.mask) : address.getClassMask();
        int prefixLength = mask.numSubnetBits();
        prefix = new Prefix(address, prefixLength);
    }
    String map = null;
    Integer mapLine = null;
    if (ctx.mapname != null) {
        map = ctx.mapname.getText();
        mapLine = ctx.mapname.getStart().getLine();
    }
    BgpNetwork bgpNetwork = new BgpNetwork(prefix, map, mapLine);
    BgpProcess proc = currentVrf().getBgpProcess();
    proc.getIpNetworks().put(prefix, bgpNetwork);
}
Also used : BgpProcess(org.batfish.representation.cisco.BgpProcess) BgpNetwork(org.batfish.representation.cisco.BgpNetwork) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) Prefix(org.batfish.datamodel.Prefix)

Aggregations

Ip (org.batfish.datamodel.Ip)1 Prefix (org.batfish.datamodel.Prefix)1 BgpNetwork (org.batfish.representation.cisco.BgpNetwork)1 BgpProcess (org.batfish.representation.cisco.BgpProcess)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1