Пример #1
0
    def setUp(self):
        super(HPE3ParDriverTestCase, self).setUp()

        # Create a mock configuration with attributes and a safe_get()
        self.conf = mock.Mock()
        self.conf.driver_handles_share_servers = True
        self.conf.hpe3par_debug = constants.EXPECTED_HPE_DEBUG
        self.conf.hpe3par_username = constants.USERNAME
        self.conf.hpe3par_password = constants.PASSWORD
        self.conf.hpe3par_api_url = constants.API_URL
        self.conf.hpe3par_san_login = constants.SAN_LOGIN
        self.conf.hpe3par_san_password = constants.SAN_PASSWORD
        self.conf.hpe3par_san_ip = constants.EXPECTED_IP_1234
        self.conf.hpe3par_fpg = constants.EXPECTED_FPG
        self.conf.hpe3par_san_ssh_port = constants.PORT
        self.conf.ssh_conn_timeout = constants.TIMEOUT
        self.conf.hpe3par_share_ip_address = None
        self.conf.hpe3par_fstore_per_share = False
        self.conf.hpe3par_require_cifs_ip = False
        self.conf.network_config_group = 'test_network_config_group'

        def safe_get(attr):
            try:
                return self.conf.__getattribute__(attr)
            except AttributeError:
                return None

        self.conf.safe_get = safe_get

        self.real_hpe_3par_mediator = hpe3parmediator.HPE3ParMediator
        self.mock_object(hpe3parmediator, 'HPE3ParMediator')
        self.mock_mediator_constructor = hpe3parmediator.HPE3ParMediator
        self.mock_mediator = self.mock_mediator_constructor()

        self.driver = hpe3pardriver.HPE3ParShareDriver(configuration=self.conf)
Пример #2
0
    def setUp(self):
        super(HPE3ParDriverTestCase, self).setUp()

        # Create a mock configuration with attributes and a safe_get()
        self.conf = mock.Mock()
        self.conf.driver_handles_share_servers = True
        self.conf.hpe3par_debug = constants.EXPECTED_HPE_DEBUG
        self.conf.hpe3par_username = constants.USERNAME
        self.conf.hpe3par_password = constants.PASSWORD
        self.conf.hpe3par_api_url = constants.API_URL
        self.conf.hpe3par_san_login = constants.SAN_LOGIN
        self.conf.hpe3par_san_password = constants.SAN_PASSWORD
        self.conf.hpe3par_san_ip = constants.EXPECTED_IP_1234
        self.conf.hpe3par_fpg = constants.EXPECTED_FPG_CONF
        self.conf.hpe3par_san_ssh_port = constants.PORT
        self.conf.ssh_conn_timeout = constants.TIMEOUT
        self.conf.hpe3par_fstore_per_share = False
        self.conf.hpe3par_require_cifs_ip = False
        self.conf.hpe3par_cifs_admin_access_username = constants.USERNAME,
        self.conf.hpe3par_cifs_admin_access_password = constants.PASSWORD,
        self.conf.hpe3par_cifs_admin_access_domain = (
            constants.EXPECTED_CIFS_DOMAIN),
        self.conf.hpe3par_share_mount_path = constants.EXPECTED_MOUNT_PATH,
        self.conf.my_ip = constants.EXPECTED_IP_1234
        self.conf.network_config_group = 'test_network_config_group'
        self.conf.admin_network_config_group = (
            'test_admin_network_config_group')
        self.conf.filter_function = None
        self.conf.goodness_function = None

        def safe_get(attr):
            try:
                return self.conf.__getattribute__(attr)
            except AttributeError:
                return None

        self.conf.safe_get = safe_get

        self.real_hpe_3par_mediator = hpe3parmediator.HPE3ParMediator
        self.mock_object(hpe3parmediator, 'HPE3ParMediator')
        self.mock_mediator_constructor = hpe3parmediator.HPE3ParMediator
        self.mock_mediator = self.mock_mediator_constructor()
        # restore needed static methods
        self.mock_mediator.ensure_supported_protocol = (
            self.real_hpe_3par_mediator.ensure_supported_protocol)
        self.mock_mediator.build_export_locations = (
            self.real_hpe_3par_mediator.build_export_locations)

        self.driver = hpe3pardriver.HPE3ParShareDriver(configuration=self.conf)