blob: eb2ab7314dda63c297007736b2a33d2471683ce3 [file] [log] [blame]
Jon Hall66e001c2015-11-12 09:45:10 -08001"""
2These functions are for use with the Network config system
3"""
4import time
5
6def compareCfg( main, gossipTime=None ):
7 """
8 Compare the network configurations across all nodes in the network
9 gossipTime is the number of seconds each gossip round take for the netCfg maps
10 """
11 main.step( "Check net config" )
12 if gossipTime:
13 time.sleep( gossipTime * len( main.nodes ) )
14 responses = []
15 failMsg = "Net Cfg is different on some nodes."
16 failed = False
17 for node in main.nodes:
18 response = node.getNetCfg( )
19 responses.append( node.pprint( response ) )
20 if response == main.FALSE:
21 failed = True
22 compare = [ i == responses[0] for i in responses ]
23 if failed:
24 failMsg += " Some nodes failed to GET netCfg."
25 utilities.assert_equals( expect=True,
26 actual=all( compare ),
27 onpass="Net Cfg is the same on all nodes",
28 onfail=failMsg )
29 if not all( compare ):
30 main.log.debug( "Net Config results:" )
31 for i in responses:
32 main.log.debug( i )