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);
}
Aggregations