output = []
     try:
         output = subprocess.check_output(command, stdin=stdin, shell=True)
-    except Exception:
+    except Exception:  # pylint: disable=broad-except
         exitcode = -1
         LOG.error("exec command '%s' error:\n ", command, exc_info=True)
 
     __attacker_type__ = 'bare-metal-down'
 
     def setup(self):
+        # baremetal down need to recover even sla pass
+        self.mandatory = True
         LOG.debug("config:%s context:%s", self._config, self._context)
         host = self._context.get(self._config['host'], None)
 
 
--- /dev/null
+##############################################################################
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import unittest
+
+from yardstick.benchmark.scenarios.availability.attacker import baseattacker
+
+
+class BaseAttackerTestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.attacker_cfg = {
+            'fault_type': 'test-attacker',
+            'action_parameter': {'process_name': 'nova_api'},
+            'rollback_parameter': {'process_name': 'nova_api'},
+            'key': 'stop-service',
+            'attack_key': 'stop-service',
+            'host': 'node1',
+        }
+        self.base_attacker = baseattacker.BaseAttacker({}, {})
+
+    def test__init__(self):
+        self.assertEqual(self.base_attacker.data, {})
+        self.assertFalse(self.base_attacker.mandatory)
+        self.assertEqual(self.base_attacker.intermediate_variables, {})
+        self.assertFalse(self.base_attacker.mandatory)
+
+    def test_get_attacker_cls(self):
+        with self.assertRaises(RuntimeError):
+            baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
 
         ret = {}
         p.run(ret)
         attacker = mock.Mock()
+        attacker.mandatory = False
         p.attackers = [attacker]
         p.teardown()
         attacker.recover.assert_not_called()
+
+    @mock.patch.object(serviceha, 'baseattacker')
+    @mock.patch.object(serviceha, 'basemonitor')
+    def test__serviceha_teardown_when_mandatory(self, mock_monitor,
+                                                *args):
+        p = serviceha.ServiceHA(self.args, self.ctx)
+        p.setup()
+        self.assertTrue(p.setup_done)
+        mock_monitor.MonitorMgr().verify_SLA.return_value = True
+        ret = {}
+        p.run(ret)
+        attacker = mock.Mock()
+        attacker.mandatory = True
+        p.attackers = [attacker]
+        p.teardown()
+        attacker.recover.assert_called_once()