Introduce new option to list test cases.
And return a dummy mac on get_mac failure
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 9f3a357..acfd704 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -181,6 +181,17 @@
print('Removing test container %s' %self.name)
self.kill(remove=True)
+ @classmethod
+ def list_tests(cls, tests):
+ print('Listing test cases')
+ for test in tests:
+ if test == 'tls':
+ test_file = test + 'AuthTest.py'
+ else:
+ test_file = test + 'Test.py'
+ cmd = 'nosetests -v --collect-only {0}/../{1}/{2}'.format(cls.tester_base, test, test_file)
+ os.system(cmd)
+
##default onos/radius/test container images and names
onos_image_default='onosproject/onos:latest'
nose_image_default='cord-test/nose:latest'
@@ -191,6 +202,7 @@
def runTest(args):
global test_server
+ tests = args.test_type.split('-')
onos_cnt = {'tag':'latest'}
nose_cnt = {'image': 'cord-test/nose','tag': 'latest'}
radius_ip = None
@@ -203,6 +215,10 @@
Container.cleanup(cleanup_container)
sys.exit(0)
+ if args.list:
+ CordTester.list_tests(tests)
+ sys.exit(0)
+
#don't spawn onos if the user has specified external test controller with test interface config
if args.test_controller:
ips = args.test_controller.split('/')
@@ -251,7 +267,6 @@
if args.start_switch or not args.olt:
test_cnt.start_switch()
test_cnt.setup_intfs()
- tests = args.test_type.split('-')
test_cnt.run_tests(tests)
cord_test_server_stop(test_server)
@@ -262,7 +277,8 @@
parser.add_argument('-r', '--radius',action='store_true', help='Start Radius service')
parser.add_argument('-q', '--quagga',action='store_true',help='Provision quagga container for vrouter')
parser.add_argument('-a', '--app', default=onos_app_file, type=str, help='Cord ONOS app filename')
- parser.add_argument('-l', '--olt', action='store_true', help='Use OLT config')
+ parser.add_argument('-p', '--olt', action='store_true', help='Use OLT config')
+ parser.add_argument('-l', '--list', action='store_true', help='List test cases')
parser.add_argument('-e', '--test-controller', default='', type=str, help='External test controller ip for Onos and/or radius server.'
'Eg: 10.0.0.2/10.0.0.3 to specify ONOS and Radius ip to connect')
parser.add_argument('-c', '--cleanup', default='', type=str, help='Cleanup test containers')
diff --git a/src/test/utils/OnosFlowCtrl.py b/src/test/utils/OnosFlowCtrl.py
index 323a720..0aed3d1 100644
--- a/src/test/utils/OnosFlowCtrl.py
+++ b/src/test/utils/OnosFlowCtrl.py
@@ -8,7 +8,10 @@
def get_mac(iface = 'ovsbr0', pad = 4):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', iface[:15]))
+ try:
+ info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', iface[:15]))
+ except:
+ info = ['0'] * 24
return '0'*pad + ''.join(['%02x' %ord(char) for char in info[18:24]])
class OnosFlowCtrl: