
import jinja2
from jinja2 import Environment, meta

# Define the template string
template_string = "Found the BGP established with PEER IP {{peer_ip}}"

# Create a Jinja2 Environment
env = Environment()

# Parse the template string to extract variable names
parsed_content = env.parse(template_string)
variable_names = meta.find_undeclared_variables(parsed_content)

# Print the extracted variable names
print("Variable names:", variable_names)
