Best Python code snippet using pytest-play_python
pcf-phase3.py
Source:pcf-phase3.py
...38 'rows': []}] }39 payload['name'] = iapp_name40 payload['properties'] = [{'id':'cloudConnectorReference', 'isRequired': False, 'value': cloud_connector}]41 42 payload = self._merge_payload(payload, service_name, app_names, pool_members)43 resp = self.iwf.post('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp' %(self.host, tenant),json=payload)44 print "Created iApp %s" % iapp_name45 def update_iapp(self, tenant, iapp_name, service_name, app_names, pool_members):46 resp = self.iwf.get('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp/%s' %(self.host, tenant, iapp_name)) 47 payload = resp.json()48 payload = self._merge_payload(payload, service_name, app_names, pool_members)49 50 resp = self.iwf.put('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp/%s' %(self.host, tenant, iapp_name),json=payload) 51 print "Updated iApp %s" % iapp_name52 def update_iapp_service(self, tenant, iapp_name, service_name, app_names, pool_members):53 resp = self.iwf.get('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp/%s' %(self.host, tenant, iapp_name)) 54 payload = resp.json()55 payload = self._merge_payload(payload, service_name, app_names, pool_members)56 resp = self.iwf.put('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp/%s' %(self.host, tenant, iapp_name),json=payload)57 print "Updated iApp %s Service to %s" % (iapp_name, service_name)58 def delete_iapp(self, iapp_name, tenant):59 resp = self.iwf.delete('https://%s/mgmt/cm/cloud/tenants/%s/services/iapp/%s' %(self.host, tenant, iapp_name))60 print "Deleted iApp %s" % iapp_name 61 def create_service(self, service_name, tenant, filename): 62 payload = yaml.load(open(filename))63 resp = self.iwf_admin.post('https://%s/mgmt/cm/cloud/provider/templates/iapp' %(self.host),json=payload)64 65 def delete_service(self, service_name, tenant):66 resp = self.iwf_admin.delete('https://%s/mgmt/cm/cloud/provider/templates/iapp/%s' %(self.host, service_name))67 def _merge_payload(self,payload, service_name, app_names, pool_members):68 monitor_table = None69 member_table = None70 pool_table = None71 rule_table = None72 action_table = None73 merge_payload = {}74 75 if app_names:76 monitor_str = "interval=30;timeout=91;send=GET /env/VCAP_APPLICATION HTTP/1.1\\r\\nhost: %s\\r\\nconnection:close\\r\\n\\r\\n;recv=%s" 77 monitor_table = [[str(x+1), '%s_monitor' %(app_names[x]), monitor_str %(app_names[x],app_names[x])] for x in range(num_apps)]78 monitor_table.insert(0,['0','_default_monitor',''])79 80 pool_table = [[str(x+1),str(x+1), '%s_pool' %(app_names[x])] for x in range(num_apps)]81 pool_table.insert(0,['0','0','_default_pool'])...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!