public VRouterDetailResp(VRouterDetailReq req) { vrouter = new VRouterInfo(); // populate here the info Map<String, ContrailVRouterApi> vRouters = VCenterMonitor.getVncDB().getVRouterApiMap(); if (!vRouters.containsKey(req.ipAddr)) { return; } vrouter.setIpAddr(req.ipAddr); ContrailVRouterApi api = vRouters.get(req.ipAddr); vrouter.setState(api != null); Map<String, String> host2VrouterMap = VCenterMonitor.getVcenterDB().esxiToVRouterIpMap; for (Map.Entry<String, String> map_entry : host2VrouterMap.entrySet()) { if (map_entry.getValue().equals(req.ipAddr)) { vrouter.setEsxiHost(map_entry.getKey()); } } populateVNetworks(vrouter.getVNetworks()); }
private void populateVNetworks(SandeshObjectList<VirtualNetworkInfo> vNetworks) { SortedMap<String, VmwareVirtualNetworkInfo> entries = VCenterMonitor.getVcenterDB().getPrevVmwareVNInfos(); if (entries == null) { return; } for (Map.Entry<String, VmwareVirtualNetworkInfo> entry : entries.entrySet()) { VmwareVirtualNetworkInfo vmwareVN = entry.getValue(); VirtualNetworkInfo vn = new VirtualNetworkInfo(); populateVMs(vn, vmwareVN); if (vn.getVMachines().size() > 0) { vn.setName(vmwareVN.getName()); vNetworks.add(vn); } } }