Re: [PATCH nft v6 2/2]tests: py: add netns feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2019 at 01:31:04PM +0530, shekhar sharma wrote:
> On Wed, Jun 12, 2019 at 12:17 AM Eric Garver <eric@xxxxxxxxxxx> wrote:
> >
> > On Sun, Jun 09, 2019 at 11:48:49PM +0530, Shekhar Sharma wrote:
> > > This patch adds the netns feature to the 'nft-test.py' file.
> > >
> > > Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx>
> > > ---
> > > The version history of the patch is :
> > > v1: add the netns feature
> > > v2: use format() method to simplify print statements.
> > > v3: updated the shebang
> > > v4: resent the same with small changes
> > >
> > >  tests/py/nft-test.py | 98 ++++++++++++++++++++++++++++++++++++--------
> > >  1 file changed, 80 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
> > > index 4e18ae54..c9f65dc5 100755
> > > --- a/tests/py/nft-test.py
> > > +++ b/tests/py/nft-test.py
> > [..]
> > > @@ -245,6 +251,8 @@ def table_delete(table, filename=None, lineno=None):
> > >          return -1
> > >
> > >      cmd = "delete table %s" % table
> > > +    if netns:
> > > +        cmd = "ip netns exec ___nftables-container-test {}".format(cmd)
> >
> > Can we pass the netns name via the netns argument? Then we don't have to
> > have instances of ___nftables-container-test in the command literals.
> OK.
> 
> > Just make netns part of your string format. You can also change the
> > default arg value to "".
> >
> Should i keep the default value in all the occurrences (in those
> functions as well where no other default arguments are used? )

If it makes sense to allow calling the function without the netns arg,
then yes.




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux