def test_list_port_groups(self, mock_storage_view): mock_storage_view.return_value = GET_STORAGE_VIEW list_port_groups = VplexStorageDriver(**ACCESS_INFO).\ list_port_groups(context) port_groups_result = { 'port_groups': list_port_groups.get('port_groups'), 'port_grp_port_rels': list_port_groups.get('port_grp_port_rels') } self.assertDictEqual(port_groups_result, list_port_groups_result)
def test_list_masking_views(self, mock_storage_view, mock_storage_hosts): mock_storage_view.return_value = list_storage_hosts_result mock_storage_hosts.return_value = GET_STORAGE_VIEW list_masking_views = VplexStorageDriver(**ACCESS_INFO). \ list_masking_views(context) self.assertDictEqual(list_masking_views[0], list_masking_views_result[0])
def test_get_storage(self): RestHandler.get_rest_info = mock.Mock(side_effect=[ GET_HEALH_CHECK, GET_ALL_CLUSTER, GET_CLUSTER, GET_ALL_STORAGE_VOLUME_SUMMARY, GET_ALL_POOLS_SUMMARY, GET_ALL_LUNS_SUMMARY ]) storage = VplexStorageDriver(**ACCESS_INFO).get_storage(context) self.assertDictEqual(storage, storage_result)
def test_list_port(self, mock_hardware_port, mock_export_port): mock_hardware_port.return_value = GET_ALL_ENGINE_DIRECTOR_HARDWARE_PORT mock_export_port.return_value = GET_ALL_CLUSTER_EXPORT_PORT ports = VplexStorageDriver(**ACCESS_INFO).list_ports(context) self.assertDictEqual(ports[0], ports_result[0])
def test_list_controller(self, mock_controller, mocke_version): mocke_version.return_value = GET_VERSION_VERBOSE mock_controller.return_value = GET_ALL_ENGINE_DIRECTOR controllers = VplexStorageDriver(**ACCESS_INFO). \ list_controllers(context) self.assertDictEqual(controllers[0], controllers_result[0])
def test_list_alerts(self): with self.assertRaises(Exception) as exc: VplexStorageDriver(**ACCESS_INFO).list_alerts(context) self.assertEqual('list_alerts is not supported in model VPLEX', str(exc.exception))
def test_list_storage_pools(self, mock_name, mock_device, mock_cluster): mock_cluster.return_value = GET_ALL_CLUSTER mock_device.return_value = GET_ALL_POOLS mock_name.return_value = GET_POOL pool = VplexStorageDriver(**ACCESS_INFO).list_storage_pools(context) self.assertDictEqual(pool[0], pool_result[0])
def test_list_volumes(self, mock_name, mock_volume, mock_cluster): mock_cluster.return_value = GET_ALL_CLUSTER mock_volume.return_value = GET_ALL_LUNS mock_name.return_value = GET_LUN volume = VplexStorageDriver(**ACCESS_INFO).list_volumes(context) self.assertDictEqual(volume[0], volume_result[0])
def test_parse_alert(self): trap = VplexStorageDriver(**ACCESS_INFO).parse_alert( context, TRAP_INFO) trap_result['occur_time'] = trap['occur_time'] self.assertDictEqual(trap, trap_result)
def test_list_storage_host_initiators(self, mock_initiators_port): mock_initiators_port.return_value = GET_INITIATORS_PORT list_storage_host_initiators = VplexStorageDriver(**ACCESS_INFO). \ list_storage_host_initiators(context) self.assertDictEqual(list_storage_host_initiators[0], list_storage_host_initiators_result[0])
def test_list_storage_hosts(self, mock_storage_view): mock_storage_view.return_value = GET_INITIATORS_PORT list_storage_hosts = VplexStorageDriver(**ACCESS_INFO). \ list_storage_hosts(context) self.assertDictEqual(list_storage_hosts[0], list_storage_hosts_result[0])