summaryrefslogtreecommitdiffstats
path: root/.gitreview
blob: 09e06ca559af96243a74d9d64b2cb203494cb692 (plain)
1
2
3
4
[gerrit]
host=gerrit.opnfv.org
port=29418
project=armband.git
.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
"""
Description:
    This file include basis functions
    lanqinglong@huawei.com
"""

import logging
import os
import time
import yaml

class foundation:

    def __init__(self):

        currentpath = os.getcwd()
        self.logdir = os.path.join( currentpath, 'log' )
        self.workhome = currentpath[0:currentpath.rfind('testcases')-1]
        self.Result_DB = ''

    def log (self, loginfo):
        """
        Record log in log directory for deploying test environment
        parameters:
        loginfo(input): record info
        """
        filename = time.strftime( '%Y-%m-%d-%H-%M-%S' ) + '.log'
        filepath = os.path.join( self.logdir, filename )
        logging.basicConfig( level=logging.INFO,
                format = '%(asctime)s %(filename)s:%(message)s',
                datefmt = '%d %b %Y %H:%M:%S',
                filename = filepath,
                filemode = 'w')
        filelog = logging.FileHandler( filepath )
        logging.getLogger( 'Functest' ).addHandler( filelog )
        print loginfo
        logging.info(loginfo)

    def getdefaultpara( self ):
        """
        Get Default Parameters value
        """
        with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
            functest_yaml = yaml.safe_load(f)
        f.close()

        self.Result_DB = str(functest_yaml.get("results").get("test_db_url"))
        self.masterusername = str(functest_yaml.get("ONOS").get("general").\
                                 get('onosbench_username'))
        self.masterpassword = str(functest_yaml.get("ONOS").get("general").\
                                 get("onosbench_password"))
        self.agentusername = str(functest_yaml.get("ONOS").get("general").\
                                 get("onoscli_username"))
        self.agentpassword = str(functest_yaml.get("ONOS").get("general").\
                                 get("onoscli_password"))
        self.runtimeout = functest_yaml.get("ONOS").get("general").get("runtimeout")
        self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT"))
        self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1"))
        self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2"))
        self.OC3 = str(functest_yaml.get("ONOS").get("environment").get("OC3"))
        self.OCN = str(functest_yaml.get("ONOS").get("environment").get("OCN"))
        self.OCN2 = str(functest_yaml.get("ONOS").get("environment").get("OCN2"))
        self.localhost = self.OCT
        return True