Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-18 Thread TommyLike Hu
Thanks for your explicit explanations,I even misunderstand(maybe
superficial understand) the intentions of the random IP when I set up this
thread :)

Ihar Hrachyshka 于2016年10月19日周三 上午12:05写道:

> (To clarify for those not part of the neutron dev team, ‘fullstack’ in
> neutron gate is not devstack/tempest, and does not involve other openstack
> services, or multiple nodes.)
>
> No, we don’t dump a seed. I don’t think I saw a ‘fullstack’ failure that
> required an exact environment duplication to reproduce a test failure.
>
> For neutron ‘fullstack’ tests, we run complete neutron services, and
> collect all their logs, per test scenario. Basically, every ‘fullstack’
> test case is a tiny openstack setup with just neutron services running,
> using some common resources like amqp bus, or ovs bridge emulating physical
> infrastructure. As long as service logs are sufficient to debug failures,
> it doesn’t differ much from any other failure in neutron f.e. in tempest.
>
> It’s common for neutron to allocate a ‘random’ address from a subnet
> allocation pool for its network and instance ports, in which case we need
> to trace port-ids and whatnot to link related server/agent/tempest logs.
> (If you ask me why we randomize ip address allocation in neutron IPAM code,
> that’s actually for a reason, to reduce database contention when allocating
> addresses for parallel port requests).
>
> Ihar
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-18 Thread Ihar Hrachyshka

Joshua Harlow  wrote:


Ihar Hrachyshka wrote:

In Neutron, we have a need to allocate random but unique addresses and
such. For that matter, we have a concept of exclusive resources:
https://github.com/openstack/neutron/tree/master/neutron/tests/common/exclusive_resources
that are relying on locks and shared file based resource allocation
storage. This is used in fullstack tests where all allocation is limited
to a single node.

Another place where we randomize addresses is in our NeutronObject tests
where we just want to generate values good enough to pass
oslo.versionedobjects fields constraints:
https://github.com/openstack/neutron/blob/master/neutron/tests/unit/objects/test_base.py#L494
We have some hacks there to guarantee uniqueness where may be needed
(f.e. in case of lists of ip networks), but otherwise it’s just random
addresses. It’s good enough for unit tests because each test has its own
testing environment isolated from others.

Ihar


Ok good/interesting to know, if a test fails and someone wants to  
reproduce it 'at home' what's the recommended way to do that if these are  
all randomized (and the source of the failure say is in one of these  
randomized data 'using' tests)


Do you output the random number gen seed (this seems like it would work,  
although a little PITA) so that people can use the same initially seed  
(and then get the same random numbers as a result)?


(To clarify for those not part of the neutron dev team, ‘fullstack’ in  
neutron gate is not devstack/tempest, and does not involve other openstack  
services, or multiple nodes.)


No, we don’t dump a seed. I don’t think I saw a ‘fullstack’ failure that  
required an exact environment duplication to reproduce a test failure.


For neutron ‘fullstack’ tests, we run complete neutron services, and  
collect all their logs, per test scenario. Basically, every ‘fullstack’  
test case is a tiny openstack setup with just neutron services running,  
using some common resources like amqp bus, or ovs bridge emulating physical  
infrastructure. As long as service logs are sufficient to debug failures,  
it doesn’t differ much from any other failure in neutron f.e. in tempest.


It’s common for neutron to allocate a ‘random’ address from a subnet  
allocation pool for its network and instance ports, in which case we need  
to trace port-ids and whatnot to link related server/agent/tempest logs.  
(If you ask me why we randomize ip address allocation in neutron IPAM code,  
that’s actually for a reason, to reduce database contention when allocating  
addresses for parallel port requests).


Ihar

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-18 Thread Joshua Harlow

Ihar Hrachyshka wrote:

In Neutron, we have a need to allocate random but unique addresses and
such. For that matter, we have a concept of exclusive resources:
https://github.com/openstack/neutron/tree/master/neutron/tests/common/exclusive_resources
that are relying on locks and shared file based resource allocation
storage. This is used in fullstack tests where all allocation is limited
to a single node.

Another place where we randomize addresses is in our NeutronObject tests
where we just want to generate values good enough to pass
oslo.versionedobjects fields constraints:
https://github.com/openstack/neutron/blob/master/neutron/tests/unit/objects/test_base.py#L494
We have some hacks there to guarantee uniqueness where may be needed
(f.e. in case of lists of ip networks), but otherwise it’s just random
addresses. It’s good enough for unit tests because each test has its own
testing environment isolated from others.

Ihar



Ok good/interesting to know, if a test fails and someone wants to 
reproduce it 'at home' what's the recommended way to do that if these 
are all randomized (and the source of the failure say is in one of these 
randomized data 'using' tests)


Do you output the random number gen seed (this seems like it would work, 
although a little PITA) so that people can use the same initially seed 
(and then get the same random numbers as a result)?


-Josh



__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-18 Thread Doug Hellmann
Excerpts from Joshua Harlow's message of 2016-10-17 20:59:23 -0700:
> I think doug (he can correct me if I am wrong) was more wondering the 
> question of 'why would you want to use random data' in a test vs using 
> known fixed data. When a test fails it can be quite hard to identify the 
> reason if certain data that the test uses is randomized for each run.
> 
> Randomness might be useful, but it has always made me feel like 
> something is off when you see to much of it in tests...
> 
> -Josh

Yes, thanks, Josh, that's what I was trying to ask.

Doug

> 
> TommyLike Hu wrote:
> > Hmm,it's used to generate the ip address for validation or rule
> > checking, Meanwhile add some randomness. Of course it's unreasonable the
> > case you mentioned, please check the existed cases [1] and [2]
> >
> > [1]
> > https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/base.py#L828
> > [2]
> > https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/test_replication.py#L76
> >
> > Doug Hellmann >于
> > 2016年10月18日周二 上午12:01写道:
> >
> > Excerpts from TommyLike Hu's message of 2016-10-17 14:46:36 +:
> >  > It's used in testcase already, and basic codes is from here:
> >  >
> > 
> > https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93
> >
> > OK, I guess the real question I had is why use *random* addresses.
> > Because that seems like a way to end up having two tests try to use the
> > same address at the same time. If that did happen, would it cause
> > conflicts or race conditions for the manila tests?
> >
> >  >
> >  > Doug Hellmann  > >于2016年10月17日周一 下午10:13写道:
> >  >
> >  > > Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
> >  > > > When I handle some stuff related to Manila recently, I found
> > a case which
> >  > > > may be suitable for Oslo, Anyhow I put it in the maillist so
> > it can be
> >  > > > discussed before I put it in action.
> >  > > > In testcase, we need a function(maybe 2) to generate random
> > ip address
> >  > > (or
> >  > > > network), also they should in the range of [1](ipv4
> > documentation range)
> >  > > or
> >  > > > [2](ipv6 documentation range), this is the draft code for ipv4:
> >  > > >
> >  > > > import six
> >  > > > import random
> >  > > >
> >  > > >
> >  > > > def rand_ipv4(network=False):
> >  > > > """This uses the TEST-NET-3 range of reserved IP addresses."""
> >  > > >
> >  > > > test_net_3 = '203.0.113.'
> >  > > > if network:
> >  > > > host_length = random.randint(0, 8)
> >  > > > address_segment = random.randint(0, 8 - host_length)
> >  > > > address_segment <<= host_length
> >  > > > address = test_net_3 + six.text_type(address_segment)
> >  > > > address = '/'.join((address,
> >  > > > six.text_type(32 - host_length)))
> >  > > > else:
> >  > > > address = test_net_3 +
> > six.text_type(random.randint(0, 255))
> >  > > > return address
> >  > > >
> >  > > > The primary use case here is writing testcases,  I am not
> > sure whether it
> >  > > > is suitable here, or maybe I misunderstood the intention of
> > TEST-NET-3,
> >  > > > please leave any comment you like.
> >  > > >
> >  > > >
> >  > > > [1] https://tools.ietf.org/html/rfc5737
> >  > > > [2] https://tools.ietf.org/html/rfc5156
> >  > >
> >  > > In what way are you using random addresses in tests?
> >  > >
> >  > > Doug
> >  > >
> >  > >
> > 
> > __
> >  > > OpenStack Development Mailing List (not for usage questions)
> >  > > Unsubscribe:
> > openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > 
> >  > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >  > >
> >
> > 
> > __
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe:
> > openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > 
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >
> > __
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-18 Thread Ihar Hrachyshka
In Neutron, we have a need to allocate random but unique addresses and  
such. For that matter, we have a concept of exclusive resources:  
https://github.com/openstack/neutron/tree/master/neutron/tests/common/exclusive_resources  
that are relying on locks and shared file based resource allocation  
storage. This is used in fullstack tests where all allocation is limited to  
a single node.


