Add the robot based CSIT tool with the base edition
[integration/test.git] / test / tools / Robot_Tool / libraries / Common.py
1 """
2 Library for the robot based system test tool of the OpenDaylight project.
3 Authors: Baohua Yang@IBM, Denghui Huang@IBM
4 Updated: 2013-11-14
5 """
6 import collections
7
8 '''
9 Common constants and functions for the robot framework.
10 '''
11
12 def collection_should_contain(collection, *members):
13     """
14     Fail if not every members is in the collection.
15     """
16     if not isinstance(collection, collections.Iterable):
17         return False
18     for m in members:
19         if m not in collection:
20             return False
21     else:
22         return True
23
24 def combine_strings(*strings):
25     """
26     Combines the given `strings` together and returns the result.
27     The given strings are not altered by this keyword.
28     """
29     result = ''
30     for s in strings:
31         if isinstance(s,str) or isinstance(s,unicode):
32             result += s
33     if result == '':
34         return None
35     else:
36         return result
37
38 if __name__ == '__main__':
39     pass