mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 01:42:55 +00:00
topotest: log sleep function
Added a wrapper for the sleep function that should be used to register in the log files the amount of time spent sleeping.
This commit is contained in:
parent
1f4c4aec44
commit
570f25d80a
@ -32,6 +32,7 @@ import subprocess
|
|||||||
import tempfile
|
import tempfile
|
||||||
import platform
|
import platform
|
||||||
import difflib
|
import difflib
|
||||||
|
import time
|
||||||
|
|
||||||
from lib.topolog import logger
|
from lib.topolog import logger
|
||||||
|
|
||||||
@ -42,8 +43,6 @@ from mininet.log import setLogLevel, info
|
|||||||
from mininet.cli import CLI
|
from mininet.cli import CLI
|
||||||
from mininet.link import Intf
|
from mininet.link import Intf
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
class json_cmp_result(object):
|
class json_cmp_result(object):
|
||||||
"json_cmp result class for better assertion messages"
|
"json_cmp result class for better assertion messages"
|
||||||
|
|
||||||
@ -159,7 +158,7 @@ def run_and_expect(func, what, count=20, wait=3):
|
|||||||
while count > 0:
|
while count > 0:
|
||||||
result = func()
|
result = func()
|
||||||
if result != what:
|
if result != what:
|
||||||
sleep(wait)
|
time.sleep(wait)
|
||||||
count -= 1
|
count -= 1
|
||||||
continue
|
continue
|
||||||
return (True, result)
|
return (True, result)
|
||||||
@ -364,6 +363,17 @@ def ip6_route(node):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def sleep(amount, reason=None):
|
||||||
|
"""
|
||||||
|
Sleep wrapper that registers in the log the amount of sleep
|
||||||
|
"""
|
||||||
|
if reason is None:
|
||||||
|
logger.info('Sleeping for {} seconds'.format(amount))
|
||||||
|
else:
|
||||||
|
logger.info(reason + ' ({} seconds)'.format(amount))
|
||||||
|
|
||||||
|
time.sleep(amount)
|
||||||
|
|
||||||
def checkAddressSanitizerError(output, router, component):
|
def checkAddressSanitizerError(output, router, component):
|
||||||
"Checks for AddressSanitizer in output. If found, then logs it and returns true, false otherwise"
|
"Checks for AddressSanitizer in output. If found, then logs it and returns true, false otherwise"
|
||||||
|
|
||||||
@ -576,7 +586,7 @@ class Router(Node):
|
|||||||
))
|
))
|
||||||
self.waitOutput()
|
self.waitOutput()
|
||||||
logger.debug('{}: {} zebra started'.format(self, self.routertype))
|
logger.debug('{}: {} zebra started'.format(self, self.routertype))
|
||||||
sleep(1)
|
time.sleep(1)
|
||||||
# Fix Link-Local Addresses
|
# Fix Link-Local Addresses
|
||||||
# Somehow (on Mininet only), Zebra removes the IPv6 Link-Local addresses on start. Fix this
|
# Somehow (on Mininet only), Zebra removes the IPv6 Link-Local addresses on start. Fix this
|
||||||
self.cmd('for i in `ls /sys/class/net/` ; do mac=`cat /sys/class/net/$i/address`; IFS=\':\'; set $mac; unset IFS; ip address add dev $i scope link fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6/64; done')
|
self.cmd('for i in `ls /sys/class/net/` ; do mac=`cat /sys/class/net/$i/address`; IFS=\':\'; set $mac; unset IFS; ip address add dev $i scope link fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6/64; done')
|
||||||
|
Loading…
Reference in New Issue
Block a user