/** * Returns an instance of NetworkLite for every network that is routed to the request network. * * @param networkLite the networklite for which the routed networks are requested * @param dbClient an instance of dbClient * @return an instance of NetworkLite for every network that is routed to the request network */ public static Set<NetworkLite> getNetworkLiteRoutedNetworks( NetworkLite networkLite, DbClient dbClient) { if (networkLite != null && networkLite.getRoutedNetworks() != null && !networkLite.getRoutedNetworks().isEmpty()) { return getNetworkLites(networkLite.getRoutedNetworks(), dbClient); } return new HashSet<NetworkLite>(); }
/** * Returns the ports in the given network in a port-wwn-to-port map. * * @param networkLite the network * @param ports the ports * @return a map of port-wwn-to-port */ public static Map<String, StoragePort> getPortsInNetworkMap( NetworkLite networkLite, Collection<StoragePort> ports) { Map<String, StoragePort> map = new HashMap<String, StoragePort>(); if (networkLite != null) { for (StoragePort port : ports) { if (port.getNetwork() != null && port.getNetwork().equals(networkLite.getId())) { map.put(port.getPortNetworkId(), port); } } if (map.isEmpty() && networkLite.getRoutedNetworks() != null) { for (StoragePort port : ports) { if (port.getNetwork() != null && networkLite.getRoutedNetworks().contains(port.getNetwork().toString())) { map.put(port.getPortNetworkId(), port); } } } } return map; }