@Override public String getValue(VmNetworkInterface object) { return object.getMacAddress(); } };
@Override protected String getDefaultMacAddress() { return getNic().getMacAddress(); }
protected void writeMacAddress(VmNetworkInterface iface) { _writer.writeElement(RASD_URI, "MACAddress", iface.getMacAddress()); }
private VmGuestAgentInterface findGuestAgentDataForInterface(VmNetworkInterface networkInterface) { return allGuestAgentData.stream() .filter(guestAgentIface -> Objects.nonNull(guestAgentIface.getMacAddress())) .filter(guestAgentIface -> Objects.equals(guestAgentIface.getMacAddress(), networkInterface.getMacAddress())) .findAny() .orElse(new VmGuestAgentInterface()); } }
@Override protected void onSaveMAC(VmNetworkInterface nicToSave) { nicToSave.setMacAddress(getNic().getMacAddress()); }
private void initSelectionGuestAgentData(VmNetworkInterface selectedItem) { if (selectedItem == null || getGuestAgentData() == null){ setSelectionGuestAgentData(null); return; } List<VmGuestAgentInterface> selectionInterfaces = new ArrayList<>(); for (VmGuestAgentInterface guestInterface : getGuestAgentData()) { if (Objects.equals(guestInterface.getMacAddress(), selectedItem.getMacAddress())) { selectionInterfaces.add(guestInterface); } } setSelectionGuestAgentData(selectionInterfaces); }
public static void addReportedDevices(BackendResource resource, Nic model, VmNetworkInterface entity) { List<ReportedDevice> devices = getDevices(resource, entity.getVmId(), entity.getMacAddress()); if (!devices.isEmpty()) { ReportedDevices reportedDevices = new ReportedDevices(); reportedDevices.getReportedDevices().addAll(devices); model.setReportedDevices(reportedDevices); } }
private VmNetworkInterface setUpEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics, int index, String networkName) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmId()).thenReturn(VM_ID); when(entity.getNetworkName()).thenReturn(networkName); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getMacAddress()).thenReturn(ADDRESSES[2]); when(entity.getType()).thenReturn(0); when(entity.getSpeed()).thenReturn(50); return setUpStatisticalEntityExpectations(entity, statistics); }
static VmNetworkInterface setUpEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics, int index, String networkName) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmId()).thenReturn(INSTANCE_TYPE_ID); when(entity.getNetworkName()).thenReturn(networkName); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getMacAddress()).thenReturn(ADDRESSES[2]); when(entity.getType()).thenReturn(0); when(entity.getSpeed()).thenReturn(50); return setUpStatisticalEntityExpectations(entity, statistics); }
@Override protected void initMAC() { getMAC().setIsChangeable(false); getMAC().setEntity(getNic().getMacAddress()); }
static VmNetworkInterface setUpEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics, int index, String networkName) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmId()).thenReturn(VM_ID); when(entity.getNetworkName()).thenReturn(networkName); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getMacAddress()).thenReturn(ADDRESSES[2]); when(entity.getType()).thenReturn(0); when(entity.getSpeed()).thenReturn(50); return setUpStatisticalEntityExpectations(entity, statistics); }
static VmNetworkInterface setUpEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics, int index, String networkName) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmId()).thenReturn(VM_ID); when(entity.getNetworkName()).thenReturn(networkName); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getMacAddress()).thenReturn(ADDRESSES[2]); when(entity.getType()).thenReturn(0); when(entity.getSpeed()).thenReturn(50); return setUpStatisticalEntityExpectations(entity, statistics); }
protected IsWidget createMacColumn(VmNetworkInterface networkInterface) { Column column = new Column(ColumnSize.SM_4); column.addStyleName(VM_NIC_OVERFLOW); DListElement dl = Document.get().createDLElement(); SafeHtml mac = SafeHtmlUtils.fromString(networkInterface.getMacAddress()); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), mac, dl); column.getElement().appendChild(dl); WidgetTooltip tooltip = new WidgetTooltip(column); tooltip.setHtml(mac); return tooltip; }
public VmNetworkInterface(VmNetworkInterface iface) { setId(iface.getId()); setMacAddress(iface.getMacAddress()); setName(iface.getName()); setNetworkName(iface.getNetworkName()); setLinked(iface.isLinked()); setSpeed(iface.getSpeed()); setType(iface.getType()); setVmId(iface.getVmId()); setVmName(iface.getVmName()); setVmTemplateId(iface.getVmTemplateId()); setStatistics(new VmNetworkStatistics(iface.getStatistics())); }
@Mapping(from = VmNetworkInterface.class, to = Nic.class) public static Nic map(VmNetworkInterface entity, Nic template) { Nic model = template != null ? template : new Nic(); if (entity.getVmId() != null) { model.setVm(new Vm()); model.getVm().setId(entity.getVmId().toString()); } if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getName() != null) { model.setName(entity.getName()); } if (entity.getMacAddress() != null) { model.setMac(new Mac()); model.getMac().setAddress(entity.getMacAddress()); } model.setLinked(entity.isLinked()); model.setInterface(map(entity.getType())); model.setPlugged(entity.isPlugged()); if (entity.getVnicProfileId() != null) { model.setVnicProfile(new VnicProfile()); model.getVnicProfile().setId(entity.getVnicProfileId().toString()); } return model; }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("name", getName()) .append("networkName", getNetworkName()) .append("vnicProfileName", getVnicProfileName()) .append("vnicProfileId", getVnicProfileId()) .append("speed", getSpeed()) .append("type", getType()) .append("macAddress", getMacAddress()) .append("active", isPlugged()) .append("linked", isLinked()) .append("portMirroring", isPortMirroring()) .append("vmId", getVmId()) .append("vmName", getVmName()) .append("vmTemplateId", getVmTemplateId()) .append("QoSName", getQosName()) .append("remoteNetworkName", getRemoteNetworkName()) .build(); }
SafeHtmlUtils.fromString(VmInterfaceType.forValue(nic.getType()).getDescription()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macInterface()), SafeHtmlUtils.fromString(nic.getMacAddress()), dl); addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { nic.getStatistics().getReceiveRate(),