コード例 #1
0
ファイル: VppConfigGenerator.py プロジェクト: yossihan/csit
    def apply_config(self, filename=None, verify_vpp=True):
        """Generate and write VPP startup configuration to file and restart VPP.

        Use data from calls to this class to form a startup.conf file and
        replace /etc/vpp/startup.conf with it on topology node.

        :param filename: Startup configuration file name.
        :param verify_vpp: Verify VPP is running after restart.
        :type filename: str
        :type verify_vpp: bool
        """
        self.write_config(filename=filename)

        VPPUtil.restart_vpp_service(self._node, self._node_key)
        if verify_vpp:
            VPPUtil.verify_vpp(self._node)
コード例 #2
0
ファイル: QemuUtils.py プロジェクト: yossihan/csit
    def _wait_until_kernelvm_boot(self, retries=60):
        """Wait until QEMU KernelVM is booted.

        :param retries: Number of retries.
        :type retries: int
        """
        vpp_ver = VPPUtil.vpp_show_version(self._node)

        for _ in range(retries):
            command = f"tail -1 {self._temp.get(u'log')}"
            stdout = None
            try:
                stdout, _ = exec_cmd_no_error(self._node, command, sudo=True)
                sleep(1)
            except RuntimeError:
                pass
            if vpp_ver in stdout or u"Press enter to exit" in stdout:
                break
            if u"reboot: Power down" in stdout:
                raise RuntimeError(
                    f"QEMU: NF failed to run on {self._node[u'host']}!"
                )
        else:
            raise RuntimeError(
                f"QEMU: Timeout, VM not booted on {self._node[u'host']}!"
            )
コード例 #3
0
    def crypto_device_init(node, numvfs):
        """Init Crypto QAT device virtual functions on DUT.

        :param node: DUT node.
        :param numvfs: Number of VFs to initialize, 0 - disable the VFs.
        :type node: dict
        :type numvfs: int
        :returns: nothing
        :raises RuntimeError: If failed to stop VPP or QAT failed to initialize.
        """
        cryptodev = Topology.get_cryptodev(node)

        # QAT device must be re-bound to kernel driver before initialization
        driver = 'dh895xcc'
        kernel_module = 'qat_dh895xcc'
        current_driver = DUTSetup.get_pci_dev_driver(
            node, cryptodev.replace(':', r'\:'))

        DUTSetup.kernel_module_verify(node, kernel_module, force_load=True)

        VPPUtil.stop_vpp_service(node)
        if current_driver is not None:
            DUTSetup.pci_driver_unbind(node, cryptodev)
        DUTSetup.pci_driver_bind(node, cryptodev, driver)

        ssh = SSH()
        ssh.connect(node)

        # Initialize QAT VFs
        if numvfs > 0:
            cmd = 'echo "{0}" | tee /sys/bus/pci/devices/{1}/sriov_numvfs'.\
                format(numvfs, cryptodev.replace(':', r'\:'), timeout=180)
            ret_code, _, _ = ssh.exec_command_sudo("sh -c '{0}'".format(cmd))

            if int(ret_code) != 0:
                raise RuntimeError(
                    'Failed to initialize {0} VFs on QAT device '
                    ' on host {1}'.format(numvfs, node['host']))
コード例 #4
0
    def verify_vpp_papi(self, retries=120, retry_wait=1):
        """Verify that VPP is available for PAPI.

        This also opens and caches PAPI connection for quick reuse.
        The connection is disconnected when ContainerManager decides to do so.

        :param retries: Check for VPP for this number of times Default: 120
        :param retry_wait: Wait for this number of seconds between retries.
        """
        # Wait for success.
        for _ in range(retries + 1):
            try:
                VPPUtil.vpp_show_version(
                    node=self.container.node,
                    remote_vpp_socket=self.container.api_socket,
                    log=False,
                )
                break
            except (RuntimeError, AssertionError):
                sleep(retry_wait)
        else:
            self.execute(u"cat /tmp/vppd.log")
            raise RuntimeError(
                f"VPP PAPI fails in container: {self.container.name}")
コード例 #5
0
ファイル: QemuUtils.py プロジェクト: preym17/csit
    def _wait_until_kernelvm_boot(self, retries=60):
        """Wait until QEMU KernelVM is booted.

        :param retries: Number of retries.
        :type retries: int
        """
        vpp_ver = VPPUtil.vpp_show_version(self._node)

        for _ in range(retries):
            command = ('tail -1 {log}'.format(log=self._temp.get('log')))
            stdout = None
            try:
                stdout, _ = exec_cmd_no_error(self._node, command, sudo=True)
                sleep(1)
            except RuntimeError:
                pass
            if vpp_ver in stdout or 'Press enter to exit' in stdout:
                break
            if 'reboot: Power down' in stdout:
                raise RuntimeError('QEMU: NF failed to run on {host}!'.
                                   format(host=self._node['host']))
        else:
            raise RuntimeError('QEMU: Timeout, VM not booted on {host}!'.
                               format(host=self._node['host']))