# Import Jinja2 library and PyYAML
from jinja2 import Environment, FileSystemLoader
import yaml

# Declare template environment
ENV = Environment(loader=FileSystemLoader('/Users/richardt/src/projects/'))

def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100

ENV.filters['interface_speed'] = get_interface_speed
template = ENV.get_template('template2.j2') 

# We load our YAML file and pass it in to the template when rendering it. 
with open("data.yml") as file:   
    interfaces = yaml.load(file, Loader=yaml.FullLoader)  
    print(template.render(interface_list=interfaces))    

5b331dc4e99aecb456693e6b6e5542677cdeab3c
<mask token>


def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100


<mask token>

<mask token>


def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100


<mask token>
with open('data.yml') as file:
    interfaces = yaml.load(file, Loader=yaml.FullLoader)
    print(template.render(interface_list=interfaces))

<mask token>
ENV = Environment(loader=FileSystemLoader('/Users/richardt/src/projects/'))


def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100


ENV.filters['interface_speed'] = get_interface_speed
template = ENV.get_template('template2.j2')
with open('data.yml') as file:
    interfaces = yaml.load(file, Loader=yaml.FullLoader)
    print(template.render(interface_list=interfaces))

from jinja2 import Environment, FileSystemLoader
import yaml
ENV = Environment(loader=FileSystemLoader('/Users/richardt/src/projects/'))


def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100


ENV.filters['interface_speed'] = get_interface_speed
template = ENV.get_template('template2.j2')
with open('data.yml') as file:
    interfaces = yaml.load(file, Loader=yaml.FullLoader)
    print(template.render(interface_list=interfaces))

# Import Jinja2 library and PyYAML
from jinja2 import Environment, FileSystemLoader
import yaml

# Declare template environment
ENV = Environment(loader=FileSystemLoader('/Users/richardt/src/projects/'))

def get_interface_speed(interface_name):
    if 'gigabit' in interface_name.lower():
        return 1000
    if 'fast' in interface_name.lower():
        return 100

ENV.filters['interface_speed'] = get_interface_speed
template = ENV.get_template('template2.j2') 

# We load our YAML file and pass it in to the template when rendering it. 
with open("data.yml") as file:   
    interfaces = yaml.load(file, Loader=yaml.FullLoader)  
    print(template.render(interface_list=interfaces))    
