Search in sources :

Example 1 with LineAction

use of org.batfish.datamodel.LineAction in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitStandard_ipv6_access_list_tail.

@Override
public void exitStandard_ipv6_access_list_tail(Standard_ipv6_access_list_tailContext ctx) {
    LineAction action = toLineAction(ctx.ala);
    Ip6 srcIp = getIp(ctx.ipr);
    Ip6 srcWildcard = getWildcard(ctx.ipr);
    Set<Integer> dscps = new TreeSet<>();
    Set<Integer> ecns = new TreeSet<>();
    for (Standard_access_list_additional_featureContext feature : ctx.features) {
        if (feature.DSCP() != null) {
            int dscpType = toDscpType(feature.dscp_type());
            dscps.add(dscpType);
        } else if (feature.ECN() != null) {
            int ecn = toInteger(feature.ecn);
            ecns.add(ecn);
        }
    }
    String name;
    if (ctx.num != null) {
        name = ctx.num.getText();
    } else {
        name = getFullText(ctx).trim();
    }
    StandardIpv6AccessListLine line = new StandardIpv6AccessListLine(name, action, new Ip6Wildcard(srcIp, srcWildcard), dscps, ecns);
    _currentStandardIpv6Acl.addLine(line);
}
Also used : LineAction(org.batfish.datamodel.LineAction) Standard_access_list_additional_featureContext(org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext) TreeSet(java.util.TreeSet) StandardIpv6AccessListLine(org.batfish.representation.cisco.StandardIpv6AccessListLine) Ip6(org.batfish.datamodel.Ip6) Ip6Wildcard(org.batfish.datamodel.Ip6Wildcard)

Example 2 with LineAction

use of org.batfish.datamodel.LineAction in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIp_community_list_standard_tail.

@Override
public void exitIp_community_list_standard_tail(Ip_community_list_standard_tailContext ctx) {
    LineAction action = toLineAction(ctx.ala);
    List<Long> communities = new ArrayList<>();
    for (CommunityContext communityCtx : ctx.communities) {
        long community = toLong(communityCtx);
        communities.add(community);
    }
    StandardCommunityListLine line = new StandardCommunityListLine(action, communities);
    _currentStandardCommunityList.getLines().add(line);
}
Also used : LineAction(org.batfish.datamodel.LineAction) StandardCommunityListLine(org.batfish.representation.cisco.StandardCommunityListLine) LiteralLong(org.batfish.datamodel.routing_policy.expr.LiteralLong) VarLong(org.batfish.datamodel.routing_policy.expr.VarLong) ArrayList(java.util.ArrayList) CommunityContext(org.batfish.grammar.cisco.CiscoParser.CommunityContext)

Example 3 with LineAction

use of org.batfish.datamodel.LineAction in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitStandard_access_list_tail.

@Override
public void exitStandard_access_list_tail(Standard_access_list_tailContext ctx) {
    LineAction action = toLineAction(ctx.ala);
    Ip srcIp = getIp(ctx.ipr);
    Ip srcWildcard = getWildcard(ctx.ipr);
    Set<Integer> dscps = new TreeSet<>();
    Set<Integer> ecns = new TreeSet<>();
    for (Standard_access_list_additional_featureContext feature : ctx.features) {
        if (feature.DSCP() != null) {
            int dscpType = toDscpType(feature.dscp_type());
            dscps.add(dscpType);
        } else if (feature.ECN() != null) {
            int ecn = toInteger(feature.ecn);
            ecns.add(ecn);
        }
    }
    String name;
    if (ctx.num != null) {
        name = ctx.num.getText();
    } else {
        name = getFullText(ctx).trim();
    }
    StandardAccessListLine line = new StandardAccessListLine(name, action, new IpWildcard(srcIp, srcWildcard), dscps, ecns);
    _currentStandardAcl.addLine(line);
}
Also used : LineAction(org.batfish.datamodel.LineAction) IpWildcard(org.batfish.datamodel.IpWildcard) Standard_access_list_additional_featureContext(org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext) StandardAccessListLine(org.batfish.representation.cisco.StandardAccessListLine) TreeSet(java.util.TreeSet) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp)

Example 4 with LineAction

use of org.batfish.datamodel.LineAction in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitIp_community_list_expanded_tail.

@Override
public void exitIp_community_list_expanded_tail(Ip_community_list_expanded_tailContext ctx) {
    LineAction action = toLineAction(ctx.ala);
    String regex = "";
    for (Token remainder : ctx.remainder) {
        regex += remainder.getText();
    }
    ExpandedCommunityListLine line = new ExpandedCommunityListLine(action, regex);
    _currentExpandedCommunityList.addLine(line);
}
Also used : LineAction(org.batfish.datamodel.LineAction) ExpandedCommunityListLine(org.batfish.representation.cisco.ExpandedCommunityListLine) Token(org.antlr.v4.runtime.Token)

Example 5 with LineAction

use of org.batfish.datamodel.LineAction in project batfish by batfish.

the class FlatVyosControlPlaneExtractor method exitRmrt_action.

@Override
public void exitRmrt_action(Rmrt_actionContext ctx) {
    LineAction action = toAction(ctx.action);
    _currentRouteMapRule.setAction(action);
}
Also used : LineAction(org.batfish.datamodel.LineAction)

Aggregations

LineAction (org.batfish.datamodel.LineAction)21 SubRange (org.batfish.datamodel.SubRange)9 Prefix (org.batfish.datamodel.Prefix)5 ArrayList (java.util.ArrayList)4 TreeSet (java.util.TreeSet)4 IpAccessList (org.batfish.datamodel.IpAccessList)4 IpWildcard (org.batfish.datamodel.IpWildcard)4 ImmutableList (com.google.common.collect.ImmutableList)3 Ip (org.batfish.datamodel.Ip)3 Ip6 (org.batfish.datamodel.Ip6)3 IpAccessListLine (org.batfish.datamodel.IpAccessListLine)3 IpProtocol (org.batfish.datamodel.IpProtocol)3 RouteFilterLine (org.batfish.datamodel.RouteFilterLine)3 List (java.util.List)2 Ip6Wildcard (org.batfish.datamodel.Ip6Wildcard)2 Prefix6 (org.batfish.datamodel.Prefix6)2 RouteFilterList (org.batfish.datamodel.RouteFilterList)2 State (org.batfish.datamodel.State)2 TcpFlags (org.batfish.datamodel.TcpFlags)2 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)2