Another place where we randomize addresses is in our NeutronObject tests  
where we just want to generate values good enough to pass  
oslo.versionedobjects fields constraints:  
https://github.com/openstack/neutron/blob/master/neutron/tests/unit/objects/test_base.py#L494  
We have some hacks there to guarantee uniqueness where may be needed (f.e.  
in case of lists of ip networks), but otherwise it’s just random addresses.  
It’s good enough for unit tests because each test has its own testing  
environment isolated from others.


Ihar

Joshua Harlow  wrote:

I think doug (he can correct me if I am wrong) was more wondering the  
question of 'why would you want to use random data' in a test vs using  
known fixed data. When a test fails it can be quite hard to identify the  
reason if certain data that the test uses is randomized for each run.


Randomness might be useful, but it has always made me feel like something  
is off when you see to much of it in tests...


-Josh

TommyLike Hu wrote:

Hmm,it's used to generate the ip address for validation or rule
checking, Meanwhile add some randomness. Of course it's unreasonable the
case you mentioned, please check the existed cases [1] and [2]

[1]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/base.py#L828
[2]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/test_replication.py#L76

Doug Hellmann >于
2016年10月18日周二 上午12:01写道:

Excerpts from TommyLike Hu's message of 2016-10-17 14:46:36 +:
 > It's used in testcase already, and basic codes is from here:
 >

https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93

OK, I guess the real question I had is why use *random* addresses.
Because that seems like a way to end up having two tests try to use the
same address at the same time. If that did happen, would it cause
conflicts or race conditions for the manila tests?

 >
 > Doug Hellmann >于2016年10月17日周一 下午10:13写道:
 >
 > > Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
 > > > When I handle some stuff related to Manila recently, I found
a case which
 > > > may be suitable for Oslo, Anyhow I put it in the maillist so
it can be
 > > > discussed before I put it in action.
 > > > In testcase, we need a function(maybe 2) to generate random
ip address
 > > (or
 > > > network), also they should in the range of [1](ipv4
documentation range)
 > > or
 > > > [2](ipv6 documentation range), this is the draft code for ipv4:
 > > >
 > > > import six
 > > > import random
 > > >
 > > >
 > > > def rand_ipv4(network=False):
 > > > """This uses the TEST-NET-3 range of reserved IP addresses."""
 > > >
 > > > test_net_3 = '203.0.113.'
 > > > if network:
 > > > host_length = random.randint(0, 8)
 > > > address_segment = random.randint(0, 8 - host_length)
 > > > address_segment <<= host_length
 > > > address = test_net_3 + six.text_type(address_segment)
 > > > address = '/'.join((address,
 > > > six.text_type(32 - host_length)))
 > > > else:
 > > > address = test_net_3 +
six.text_type(random.randint(0, 255))
 > > > return address
 > > >
 > > > The primary use case here is writing testcases,  I am not
sure whether it
 > > > is suitable here, or maybe I misunderstood the intention of
TEST-NET-3,
 > > > please leave any comment you like.
 > > >
 > > >
 > > > [1] https://tools.ietf.org/html/rfc5737
 > > > [2] https://tools.ietf.org/html/rfc5156
 > >
 > > In what way are you using random addresses in tests?
 > >
 > > Doug
 > >
 > >
__
 > > OpenStack Development Mailing List (not for usage questions)
 > > Unsubscribe:
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

 > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 > >

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe:

Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread Joshua Harlow
I think doug (he can correct me if I am wrong) was more wondering the 
question of 'why would you want to use random data' in a test vs using 
known fixed data. When a test fails it can be quite hard to identify the 
reason if certain data that the test uses is randomized for each run.


Randomness might be useful, but it has always made me feel like 
something is off when you see to much of it in tests...


-Josh

TommyLike Hu wrote:

Hmm,it's used to generate the ip address for validation or rule
checking, Meanwhile add some randomness. Of course it's unreasonable the
case you mentioned, please check the existed cases [1] and [2]

[1]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/base.py#L828
[2]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/test_replication.py#L76

Doug Hellmann >于
2016年10月18日周二 上午12:01写道:

Excerpts from TommyLike Hu's message of 2016-10-17 14:46:36 +:
 > It's used in testcase already, and basic codes is from here:
 >

