Exemplo n.º 1
0
    def test_is_ssh_blocked_returned_true(self, mock_netcat):
        """
        Checks the proper funcitonality of is_ssh_blocked
        function when the returncode is non-zero integer
        """

        dest_ip = 'mock_destination_ip'
        nc_calls = [call('10.10.10.10',
                         'mock_destination_ip',
                         destination_port='22',
                         source_port=None)]

        mock_netcat.return_value = 1
        self.assertTrue(test_utils.is_ssh_blocked(self.ip, dest_ip))
        mock_netcat.assert_has_calls(nc_calls)
Exemplo n.º 2
0
    def present_results_ssh(self):
        """Check whether the connection between server and client using
        SSH protocol is blocked or not.

        :return: The results for the specific action of the scenario
        """

        logger.info("Test SSH")
        if test_utils.is_ssh_blocked(self.client_floating_ip, self.server_ip):
            results.add_to_summary(2, "PASS", "SSH Blocked")
        else:
            error = ('\033[91mTEST [FAILED] ==> SSH NOT BLOCKED\033[0m')
            logger.error(error)
            test_utils.capture_ovs_logs(
                self.ovs_logger, self.controller_clients, self.compute_clients,
                error)
            results.add_to_summary(2, "FAIL", "SSH Works")

        return results