diff options
author | 2017-08-25 14:26:30 +0000 | |
---|---|---|
committer | 2017-08-29 07:19:48 +0000 | |
commit | 0a56dfd7f42d6a6d849e5cf3f82b0863c8a62ffe (patch) | |
tree | 2361c11c016f4101487787c9ea7676c4d696902d /functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py | |
parent | cb239a2a5ec46086ce8c046e2db4cb7eb7b18181 (diff) |
Refactor the vyos_vrouter to adopt VNF abstraction
JIRA: FUNCTEST-788
1.Modifying code of vyos_vrouter to inherit vnf abstraction class.
2.Adding vyos_vrouter code from our repo to functest.
3.Adding unit test of vyos_vrouter.
4.Doing test of modified vyos_vrouter codes on our labs.
Change-Id: I77e4be8b2a140ea0176c607f2be736599f893ace
Signed-off-by: Shuya Nakama <shuya.nakama@okinawaopenlabs.org>
Diffstat (limited to 'functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py')
-rw-r--r-- | functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py b/functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py new file mode 100644 index 00000000..98cb14cc --- /dev/null +++ b/functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Okinawa Open Laboratory and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +"""command generator module for vrouter testing""" + +import logging +from jinja2 import Environment, FileSystemLoader + + +class CommandGenerator(object): + """command generator class for vrouter testing""" + + logger = logging.getLogger(__name__) + + def __init__(self): + self.logger.debug("init command generator") + + def load_template(self, template_dir, template): + loader = FileSystemLoader(template_dir, + encoding='utf8') + env = Environment(loader=loader) + return env.get_template(template) + + def command_create(self, template, parameter): + commands = template.render(parameter) + return commands.split('\n') |