示例#1
0
def _get_env(result, versions):
    """
    Get system configuration.

    :returns: Return a dictionary of the test environment.
              The following is an example return value:
               {'kernel': '3.10.0-229.4.2.el7.x86_64',
                'os': 'OS Version',
                'cpu': ' CPU 2.30GHz',
                'platform': '[2 sockets]',
                'nic': 'NIC'}

    """
    def _get_version(name, versions):
        """Returns version of tool with given `name` if version was not read
        during runtime (not inside given `versions` list), then it will be
        obtained by call of systeminfo.get_version()
        """
        for version in versions:
            if version.get()['name'] == name:
                return version

        return systeminfo.get_version(name)

    env = {
        'os': systeminfo.get_os(),
        'kernel': systeminfo.get_kernel(),
        'nics': systeminfo.get_nic(),
        'cpu': systeminfo.get_cpu(),
        'cpu_cores': systeminfo.get_cpu_cores(),
        'memory': systeminfo.get_memory(),
        'platform': systeminfo.get_platform(),
        'vsperf': systeminfo.get_version('vswitchperf'),
        'traffic_gen': systeminfo.get_version(S.getValue('TRAFFICGEN')),
        'vswitch': _get_version(S.getValue('VSWITCH'), versions),
    }

    if str(S.getValue('VSWITCH')).lower().count('dpdk'):
        env.update({'dpdk': _get_version('dpdk', versions)})

    if result[ResultsConstants.DEPLOYMENT].count('v'):
        env.update({
            'vnf':
            systeminfo.get_version(S.getValue('VNF')),
            'guest_image':
            S.getValue('GUEST_IMAGE'),
            'loopback_app':
            list(
                map(systeminfo.get_loopback_version,
                    S.getValue('GUEST_LOOPBACK'))),
        })

    return env
示例#2
0
def configure_env():
    """Configure envionment for TCL.

    """
    os.environ['IXIA_HOME'] = _IXIA_ROOT_DIR

    # USER MAY NEED TO CHANGE THESE IF USING OWN TCL LIBRARY
    os.environ['TCL_HOME'] = _IXIA_ROOT_DIR
    os.environ['TCLver'] = '8.5'

    # USER NORMALLY DOES NOT CHANGE ANY LINES BELOW
    os.environ['IxiaLibPath'] = os.path.expandvars('$IXIA_HOME/lib')
    os.environ['IxiaBinPath'] = os.path.expandvars('$IXIA_HOME/bin')

    os.environ['TCLLibPath'] = os.path.expandvars('$TCL_HOME/lib')
    os.environ['TCLBinPath'] = os.path.expandvars('$TCL_HOME/bin')

    os.environ['TCL_LIBRARY'] = os.path.expandvars('$TCLLibPath/tcl$TCLver')
    os.environ['TK_LIBRARY'] = os.path.expandvars('$TCLLibPath/tk$TCLver')

    os.environ['PATH'] = os.path.expandvars('$IxiaBinPath:.:$TCLBinPath:$PATH')
    os.environ['TCLLIBPATH'] = os.path.expandvars('$IxiaLibPath')
    os.environ['LD_LIBRARY_PATH'] = os.path.expandvars(
        '$IxiaLibPath:$TCLLibPath:$LD_LIBRARY_PATH')

    os.environ['IXIA_RESULTS_DIR'] = '/tmp/Ixia/Results'
    os.environ['IXIA_LOGS_DIR'] = '/tmp/Ixia/Logs'
    os.environ['IXIA_TCL_DIR'] = os.path.expandvars('$IxiaLibPath')
    os.environ['IXIA_SAMPLES'] = os.path.expandvars('$IxiaLibPath/ixTcl1.0')
    os.environ['IXIA_VERSION'] = systeminfo.get_version('Ixia').get()['version']
示例#3
0
    def _get_version(name, versions):
        """Returns version of tool with given `name` if version was not read
        during runtime (not inside given `versions` list), then it will be
        obtained by call of systeminfo.get_version()
        """
        for version in versions:
            if version.get()['name'] == name:
                return version

        return systeminfo.get_version(name)
示例#4
0
def _get_env(result):
    """
    Get system configuration.

    :returns: Return a dictionary of the test environment.
              The following is an example return value:
               {'kernel': '3.10.0-229.4.2.el7.x86_64',
                'os': 'OS Version',
                'cpu': ' CPU 2.30GHz',
                'platform': '[2 sockets]',
                'nic': 'NIC'}

    """

    env = {
        'os': systeminfo.get_os(),
        'kernel': systeminfo.get_kernel(),
        'nics': systeminfo.get_nic(),
        'cpu': systeminfo.get_cpu(),
        'cpu_cores': systeminfo.get_cpu_cores(),
        'memory': systeminfo.get_memory(),
        'platform': systeminfo.get_platform(),
        'vsperf': systeminfo.get_version('vswitchperf'),
        'traffic_gen': systeminfo.get_version(S.getValue('TRAFFICGEN')),
        'vswitch': systeminfo.get_version(S.getValue('VSWITCH')),
    }

    if S.getValue('VSWITCH').lower().count('dpdk'):
        env.update({'dpdk': systeminfo.get_version('dpdk')})

    if result[ResultsConstants.DEPLOYMENT].count('v'):
        env.update({
            'vnf':
            systeminfo.get_version(S.getValue('VNF')),
            'guest_image':
            S.getValue('GUEST_IMAGE'),
            'loopback_app':
            list(map(systeminfo.get_version, S.getValue('GUEST_LOOPBACK'))),
        })

    return env