def test_get_nodes_selection(self, query_nodes, api, get_user): get_user.return_value = ('user', 'password') query_nodes.return_value = ['a8-1', 'm3-1'] ret = common.get_nodes_selection(username=None, password=None, experiment_id=None, nodes_list=()) self.assertEqual(['a8-1', 'm3-1'], ret) query_nodes.assert_called_with(api.return_value, None, ())
def select_nodes(opts): """ Select all gateways and open-a8 if `with_a8` """ nodes = common.get_nodes_selection(**vars(opts)) # all gateways urls except A8 nodes_list = [n for n in nodes if not n.startswith('a8')] # add open-a8 urls with 'node-' in front all urls if opts.with_a8: nodes_list += ['node-' + n for n in nodes if n.startswith('a8')] return nodes_list
def select_nodes(opts): """ Select all gateways that support sniffer """ nodes = common.get_nodes_selection(**vars(opts)) nodes_list = [n for n in nodes if n.startswith(('m3', 'a8'))] return nodes_list