@Test public void testGetMatchingPskInvalidLocalIfaceKr() { IsakmpProfile isakmpProfile = new IsakmpProfile("Invalid_Iface_Local_Address"); isakmpProfile.setLocalInterfaceName("local_interface"); isakmpProfile.setKeyring("IKE_Phase1_Key"); IkePhase1Key ikePhase1Key = new IkePhase1Key(); ikePhase1Key.setKeyHash("test_key"); ikePhase1Key.setKeyType(IkeKeyType.PRE_SHARED_KEY_UNENCRYPTED); ikePhase1Key.setLocalInterface(INVALID_LOCAL_INTERFACE); IkePhase1Key matchingKey = getMatchingPsk(isakmpProfile, _warnings, ImmutableMap.of(IKE_PHASE1_KEY, ikePhase1Key)); assertThat(matchingKey, is(nullValue())); assertThat( Iterables.getOnlyElement(_warnings.getRedFlagWarnings()).getText(), equalTo("Invalid local address interface configured for keyring IKE_Phase1_Key")); }
static IkePhase1Key getMatchingPsk( IsakmpProfile isakmpProfile, Warnings w, Map<String, IkePhase1Key> ikePhase1Keys) { IkePhase1Key ikePhase1Key = null; String isakmpProfileName = isakmpProfile.getName(); if (isakmpProfile.getLocalInterfaceName().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for ISAKMP profile %s", isakmpProfileName)); } else if (isakmpProfile.getKeyring() == null) { w.redFlag(String.format("Keyring not set for ISAKMP profile %s", isakmpProfileName)); } else if (!ikePhase1Keys.containsKey(isakmpProfile.getKeyring())) { w.redFlag( String.format( "Cannot find keyring %s for ISAKMP profile %s", isakmpProfile.getKeyring(), isakmpProfileName)); } else { IkePhase1Key tempIkePhase1Key = ikePhase1Keys.get(isakmpProfile.getKeyring()); if (tempIkePhase1Key.getLocalInterface().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for keyring %s", isakmpProfile.getKeyring())); } else if (tempIkePhase1Key.match( isakmpProfile.getLocalInterfaceName(), isakmpProfile.getMatchIdentity())) { ikePhase1Key = tempIkePhase1Key; } } return ikePhase1Key; }
CiscoConversions { static IkePhase1Key getMatchingPsk( IsakmpProfile isakmpProfile, Warnings w, Map<String, IkePhase1Key> ikePhase1Keys) { IkePhase1Key ikePhase1Key = null; String isakmpProfileName = isakmpProfile.getName(); if (isakmpProfile.getLocalInterfaceName().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for ISAKMP profile %s", isakmpProfileName)); } else if (isakmpProfile.getKeyring() == null) { w.redFlag(String.format("Keyring not set for ISAKMP profile %s", isakmpProfileName)); } else if (!ikePhase1Keys.containsKey(isakmpProfile.getKeyring())) { w.redFlag( String.format( "Cannot find keyring %s for ISAKMP profile %s", isakmpProfile.getKeyring(), isakmpProfileName)); } else { IkePhase1Key tempIkePhase1Key = ikePhase1Keys.get(isakmpProfile.getKeyring()); if (tempIkePhase1Key.getLocalInterface().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for keyring %s", isakmpProfile.getKeyring())); } else if (tempIkePhase1Key.match( isakmpProfile.getLocalInterfaceName(), isakmpProfile.getMatchIdentity())) { ikePhase1Key = tempIkePhase1Key; } } return ikePhase1Key; } }
CiscoConversions { static IkePhase1Key getMatchingPsk( IsakmpProfile isakmpProfile, Warnings w, Map<String, IkePhase1Key> ikePhase1Keys) { IkePhase1Key ikePhase1Key = null; String isakmpProfileName = isakmpProfile.getName(); if (isakmpProfile.getLocalInterfaceName().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for ISAKMP profile %s", isakmpProfileName)); } else if (isakmpProfile.getKeyring() == null) { w.redFlag(String.format("Keyring not set for ISAKMP profile %s", isakmpProfileName)); } else if (!ikePhase1Keys.containsKey(isakmpProfile.getKeyring())) { w.redFlag( String.format( "Cannot find keyring %s for ISAKMP profile %s", isakmpProfile.getKeyring(), isakmpProfileName)); } else { IkePhase1Key tempIkePhase1Key = ikePhase1Keys.get(isakmpProfile.getKeyring()); if (tempIkePhase1Key.getLocalInterface().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for keyring %s", isakmpProfile.getKeyring())); } else if (tempIkePhase1Key.match( isakmpProfile.getLocalInterfaceName(), isakmpProfile.getMatchIdentity())) { ikePhase1Key = tempIkePhase1Key; } } return ikePhase1Key; } private  CiscoConversions(); }
CiscoConversions { static IkePhase1Key getMatchingPsk( IsakmpProfile isakmpProfile, Warnings w, Map<String, IkePhase1Key> ikePhase1Keys) { IkePhase1Key ikePhase1Key = null; String isakmpProfileName = isakmpProfile.getName(); if (isakmpProfile.getLocalInterfaceName().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for ISAKMP profile %s", isakmpProfileName)); } else if (isakmpProfile.getKeyring() == null) { w.redFlag(String.format("Keyring not set for ISAKMP profile %s", isakmpProfileName)); } else if (!ikePhase1Keys.containsKey(isakmpProfile.getKeyring())) { w.redFlag( String.format( "Cannot find keyring %s for ISAKMP profile %s", isakmpProfile.getKeyring(), isakmpProfileName)); } else { IkePhase1Key tempIkePhase1Key = ikePhase1Keys.get(isakmpProfile.getKeyring()); if (tempIkePhase1Key.getLocalInterface().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for keyring %s", isakmpProfile.getKeyring())); } else if (tempIkePhase1Key.match( isakmpProfile.getLocalInterfaceName(), isakmpProfile.getMatchIdentity())) { ikePhase1Key = tempIkePhase1Key; } } return ikePhase1Key; } private  CiscoConversions(); static CommunityList toCommunityList(StandardCommunityList scList); }
CiscoConversions { static IkePhase1Key getMatchingPsk( IsakmpProfile isakmpProfile, Warnings w, Map<String, IkePhase1Key> ikePhase1Keys) { IkePhase1Key ikePhase1Key = null; String isakmpProfileName = isakmpProfile.getName(); if (isakmpProfile.getLocalInterfaceName().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for ISAKMP profile %s", isakmpProfileName)); } else if (isakmpProfile.getKeyring() == null) { w.redFlag(String.format("Keyring not set for ISAKMP profile %s", isakmpProfileName)); } else if (!ikePhase1Keys.containsKey(isakmpProfile.getKeyring())) { w.redFlag( String.format( "Cannot find keyring %s for ISAKMP profile %s", isakmpProfile.getKeyring(), isakmpProfileName)); } else { IkePhase1Key tempIkePhase1Key = ikePhase1Keys.get(isakmpProfile.getKeyring()); if (tempIkePhase1Key.getLocalInterface().equals(INVALID_LOCAL_INTERFACE)) { w.redFlag( String.format( "Invalid local address interface configured for keyring %s", isakmpProfile.getKeyring())); } else if (tempIkePhase1Key.match( isakmpProfile.getLocalInterfaceName(), isakmpProfile.getMatchIdentity())) { ikePhase1Key = tempIkePhase1Key; } } return ikePhase1Key; } private  CiscoConversions(); static CommunityList toCommunityList(StandardCommunityList scList);  }