X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=testsuites%2Fvstf%2Fvstf_scripts%2Fvstf%2Fcontroller%2Fenv_build%2Fenv_build.py;fp=testsuites%2Fvstf%2Fvstf_scripts%2Fvstf%2Fcontroller%2Fenv_build%2Fenv_build.py;h=0000000000000000000000000000000000000000;hb=fb9e1a726d3a598494fd38330848ef676219a47a;hp=40e25e9f987d02cf96bf25f50e31b865baafebde;hpb=6dff90faee27dc5569255f5cb6ba72ae5e22b924;p=bottlenecks.git diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/env_build/env_build.py b/testsuites/vstf/vstf_scripts/vstf/controller/env_build/env_build.py deleted file mode 100644 index 40e25e9f..00000000 --- a/testsuites/vstf/vstf_scripts/vstf/controller/env_build/env_build.py +++ /dev/null @@ -1,85 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd 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 -############################################################################## - -import logging - -from vstf.controller.fabricant import Fabricant -from vstf.rpc_frame_work.rpc_producer import Server -from vstf.controller.env_build.cfg_intent_parse import IntentParser - -LOG = logging.getLogger(__name__) - - -class EnvBuildApi(object): - - def __init__(self, conn, config_file): - LOG.info("welcome to EnvBuilder") - self.conn = conn - intent_parser = IntentParser(config_file) - self.cfg_intent = intent_parser.parse_cfg_file() - - def build(self): - LOG.info("start build") - for host_cfg in self.cfg_intent['env-build']: - rpc = Fabricant(host_cfg['ip'], self.conn) - rpc.build_env(timeout=1800, cfg_intent=host_cfg) - return True - - def clean(self): - for host_cfg in self.cfg_intent['env-build']: - rpc = Fabricant(host_cfg['ip'], self.conn) - rpc.clean_env(timeout=120) - return True - - def get_hosts(self): - result = [] - for host_cfg in self.cfg_intent['env-build']: - host = { - 'name': host_cfg['ip'], - 'nic': "82599ES 10-Gigabit" - } - result.append(host) - return result - - -class TransmitterBuild(object): - - def __init__(self, conn, config_file): - LOG.info("welcome to TransmitterBuild") - self.conn = conn - self._cfg_intent = config_file["transmitter-build"] - - def build(self): - LOG.info("start build") - for cfg in self.cfg_intent: - rpc = Fabricant(cfg['ip'], self.conn) - cfg.setdefault("scheme", 'transmitter') - rpc.build_env(timeout=1800, cfg_intent=cfg) - return True - - def clean(self): - for cfg in self.cfg_intent: - rpc = Fabricant(cfg['ip'], self.conn) - rpc.clean_env(timeout=10) - return True - - -if __name__ == "__main__": - import argparse - - parser = argparse.ArgumentParser() - parser.add_argument( - '--rpc_server', - help='rabbitmq server for deliver messages.') - parser.add_argument('--config', help='config file to parse') - args = parser.parse_args() - logging.basicConfig(level=logging.INFO) - conn = Server(args.rpc_server) - tn = EnvBuildApi(conn, args.config) - tn.build()