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 # pylint: disable=missing-docstring
12 """command generator module for vrouter testing"""
15 from jinja2 import Environment, FileSystemLoader
18 class CommandGenerator(object):
19 """command generator class for vrouter testing"""
21 logger = logging.getLogger(__name__)
24 self.logger.debug("init command generator")
27 def load_template(template_dir, template):
28 # pylint disable=missing-docstring
29 loader = FileSystemLoader(template_dir,
31 env = Environment(loader=loader)
32 return env.get_template(template)
35 def command_create(template, parameter):
36 # pylint disable=missing-docstring
37 commands = template.render(parameter)
38 return commands.split('\n')