Retrieves VM IP.
@param hostIpPort IP and port of OCCI server (eg. "172.16.225.91:8080")
@param id Unique VM ID
@return The VM's IP address
@throws TargetException
970824
public static String getVMIP(String hostIpPort, String id) throws TargetException {

		//TODO Expecting more interoperable implem... /compute/urn:uuid:ID for Scalair, /ID for CA !
		if(! hostIpPort.endsWith("/compute") && id.startsWith("urn:uuid:")) id = id.substring(9);
		String vmIp = null;
		URL url = null;
		try {
			CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
			url = new URL("http://" + hostIpPort + "/" + id);
		} catch (MalformedURLException e) {
			throw new TargetException(e);
		}

		HttpURLConnection httpURLConnection = null;
		DataInputStream in = null;
		try {
			httpURLConnection = (HttpURLConnection) url.openConnection();
			httpURLConnection.setRequestMethod("GET");
			httpURLConnection.setRequestProperty("Accept", "application/json");

			in = new DataInputStream(httpURLConnection.getInputStream());
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			Utils.copyStreamSafely(in, out);

			// Parse JSON response to extract VM IP
			ObjectMapper objectMapper = new ObjectMapper();
			JsonResponse rsp = objectMapper.readValue(out.toString( "UTF-8" ), JsonResponse.class);
			vmIp = rsp.getHostsystemname();
			if(Utils.isEmptyOrWhitespaces(vmIp)) vmIp = rsp.getHostname();
			if(Utils.isEmptyOrWhitespaces(vmIp) && rsp.getAttributes() != null)
				vmIp = rsp.getAttributes().getHostname();

		} catch (IOException e) {
			throw new TargetException(e);

		}  finally {
			Utils.closeQuietly(in);
			if (httpURLConnection != null) {
				httpURLConnection.disconnect();
			}
		}

		return vmIp;
	}
1312903
private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException {
		// A null target may be acceptable if there is a default target.
		// Otherwise, the null target is detected in the director.
		HttpHost target = null;
		URI requestURI = request.getURI();
		if (requestURI.isAbsolute()) {
			target = URIUtils.extractHost(requestURI);
			if (target == null) {
				throw new ClientProtocolException(
						"URI does not specify a valid host name: " + requestURI);
			}
		}
		return target;
	}
273723
public OvhFailoverIp project_serviceName_ip_failover_id_attach_POST(String serviceName, String id, String instanceId) throws IOException {
		String qPath = "/cloud/project/{serviceName}/ip/failover/{id}/attach";
		StringBuilder sb = path(qPath, serviceName, id);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "instanceId", instanceId);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhFailoverIp.class);
	}
1038291
def get_transport_target(cls, instance, timeout, retries):
        '''
        
        '''
        if "ip_address" not in instance:
            raise Exception("An IP address needs to be specified")
        ip_address = instance["ip_address"]
        port = int(instance.get("port", 161))  # Default SNMP port
        return hlapi.UdpTransportTarget((ip_address, port), timeout=timeout, retries=retries)
55758
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.CreativeServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.CreativeServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.CreativeServiceSoapBindingStub(new java.net.URL(CreativeServiceInterfacePort_address), this);
                _stub.setPortName(getCreativeServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1036089
private int getTargetPort() {
        int port = getVirtualPort();
        if (NOTSET == port) {
            port = (isIncoming()) ? getServiceContext().getLocalPort() : getServiceContext().getRemotePort();
        }
        return port;
    }
987126
def _get_ip(self, interface):
        
        if interface in ni.interfaces():
            addresses = ni.ifaddresses(interface)
            if ni.AF_INET in addresses:
                return addresses[ni.AF_INET][0]["addr"]
        return ""
374958
public OvhHostProfile location_pccZone_hostProfile_id_GET(String pccZone, Long id) throws IOException {
		String qPath = "/dedicatedCloud/location/{pccZone}/hostProfile/{id}";
		StringBuilder sb = path(qPath, pccZone, id);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhHostProfile.class);
	}
871952
protected Client getClient(String id) throws IOException {
        Get get = new Get.Builder(getIndexName(), id).type("client").build(); //$NON-NLS-1$
        JestResult result = getClient().execute(get);
        if (result.isSucceeded()) {
            Client client = result.getSourceAsObject(Client.class);
            return client;
        } else {
            return null;
        }
    }
881929
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.TrialServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.TrialServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.TrialServiceSoapBindingStub(new java.net.URL(TrialServiceInterfacePort_address), this);
                _stub.setPortName(getTrialServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
391798
public ArrayList<String> loadBalancing_serviceName_probeIp_GET(String serviceName, OvhLoadBalancingZoneEnum zone) throws IOException {
		String qPath = "/ip/loadBalancing/{serviceName}/probeIp";
		StringBuilder sb = path(qPath, serviceName);
		query(sb, "zone", zone);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t2);
	}
1301581
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CampaignExtensionSettingServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CampaignExtensionSettingServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CampaignExtensionSettingServiceSoapBindingStub(new java.net.URL(CampaignExtensionSettingServiceInterfacePort_address), this);
                _stub.setPortName(getCampaignExtensionSettingServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1356536
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceSoapBindingStub(new java.net.URL(CustomTargetingServiceInterfacePort_address), this);
                _stub.setPortName(getCustomTargetingServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1009875
public static InetAddress getInetAddress(String hostName) {
        try {
            return InetAddress.getByName(hostName);
        } catch (UnknownHostException e) {
            throw new IllegalStateException("Unknown host: " + e.getMessage() +
                    ". Make sure you have specified the 'GelfUDPAppender.remoteHost' property correctly in your logback.xml'");
        }
    }
32212
public static InetAddress getLocalIpAddress() throws RuntimeException
	{
		try
		{
			List<InetAddress> ips = getLocalIpAddresses(false, true);

			for (InetAddress ip : ips)
			{
				log.debug("[IpHelper] {getLocalIpAddress} Considering locality of " + ip.getHostAddress());
				if (!ip.isAnyLocalAddress() && (ip instanceof Inet4Address))
				{
					// Ubuntu sets the unix hostname to resolve to 127.0.1.1; this is annoying so treat it as a loopback
					if (!ip.getHostAddress().startsWith("127.0."))
					{
						log.debug("[IpHelper] {getLocalIpAddress} Found nonloopback IP: " + ip.getHostAddress());
						return ip;
					}
				}
			}

			log.trace("[IpHelper] {getLocalIpAddress} Couldn't find a public IP in the ip (size " + ips.size() + ")");
			return InetAddress.getLocalHost();
		}
		catch (UnknownHostException e)
		{
			throw new RuntimeException("[FileHelper] {getLocalIp}: Unable to acquire the current machine's InetAddress", e);
		}
	}
1142278
@Override
  public InetSocketAddress lookup(final Identifier id) {
    LOG.log(Level.FINE, "id: {0}", id);
    return idToAddrMap.get(id);
  }
1017960
def get_ips(self, instance_id):
        
        self._init_os_api()
        instance = self._load_instance(instance_id)
        try:
            ip_addrs = set([self.floating_ip])
        except AttributeError:
            ip_addrs = set([])
        for ip_addr in sum(instance.networks.values(), []):
            ip_addrs.add(ip_addr)
        log.debug("VM `%s` has IP addresses %r", instance_id, ip_addrs)
        return list(ip_addrs)