diff options
author | Stuart Mackie <wsmackie@juniper.net> | 2016-01-29 16:00:57 -0800 |
---|---|---|
committer | Stuart Mackie <wsmackie@juniper.net> | 2016-01-29 16:00:57 -0800 |
commit | 82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (patch) | |
tree | f930c90f75846ec8d8e33cf27325ff8fafc85d5c /Testcases/cfgm_common/ifmap/util.py | |
parent | 5c04f2e22eb6b5e7a671bc02ba53a438eb66e90d (diff) |
OpenContrail test suitestable/colorado
Change-Id: I61168093a2a05d47377ef47c8638ae1554b1a999
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'Testcases/cfgm_common/ifmap/util.py')
-rw-r--r-- | Testcases/cfgm_common/ifmap/util.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Testcases/cfgm_common/ifmap/util.py b/Testcases/cfgm_common/ifmap/util.py new file mode 100644 index 0000000..e4d06dd --- /dev/null +++ b/Testcases/cfgm_common/ifmap/util.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# +# Copyright 2011, Infoblox, All Rights Reserved +# +# Open Source, see LICENSE +# + +def attr(attributes): + """ + attr creates an XML string for any attribute that has a value + attr({'session-id': '2345', 'validation':'metadata'}) + """ + if attributes and (type(attributes) == type({})): # check if it is a dictionary + __xml = "" + for label, value in attributes.items(): + if value != None: + __xml += label + '="' + value + '" ' + return __xml + else: + return '' + +def link_ids(id1, id2): + """ + Takes two id arguments. + Returns XML for id1 or links id1 and id2 together + """ + if id1 and id2: # Both exist, so link them + #return '<link>' + id1 + id2 + '</link>' + return id1 + id2 + else: + return id1 + + + |