Search in sources :

Example 1 with CiscoStructureUsage

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

the class CiscoControlPlaneExtractor method exitL_access_class.

@Override
public void exitL_access_class(L_access_classContext ctx) {
    boolean ipv6 = (ctx.IPV6() != null);
    String name = ctx.name.getText();
    int nameLine = ctx.name.getStart().getLine();
    BiConsumer<Line, String> setter;
    CiscoStructureType structureType;
    CiscoStructureUsage structureUsage;
    if (ctx.OUT() != null || ctx.EGRESS() != null) {
        if (ipv6) {
            setter = Line::setOutputIpv6AccessList;
            structureType = CiscoStructureType.IPV6_ACCESS_LIST;
            structureUsage = CiscoStructureUsage.LINE_ACCESS_CLASS_LIST6;
            _configuration.getLineIpv6AccessClassLists().add(name);
        } else {
            setter = Line::setOutputAccessList;
            structureType = CiscoStructureType.IP_ACCESS_LIST;
            structureUsage = CiscoStructureUsage.LINE_ACCESS_CLASS_LIST;
            _configuration.getLineAccessClassLists().add(name);
        }
    } else {
        if (ipv6) {
            setter = Line::setInputIpv6AccessList;
            structureType = CiscoStructureType.IPV6_ACCESS_LIST;
            structureUsage = CiscoStructureUsage.LINE_ACCESS_CLASS_LIST6;
            _configuration.getLineIpv6AccessClassLists().add(name);
        } else {
            setter = Line::setInputAccessList;
            structureType = CiscoStructureType.IP_ACCESS_LIST;
            structureUsage = CiscoStructureUsage.LINE_ACCESS_CLASS_LIST;
            _configuration.getLineAccessClassLists().add(name);
        }
    }
    _configuration.referenceStructure(structureType, name, structureUsage, nameLine);
    for (String currentName : _currentLineNames) {
        Line line = _configuration.getCf().getLines().get(currentName);
        setter.accept(line, name);
    }
}
Also used : RouteMapSetAsPathPrependLine(org.batfish.representation.cisco.RouteMapSetAsPathPrependLine) RouteMapMatchAsPathAccessListLine(org.batfish.representation.cisco.RouteMapMatchAsPathAccessListLine) RouteMapSetCommunityNoneLine(org.batfish.representation.cisco.RouteMapSetCommunityNoneLine) RouteMapSetCommunityLine(org.batfish.representation.cisco.RouteMapSetCommunityLine) RouteMapSetDeleteCommunityLine(org.batfish.representation.cisco.RouteMapSetDeleteCommunityLine) RouteMapSetLocalPreferenceLine(org.batfish.representation.cisco.RouteMapSetLocalPreferenceLine) PrefixListLine(org.batfish.representation.cisco.PrefixListLine) ExtendedIpv6AccessListLine(org.batfish.representation.cisco.ExtendedIpv6AccessListLine) RouteMapMatchCommunityListLine(org.batfish.representation.cisco.RouteMapMatchCommunityListLine) ExpandedCommunityListLine(org.batfish.representation.cisco.ExpandedCommunityListLine) RouteMapMatchIpv6AccessListLine(org.batfish.representation.cisco.RouteMapMatchIpv6AccessListLine) RouteMapMatchIpAccessListLine(org.batfish.representation.cisco.RouteMapMatchIpAccessListLine) Prefix6ListLine(org.batfish.representation.cisco.Prefix6ListLine) RouteMapMatchIpPrefixListLine(org.batfish.representation.cisco.RouteMapMatchIpPrefixListLine) RouteMapMatchIpv6PrefixListLine(org.batfish.representation.cisco.RouteMapMatchIpv6PrefixListLine) StandardAccessListLine(org.batfish.representation.cisco.StandardAccessListLine) RouteMapSetAdditiveCommunityLine(org.batfish.representation.cisco.RouteMapSetAdditiveCommunityLine) RouteMapSetAdditiveCommunityListLine(org.batfish.representation.cisco.RouteMapSetAdditiveCommunityListLine) RouteMapMatchTagLine(org.batfish.representation.cisco.RouteMapMatchTagLine) RouteMapSetCommunityListLine(org.batfish.representation.cisco.RouteMapSetCommunityListLine) Line(org.batfish.datamodel.vendor_family.cisco.Line) StandardCommunityListLine(org.batfish.representation.cisco.StandardCommunityListLine) RouteMapSetOriginTypeLine(org.batfish.representation.cisco.RouteMapSetOriginTypeLine) ExtendedAccessListLine(org.batfish.representation.cisco.ExtendedAccessListLine) RouteMapSetMetricLine(org.batfish.representation.cisco.RouteMapSetMetricLine) RouteMapSetNextHopLine(org.batfish.representation.cisco.RouteMapSetNextHopLine) StandardIpv6AccessListLine(org.batfish.representation.cisco.StandardIpv6AccessListLine) IpAsPathAccessListLine(org.batfish.representation.cisco.IpAsPathAccessListLine) RouteMapSetLine(org.batfish.representation.cisco.RouteMapSetLine) CiscoStructureUsage(org.batfish.representation.cisco.CiscoStructureUsage) CiscoStructureType(org.batfish.representation.cisco.CiscoStructureType)

Aggregations

Line (org.batfish.datamodel.vendor_family.cisco.Line)1 CiscoStructureType (org.batfish.representation.cisco.CiscoStructureType)1 CiscoStructureUsage (org.batfish.representation.cisco.CiscoStructureUsage)1 ExpandedCommunityListLine (org.batfish.representation.cisco.ExpandedCommunityListLine)1 ExtendedAccessListLine (org.batfish.representation.cisco.ExtendedAccessListLine)1 ExtendedIpv6AccessListLine (org.batfish.representation.cisco.ExtendedIpv6AccessListLine)1 IpAsPathAccessListLine (org.batfish.representation.cisco.IpAsPathAccessListLine)1 Prefix6ListLine (org.batfish.representation.cisco.Prefix6ListLine)1 PrefixListLine (org.batfish.representation.cisco.PrefixListLine)1 RouteMapMatchAsPathAccessListLine (org.batfish.representation.cisco.RouteMapMatchAsPathAccessListLine)1 RouteMapMatchCommunityListLine (org.batfish.representation.cisco.RouteMapMatchCommunityListLine)1 RouteMapMatchIpAccessListLine (org.batfish.representation.cisco.RouteMapMatchIpAccessListLine)1 RouteMapMatchIpPrefixListLine (org.batfish.representation.cisco.RouteMapMatchIpPrefixListLine)1 RouteMapMatchIpv6AccessListLine (org.batfish.representation.cisco.RouteMapMatchIpv6AccessListLine)1 RouteMapMatchIpv6PrefixListLine (org.batfish.representation.cisco.RouteMapMatchIpv6PrefixListLine)1 RouteMapMatchTagLine (org.batfish.representation.cisco.RouteMapMatchTagLine)1 RouteMapSetAdditiveCommunityLine (org.batfish.representation.cisco.RouteMapSetAdditiveCommunityLine)1 RouteMapSetAdditiveCommunityListLine (org.batfish.representation.cisco.RouteMapSetAdditiveCommunityListLine)1 RouteMapSetAsPathPrependLine (org.batfish.representation.cisco.RouteMapSetAsPathPrependLine)1 RouteMapSetCommunityLine (org.batfish.representation.cisco.RouteMapSetCommunityLine)1