public static List<String> checkAddressesOnSameSubNetwork(LinkedHashMap<String,String> map1,LinkedHashMap<String,String> map2){
  List<String> errorMsg=new ArrayList<String>();
  if (!map1.isEmpty()) {
    Map<String,String> ipv4=new HashMap<String,String>();
    ipv4.putAll(map1);
    String mask=ipv4.get(InstallerConstants.DISPLAY_LABEL_IPV4_NETMASK);
    ipv4.remove(InstallerConstants.DISPLAY_LABEL_IPV4_NETMASK);
    if (!isOnSameNetworkIPv4(ipv4.values(),mask)) {
      errorMsg.add("IPv4 addresses are not in the same subnet");
      log.warn("IPv4 addresses are not in the same subnet");
    }
  }
  if (!map2.isEmpty()) {
    Map<String,String> ipv6=new HashMap<String,String>();
    ipv6.putAll(map2);
    String prefixLength=ipv6.get(InstallerConstants.DISPLAY_LABEL_IPV6_PREFIX);
    ipv6.remove(InstallerConstants.DISPLAY_LABEL_IPV6_PREFIX);
    if (!isOnSameNetworkIPv6(ipv6.values(),prefixLength)) {
      errorMsg.add("IPv6 addresses are not in the same subnet");
      log.warn("IPv6 addresses are not in the same subnet");
    }
  }
  return errorMsg;
}

public static List < String > checkAddressesOnSameSubNetwork ( LinkedHashMap < String , String > map1 , LinkedHashMap < String , String > map2 ) { List < String > errorMsg = new ArrayList < String > ( ) ; if ( ! map1 . isEmpty ( ) ) { Map < String , String > ipv4 = new HashMap < String , String > ( ) ; ipv4 . putAll ( map1 ) ; String mask = ipv4 . get ( InstallerConstants . DISPLAY_LABEL_IPV4_NETMASK ) ; ipv4 . remove ( InstallerConstants . DISPLAY_LABEL_IPV4_NETMASK ) ; if ( ! isOnSameNetworkIPv4 ( ipv4 . values ( ) , mask ) ) { errorMsg . add ( "IPv4 addresses are not in the same subnet" ) ; log . warn ( "IPv4 addresses are not in the same subnet" ) ; } } if ( ! map2 . isEmpty ( ) ) { Map < String , String > ipv6 = new HashMap < String , String > ( ) ; ipv6 . putAll ( map2 ) ; String prefixLength = ipv6 . get ( InstallerConstants . DISPLAY_LABEL_IPV6_PREFIX ) ; ipv6 . remove ( InstallerConstants . DISPLAY_LABEL_IPV6_PREFIX ) ; if ( ! isOnSameNetworkIPv6 ( ipv6 . values ( ) , prefixLength ) ) { errorMsg . add ( "IPv6 addresses are not in the same subnet" ) ; log . warn ( "IPv6 addresses are not in the same subnet" ) ; } } return errorMsg ; }
check if the network addresses are on the same sub network .
