コード例 #1
0
 def test_existing_rccg(self, svc_authorize_mock, svc_obj_info_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'started',
         'clean': 'true'
     })
     svc_obj_info_mock.return_value = {
         "id": "11",
         "name": "test_name",
         "master_cluster_id": "0000020321E04566",
         "master_cluster_name": "FlashSystem V9000",
         "aux_cluster_id": "0000020321E04566",
         "aux_cluster_name": "FlashSystem V9000",
         "primary": "",
         "state": "empty",
         "relationship_count": "0",
         "freeze_time": "",
         "status": "",
         "sync": "",
         "copy_type": "empty_group",
         "cycling_mode": "",
         "cycle_period_seconds": "0"
     }
     obj = IBMSVCStartStopReplication()
     return_data = obj.existing_rccg()
     self.assertEqual("test_name", return_data["name"])
コード例 #2
0
 def test_stop_when_isgroup(self, svc_authorize_mock, svc_run_command_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'stopped',
         'isgroup': 'true'
     })
     svc_run_command_mock.return_value = ''
     obj = IBMSVCStartStopReplication()
     return_data = obj.stop()
     self.assertEqual(None, return_data)
 def test_stop_remotecopy(self, svc_authorize_mock, svc_run_command_mock,
                          start_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'stopped',
     })
     with pytest.raises(AnsibleExitJson) as exc:
         obj = IBMSVCStartStopReplication()
         obj.apply()
     self.assertEqual(True, exc.value.args[0]['changed'])
コード例 #4
0
 def test_failure_stopping_rcrelationship(self, svc_authorize_mock,
                                          svc_run_command_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'stopped',
     })
     svc_run_command_mock.return_value = {}
     with pytest.raises(AnsibleFailJson) as exc:
         obj = IBMSVCStartStopReplication()
         obj.stop()
     self.assertEqual(True, exc.value.args[0]['failed'])
 def test_for_failure_with_activeactive(self, svc_authorize_mock,
                                        svc_run_command_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'started',
         'clean': 'true'
     })
     with pytest.raises(AnsibleFailJson) as exc:
         obj = IBMSVCStartStopReplication()
         obj.apply()
     self.assertEqual(True, exc.value.args[0]['failed'])
コード例 #6
0
 def test_stop_remotecopy_when_isgroup(self, svc_authorize_mock,
                                       svc_run_command_mock,
                                       existing_rccg_mock, start_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'stopped',
         'clean': 'true',
         'isgroup': 'true'
     })
     existing_rccg_mock.return_value = {
         "id": "226",
         "name": "test_name",
         "master_cluster_id": "0000020321E04566",
         "master_cluster_name": "FlashSystem V9000",
         "master_vdisk_id": "226",
         "master_vdisk_name": "vol9",
         "aux_cluster_id": "0000020321E04566",
         "aux_cluster_name": "FlashSystem V9000",
         "aux_vdisk_id": "227",
         "aux_vdisk_name": "vol10",
         "primary": "master",
         "consistency_group_id": "",
         "consistency_group_name": "",
         "state": "consistent_synchronized",
         "bg_copy_priority": "50",
         "progress": "",
         "freeze_time": "",
         "status": "online",
         "sync": "",
         "copy_type": "metro",
         "cycling_mode": "",
         "cycle_period_seconds": "300",
         "master_change_vdisk_id": "",
         "master_change_vdisk_name": "",
         "aux_change_vdisk_id": "",
         "aux_change_vdisk_name": ""
     }
     with pytest.raises(AnsibleExitJson) as exc:
         obj = IBMSVCStartStopReplication()
         obj.apply()
     self.assertEqual(True, exc.value.args[0]['changed'])
コード例 #7
0
 def test_existing_rc(self, svc_authorize_mock, svc_obj_info_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'started',
         'clean': 'true'
     })
     svc_obj_info_mock.return_value = {
         "id": "226",
         "name": "test_name",
         "master_cluster_id": "0000020321E04566",
         "master_cluster_name": "FlashSystem V9000",
         "master_vdisk_id": "226",
         "master_vdisk_name": "vol9",
         "aux_cluster_id": "0000020321E04566",
         "aux_cluster_name": "FlashSystem V9000",
         "aux_vdisk_id": "227",
         "aux_vdisk_name": "vol10",
         "primary": "master",
         "consistency_group_id": "",
         "consistency_group_name": "",
         "state": "consistent_synchronized",
         "bg_copy_priority": "50",
         "progress": "",
         "freeze_time": "",
         "status": "online",
         "sync": "",
         "copy_type": "metro",
         "cycling_mode": "",
         "cycle_period_seconds": "300",
         "master_change_vdisk_id": "",
         "master_change_vdisk_name": "",
         "aux_change_vdisk_id": "",
         "aux_change_vdisk_name": ""
     }
     obj = IBMSVCStartStopReplication()
     return_data = obj.existing_rc()
     self.assertEqual("test_name", return_data["name"])
コード例 #8
0
 def test_ishyperswap(self, svc_authorize_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'state': 'stopped',
         'isgroup': 'true'
     })
     arg_data = {
         "id": "226",
         "name": "test_name",
         "master_cluster_id": "0000020321E04566",
         "master_cluster_name": "FlashSystem V9000",
         "master_vdisk_id": "226",
         "master_vdisk_name": "vol9",
         "aux_cluster_id": "0000020321E04566",
         "aux_cluster_name": "FlashSystem V9000",
         "aux_vdisk_id": "227",
         "aux_vdisk_name": "vol10",
         "primary": "master",
         "consistency_group_id": "",
         "consistency_group_name": "",
         "state": "consistent_synchronized",
         "bg_copy_priority": "50",
         "progress": "",
         "freeze_time": "",
         "status": "online",
         "sync": "",
         "copy_type": "activeactive",
         "cycling_mode": "",
         "cycle_period_seconds": "300",
         "master_change_vdisk_id": "",
         "master_change_vdisk_name": "",
         "aux_change_vdisk_id": "",
         "aux_change_vdisk_name": ""
     }
     obj = IBMSVCStartStopReplication()
     return_data = obj.ishyperswap(arg_data)
     self.assertEqual(True, return_data)
コード例 #9
0
 def test_module_fail_when_required_args_missing(self):
     """ required arguments are reported as errors """
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args({})
         IBMSVCStartStopReplication()
     print('Info: %s' % exc.value.args[0]['msg'])