Conversion Functions -------------------- .. index:: Macro function;fn.pkid_to_bkey * *fn.pkid_to_bkey*: Given a pkid, return the business key. .. index:: Macro function;fn.bkey_to_pkid * *fn.bkey_to_pkid*: Given a business key, return the pkid Provide the data type as an argument. .. index:: Macro function;fn.from_business_key_format * *fn.from_business_key_format*: Convert a field business key string format to a list .. index:: Macro function;fn.as_int * *fn.as_int*: Given a string, return an integer. .. index:: Macro function;fn.as_string * *fn.as_string*: Given an integer, return a string. .. index:: Macro function;fn.as_bool * *fn.as_bool*: Given strings "True", "TRUE", "T", "t", "1", return True. Given strings "False", "FALSE", "F", "f", "0", return False. .. index:: Macro function;fn.as_list * *fn.as_list*: Given input, return it as a list. List input is returned as is. .. index:: Macro function;fn.int_to_hex * *fn.int_to_hex*: Return the hexadecimal value of an integer. Application example: for gateways that use hexadecimal values for port numbers. .. index:: Macro function;fn.hex_to_int * *fn.hex_to_int*: Return the integer value of a hexadecimal value. Application example: for gateways that use hexadecimal values for port numbers. .. index:: Macro function;fn.getMajorMinorVersion * *fn.getMajorMinorVersion*: Given a version in various formats, return a version of the format .. Examples: .. tabularcolumns:: |p{9cm}|p{6cm}| +----------------------------------------------+-----------------------------------+ | Example | Output | +==============================================+===================================+ | :: | :: | | | | | macro: USA_pkid = | "[u'United States of America', | | {{data.Countries.__pkid | u'USA', u'']" | | iso_country_code:USA}} | | | | | | {{fn.pkid_to_bkey macro.USA_pkid}} | | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | macro: a_country_bkey = | "52d3eba8893d57373f842acb" | | {{data.Countries.__bkey | | | __pkid:macro.USA_pkid}} | | | | | | {{fn.bkey_to_pkid macro.a_country_bkey, | | | data/Countries}} | | +----------------------------------------------+-----------------------------------+ | context data: | :: | | | | | | [ | | :: | "10.110.21.101", | | | "8443", | | | "hcs.CS-P.CS-NB.AAAGlobal" | | { | | | "self": { | [ | | "bk": "[\"10.110.21.101\", | | | \"8443\", | | | \"hcs.CS-P.CS-NB.AAAGlobal\"]" | | | } | | | } | | | | | | function: | | | | | | :: | | | | | | {{ fn.from_business_key_format self.bk }} | | +----------------------------------------------+-----------------------------------+ .. tabularcolumns:: |p{9cm}|p{6cm}| +----------------------------------------------+-----------------------------------+ | Example | Output | +==============================================+===================================+ | :: | :: | | | | | {{fn.as_int "1"}} | 1 | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {{fn.as_string 12345}} | "12345" | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {{fn.as_bool "T"}} | true | | | | | {{fn.as_bool "0"}} | false | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {#fn.as_list foo bar#} | ['foo bar'] | | | | | {#fn.as_list 'foo,bar'#} | ['foo,bar'] | | | | | {#fn.as_list ['foo','bar']#} | ['foo','bar'] | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {{fn.int_to_hex 255}} | ff | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {{fn.hex_to_int ff}} | 255 | +----------------------------------------------+-----------------------------------+ | :: | :: | | | | | {{ fn.getMajorMinorVersion 10.5(4) }} | 10.5 | | | | | {{ fn.getMajorMinorVersion 11.5(1) SU1 }} | 11.5 | | | | | {{ fn.getMajorMinorVersion 11.5.3 }} | 11.5 | +----------------------------------------------+-----------------------------------+ .. |VOSS-4-UC| replace:: VOSS-4-UC .. |Unified CM| replace:: Unified CM