def mux_server_url(request, tbinfo): """ A session level fixture to retrieve the address of mux simulator address Args: request: A fixture from Ansible tbinfo: A session level fixture Returns: str: The address of mux simulator server + vmset_name, like http://10.0.0.64:8080/mux/vms17-8 """ server = tbinfo['server'] vmset_name = tbinfo['group-name'] inv_files = request.config.option.ansible_inventory ip = utilities.get_test_server_vars(inv_files, server, 'ansible_host') port = utilities.get_group_visible_vars(inv_files, server, 'mux_simulator_port') return "http://{}:{}/mux/{}".format(ip, port, vmset_name)
def mux_server_info(request, tbinfo): """Fixture for getting ip, port and vmset_name of mux simulator server Args: request (obj): Pytest request object tbinfo (dict): Testbed info Returns: tuple: Tuple with items: ip, port, vmset_name. For non-dualtor testbed, returns None, None, None """ if 'dualtor' in tbinfo['topo']['name']: server = tbinfo['server'] vmset_name = tbinfo['group-name'] inv_files = request.config.option.ansible_inventory ip = utilities.get_test_server_vars(inv_files, server).get('ansible_host') _port_map = utilities.get_group_visible_vars(inv_files, server).get('mux_simulator_http_port') port = _port_map[tbinfo['conf-name']] return ip, port, vmset_name return None, None, None