@Override public Map<String, String> getCustomProperties() { return networkAttachment.getProperties(); }
public Map<String, String> getProperties() { return networkAttachment.getProperties(); }
public boolean hasProperties() { return !(getProperties() == null || getProperties().isEmpty()); }
private void setCustomProperties(Map<Guid, NetworkAttachment> attachmentsByNetworkId, Map<String, Guid> networkNameToNetworkIdMap, HostNic hostNic) { Network network = hostNic.getNetwork(); if (network == null) { return; } String networkName = network.getName(); NetworkAttachment networkAttachment = attachmentsByNetworkId.get(networkNameToNetworkIdMap.get(networkName)); if (networkAttachment == null) { return; } Map<String, String> properties = networkAttachment.getProperties(); if (properties != null) { hostNic.setProperties(CustomPropertiesParser.fromMap(properties)); } }
public NetworkAttachment(NetworkAttachment networkAttachment) { id = networkAttachment.getId(); nicId = networkAttachment.getNicId(); nicName = networkAttachment.getNicName(); networkId = networkAttachment.getNetworkId(); networkName = networkAttachment.getNetworkName(); ipConfiguration = networkAttachment.getIpConfiguration(); properties = networkAttachment.getProperties(); overrideConfiguration = networkAttachment.isOverrideConfiguration(); reportedConfigurations = networkAttachment.getReportedConfigurations(); }
@Override protected MapSqlParameterSource createFullParametersMapper(NetworkAttachment networkAttachment) { MapSqlParameterSource mapper = createIdParameterMapper(networkAttachment.getId()) .addValue("network_id", networkAttachment.getNetworkId()) .addValue("nic_id", networkAttachment.getNicId()) .addValue("custom_properties", SerializationFactory.getSerializer().serialize(networkAttachment.getProperties())); mapIpConfiguration(networkAttachment, mapper); mapper.addValue("dns_resolver_configuration_id", getDnsResolverConfigurationId(networkAttachment)); return mapper; }
private void assertNetworkAttachmentEquals(NetworkAttachment expected, NetworkAttachment actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getNetworkId(), actual.getNetworkId()); assertEquals(expected.getNicId(), actual.getNicId()); assertEquals(expected.getNicName(), actual.getNicName()); assertEquals(expected.getIpConfiguration(), actual.getIpConfiguration()); assertEquals(expected.getProperties().entrySet(), actual.getProperties().entrySet()); assertEquals(expected.getDnsResolverConfiguration(), actual.getDnsResolverConfiguration()); }
model.setProperties(CustomPropertiesParser.fromMap(entity.getProperties()));
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("networkId", getNetworkId()) .append("networkName", getNetworkName()) .append("nicId", getNicId()) .append("nicName", getNicName()) .append("ipConfiguration", getIpConfiguration()) .append("dnsResolverConfiguration", getDnsResolverConfiguration()) .append("properties", getProperties()) .append("overrideConfiguration", isOverrideConfiguration()) .build(); } }
private void storeAttachmentParamsBeforeDetach() { NetworkAttachment networkAttachment = networkModel.getNetworkAttachment(); if (networkAttachment == null) { return; } NetworkParameters netParams = new NetworkParameters(); IPv4Address ipv4Address = networkAttachment.getIpConfiguration().getIpv4PrimaryAddress(); if (ipv4Address != null) { netParams.setIpv4BootProtocol(ipv4Address.getBootProtocol()); netParams.setIpv4Address(ipv4Address.getAddress()); netParams.setIpv4Netmask(ipv4Address.getNetmask()); netParams.setIpv4Gateway(ipv4Address.getGateway()); } IpV6Address ipv6Address = networkAttachment.getIpConfiguration().getIpv6PrimaryAddress(); if (ipv6Address != null) { netParams.setIpv6BootProtocol(ipv6Address.getBootProtocol()); netParams.setIpv6Address(ipv6Address.getAddress()); netParams.setIpv6Prefix(ipv6Address.getPrefix()); netParams.setIpv6Gateway(ipv6Address.getGateway()); } netParams.setHostNetworkQos(HostNetworkQos.fromAnonymousHostNetworkQos(networkAttachment.getHostNetworkQos())); netParams.setQosOverridden(networkAttachment.isQosOverridden()); netParams.setCustomProperties(networkAttachment.getProperties()); netParams.setDnsResolverConfiguration(networkAttachment.getDnsResolverConfiguration()); networkModel.getSetupModel().getNetworkToLastDetachParams().put(networkModel.getName(), netParams); }
version))); customPropertiesModel.setKeyValueMap(validProperties); customPropertiesModel.deserialize(KeyValueModel.convertProperties(networkAttachment.getProperties()));