@Test public void testGetIpsecSesssionCloud() { NetworkFactory nf = new NetworkFactory(); Configuration.Builder cb = nf.configurationBuilder(); IpsecStaticPeerConfig.Builder ipsecPeerConfigBuilder = IpsecStaticPeerConfig.builder(); assertTrue( getIpsecSession( cb.setConfigurationFormat(AWS).build(), cb.setConfigurationFormat(AWS).build(), ipsecPeerConfigBuilder.build(), ipsecPeerConfigBuilder.build()) .isCloud()); assertTrue( getIpsecSession( cb.setConfigurationFormat(CISCO_IOS).build(), cb.setConfigurationFormat(AWS).build(), ipsecPeerConfigBuilder.build(), ipsecPeerConfigBuilder.build()) .isCloud()); assertFalse( getIpsecSession( cb.setConfigurationFormat(CISCO_IOS).build(), cb.setConfigurationFormat(CISCO_IOS).build(), ipsecPeerConfigBuilder.build(), ipsecPeerConfigBuilder.build()) .isCloud()); }
@VisibleForTesting @Nonnull static IpsecSession getIpsecSession( Configuration initiatorOwner, Configuration peerOwner, IpsecStaticPeerConfig initiator, IpsecPeerConfig candidatePeer) { IpsecSession.Builder ipsecSessionBuilder = IpsecSession.builder(); ipsecSessionBuilder.setCloud( IpsecSession.isCloudConfig(initiatorOwner) || IpsecSession.isCloudConfig(peerOwner)); negotiateIkeP1(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); if (ipsecSessionBuilder.getNegotiatedIkeP1Proposal() == null || ipsecSessionBuilder.getNegotiatedIkeP1Key() == null) { return ipsecSessionBuilder.build(); } negotiateIpsecP2(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); return ipsecSessionBuilder.build(); }
IpsecUtil { @VisibleForTesting @Nonnull static IpsecSession getIpsecSession( Configuration initiatorOwner, Configuration peerOwner, IpsecStaticPeerConfig initiator, IpsecPeerConfig candidatePeer) { IpsecSession.Builder ipsecSessionBuilder = IpsecSession.builder(); ipsecSessionBuilder.setCloud( IpsecSession.isCloudConfig(initiatorOwner) || IpsecSession.isCloudConfig(peerOwner)); negotiateIkeP1(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); if (ipsecSessionBuilder.getNegotiatedIkeP1Proposal() == null || ipsecSessionBuilder.getNegotiatedIkeP1Key() == null) { return ipsecSessionBuilder.build(); } negotiateIpsecP2(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); return ipsecSessionBuilder.build(); } }
IpsecUtil { @VisibleForTesting @Nonnull static IpsecSession getIpsecSession( Configuration initiatorOwner, Configuration peerOwner, IpsecStaticPeerConfig initiator, IpsecPeerConfig candidatePeer) { IpsecSession.Builder ipsecSessionBuilder = IpsecSession.builder(); ipsecSessionBuilder.setCloud( IpsecSession.isCloudConfig(initiatorOwner) || IpsecSession.isCloudConfig(peerOwner)); negotiateIkeP1(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); if (ipsecSessionBuilder.getNegotiatedIkeP1Proposal() == null || ipsecSessionBuilder.getNegotiatedIkeP1Key() == null) { return ipsecSessionBuilder.build(); } negotiateIpsecP2(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); return ipsecSessionBuilder.build(); }  }
IpsecUtil { @VisibleForTesting @Nonnull static IpsecSession getIpsecSession( Configuration initiatorOwner, Configuration peerOwner, IpsecStaticPeerConfig initiator, IpsecPeerConfig candidatePeer) { IpsecSession.Builder ipsecSessionBuilder = IpsecSession.builder(); ipsecSessionBuilder.setCloud( IpsecSession.isCloudConfig(initiatorOwner) || IpsecSession.isCloudConfig(peerOwner)); negotiateIkeP1(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); if (ipsecSessionBuilder.getNegotiatedIkeP1Proposal() == null || ipsecSessionBuilder.getNegotiatedIkeP1Key() == null) { return ipsecSessionBuilder.build(); } negotiateIpsecP2(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); return ipsecSessionBuilder.build(); }  static IpsecTopology initIpsecTopology(Map<String, Configuration> configurations); static IpsecTopology retainCompatibleTunnelEdges(
      IpsecTopology ipsecTopology, Map<String, Configuration> configurations); static Set<Edge> toEdgeSet(
      @Nonnull IpsecTopology ipsecTopology, @Nonnull Map<String, Configuration> configurations); static @Nonnull IpsecTopology retainReachableIpsecEdges(
      IpsecTopology ipsecTopology,
      Map<String, Configuration> configurations,
      TracerouteEngine tracerouteEngine); }
IpsecUtil { @VisibleForTesting @Nonnull static IpsecSession getIpsecSession( Configuration initiatorOwner, Configuration peerOwner, IpsecStaticPeerConfig initiator, IpsecPeerConfig candidatePeer) { IpsecSession.Builder ipsecSessionBuilder = IpsecSession.builder(); ipsecSessionBuilder.setCloud( IpsecSession.isCloudConfig(initiatorOwner) || IpsecSession.isCloudConfig(peerOwner)); negotiateIkeP1(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); if (ipsecSessionBuilder.getNegotiatedIkeP1Proposal() == null || ipsecSessionBuilder.getNegotiatedIkeP1Key() == null) { return ipsecSessionBuilder.build(); } negotiateIpsecP2(initiatorOwner, peerOwner, initiator, candidatePeer, ipsecSessionBuilder); return ipsecSessionBuilder.build(); }  static IpsecTopology initIpsecTopology(Map<String, Configuration> configurations); static IpsecTopology retainCompatibleTunnelEdges(
      IpsecTopology ipsecTopology, Map<String, Configuration> configurations); static Set<Edge> toEdgeSet(
      @Nonnull IpsecTopology ipsecTopology, @Nonnull Map<String, Configuration> configurations); static @Nonnull IpsecTopology retainReachableIpsecEdges(
      IpsecTopology ipsecTopology,
      Map<String, Configuration> configurations,
      TracerouteEngine tracerouteEngine);  }