예제 #1
0
    def run_finalize(self):
        """ Tear down test execution environment and record test results
        """
        # Stop all VNFs started by TestSteps in case that something went wrong
        self.step_stop_vnfs()

        # umount hugepages if mounted
        self._umount_hugepages()

        # cleanup any namespaces created
        if os.path.isdir('/tmp/namespaces'):
            namespace_list = os.listdir('/tmp/namespaces')
            if len(namespace_list):
                self._logger.info('Cleaning up namespaces')
            for name in namespace_list:
                namespace.delete_namespace(name)
            os.rmdir('/tmp/namespaces')
        # cleanup any veth ports created
        if os.path.isdir('/tmp/veth'):
            veth_list = os.listdir('/tmp/veth')
            if len(veth_list):
                self._logger.info('Cleaning up veth ports')
            for eth in veth_list:
                port1, port2 = eth.split('-')
                veth.del_veth_port(port1, port2)
            os.rmdir('/tmp/veth')
예제 #2
0
    def run_finalize(self):
        """ Tear down test execution environment and record test results
        """
        # Stop all VNFs started by TestSteps in case that something went wrong
        self.step_stop_vnfs()

        # Cleanup any LLC-allocations
        if S.getValue('LLC_ALLOCATION'):
            self._rmd.cleanup_llc_allocation()

        # Stop all processes executed by testcase
        tasks.terminate_all_tasks(self._logger)

        # umount hugepages if mounted
        self._umount_hugepages()

        # cleanup any namespaces created
        if os.path.isdir('/tmp/namespaces'):
            namespace_list = os.listdir('/tmp/namespaces')
            if namespace_list:
                self._logger.info('Cleaning up namespaces')
            for name in namespace_list:
                namespace.delete_namespace(name)
            os.rmdir('/tmp/namespaces')
        # cleanup any veth ports created
        if os.path.isdir('/tmp/veth'):
            veth_list = os.listdir('/tmp/veth')
            if veth_list:
                self._logger.info('Cleaning up veth ports')
            for eth in veth_list:
                port1, port2 = eth.split('-')
                veth.del_veth_port(port1, port2)
            os.rmdir('/tmp/veth')