def get_glm_license_subflow(self, prefix, role): sf_name = prefix + '-' + a10constants.ACTIVATE_GLM_LICENSE_SUBFLOW glm_license_subflow = linear_flow.Flow(sf_name) if role == constants.ROLE_BACKUP: glm_license_subflow.add( vthunder_tasks.SetVThunderHostname( name=sf_name + '-' + a10constants.SET_VTHUNDER_HOSTNAME, requires=constants.AMPHORA, rebind={ a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER })) glm_license_subflow.add( glm_tasks.ConfigureForwardProxyServer( name=sf_name + '-' + a10constants.CONFIGURE_PROXY_SERVER, requires=constants.FLAVOR, rebind={ a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER })) glm_license_subflow.add( glm_tasks.DNSConfiguration( name=sf_name + '-' + a10constants.CONFIGURE_DNS_NAMESERVERS, requires=constants.FLAVOR, rebind={ a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER }, )) glm_license_subflow.add( glm_tasks.ActivateFlexpoolLicense( name=sf_name + '-' + a10constants.ACTIVATE_FLEXPOOL_LICENSE, requires=(constants.AMPHORA, constants.FLAVOR), rebind={ a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER }, )) else: glm_license_subflow.add( vthunder_tasks.SetVThunderHostname( name=sf_name + '-' + a10constants.SET_VTHUNDER_HOSTNAME, requires=(constants.AMPHORA, a10constants.VTHUNDER))) glm_license_subflow.add( glm_tasks.ConfigureForwardProxyServer( name=sf_name + '-' + a10constants.CONFIGURE_PROXY_SERVER, requires=(constants.FLAVOR, a10constants.VTHUNDER))) glm_license_subflow.add( glm_tasks.DNSConfiguration( name=sf_name + '-' + a10constants.CONFIGURE_DNS_NAMESERVERS, requires=(constants.FLAVOR, a10constants.VTHUNDER))) glm_license_subflow.add( glm_tasks.ActivateFlexpoolLicense( name=sf_name + '-' + a10constants.ACTIVATE_FLEXPOOL_LICENSE, requires=(constants.AMPHORA, a10constants.VTHUNDER, constants.FLAVOR), )) return glm_license_subflow
def test_ConfigureForwardProxyServer_execute_no_proxy_conf(self): self.conf.config(group=a10constants.GLM_LICENSE_CONFIG_SECTION, proxy_host=None, proxy_port=None) vthunder = copy.deepcopy(VTHUNDER) proxy_server = task.ConfigureForwardProxyServer() proxy_server.axapi_client = self.client_mock proxy_server.execute(vthunder) self.client_mock.glm.proxy_server.create.assert_not_called()
def test_ConfigureForwardProxyServer_execute_no_vthunder_warn(self): proxy_server = task.ConfigureForwardProxyServer() proxy_server.axapi_client = self.client_mock task_path = "a10_octavia.controller.worker.tasks.glm_tasks" log_message = str("No vthunder therefore forward proxy server cannot be configured.") expected_log = ["WARNING:{}:{}".format(task_path, log_message)] with self.assertLogs(task_path, level='WARN') as cm: proxy_server.execute(None, None) self.assertEqual(expected_log, cm.output)
def test_ConfigureForwardProxyServer_execute_success(self): self.conf.config(group=a10constants.GLM_LICENSE_CONFIG_SECTION, proxy_host=PROXY_HOST, proxy_port=PROXY_PORT, proxy_username=PROXY_USERNAME, proxy_password=PROXY_PASSWORD, proxy_secret_string=PROXY_PASSWORD_VALUE) vthunder = copy.deepcopy(VTHUNDER) proxy_server = task.ConfigureForwardProxyServer() proxy_server.axapi_client = self.client_mock proxy_server.execute(vthunder) self.client_mock.glm.proxy_server.create.assert_called()
def test_ConfigureForwardProxyServer_execute_flavor_success(self): flavor = { 'glm-proxy-server': { 'proxy_host': PROXY_HOST, 'proxy_port': PROXY_PORT, 'proxy_username': PROXY_USERNAME, 'proxy_password': PROXY_PASSWORD, 'proxy_secret_string': PROXY_PASSWORD_VALUE } } self.conf.config(group=a10constants.GLM_LICENSE_CONFIG_SECTION, proxy_host="10.10.10.11", proxy_port=8888, proxy_username='******', proxy_password=False, proxy_secret_string='configpwrd') vthunder = copy.deepcopy(VTHUNDER) proxy_server = task.ConfigureForwardProxyServer() proxy_server.axapi_client = self.client_mock proxy_server.execute(vthunder, flavor) self.client_mock.glm.proxy_server.create.assert_called_with(**{'host': PROXY_HOST, 'port': PROXY_PORT, 'username': PROXY_USERNAME, 'password': PROXY_PASSWORD, 'secret_string': PROXY_PASSWORD_VALUE})