fork download
  1. # your code goes here
  2. # your code goes here
  3. from jinja2 import Environment
  4. var_bind_val_map = {'VarBind_1': '0:8:33:41.00', 'VarBind_2': '.1.3.6.1.4.1.46634.1.3.1.0.62', 'VarBind_3': 'EDGE-1', 'VarBind_4': '2', 'VarBind_5': '1', 'VarBind_6': ' ', 'VarBind_7': 'system', 'VarBind_8': '10.110.1.2', 'VarBind_9': '2147483647', 'VarBind_10': '2147483647', 'VarBind_11': '2147483647', 'VarBind_12': '2147483647'}
  5. thresid_map = "BGP_SESSION_DOWN_{{VarBind_7}}_{{VarBind_8}}"
  6. msg = Environment().from_string(thresid_map).render(**var_bind_val_map)
  7. print("msg is: ",msg)
  8.  
Success #stdin #stdout 0.04s 15208KB
stdin
Standard input is empty
stdout
('msg is: ', u'BGP_SESSION_DOWN_system_10.110.1.2')