Harden HA tests against bad ONOS output
- also update gen partitions files
Change-Id: I9fbed42971650aa7feb050aafa66a37b1818804c
diff --git a/TestON/tests/HAstopNodes/dependencies/Counters.py b/TestON/tests/HAstopNodes/dependencies/Counters.py
index 455e3e7..f3833eb 100644
--- a/TestON/tests/HAstopNodes/dependencies/Counters.py
+++ b/TestON/tests/HAstopNodes/dependencies/Counters.py
@@ -32,6 +32,7 @@
main.log.error( "Could not parse counters response from ONOS" +
str( main.activeNodes[i] + 1 ) )
main.log.warn( repr( onosCountersRaw[ i ] ) )
+ onosCounters.append( [] )
return main.FALSE
testCounters = {}
diff --git a/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions b/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
index b73ed4a..cb0d826 100755
--- a/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
+++ b/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
@@ -1,16 +1,17 @@
#!/usr/bin/env python
-'''
+"""
Generate the partitions json file from the $OC* environment variables
Usage: onos-gen-partitions [output file]
If output file is not provided, the json is written to stdout.
-'''
+"""
from os import environ
from collections import deque, OrderedDict
import re
import json
import sys
+import hashlib
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
@@ -54,8 +55,11 @@
vars = get_OC_vars()
nodes = get_nodes(vars)
partitions = generate_permutations2([v.get('id') for v in nodes], 3)
+ name = 0
+ for node in nodes:
+ name = name ^ hash(node['ip'])
data = {
- 'name': 'default',
+ 'name': name,
'nodes': nodes,
'partitions': partitions
}