Search in sources :

Example 1 with Problem

use of org.batfish.question.ipsecvpnstatus.IpsecVpnInfo.Problem in project batfish by batfish.

the class IpsecVpnStatusAnswerer method analyzeIpsecVpn.

@VisibleForTesting
public static IpsecVpnInfo analyzeIpsecVpn(IpsecVpn ipsecVpn) {
    SortedSet<Problem> problems = new TreeSet<>();
    IpsecVpn remoteIpsecVpn = null;
    if (ipsecVpn.getRemoteIpsecVpn() == null) {
        problems.add(Problem.MISSING_REMOTE_ENDPOINT);
    } else {
        if (ipsecVpn.getCandidateRemoteIpsecVpns().size() != 1) {
            problems.add(Problem.MULTIPLE_REMOTE_ENDPOINTS);
        }
        remoteIpsecVpn = ipsecVpn.getRemoteIpsecVpn();
        if (!ipsecVpn.compatibleIkeProposals(remoteIpsecVpn)) {
            problems.add(Problem.INCOMPATIBLE_IKE_PROPOSALS);
        }
        if (!ipsecVpn.compatibleIpsecProposals(remoteIpsecVpn)) {
            problems.add(Problem.INCOMPATIBLE_IPSEC_PROPOSALS);
        }
        if (!ipsecVpn.compatiblePreSharedKey(remoteIpsecVpn)) {
            problems.add(Problem.INCOMPATIBLE_PRE_SHARED_KEY);
        }
    }
    if (problems.size() == 0) {
        problems.add(Problem.NONE);
    }
    return new IpsecVpnInfo(ipsecVpn, problems, remoteIpsecVpn);
}
Also used : IpsecVpn(org.batfish.datamodel.IpsecVpn) TreeSet(java.util.TreeSet) Problem(org.batfish.question.ipsecvpnstatus.IpsecVpnInfo.Problem) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 TreeSet (java.util.TreeSet)1 IpsecVpn (org.batfish.datamodel.IpsecVpn)1 Problem (org.batfish.question.ipsecvpnstatus.IpsecVpnInfo.Problem)1