import requests


def icmp_echo(baseurl, host, cookie_header):
    """
    Test IP connectivity to a given host
    :param baseurl: Imported from yaml
    :param host: IP address of destination
    :param cookie_header: Object created by loginOS.login_os()
    :return: REST call response JSON
    """
    url = baseurl + 'ping'
    headers = {'cookie': cookie_header}
    ip = {'destination': {'ip_address': {'version': 'IAV_IP_V4', 'octets': host}}}
    response = requests.post(url, headers=headers, json=ip, verify=False)
    return response.json()