Merge "Remove dependency of impl on onf-extensions"
[openflowplugin.git] / test-scripts / openvswitch / convertor_tools.py
1 '''
2 Created on Jan 24, 2014
3
4 @author: vdemcak
5 '''
6
7
8 class ConvertorTools():
9     """
10         Tool class contains static conversion method
11         for the value conversions
12     """
13     CONVERTORS = {
14         'cookie': hex, 
15         'metadata': hex
16     }  
17     
18     @staticmethod
19     def base_tag_values_conversion(key, value):
20         """
21         Check a need to conversion and convert if need
22         """
23         if value is None : return ''
24         else:
25             convertor = ConvertorTools.CONVERTORS.get(key, None)
26             if convertor is None : return value
27             else :
28                 return convertor(int(value))