https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93

OK, I guess the real question I had is why use *random* addresses.
Because that seems like a way to end up having two tests try to use the
same address at the same time. If that did happen, would it cause
conflicts or race conditions for the manila tests?

 >
 > Doug Hellmann >于2016年10月17日周一 下午10:13写道:
 >
 > > Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
 > > > When I handle some stuff related to Manila recently, I found
a case which
 > > > may be suitable for Oslo, Anyhow I put it in the maillist so
it can be
 > > > discussed before I put it in action.
 > > > In testcase, we need a function(maybe 2) to generate random
ip address
 > > (or
 > > > network), also they should in the range of [1](ipv4
documentation range)
 > > or
 > > > [2](ipv6 documentation range), this is the draft code for ipv4:
 > > >
 > > > import six
 > > > import random
 > > >
 > > >
 > > > def rand_ipv4(network=False):
 > > > """This uses the TEST-NET-3 range of reserved IP addresses."""
 > > >
 > > > test_net_3 = '203.0.113.'
 > > > if network:
 > > > host_length = random.randint(0, 8)
 > > > address_segment = random.randint(0, 8 - host_length)
 > > > address_segment <<= host_length
 > > > address = test_net_3 + six.text_type(address_segment)
 > > > address = '/'.join((address,
 > > > six.text_type(32 - host_length)))
 > > > else:
 > > > address = test_net_3 +
six.text_type(random.randint(0, 255))
 > > > return address
 > > >
 > > > The primary use case here is writing testcases,  I am not
sure whether it
 > > > is suitable here, or maybe I misunderstood the intention of
TEST-NET-3,
 > > > please leave any comment you like.
 > > >
 > > >
 > > > [1] https://tools.ietf.org/html/rfc5737
 > > > [2] https://tools.ietf.org/html/rfc5156
 > >
 > > In what way are you using random addresses in tests?
 > >
 > > Doug
 > >
 > >
__
 > > OpenStack Development Mailing List (not for usage questions)
 > > Unsubscribe:
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

 > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 > >

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe:
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread TommyLike Hu
Ha,thanks for your link, it's absolutely much clearer and more correct
here, and how do you think of this util function itself?

Kiall Mac Innes 于2016年10月18日周二 上午12:03写道:

> We tend to try stick with the various TEST-NET CIDRs etc as well in
> Designate, and document them here:
>
>
> http://docs.openstack.org/developer/designate/developer-guidelines.html#example-dns-names-and-ip-space
> Thanks,
> Kiall
>
>
> On 17/10/16 10:56, TommyLike Hu wrote:
>
> When I handle some stuff related to Manila recently, I found a case which
> may be suitable for Oslo, Anyhow I put it in the maillist so it can be
> discussed before I put it in action.
> In testcase, we need a function(maybe 2) to generate random ip address (or
> network), also they should in the range of [1](ipv4 documentation range) or
> [2](ipv6 documentation range), this is the draft code for ipv4:
>
> import six
> import random
>
>
> def rand_ipv4(network=False):
> """This uses the TEST-NET-3 range of reserved IP addresses."""
>
> test_net_3 = '203.0.113.'
> if network:
> host_length = random.randint(0, 8)
> address_segment = random.randint(0, 8 - host_length)
> address_segment <<= host_length
> address = test_net_3 + six.text_type(address_segment)
> address = '/'.join((address,
> six.text_type(32 - host_length)))
> else:
> address = test_net_3 + six.text_type(random.randint(0, 255))
> return address
>
> The primary use case here is writing testcases,  I am not sure whether it
> is suitable here, or maybe I misunderstood the intention of TEST-NET-3,
> please leave any comment you like.
>
>
> [1]  https://tools.ietf.org/html/rfc5737
> [2]  https://tools.ietf.org/html/rfc5156
>
>
>
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: 
> openstack-dev-requ...@lists.openstack.org?subject:unsubscribehttp://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread TommyLike Hu
Hmm,it's used to generate the ip address for validation or rule checking,
Meanwhile add some randomness. Of course it's unreasonable the case you
mentioned, please check the existed cases [1] and [2]

[1]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/base.py#L828
[2]
https://github.com/openstack/manila/blob/master/manila_tempest_tests/tests/api/test_replication.py#L76

Doug Hellmann 于2016年10月18日周二 上午12:01写道:

