3 # Copyright (c) 2017 Okinawa Open Laboratory and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 """command generator module for vrouter testing"""
13 from jinja2 import Environment, FileSystemLoader
16 class CommandGenerator(object):
17 """command generator class for vrouter testing"""
19 logger = logging.getLogger(__name__)
22 self.logger.debug("init command generator")
24 def load_template(self, template_dir, template):
25 loader = FileSystemLoader(template_dir,
27 env = Environment(loader=loader)
28 return env.get_template(template)
30 def command_create(self, template, parameter):
31 commands = template.render(parameter)
32 return commands.split('\n')