Search in sources :

Example 1 with Standard_access_list_additional_featureContext

use of org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext 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 Standard_access_list_additional_featureContext

use of org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext 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)

Aggregations

TreeSet (java.util.TreeSet)2 LineAction (org.batfish.datamodel.LineAction)2 Standard_access_list_additional_featureContext (org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext)2 Ip (org.batfish.datamodel.Ip)1 Ip6 (org.batfish.datamodel.Ip6)1 Ip6Wildcard (org.batfish.datamodel.Ip6Wildcard)1 IpWildcard (org.batfish.datamodel.IpWildcard)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1 StandardAccessListLine (org.batfish.representation.cisco.StandardAccessListLine)1 StandardIpv6AccessListLine (org.batfish.representation.cisco.StandardIpv6AccessListLine)1