> Excerpts from TommyLike Hu's message of 2016-10-17 14:46:36 +:
> > It's used in testcase already, and basic codes is from here:
> >
> https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93
>
> OK, I guess the real question I had is why use *random* addresses.
> Because that seems like a way to end up having two tests try to use the
> same address at the same time. If that did happen, would it cause
> conflicts or race conditions for the manila tests?
>
> >
> > Doug Hellmann 于2016年10月17日周一 下午10:13写道:
> >
> > > Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
> > > > When I handle some stuff related to Manila recently, I found a case
> which
> > > > may be suitable for Oslo, Anyhow I put it in the maillist so it can
> be
> > > > discussed before I put it in action.
> > > > In testcase, we need a function(maybe 2) to generate random ip
> address
> > > (or
> > > > network), also they should in the range of [1](ipv4 documentation
> range)
> > > or
> > > > [2](ipv6 documentation range), this is the draft code for ipv4:
> > > >
> > > > import six
> > > > import random
> > > >
> > > >
> > > > def rand_ipv4(network=False):
> > > > """This uses the TEST-NET-3 range of reserved IP addresses."""
> > > >
> > > > test_net_3 = '203.0.113.'
> > > > if network:
> > > > host_length = random.randint(0, 8)
> > > > address_segment = random.randint(0, 8 - host_length)
> > > > address_segment <<= host_length
> > > > address = test_net_3 + six.text_type(address_segment)
> > > > address = '/'.join((address,
> > > > six.text_type(32 - host_length)))
> > > > else:
> > > > address = test_net_3 + six.text_type(random.randint(0, 255))
> > > > return address
> > > >
> > > > The primary use case here is writing testcases,  I am not sure
> whether it
> > > > is suitable here, or maybe I misunderstood the intention of
> TEST-NET-3,
> > > > please leave any comment you like.
> > > >
> > > >
> > > > [1]  https://tools.ietf.org/html/rfc5737
> > > > [2]  https://tools.ietf.org/html/rfc5156
> > >
> > > In what way are you using random addresses in tests?
> > >
> > > Doug
> > >
> > >
> __
> > > OpenStack Development Mailing List (not for usage questions)
> > > Unsubscribe:
> openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> > >
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread Kiall Mac Innes
We tend to try stick with the various TEST-NET CIDRs etc as well in 
Designate, and document them here:


http://docs.openstack.org/developer/designate/developer-guidelines.html#example-dns-names-and-ip-space

Thanks,
Kiall

On 17/10/16 10:56, TommyLike Hu wrote:
When I handle some stuff related to Manila recently, I found a case 
which may be suitable for Oslo, Anyhow I put it in the maillist so it 
can be discussed before I put it in action.
In testcase, we need a function(maybe 2) to generate random ip address 
(or network), also they should in the range of [1](ipv4 documentation 
range) or [2](ipv6 documentation range), this is the draft code for ipv4:


import six
import random


def rand_ipv4(network=False):
"""This uses the TEST-NET-3 range of reserved IP addresses."""

test_net_3 = '203.0.113.'
if network:
host_length = random.randint(0, 8)
address_segment = random.randint(0, 8 - host_length)
address_segment <<= host_length
address = test_net_3 + six.text_type(address_segment)
address = '/'.join((address,
six.text_type(32 - host_length)))
else:
address = test_net_3 + six.text_type(random.randint(0, 255))
return address

The primary use case here is writing testcases,  I am not sure whether 
it is suitable here, or maybe I misunderstood the intention of 
TEST-NET-3, please leave any comment you like.



[1] https://tools.ietf.org/html/rfc5737
[2] https://tools.ietf.org/html/rfc5156




__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread Doug Hellmann
Excerpts from TommyLike Hu's message of 2016-10-17 14:46:36 +:
> It's used in testcase already, and basic codes is from here:
> https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93

OK, I guess the real question I had is why use *random* addresses.
Because that seems like a way to end up having two tests try to use the
same address at the same time. If that did happen, would it cause
conflicts or race conditions for the manila tests?

