summaryrefslogtreecommitdiffstats
path: root/Testcases/cfgm_common/__init__.py
diff options
context:
space:
mode:
authorStuart Mackie <wsmackie@juniper.net>2016-01-29 16:00:57 -0800
committerStuart Mackie <wsmackie@juniper.net>2016-01-29 16:00:57 -0800
commit82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (patch)
treef930c90f75846ec8d8e33cf27325ff8fafc85d5c /Testcases/cfgm_common/__init__.py
parent5c04f2e22eb6b5e7a671bc02ba53a438eb66e90d (diff)
OpenContrail test suitestable/colorado
Change-Id: I61168093a2a05d47377ef47c8638ae1554b1a999 Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'Testcases/cfgm_common/__init__.py')
-rw-r--r--Testcases/cfgm_common/__init__.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/Testcases/cfgm_common/__init__.py b/Testcases/cfgm_common/__init__.py
new file mode 100644
index 0000000..feaf215
--- /dev/null
+++ b/Testcases/cfgm_common/__init__.py
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
+#
+
+import sys
+import re
+
+IP_FABRIC_VN_FQ_NAME = ['default-domain', 'default-project', 'ip-fabric']
+IP_FABRIC_RI_FQ_NAME = IP_FABRIC_VN_FQ_NAME + ['__default__']
+LINK_LOCAL_VN_FQ_NAME = ['default-domain', 'default-project', '__link_local__']
+LINK_LOCAL_RI_FQ_NAME = LINK_LOCAL_VN_FQ_NAME + ['__link_local__']
+SG_NO_RULE_NAME = "__no_rule__"
+SG_NO_RULE_FQ_NAME = ['default-domain', 'default-project', SG_NO_RULE_NAME]
+
+BGP_RTGT_MIN_ID = 8000000
+SGID_MIN_ALLOC = 8000000
+
+def obj_to_json(obj):
+ return dict((k, v) for k, v in obj.__dict__.iteritems())
+#end obj_to_json
+
+def json_to_obj(obj):
+ pass
+#end json_to_obj
+
+def ignore_exceptions(func):
+ def wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except Exception as e:
+ return None
+ return wrapper
+# end ignore_exceptions
+
+_illegal_unichrs = [(0x00, 0x08), (0x0B, 0x0C), (0x0E, 0x1F),
+ (0x7F, 0x84), (0x86, 0x9F),
+ (0xFDD0, 0xFDDF), (0xFFFE, 0xFFFF)]
+if sys.maxunicode >= 0x10000: # not narrow build
+ _illegal_unichrs.extend([(0x1FFFE, 0x1FFFF), (0x2FFFE, 0x2FFFF),
+ (0x3FFFE, 0x3FFFF), (0x4FFFE, 0x4FFFF),
+ (0x5FFFE, 0x5FFFF), (0x6FFFE, 0x6FFFF),
+ (0x7FFFE, 0x7FFFF), (0x8FFFE, 0x8FFFF),
+ (0x9FFFE, 0x9FFFF), (0xAFFFE, 0xAFFFF),
+ (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF),
+ (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF),
+ (0xFFFFE, 0xFFFFF), (0x10FFFE, 0x10FFFF)])
+
+_illegal_ranges = ["%s-%s" % (unichr(low), unichr(high))
+ for (low, high) in _illegal_unichrs]
+illegal_xml_chars_RE = re.compile(u'[%s]' % u''.join(_illegal_ranges))