def ptfhost(ansible_adhoc, tbinfo, duthost): if "ptf" in tbinfo: return PTFHost(ansible_adhoc, tbinfo["ptf"]) else: # when no ptf defined in testbed.csv # try to parse it from inventory ptf_host = duthost.host.options["inventory_manager"].get_host(duthost.hostname).get_vars()["ptf_host"] return PTFHost(ansible_adhoc, ptf_host)
def ptfhost(ansible_adhoc, tbinfo, duthost): if "ptf_image_name" in tbinfo and "docker-keysight-api-server" in tbinfo["ptf_image_name"]: return None if "ptf" in tbinfo: return PTFHost(ansible_adhoc, tbinfo["ptf"]) else: # when no ptf defined in testbed.csv # try to parse it from inventory ptf_host = duthost.host.options["inventory_manager"].get_host(duthost.hostname).get_vars()["ptf_host"] return PTFHost(ansible_adhoc, ptf_host)