> 
> Doug Hellmann 于2016年10月17日周一 下午10:13写道:
> 
> > Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
> > > When I handle some stuff related to Manila recently, I found a case which
> > > may be suitable for Oslo, Anyhow I put it in the maillist so it can be
> > > discussed before I put it in action.
> > > In testcase, we need a function(maybe 2) to generate random ip address
> > (or
> > > network), also they should in the range of [1](ipv4 documentation range)
> > or
> > > [2](ipv6 documentation range), this is the draft code for ipv4:
> > >
> > > import six
> > > import random
> > >
> > >
> > > def rand_ipv4(network=False):
> > > """This uses the TEST-NET-3 range of reserved IP addresses."""
> > >
> > > test_net_3 = '203.0.113.'
> > > if network:
> > > host_length = random.randint(0, 8)
> > > address_segment = random.randint(0, 8 - host_length)
> > > address_segment <<= host_length
> > > address = test_net_3 + six.text_type(address_segment)
> > > address = '/'.join((address,
> > > six.text_type(32 - host_length)))
> > > else:
> > > address = test_net_3 + six.text_type(random.randint(0, 255))
> > > return address
> > >
> > > The primary use case here is writing testcases,  I am not sure whether it
> > > is suitable here, or maybe I misunderstood the intention of TEST-NET-3,
> > > please leave any comment you like.
> > >
> > >
> > > [1]  https://tools.ietf.org/html/rfc5737
> > > [2]  https://tools.ietf.org/html/rfc5156
> >
> > In what way are you using random addresses in tests?
> >
> > Doug
> >
> > __
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread TommyLike Hu
It's used in testcase already, and basic codes is from here:
https://github.com/openstack/manila/blob/master/manila_tempest_tests/utils.py#L93

Doug Hellmann 于2016年10月17日周一 下午10:13写道:

> Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
> > When I handle some stuff related to Manila recently, I found a case which
> > may be suitable for Oslo, Anyhow I put it in the maillist so it can be
> > discussed before I put it in action.
> > In testcase, we need a function(maybe 2) to generate random ip address
> (or
> > network), also they should in the range of [1](ipv4 documentation range)
> or
> > [2](ipv6 documentation range), this is the draft code for ipv4:
> >
> > import six
> > import random
> >
> >
> > def rand_ipv4(network=False):
> > """This uses the TEST-NET-3 range of reserved IP addresses."""
> >
> > test_net_3 = '203.0.113.'
> > if network:
> > host_length = random.randint(0, 8)
> > address_segment = random.randint(0, 8 - host_length)
> > address_segment <<= host_length
> > address = test_net_3 + six.text_type(address_segment)
> > address = '/'.join((address,
> > six.text_type(32 - host_length)))
> > else:
> > address = test_net_3 + six.text_type(random.randint(0, 255))
> > return address
> >
> > The primary use case here is writing testcases,  I am not sure whether it
> > is suitable here, or maybe I misunderstood the intention of TEST-NET-3,
> > please leave any comment you like.
> >
> >
> > [1]  https://tools.ietf.org/html/rfc5737
> > [2]  https://tools.ietf.org/html/rfc5156
>
> In what way are you using random addresses in tests?
>
> Doug
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [oslo] Propose support generate IPv4 and IPv6 random address( or network) for documentation(test?)

2016-10-17 Thread Doug Hellmann
Excerpts from TommyLike Hu's message of 2016-10-17 09:56:15 +:
> When I handle some stuff related to Manila recently, I found a case which
> may be suitable for Oslo, Anyhow I put it in the maillist so it can be
> discussed before I put it in action.
> In testcase, we need a function(maybe 2) to generate random ip address (or
> network), also they should in the range of [1](ipv4 documentation range) or
> [2](ipv6 documentation range), this is the draft code for ipv4:
> 
> import six
> import random
> 
> 
> def rand_ipv4(network=False):
> """This uses the TEST-NET-3 range of reserved IP addresses."""
> 
> test_net_3 = '203.0.113.'
> if network:
> host_length = random.randint(0, 8)
> address_segment = random.randint(0, 8 - host_length)
> address_segment <<= host_length
> address = test_net_3 + six.text_type(address_segment)
> address = '/'.join((address,
> six.text_type(32 - host_length)))
> else:
> address = test_net_3 + six.text_type(random.randint(0, 255))
> return address
> 
> The primary use case here is writing testcases,  I am not sure whether it
> is suitable here, or maybe I misunderstood the intention of TEST-NET-3,
> please leave any comment you like.
> 
> 
> [1]  https://tools.ietf.org/html/rfc5737
> [2]  https://tools.ietf.org/html/rfc5156

In what way are you using random addresses in tests?

Doug

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev