ping_ip_address used without assertion in Neutron Tempest Plugin
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Low
|
Manjeet Singh Bhatia |
Bug Description
The Neutron Tempest Plugin has an ping_ip_address helper in:
neutron_
It's used in several places:
git grep -n ping_ip_address | cut -d":" -f1-2
neutron_
neutron_
neutron_
neutron_
neutron_
neutron_
neutron_
neutron_
neutron_
neutron_
In all places it's used without an assertion. Meaning that if the ping fails, it'll timeout (CONF.validatio
The ping command on that helper uses the options -c1 (count=1) and -w1 (deadline=1),
```
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count
packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits
with code 0. This makes it possible to use the exit code to see if a host is alive or not.
````
if the pings deson't receive 1 replay in 1 second the subprocess returns a returncode == 1 and makes the test fail
def ping_ip_ address( self, ip_address, should_ succeed= True,
ping_ timeout= None, mtu=None): scenario/ manager. py in tempest git .ping_timeout
# the code is taken from tempest/
timeout = ping_timeout or CONF.validation
cmd = ['ping', '-c1', '-w1']
if mtu:
'-M', 'do',
'-s', str(net_ utils.get_ ping_payload_ size(mtu, 4))
cmd.append( ip_address)
cmd += [
# don't fragment
# ping receives just the size of ICMP payload
]
def ping(): Popen(cmd,
stdout= subprocess. PIPE,
stderr= subprocess. PIPE)
proc. communicate( )
proc = subprocess.
return (proc.returncode == 0) == should_succeed