Best Python code snippet using tempest_python
brocade_ntp.py
Source:brocade_ntp.py
1#!/usr/bin/env python2import xml.etree.ElementTree as ET3class brocade_ntp(object):4 """Auto generated class.5 """6 def __init__(self, **kwargs):7 self._callback = kwargs.pop('callback')8 9 def show_ntp_input_rbridge_id(self, **kwargs):10 """Auto Generated Code11 """12 config = ET.Element("config")13 show_ntp = ET.Element("show_ntp")14 config = show_ntp15 if kwargs.pop('delete_show_ntp', False) is True:16 delete_show_ntp = config.find('.//*show-ntp')17 delete_show_ntp.set('operation', 'delete')18 19 input = ET.SubElement(show_ntp, "input")20 if kwargs.pop('delete_input', False) is True:21 delete_input = config.find('.//*input')22 delete_input.set('operation', 'delete')23 24 rbridge_id = ET.SubElement(input, "rbridge-id")25 if kwargs.pop('delete_rbridge_id', False) is True:26 delete_rbridge_id = config.find('.//*rbridge-id')27 delete_rbridge_id.set('operation', 'delete')28 29 rbridge_id.text = kwargs.pop('rbridge_id')30 callback = kwargs.pop('callback', self._callback)31 return callback(config)32 33 def show_ntp_output_node_active_server_rbridge_id_out(self, **kwargs):34 """Auto Generated Code35 """36 config = ET.Element("config")37 show_ntp = ET.Element("show_ntp")38 config = show_ntp39 if kwargs.pop('delete_show_ntp', False) is True:40 delete_show_ntp = config.find('.//*show-ntp')41 delete_show_ntp.set('operation', 'delete')42 43 output = ET.SubElement(show_ntp, "output")44 if kwargs.pop('delete_output', False) is True:45 delete_output = config.find('.//*output')46 delete_output.set('operation', 'delete')47 48 node_active_server = ET.SubElement(output, "node-active-server")49 if kwargs.pop('delete_node_active_server', False) is True:50 delete_node_active_server = config.find('.//*node-active-server')51 delete_node_active_server.set('operation', 'delete')52 53 rbridge_id_out = ET.SubElement(node_active_server, "rbridge-id-out")54 if kwargs.pop('delete_rbridge_id_out', False) is True:55 delete_rbridge_id_out = config.find('.//*rbridge-id-out')56 delete_rbridge_id_out.set('operation', 'delete')57 58 rbridge_id_out.text = kwargs.pop('rbridge_id_out')59 callback = kwargs.pop('callback', self._callback)60 return callback(config)61 62 def show_ntp_output_node_active_server_ip4_6_or_local_ipv4_6_active_server(self, **kwargs):63 """Auto Generated Code64 """65 config = ET.Element("config")66 show_ntp = ET.Element("show_ntp")67 config = show_ntp68 if kwargs.pop('delete_show_ntp', False) is True:69 delete_show_ntp = config.find('.//*show-ntp')70 delete_show_ntp.set('operation', 'delete')71 72 output = ET.SubElement(show_ntp, "output")73 if kwargs.pop('delete_output', False) is True:74 delete_output = config.find('.//*output')75 delete_output.set('operation', 'delete')76 77 node_active_server = ET.SubElement(output, "node-active-server")78 if kwargs.pop('delete_node_active_server', False) is True:79 delete_node_active_server = config.find('.//*node-active-server')80 delete_node_active_server.set('operation', 'delete')81 82 ip4_6_or_local = ET.SubElement(node_active_server, "ip4-6-or-local")83 if kwargs.pop('delete_ip4_6_or_local', False) is True:84 delete_ip4_6_or_local = config.find('.//*ip4-6-or-local')85 delete_ip4_6_or_local.set('operation', 'delete')86 87 ipv4_6 = ET.SubElement(ip4_6_or_local, "ipv4-6")88 if kwargs.pop('delete_ipv4_6', False) is True:89 delete_ipv4_6 = config.find('.//*ipv4-6')90 delete_ipv4_6.set('operation', 'delete')91 92 active_server = ET.SubElement(ipv4_6, "active-server")93 if kwargs.pop('delete_active_server', False) is True:94 delete_active_server = config.find('.//*active-server')95 delete_active_server.set('operation', 'delete')96 97 active_server.text = kwargs.pop('active_server')98 callback = kwargs.pop('callback', self._callback)99 return callback(config)100 101 def show_ntp_output_node_active_server_ip4_6_or_local_local_LOCL(self, **kwargs):102 """Auto Generated Code103 """104 config = ET.Element("config")105 show_ntp = ET.Element("show_ntp")106 config = show_ntp107 if kwargs.pop('delete_show_ntp', False) is True:108 delete_show_ntp = config.find('.//*show-ntp')109 delete_show_ntp.set('operation', 'delete')110 111 output = ET.SubElement(show_ntp, "output")112 if kwargs.pop('delete_output', False) is True:113 delete_output = config.find('.//*output')114 delete_output.set('operation', 'delete')115 116 node_active_server = ET.SubElement(output, "node-active-server")117 if kwargs.pop('delete_node_active_server', False) is True:118 delete_node_active_server = config.find('.//*node-active-server')119 delete_node_active_server.set('operation', 'delete')120 121 ip4_6_or_local = ET.SubElement(node_active_server, "ip4-6-or-local")122 if kwargs.pop('delete_ip4_6_or_local', False) is True:123 delete_ip4_6_or_local = config.find('.//*ip4-6-or-local')124 delete_ip4_6_or_local.set('operation', 'delete')125 126 local = ET.SubElement(ip4_6_or_local, "local")127 if kwargs.pop('delete_local', False) is True:128 delete_local = config.find('.//*local')129 delete_local.set('operation', 'delete')130 131 LOCL = ET.SubElement(local, "LOCL")132 if kwargs.pop('delete_LOCL', False) is True:133 delete_LOCL = config.find('.//*LOCL')134 delete_LOCL.set('operation', 'delete')135 136 LOCL.text = kwargs.pop('LOCL')137 callback = kwargs.pop('callback', self._callback)138 return callback(config)139 140 def ntp_server_ip(self, **kwargs):141 """Auto Generated Code142 """143 config = ET.Element("config")144 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")145 if kwargs.pop('delete_ntp', False) is True:146 delete_ntp = config.find('.//*ntp')147 delete_ntp.set('operation', 'delete')148 149 server = ET.SubElement(ntp, "server")150 if kwargs.pop('delete_server', False) is True:151 delete_server = config.find('.//*server')152 delete_server.set('operation', 'delete')153 154 use_vrf_key = ET.SubElement(server, "use-vrf")155 use_vrf_key.text = kwargs.pop('use_vrf')156 if kwargs.pop('delete_use_vrf', False) is True:157 delete_use_vrf = config.find('.//*use-vrf')158 delete_use_vrf.set('operation', 'delete')159 160 ip = ET.SubElement(server, "ip")161 if kwargs.pop('delete_ip', False) is True:162 delete_ip = config.find('.//*ip')163 delete_ip.set('operation', 'delete')164 165 ip.text = kwargs.pop('ip')166 callback = kwargs.pop('callback', self._callback)167 return callback(config)168 169 def ntp_server_key(self, **kwargs):170 """Auto Generated Code171 """172 config = ET.Element("config")173 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")174 if kwargs.pop('delete_ntp', False) is True:175 delete_ntp = config.find('.//*ntp')176 delete_ntp.set('operation', 'delete')177 178 server = ET.SubElement(ntp, "server")179 if kwargs.pop('delete_server', False) is True:180 delete_server = config.find('.//*server')181 delete_server.set('operation', 'delete')182 183 ip_key = ET.SubElement(server, "ip")184 ip_key.text = kwargs.pop('ip')185 if kwargs.pop('delete_ip', False) is True:186 delete_ip = config.find('.//*ip')187 delete_ip.set('operation', 'delete')188 189 use_vrf_key = ET.SubElement(server, "use-vrf")190 use_vrf_key.text = kwargs.pop('use_vrf')191 if kwargs.pop('delete_use_vrf', False) is True:192 delete_use_vrf = config.find('.//*use-vrf')193 delete_use_vrf.set('operation', 'delete')194 195 key = ET.SubElement(server, "key")196 if kwargs.pop('delete_key', False) is True:197 delete_key = config.find('.//*key')198 delete_key.set('operation', 'delete')199 200 key.text = kwargs.pop('key')201 callback = kwargs.pop('callback', self._callback)202 return callback(config)203 204 def ntp_server_use_vrf(self, **kwargs):205 """Auto Generated Code206 """207 config = ET.Element("config")208 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")209 if kwargs.pop('delete_ntp', False) is True:210 delete_ntp = config.find('.//*ntp')211 delete_ntp.set('operation', 'delete')212 213 server = ET.SubElement(ntp, "server")214 if kwargs.pop('delete_server', False) is True:215 delete_server = config.find('.//*server')216 delete_server.set('operation', 'delete')217 218 ip_key = ET.SubElement(server, "ip")219 ip_key.text = kwargs.pop('ip')220 if kwargs.pop('delete_ip', False) is True:221 delete_ip = config.find('.//*ip')222 delete_ip.set('operation', 'delete')223 224 use_vrf = ET.SubElement(server, "use-vrf")225 if kwargs.pop('delete_use_vrf', False) is True:226 delete_use_vrf = config.find('.//*use-vrf')227 delete_use_vrf.set('operation', 'delete')228 229 use_vrf.text = kwargs.pop('use_vrf')230 callback = kwargs.pop('callback', self._callback)231 return callback(config)232 233 def ntp_authentication_key_keyid(self, **kwargs):234 """Auto Generated Code235 """236 config = ET.Element("config")237 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")238 if kwargs.pop('delete_ntp', False) is True:239 delete_ntp = config.find('.//*ntp')240 delete_ntp.set('operation', 'delete')241 242 authentication_key = ET.SubElement(ntp, "authentication-key")243 if kwargs.pop('delete_authentication_key', False) is True:244 delete_authentication_key = config.find('.//*authentication-key')245 delete_authentication_key.set('operation', 'delete')246 247 keyid = ET.SubElement(authentication_key, "keyid")248 if kwargs.pop('delete_keyid', False) is True:249 delete_keyid = config.find('.//*keyid')250 delete_keyid.set('operation', 'delete')251 252 keyid.text = kwargs.pop('keyid')253 callback = kwargs.pop('callback', self._callback)254 return callback(config)255 256 def ntp_authentication_key_encryption_type_md5_type_md5(self, **kwargs):257 """Auto Generated Code258 """259 config = ET.Element("config")260 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")261 if kwargs.pop('delete_ntp', False) is True:262 delete_ntp = config.find('.//*ntp')263 delete_ntp.set('operation', 'delete')264 265 authentication_key = ET.SubElement(ntp, "authentication-key")266 if kwargs.pop('delete_authentication_key', False) is True:267 delete_authentication_key = config.find('.//*authentication-key')268 delete_authentication_key.set('operation', 'delete')269 270 keyid_key = ET.SubElement(authentication_key, "keyid")271 keyid_key.text = kwargs.pop('keyid')272 if kwargs.pop('delete_keyid', False) is True:273 delete_keyid = config.find('.//*keyid')274 delete_keyid.set('operation', 'delete')275 276 encryption_type = ET.SubElement(authentication_key, "encryption-type")277 if kwargs.pop('delete_encryption_type', False) is True:278 delete_encryption_type = config.find('.//*encryption-type')279 delete_encryption_type.set('operation', 'delete')280 281 md5_type = ET.SubElement(encryption_type, "md5-type")282 if kwargs.pop('delete_md5_type', False) is True:283 delete_md5_type = config.find('.//*md5-type')284 delete_md5_type.set('operation', 'delete')285 286 md5 = ET.SubElement(md5_type, "md5")287 if kwargs.pop('delete_md5', False) is True:288 delete_md5 = config.find('.//*md5')289 delete_md5.set('operation', 'delete')290 291 md5.text = kwargs.pop('md5')292 callback = kwargs.pop('callback', self._callback)293 return callback(config)294 295 def ntp_authentication_key_encryption_type_sha1_type_sha1(self, **kwargs):296 """Auto Generated Code297 """298 config = ET.Element("config")299 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")300 if kwargs.pop('delete_ntp', False) is True:301 delete_ntp = config.find('.//*ntp')302 delete_ntp.set('operation', 'delete')303 304 authentication_key = ET.SubElement(ntp, "authentication-key")305 if kwargs.pop('delete_authentication_key', False) is True:306 delete_authentication_key = config.find('.//*authentication-key')307 delete_authentication_key.set('operation', 'delete')308 309 keyid_key = ET.SubElement(authentication_key, "keyid")310 keyid_key.text = kwargs.pop('keyid')311 if kwargs.pop('delete_keyid', False) is True:312 delete_keyid = config.find('.//*keyid')313 delete_keyid.set('operation', 'delete')314 315 encryption_type = ET.SubElement(authentication_key, "encryption-type")316 if kwargs.pop('delete_encryption_type', False) is True:317 delete_encryption_type = config.find('.//*encryption-type')318 delete_encryption_type.set('operation', 'delete')319 320 sha1_type = ET.SubElement(encryption_type, "sha1-type")321 if kwargs.pop('delete_sha1_type', False) is True:322 delete_sha1_type = config.find('.//*sha1-type')323 delete_sha1_type.set('operation', 'delete')324 325 sha1 = ET.SubElement(sha1_type, "sha1")326 if kwargs.pop('delete_sha1', False) is True:327 delete_sha1 = config.find('.//*sha1')328 delete_sha1.set('operation', 'delete')329 330 sha1.text = kwargs.pop('sha1')331 callback = kwargs.pop('callback', self._callback)332 return callback(config)333 334 def ntp_authentication_key_encryption_level(self, **kwargs):335 """Auto Generated Code336 """337 config = ET.Element("config")338 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")339 if kwargs.pop('delete_ntp', False) is True:340 delete_ntp = config.find('.//*ntp')341 delete_ntp.set('operation', 'delete')342 343 authentication_key = ET.SubElement(ntp, "authentication-key")344 if kwargs.pop('delete_authentication_key', False) is True:345 delete_authentication_key = config.find('.//*authentication-key')346 delete_authentication_key.set('operation', 'delete')347 348 keyid_key = ET.SubElement(authentication_key, "keyid")349 keyid_key.text = kwargs.pop('keyid')350 if kwargs.pop('delete_keyid', False) is True:351 delete_keyid = config.find('.//*keyid')352 delete_keyid.set('operation', 'delete')353 354 encryption_level = ET.SubElement(authentication_key, "encryption-level")355 if kwargs.pop('delete_encryption_level', False) is True:356 delete_encryption_level = config.find('.//*encryption-level')357 delete_encryption_level.set('operation', 'delete')358 359 encryption_level.text = kwargs.pop('encryption_level')360 callback = kwargs.pop('callback', self._callback)361 return callback(config)362 363 def ntp_source_ip(self, **kwargs):364 """Auto Generated Code365 """366 config = ET.Element("config")367 ntp = ET.SubElement(config, "ntp", xmlns="urn:brocade.com:mgmt:brocade-ntp")368 if kwargs.pop('delete_ntp', False) is True:369 delete_ntp = config.find('.//*ntp')370 delete_ntp.set('operation', 'delete')371 372 source_ip = ET.SubElement(ntp, "source-ip")373 if kwargs.pop('delete_source_ip', False) is True:374 delete_source_ip = config.find('.//*source-ip')375 delete_source_ip.set('operation', 'delete')376 377 source_ip.text = kwargs.pop('source_ip')378 callback = kwargs.pop('callback', self._callback)379 return callback(config)...
encryption_types_client.py
Source:encryption_types_client.py
...56 resp, body = self.post(url, post_body)57 body = json.loads(body)58 self.validate_response(schema.create_encryption_type, resp, body)59 return rest_client.ResponseBody(resp, body)60 def delete_encryption_type(self, volume_type_id):61 """Delete the encryption type for the specified volume-type."""62 resp, body = self.delete(63 "/types/%s/encryption/provider" % volume_type_id)64 self.validate_response(schema.delete_encryption_type, resp, body)65 return rest_client.ResponseBody(resp, body)66 def update_encryption_type(self, volume_type_id, **kwargs):67 """Update an encryption type for an existing volume type.68 For a full list of available parameters, please refer to the official69 API reference:70 https://docs.openstack.org/api-ref/block-storage/v3/index.html#update-an-encryption-type71 """72 url = "/types/%s/encryption/provider" % volume_type_id73 put_body = json.dumps({'encryption': kwargs})74 resp, body = self.put(url, put_body)...
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!!