def create_listener(self, lb_id): listener_name = f5_os_test.random_name('test_listener_', 6) listener_config =\ {'listener': {'name': listener_name, 'loadbalancer_id': lb_id, 'protocol': 'HTTP', 'protocol_port': 80}} return self.ncm.create_listener(listener_config)['listener']
def create_vip(self, pool_id, subnet_id): vip_name = f5_os_test.random_name('test_vip_', 6) vip_conf = {'vip': {'name': vip_name, 'pool_id': pool_id, 'subnet_id': subnet_id, 'protocol': 'HTTP', 'protocol_port': 80}} return self.ncm.create_vip(vip_conf)['vip']
def create_lbaas_pool(self, l_id): pool_name = f5_os_test.random_name('test_pool_', 6) pool_config = { 'pool': { 'name': pool_name, 'lb_algorithm': 'ROUND_ROBIN', 'listener_id': l_id, 'protocol': 'HTTP'}} return self.ncm.create_lbaas_pool(pool_config)['pool']
def create_listener(self, lb_id, tls_container_ref, sni_container_refs=[]): listener_name = f5_os_test.random_name('test_listener_', 6) listener_config =\ {'listener': {'name': listener_name, 'loadbalancer_id': lb_id, 'protocol': 'TERMINATED_HTTPS', 'protocol_port': 443, 'default_tls_container_ref': tls_container_ref, 'sni_container_refs': sni_container_refs}} return self.ncm.create_listener(listener_config)['listener']
def create_lbaas_pool(self, l_id): pool_name = f5_os_test.random_name('test_pool_', 6) pool_config = { 'pool': { 'name': pool_name, 'lb_algorithm': 'ROUND_ROBIN', 'listener_id': l_id, 'protocol': 'HTTP' } } return self.ncm.create_lbaas_pool(pool_config)['pool']
def create_listener(self, lb_id): listener_name = f5_os_test.random_name('test_listener_', 6) listener_config = { 'listener': { 'name': listener_name, 'loadbalancer_id': lb_id, 'protocol': 'HTTP', 'protocol_port': 80 } } return self.ncm.create_listener(listener_config)['listener']
def create_vip(self, pool_id, subnet_id): vip_name = f5_os_test.random_name('test_vip_', 6) vip_conf = { 'vip': { 'name': vip_name, 'pool_id': pool_id, 'subnet_id': subnet_id, 'protocol': 'HTTP', 'protocol_port': 80 } } return self.ncm.create_vip(vip_conf)['vip']
def create_pool(self): pool_name = f5_os_test.random_name('test_pool_', 6) pool_conf = {} for sn in self.ncm.list_subnets()['subnets']: if sn['name'] == self.symbols['client_subnet']: pool_conf = {'pool': {'tenant_id': sn['tenant_id'], 'lb_method': 'ROUND_ROBIN', 'protocol': 'HTTP', 'subnet_id': sn['id'], 'provider': self.symbols['provider'], 'name': pool_name}} return self.ncm.create_pool(pool_conf)['pool']
def create_loadbalancer(self): lb_name = f5_os_test.random_name('test_lb_', 6) lb_conf = {} for sn in self.ncm.list_subnets()['subnets']: if sn['name'] == self.symbols['client_subnet']: lb_conf = { 'loadbalancer': { 'vip_subnet_id': sn['id'], #'lb_method': 'ROUND_ROBIN', 'tenant_id': sn['tenant_id'], 'provider': self.symbols['provider'], 'name': lb_name}} return self.ncm.create_loadbalancer(lb_conf)['loadbalancer']
def create_loadbalancer(self): lb_name = f5_os_test.random_name('test_lb_', 6) lb_conf = {} for sn in self.ncm.list_subnets()['subnets']: if sn['name'] == self.symbols['client_subnet']: lb_conf = { 'loadbalancer': { 'vip_subnet_id': sn['id'], #'lb_method': 'ROUND_ROBIN', 'tenant_id': sn['tenant_id'], 'provider': self.symbols['provider'], 'name': lb_name } } return self.ncm.create_loadbalancer(lb_conf)['loadbalancer']
def create_pool(self): pool_name = f5_os_test.random_name('test_pool_', 6) pool_conf = {} for sn in self.ncm.list_subnets()['subnets']: if sn['name'] == self.symbols['client_subnet']: pool_conf = { 'pool': { 'tenant_id': sn['tenant_id'], 'lb_method': 'ROUND_ROBIN', 'protocol': 'HTTP', 'subnet_id': sn['id'], 'provider': self.symbols['provider'], 'name': pool_name } } return self.ncm.create_pool(pool_conf)['pool']
class UpdateScenarioBase(object): lb_name = f5_os_test.random_name('test_lb_', 6) ncpm = NeutronClientPollingManager(**nclient_config) subnets = ncpm.list_subnets()['subnets'] for sn in subnets: if 'client-v4' in sn['name']: lbconf = {'vip_subnet_id': sn['id'], 'tenant_id': sn['tenant_id'], 'name': lb_name} # loadbalancer setup activelb =\ ncpm.create_loadbalancer({'loadbalancer': lbconf}) active_loadbalancer_config = activelb['loadbalancer'] loadbalancer_updater = UpdateScanner(active_loadbalancer_config) lb_param_vector = loadbalancer_updater.param_vector # listener setup listener_name = f5_os_test.random_name('test_listener_', 6) listener_config = {'listener': {'name': listener_name, 'loadbalancer_id': activelb['loadbalancer']['id'], 'protocol': 'HTTP', 'protocol_port': 80}} active_listener = ncpm.create_listener(listener_config) active_listener_config = active_listener['listener'] listener_updater = UpdateScanner(active_listener_config) listener_param_vector = listener_updater.param_vector # pool setup pool_name = f5_os_test.random_name('test_pool_', 6) pool_config = {'pool': { 'name': pool_name, 'lb_algorithm': 'ROUND_ROBIN', 'listener_id': active_listener['listener']['id'], 'protocol': 'HTTP'}} active_pool = ncpm.create_lbaas_pool(pool_config) active_pool_config = active_pool['pool'] pool_updater = UpdateScanner(active_pool_config) pool_param_vector = pool_updater.param_vector # pool member setup for sn in ncpm.list_subnets()['subnets']: if 'server-v4' in sn['name']: address = sn['allocation_pools'][0]['start'] subnet_id = sn['id'] break member_config = {'member': { 'subnet_id': subnet_id, 'address': address, 'protocol_port': 80}} pool_id = active_pool_config['id'] active_member = ncpm.create_lbaas_member(pool_id, member_config) active_member_config = active_member['member'] member_updater = UpdateScanner(active_member_config) member_param_vector = member_updater.param_vector # healthmonitor setup monitor_config = {'healthmonitor': { 'delay': 3, 'pool_id': pool_id, 'type': 'HTTP', 'timeout': 13, 'max_retries': 7}} healthmonitor = ncpm.create_lbaas_healthmonitor(monitor_config) healthmonitorconfig = healthmonitor['healthmonitor'] healthmonitor_updater = UpdateScanner(healthmonitorconfig) healthmonitor_param_vector = healthmonitor_updater.param_vector