[PATCH] samba.netbios module Python 3 compatible

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
Hello.

I've ported Python module samba.netbios to Python 3 compatible form.

As discussed before [0], it's really hard to write tests for modules
like this because it works mostly with networks. I've tried to write
some tests but I am only able test proper exceptions raising. I tested
ported module manually on my LAN.

[0]
https://lists.samba.org/archive/samba-technical/2017-June/120869.html 
and https://lists.samba.org/archive/samba-technical/2017-May/120863.html

Thank you and have a nice day.

Lumír


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On Tue, 2017-06-27 at 13:00 +0200, Lumir Balhar via samba-technical
wrote:

> Hello.
>
> I've ported Python module samba.netbios to Python 3 compatible form.
>
> As discussed before [0], it's really hard to write tests for modules
> like this because it works mostly with networks. I've tried to write
> some tests but I am only able test proper exceptions raising. I tested
> ported module manually on my LAN.
>
> [0]
> https://lists.samba.org/archive/samba-technical/2017-June/120869.html 
> and https://lists.samba.org/archive/samba-technical/2017-May/120863.html
>
> Thank you and have a nice day.

Sorry, ENOPATCH :-)

We have a full emulated network in make test, so network tests should
be entirely practical.  Mostly just run it in an environment (rather
than none) and have it interrogate $SERVER from the environment.

Thanks,

Andrew Bartlett

--
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On 06/27/2017 06:54 PM, Andrew Bartlett via samba-technical wrote:

> On Tue, 2017-06-27 at 13:00 +0200, Lumir Balhar via samba-technical
> wrote:
>> Hello.
>>
>> I've ported Python module samba.netbios to Python 3 compatible form.
>>
>> As discussed before [0], it's really hard to write tests for modules
>> like this because it works mostly with networks. I've tried to write
>> some tests but I am only able test proper exceptions raising. I tested
>> ported module manually on my LAN.
>>
>> [0]
>> https://lists.samba.org/archive/samba-technical/2017-June/120869.html
>> and https://lists.samba.org/archive/samba-technical/2017-May/120863.html
>>
>> Thank you and have a nice day.
> Sorry, ENOPATCH :-)
Sorry, I forget to add an attachment. :-)
>
> We have a full emulated network in make test, so network tests should
> be entirely practical.  Mostly just run it in an environment (rather
> than none) and have it interrogate $SERVER from the environment.
Could you please show me some example of tests which use emulated
network? Or create one for samba.netbios which I can use as an example?
>
> Thanks,
>
> Andrew Bartlett
>
Thank you!

0002-python-tests-Add-a-few-tests-for-samba.netbios-modul.patch (2K) Download Attachment
0001-python-Port-samba.netbios-module-to-Python-3-compati.patch (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On Tuesday, 27 June 2017 22:43:05 CEST Lumir Balhar via samba-technical wrote:

> On 06/27/2017 06:54 PM, Andrew Bartlett via samba-technical wrote:
> > On Tue, 2017-06-27 at 13:00 +0200, Lumir Balhar via samba-technical
> >
> > wrote:
> >> Hello.
> >>
> >> I've ported Python module samba.netbios to Python 3 compatible form.
> >>
> >> As discussed before [0], it's really hard to write tests for modules
> >> like this because it works mostly with networks. I've tried to write
> >> some tests but I am only able test proper exceptions raising. I tested
> >> ported module manually on my LAN.
> >>
> >> [0]
> >> https://lists.samba.org/archive/samba-technical/2017-June/120869.html
> >> and https://lists.samba.org/archive/samba-technical/2017-May/120863.html
> >>
> >> Thank you and have a nice day.
> >
> > Sorry, ENOPATCH :-)
>
> Sorry, I forget to add an attachment. :-)
>
> > We have a full emulated network in make test, so network tests should
> > be entirely practical.  Mostly just run it in an environment (rather
> > than none) and have it interrogate $SERVER from the environment.
>
> Could you please show me some example of tests which use emulated
> network? Or create one for samba.netbios which I can use as an example?

If you reach me over internal IRC or just call my internal number we can have
a share screen session and I explain you our awesome test environment ;)


        Andreas

--
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             [hidden email]
www.samba.org

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On 06/28/2017 08:17 AM, Andreas Schneider via samba-technical wrote:

> On Tuesday, 27 June 2017 22:43:05 CEST Lumir Balhar via samba-technical wrote:
>> On 06/27/2017 06:54 PM, Andrew Bartlett via samba-technical wrote:
>>> On Tue, 2017-06-27 at 13:00 +0200, Lumir Balhar via samba-technical
>>>
>>> wrote:
>>>> Hello.
>>>>
>>>> I've ported Python module samba.netbios to Python 3 compatible form.
>>>>
>>>> As discussed before [0], it's really hard to write tests for modules
>>>> like this because it works mostly with networks. I've tried to write
>>>> some tests but I am only able test proper exceptions raising. I tested
>>>> ported module manually on my LAN.
>>>>
>>>> [0]
>>>> https://lists.samba.org/archive/samba-technical/2017-June/120869.html
>>>> and https://lists.samba.org/archive/samba-technical/2017-May/120863.html
>>>>
>>>> Thank you and have a nice day.
>>> Sorry, ENOPATCH :-)
>> Sorry, I forget to add an attachment. :-)
>>
>>> We have a full emulated network in make test, so network tests should
>>> be entirely practical.  Mostly just run it in an environment (rather
>>> than none) and have it interrogate $SERVER from the environment.
>> Could you please show me some example of tests which use emulated
>> network? Or create one for samba.netbios which I can use as an example?
> If you reach me over internal IRC or just call my internal number we can have
> a share screen session and I explain you our awesome test environment ;)
>
>
> Andreas
>

Hello.

Thanks to Andreas, I know a lot more about samba testing environments
but with netbios module, I am lost.

I have samba.netbios ported to Python 3 compatible form and I can use it
on my LAN. For example:

 >>> from samba import netbios
 >>> n = netbios.Node()
 >>> n.query_name('frenzy-nas', '10.0.0.5', timeout=2)
('10.0.0.5', ('frenzy-nas', 0), ['10.0.0.5'])
 >>> n.name_status('frenzy-nas', '10.0.0.5', timeout=2)
('10.0.0.5', ('frenzy-nas', 0), [('FRENZY-NAS     ', 1024, 0),
('FRENZY-NAS     ', 1024, 3), ('FRENZY-NAS     ', 1024, 32),
('WORKGROUP      ', 33792, 0), ('WORKGROUP      ', 33792, 30)])

Frenzy-nas is my local NAS and '10.0.0.5' is its IP address. The same
example works also in Python 3.

But when I try the same check in 'ad_dc' test environment, it fails. For
example:

 >>> from samba import netbios
 >>> n = netbios.Node()
 >>> n.query_name('addomain', '127.0.0.30', timeout=2)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
samba.NTSTATUSError: (-1073741643, '{Device Timeout} The specified I/O
operation on %hs was not completed before the time-out period expired.')
 >>> n.name_status('addomain', '127.0.0.30', timeout=2)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
samba.NTSTATUSError: (-1073741643, '{Device Timeout} The specified I/O
operation on %hs was not completed before the time-out period expired.')

'addomain' is in $DOMAIN and '127.0.0.30' is in $SERVER_IP.

 From this point of view it seems that there is something wrong in the
testing environment and samba isn't providing netbios but when I try the
same query with nmblookup, it works.

$ bin/nmblookup addomain
127.0.0.30 addomain<00>

I don't know what I am doing wrong. Could you please help me find out
why is there a difference between netbios queries from the Python module
and nmblookup tool?

Thank you. Have a nice day.
Lumír

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On Wed, 2017-08-02 at 11:23 +0200, Lumir Balhar wrote:
>
>
> 'addomain' is in $DOMAIN and '127.0.0.30' is in $SERVER_IP.

Try using $SERVER not $DOMAIN.  $DOMAIN shouldn't work, it would be a
#1b and #1c name.

>  From this point of view it seems that there is something wrong in
> the 
> testing environment and samba isn't providing netbios but when I try
> the 
> same query with nmblookup, it works.
>
> $ bin/nmblookup addomain
> 127.0.0.30 addomain<00>
>
> I don't know what I am doing wrong. Could you please help me find
> out 
> why is there a difference between netbios queries from the Python
> module 
> and nmblookup tool?

They are backed by quite different codebases.  nmblookup4 which is no
longer installed would be a closer match.

> Thank you. Have a nice day.
> Lumír

Sorry for the long delay and poor handling of this.  Your patches are
important to us.

Andrew Bartlett

--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT  
https://catalyst.net.nz/services/samba





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] samba.netbios module Python 3 compatible

Samba - samba-technical mailing list
On 08/08/2017 06:55 AM, Andrew Bartlett wrote:
> On Wed, 2017-08-02 at 11:23 +0200, Lumir Balhar wrote:
>>
>> 'addomain' is in $DOMAIN and '127.0.0.30' is in $SERVER_IP.
> Try using $SERVER not $DOMAIN.  $DOMAIN shouldn't work, it would be a
> #1b and #1c name.
Thanks, but using 'addc' ($SERVER) instead of 'addomain' ($DOMAIN)
doesn't help.

>
>>   From this point of view it seems that there is something wrong in
>> the
>> testing environment and samba isn't providing netbios but when I try
>> the
>> same query with nmblookup, it works.
>>
>> $ bin/nmblookup addomain
>> 127.0.0.30 addomain<00>
>>
>> I don't know what I am doing wrong. Could you please help me find
>> out
>> why is there a difference between netbios queries from the Python
>> module
>> and nmblookup tool?
> They are backed by quite different codebases.  nmblookup4 which is no
> longer installed would be a closer match.
I've tried both with the same result:

$ ./bin/nmblookup addc
127.0.0.30 addc<00>

$ ./bin/nmblookup4 addc
127.0.0.30 ADDC<00>

 >>> from samba import netbios
 >>> n = netbios.Node()
 >>> n.query_name('addc', '127.0.0.30', timeout=3)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
samba.NTSTATUSError: (-1073741643, '{Device Timeout} The specified I/O
operationod expired.')
>
>> Thank you. Have a nice day.
>> Lumír
> Sorry for the long delay and poor handling of this.  Your patches are
> important to us.
>
> Andrew Bartlett
>
It's not a problem, we have a common goal.

I am probably not skilled enough to debug this issue when the Python
module works in my LAN but not in the testing environment. Moreover when
other tools are working in the testing environment.

Thanks for any help.
Lumír

Loading...