Search in sources :

Example 1 with Ip6AccessListLine

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

the class CiscoConfiguration method toIp6AccessList.

private Ip6AccessList toIp6AccessList(ExtendedIpv6AccessList eaList) {
    String name = eaList.getName();
    List<Ip6AccessListLine> lines = new ArrayList<>();
    for (ExtendedIpv6AccessListLine fromLine : eaList.getLines()) {
        Ip6AccessListLine newLine = new Ip6AccessListLine();
        newLine.setName(fromLine.getName());
        newLine.setAction(fromLine.getAction());
        Ip6Wildcard srcIpWildcard = fromLine.getSourceIpWildcard();
        if (srcIpWildcard != null) {
            newLine.getSrcIps().add(srcIpWildcard);
        }
        Ip6Wildcard dstIpWildcard = fromLine.getDestinationIpWildcard();
        if (dstIpWildcard != null) {
            newLine.getDstIps().add(dstIpWildcard);
        }
        // TODO: src/dst address group
        IpProtocol protocol = fromLine.getProtocol();
        if (protocol != IpProtocol.IP) {
            newLine.getIpProtocols().add(protocol);
        }
        newLine.getDstPorts().addAll(fromLine.getDstPorts());
        newLine.getSrcPorts().addAll(fromLine.getSrcPorts());
        Integer icmpType = fromLine.getIcmpType();
        if (icmpType != null) {
            newLine.setIcmpTypes(new TreeSet<>(Collections.singleton(new SubRange(icmpType))));
        }
        Integer icmpCode = fromLine.getIcmpCode();
        if (icmpCode != null) {
            newLine.setIcmpCodes(new TreeSet<>(Collections.singleton(new SubRange(icmpCode))));
        }
        Set<State> states = fromLine.getStates();
        newLine.getStates().addAll(states);
        List<TcpFlags> tcpFlags = fromLine.getTcpFlags();
        newLine.getTcpFlags().addAll(tcpFlags);
        Set<Integer> dscps = fromLine.getDscps();
        newLine.getDscps().addAll(dscps);
        Set<Integer> ecns = fromLine.getEcns();
        newLine.getEcns().addAll(ecns);
        lines.add(newLine);
    }
    return new Ip6AccessList(name, lines);
}
Also used : ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) TcpFlags(org.batfish.datamodel.TcpFlags) State(org.batfish.datamodel.State) IpProtocol(org.batfish.datamodel.IpProtocol) SubRange(org.batfish.datamodel.SubRange) Ip6Wildcard(org.batfish.datamodel.Ip6Wildcard) Ip6AccessList(org.batfish.datamodel.Ip6AccessList) Ip6AccessListLine(org.batfish.datamodel.Ip6AccessListLine)

Aggregations

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 Ip6AccessList (org.batfish.datamodel.Ip6AccessList)1 Ip6AccessListLine (org.batfish.datamodel.Ip6AccessListLine)1 Ip6Wildcard (org.batfish.datamodel.Ip6Wildcard)1 IpProtocol (org.batfish.datamodel.IpProtocol)1 State (org.batfish.datamodel.State)1 SubRange (org.batfish.datamodel.SubRange)1 TcpFlags (org.batfish.datamodel.TcpFlags)1