Tabnine Logo
IkePhase1Key.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.batfish.datamodel.IkePhase1Key
constructor

Best Java code snippets using org.batfish.datamodel.IkePhase1Key.<init> (Showing top 7 results out of 315)

origin: batfish/batfish

@Nonnull
private static IkePhase1Key toIkePhase1PreSharedKey(
  IpsecTunnel ipsecTunnel, Ip remoteIdentity, String localInterface) {
 IkePhase1Key ikePhase1Key = new IkePhase1Key();
 ikePhase1Key.setKeyType(IkeKeyType.PRE_SHARED_KEY);
 ikePhase1Key.setKeyHash(ipsecTunnel.getIkePreSharedKeyHash());
 ikePhase1Key.setRemoteIdentity(remoteIdentity.toIpSpace());
 ikePhase1Key.setLocalInterface(localInterface);
 return ikePhase1Key;
}
origin: batfish/batfish

/**
 * Converts {@link IkePolicy} to {@link IkePhase1Policy} and puts the used pre-shared key as a
 * {@link IkePhase1Key} in the passed-in {@code ikePhase1Keys}
 */
private static IkePhase1Policy toIkePhase1Policy(
  IkePolicy ikePolicy, ImmutableSortedMap.Builder<String, IkePhase1Key> ikePhase1Keys) {
 String name = ikePolicy.getName();
 IkePhase1Policy ikePhase1Policy = new IkePhase1Policy(name);
 // pre-shared-key
 IkePhase1Key ikePhase1Key = new IkePhase1Key();
 ikePhase1Key.setKeyType(IkeKeyType.PRE_SHARED_KEY);
 ikePhase1Key.setKeyHash(ikePolicy.getPreSharedKeyHash());
 ikePhase1Keys.put(String.format("~IKE_PHASE1_KEY_%s~", ikePolicy.getName()), ikePhase1Key);
 ikePhase1Policy.setIkePhase1Key(ikePhase1Key);
 ImmutableList.Builder<String> ikePhase1ProposalBuilder = ImmutableList.builder();
 // ike proposals
 ikePolicy.getProposals().forEach(ikePhase1ProposalBuilder::add);
 ikePhase1Policy.setIkePhase1Proposals(ikePhase1ProposalBuilder.build());
 return ikePhase1Policy;
}
origin: batfish/batfish

static IkePhase1Key toIkePhase1Key(Keyring keyring) {
 IkePhase1Key ikePhase1Key = new IkePhase1Key();
 ikePhase1Key.setKeyHash(keyring.getKey());
 ikePhase1Key.setKeyType(IkeKeyType.PRE_SHARED_KEY);
 ikePhase1Key.setLocalInterface(keyring.getLocalInterfaceName());
 if (keyring.getRemoteIdentity() != null) {
  ikePhase1Key.setRemoteIdentity(keyring.getRemoteIdentity().toIpSpace());
 }
 return ikePhase1Key;
}
origin: batfish/batfish

@Test
public void testGenerateRowsIpsec2Fail() {
 // IPSecSession does not have IPSec phase 2 proposal set
 _ipsecSessionBuilder.setNegotiatedIkeP1Proposal(new IkePhase1Proposal("test_ike_proposal"));
 _ipsecSessionBuilder.setNegotiatedIkeP1Key(new IkePhase1Key());
 _graph.putEdgeValue(
   new IpsecPeerConfigId(INITIATOR_IPSEC_PEER_CONFIG, INITIATOR_HOST_NAME),
   new IpsecPeerConfigId(RESPONDER_IPSEC_PEER_CONFIG, RESPONDER_HOST_NAME),
   _ipsecSessionBuilder.build());
 Multiset<IpsecSessionInfo> ipsecSessionInfos =
   rawAnswer(
     _networkConfigurations,
     _graph,
     ImmutableSet.of(INITIATOR_HOST_NAME),
     ImmutableSet.of(RESPONDER_HOST_NAME));
 // answer should have exactly one row
 assertThat(ipsecSessionInfos, hasSize(1));
 assertThat(
   ipsecSessionInfos.iterator().next(), hasIpsecSessionStatus(equalTo(IPSEC_PHASE2_FAILED)));
}
origin: batfish/batfish

@Test
public void testGenerateRowsIpsecEstablished() {
 // IPSecSession has all phases negotiated and IKE phase 1 key consistent
 _ipsecSessionBuilder.setNegotiatedIkeP1Proposal(new IkePhase1Proposal("test_ike_proposal"));
 _ipsecSessionBuilder.setNegotiatedIkeP1Key(new IkePhase1Key());
 _ipsecSessionBuilder.setNegotiatedIpsecP2Proposal(new IpsecPhase2Proposal());
 _graph.putEdgeValue(
   new IpsecPeerConfigId(INITIATOR_IPSEC_PEER_CONFIG, INITIATOR_HOST_NAME),
   new IpsecPeerConfigId(RESPONDER_IPSEC_PEER_CONFIG, RESPONDER_HOST_NAME),
   _ipsecSessionBuilder.build());
 Multiset<IpsecSessionInfo> ipsecSessionInfos =
   rawAnswer(
     _networkConfigurations,
     _graph,
     ImmutableSet.of(INITIATOR_HOST_NAME),
     ImmutableSet.of(RESPONDER_HOST_NAME));
 // answer should have exactly one row
 assertThat(ipsecSessionInfos, hasSize(1));
 assertThat(
   ipsecSessionInfos.iterator().next(),
   hasIpsecSessionStatus(equalTo(IPSEC_SESSION_ESTABLISHED)));
}
origin: batfish/batfish

IkePhase1Key ikePhase1Key = new IkePhase1Key();
ikePhase1Key.setKeyType(IkeKeyType.PRE_SHARED_KEY);
ikePhase1Key.setKeyHash(ipsecPeer.getAuthenticationPreSharedSecretHash());
origin: batfish/batfish

  ImmutableSortedMap.of(
    communityListName, new CommunityList(communityListName, ImmutableList.of(), true)));
config.setIkePhase1Keys(ImmutableSortedMap.of(ikePhase1KeyName, new IkePhase1Key()));
config.setIkePhase1Policies(
  ImmutableSortedMap.of(ikePhase1PolicyName, new IkePhase1Policy(ikePhase1PolicyName)));
org.batfish.datamodelIkePhase1Key<init>

Popular methods of IkePhase1Key

  • getKeyHash
  • getKeyType
  • getLocalInterface
  • match
    Returns true if this IkePhase1Key can be used with the given localInterface and matchIdentity
  • setKeyHash
  • setKeyType
  • setLocalInterface
  • setRemoteIdentity

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now