On Fri, 12 Apr 2024 10:20:47 +0200 Petr Machata wrote: > > + def up(self): > > + ip("link set dev {} up".format(self.ifname)) > > + > > + def down(self): > > + ip("link set dev {} down".format(self.ifname)) > > Yeah, what I meant by integration pain with LNST the other day was > basically this. You end up rewriting the iproute2 API in Python. > But it is what it is. Yes, I wasn't sure where to make it a local helper in the test or a method of the class. I also don't think we should wrap too much but I was worried someone will give me feedback in the opposite direction :) Let me make it a local helper in the test. I should probably move to format strings, too, not sure now what made me use .format(). > > + ksft_eq(len(attached), 1) > > + ksft_eq(len(undetached), 1) > > + > > + # Free the old page and the old pp is gone > > + nsim.dfs_write("pp_hold", "n") > > + # Freeing check is once a second so we may need to retry > > + for i in range(50): > > + pp_list = nf.page_pool_get({}, dump=True) > > + pp_list = [pp for pp in pp_list if pp.get("ifindex") == nsim.ifindex] > > + if len(pp_list) == 1: > > + break > > + time.sleep(0.05) > > + ksft_eq(len(pp_list), 1) > > Yeah, I don't know if busywait / slowwait sort of a helper is practical > to write in Python. No idea how to go about it. But the bash experience > shows it would useful fairly often. If I wrap: pp_list = nf.page_pool_get({}, dump=True) pp_list = [pp for pp in pp_list if pp.get("ifindex") == nsim.ifindex] into a helper, I can probably pass the condition in as a lambda 🤔️ Let me try..