Best Python code snippet using tempest_python
sites.py
Source:sites.py
...112 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)113 self.assertRaises(subnets.SubnetAlreadyExists,114 subnets.create_subnet, self.ldb, basedn, cidr,115 self.sitename)116 subnets.delete_subnet(self.ldb, basedn, cidr)117 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,118 expression='(&(objectclass=subnet)(cn=%s))' % cidr)119 self.assertEqual(len(ret), 0, 'Failed to delete subnet %s' % cidr)120 def test_create_shift_delete(self):121 """Create a subnet, shift it to another site, then delete it."""122 basedn = self.ldb.get_config_basedn()123 cidr = "10.11.12.0/24"124 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)125 subnets.set_subnet_site(self.ldb, basedn, cidr, self.sitename2)126 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,127 expression='(&(objectclass=subnet)(cn=%s))' % cidr)128 sites = ret[0]['siteObject']129 self.assertEqual(len(sites), 1)130 self.assertEqual(str(sites[0]),131 'CN=testsite2,CN=Sites,%s' % self.ldb.get_config_basedn())132 self.assertRaises(subnets.SubnetAlreadyExists,133 subnets.create_subnet, self.ldb, basedn, cidr,134 self.sitename)135 subnets.delete_subnet(self.ldb, basedn, cidr)136 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,137 expression='(&(objectclass=subnet)(cn=%s))' % cidr)138 self.assertEqual(len(ret), 0, 'Failed to delete subnet %s' % cidr)139 def test_delete_subnet_that_does_not_exist(self):140 """Ensure we can't delete a site that isn't there."""141 basedn = self.ldb.get_config_basedn()142 cidr = "10.15.0.0/16"143 self.assertRaises(subnets.SubnetNotFound,144 subnets.delete_subnet, self.ldb, basedn, cidr)145 def get_user_and_ldb(self, username, password, hostname=ldaphost):146 """Get a connection for a temporarily user that will vanish as soon as147 the test is over."""148 user = self.ldb.newuser(username, password)149 creds_tmp = Credentials()150 creds_tmp.set_username(username)151 creds_tmp.set_password(password)152 creds_tmp.set_domain(creds.get_domain())153 creds_tmp.set_realm(creds.get_realm())154 creds_tmp.set_workstation(creds.get_workstation())155 creds_tmp.set_gensec_features(creds_tmp.get_gensec_features()156 | gensec.FEATURE_SEAL)157 creds_tmp.set_kerberos_state(DONT_USE_KERBEROS)158 ldb_target = SamDB(url=hostname, credentials=creds_tmp, lp=lp)159 self.addCleanup(delete_force, self.ldb, self.get_user_dn(username))160 return (user, ldb_target)161 def test_rename_delete_good_subnet_to_good_subnet_other_user(self):162 """Make sure that we can't rename or delete subnets when we aren't163 admin."""164 basedn = self.ldb.get_config_basedn()165 cidr = "10.16.0.0/24"166 new_cidr = "10.16.1.0/24"167 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)168 user, non_admin_ldb = self.get_user_and_ldb("notadmin", "samba123@")169 try:170 subnets.rename_subnet(non_admin_ldb, basedn, cidr, new_cidr)171 except LdbError as e:172 self.assertEqual(e.args[0], ERR_INSUFFICIENT_ACCESS_RIGHTS,173 ("subnet rename by non-admin failed "174 "in the wrong way: %s" % e))175 else:176 self.fail("subnet rename by non-admin succeeded")177 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,178 expression='(&(objectclass=subnet)(cn=%s))' % cidr)179 self.assertEqual(len(ret), 1, ('Subnet %s destroyed or renamed '180 'by non-admin' % cidr))181 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,182 expression=('(&(objectclass=subnet)(cn=%s))'183 % new_cidr))184 self.assertEqual(len(ret), 0,185 'New subnet %s created by non-admin' % cidr)186 try:187 subnets.delete_subnet(non_admin_ldb, basedn, cidr)188 except LdbError as e:189 self.assertEqual(e.args[0], ERR_INSUFFICIENT_ACCESS_RIGHTS,190 ("subnet delete by non-admin failed "191 "in the wrong way: %s" % e))192 else:193 self.fail("subnet delete by non-admin succeeded:")194 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,195 expression='(&(objectclass=subnet)(cn=%s))' % cidr)196 self.assertEqual(len(ret), 1, 'Subnet %s deleted non-admin' % cidr)197 subnets.delete_subnet(self.ldb, basedn, cidr)198 def test_create_good_subnet_other_user(self):199 """Make sure that we can't create subnets when we aren't admin."""200 basedn = self.ldb.get_config_basedn()201 cidr = "10.16.0.0/24"202 user, non_admin_ldb = self.get_user_and_ldb("notadmin", "samba123@")203 try:204 subnets.create_subnet(non_admin_ldb, basedn, cidr, self.sitename)205 except LdbError as e:206 self.assertEqual(e.args[0], ERR_INSUFFICIENT_ACCESS_RIGHTS,207 ("subnet create by non-admin failed "208 "in the wrong way: %s" % e))209 else:210 subnets.delete_subnet(self.ldb, basedn, cidr)211 self.fail("subnet create by non-admin succeeded: %s")212 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,213 expression='(&(objectclass=subnet)(cn=%s))' % cidr)214 self.assertEqual(len(ret), 0, 'New subnet %s created by non-admin' % cidr)215 def test_rename_good_subnet_to_good_subnet(self):216 """Make sure that we can rename subnets"""217 basedn = self.ldb.get_config_basedn()218 cidr = "10.16.0.0/24"219 new_cidr = "10.16.1.0/24"220 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)221 subnets.rename_subnet(self.ldb, basedn, cidr, new_cidr)222 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,223 expression='(&(objectclass=subnet)(cn=%s))' % new_cidr)224 self.assertEqual(len(ret), 1, 'Failed to rename subnet %s' % cidr)225 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,226 expression='(&(objectclass=subnet)(cn=%s))' % cidr)227 self.assertEqual(len(ret), 0, 'Failed to remove old subnet during rename %s' % cidr)228 subnets.delete_subnet(self.ldb, basedn, new_cidr)229 def test_rename_good_subnet_to_bad_subnet(self):230 """Make sure that the CIDR checking runs during rename"""231 basedn = self.ldb.get_config_basedn()232 cidr = "10.17.0.0/24"233 bad_cidr = "10.11.12.0/14"234 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)235 self.assertRaises(subnets.SubnetInvalid, subnets.rename_subnet,236 self.ldb, basedn, cidr, bad_cidr)237 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,238 expression='(&(objectclass=subnet)(cn=%s))' % bad_cidr)239 self.assertEqual(len(ret), 0, 'Failed to rename subnet %s' % cidr)240 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,241 expression='(&(objectclass=subnet)(cn=%s))' % cidr)242 self.assertEqual(len(ret), 1, 'Failed to remove old subnet during rename %s' % cidr)243 subnets.delete_subnet(self.ldb, basedn, cidr)244 def test_create_bad_ranges(self):245 """These CIDR ranges all have something wrong with them, and they246 should all fail."""247 basedn = self.ldb.get_config_basedn()248 cidrs = [249 # IPv4250 # insufficient zeros251 "10.11.12.0/14",252 "110.0.0.0/6",253 "1.0.0.0/0",254 "10.11.13.1/24",255 "1.2.3.4/29",256 "10.11.12.0/21",257 # out of range mask258 "110.0.0.0/33",259 "110.0.0.0/-1",260 "4.0.0.0/111",261 # out of range address262 "310.0.0.0/24",263 "10.0.0.256/32",264 "1.1.-20.0/24",265 # badly formed266 "1.0.0.0/1e",267 "1.0.0.0/24.0",268 "1.0.0.0/1/1",269 "1.0.0.0",270 "1.c.0.0/24",271 "1.2.0.0.0/27",272 "1.23.0/24",273 "1.23.0.-7/24",274 "1.-23.0.7/24",275 "1.23.-0.7/24",276 "1.23.0.0/0x10",277 # IPv6 insufficient zeros -- this could be a subtle one278 # due to the vagaries of endianness in the 16 bit groups.279 "aaaa:bbbb:cccc:dddd:eeee:ffff:2222:1100/119",280 "aaaa:bbbb::/31",281 "a:b::/31",282 "c000::/1",283 "a::b00/119",284 "1::1/127",285 "1::2/126",286 "1::100/119",287 "1::8000/112",288 # out of range mask289 "a:b::/130",290 "a:b::/-1",291 "::/129",292 # An IPv4 address can't be exactly the bitmask (MS ADTS)293 "128.0.0.0/1",294 "192.0.0.0/2",295 "255.192.0.0/10",296 "255.255.255.0/24",297 "255.255.255.255/32",298 "0.0.0.0/0",299 # The address can't have leading zeros (not RFC 4632, but MS ADTS)300 "00.1.2.0/24",301 "003.1.2.0/24",302 "022.1.0.0/16",303 "00000000000000000000000003.1.2.0/24",304 "09876::abfc/126",305 "0aaaa:bbbb::/32",306 "009876::abfc/126",307 "000a:bbbb::/32",308 # How about extraneous zeros later on309 "3.01.2.0/24",310 "3.1.2.00/24",311 "22.001.0.0/16",312 "3.01.02.0/24",313 "100a:0bbb:0023::/48",314 "100a::0023/128",315 # Windows doesn't like the zero IPv4 address316 "0.0.0.0/8",317 # or the zero mask on IPv6318 "::/0",319 # various violations of RFC5952320 "0:0:0:0:0:0:0:0/8",321 "0::0/0",322 "::0:0/48",323 "::0:4/128",324 "0::/8",325 "0::4f/128",326 "0::42:0:0:0:0/64",327 "4f::0/48",328 # badly formed -- mostly the wrong arrangement of colons329 "a::b::0/120",330 "a::abcdf:0/120",331 "a::g:0/120",332 "::0::3/48",333 "2001:3::110::3/118",334 "aaaa:bbbb:cccc:dddd:eeee:ffff:2222:1111:0000/128",335 "a:::5:0/120",336 # non-canonical representations (vs RFC 5952)337 # "2001:0:c633:63::1:0/120" is correct338 "2001:0:c633:63:0:0:1:0/120",339 "2001::c633:63:0:0:1:0/120",340 "2001:0:c633:63:0:0:1::/120",341 # "10:0:0:42::/64" is correct342 "10::42:0:0:0:0/64",343 "10:0:0:42:0:0:0:0/64",344 # "1::4:5:0:0:8/127" is correct345 "1:0:0:4:5:0:0:8/127",346 "1:0:0:4:5::8/127",347 # "2001:db8:0:1:1:1:1:1/128" is correct348 "2001:db8::1:1:1:1:1/128",349 # IP4 embedded - rejected350 "a::10.0.0.0/120",351 "a::10.9.8.7/128",352 # The next ones tinker indirectly with IPv4 embedding,353 # where Windows has some odd behaviour.354 #355 # Samba's libreplace inet_ntop6 expects IPv4 embedding356 # with addresses in these forms:357 #358 # ::wx:yz359 # ::FFFF:wx:yz360 #361 # these will be stringified with trailing dottted decimal, thus:362 #363 # ::w.x.y.z364 # ::ffff:w.x.y.z365 #366 # and this will cause the address to be rejected by Samba,367 # because it uses a inet_pton / inet_ntop round trip to368 # ascertain correctness.369 "::ffff:0:0/96", # this one fails on WIN2012r2370 "::ffff:aaaa:a000/120",371 "::ffff:10:0/120",372 "::ffff:2:300/120",373 "::3:0/120",374 "::2:30/124",375 "::ffff:2:30/124",376 # completely wrong377 None,378 "bob",379 3.1415,380 False,381 "10.11.16.0/24\x00hidden bytes past a zero",382 self,383 ]384 failures = []385 for cidr in cidrs:386 try:387 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)388 except subnets.SubnetInvalid:389 print("%s fails properly" % (cidr,), file=sys.stderr)390 continue391 # we are here because it succeeded when it shouldn't have.392 print("CIDR %s fails to fail" % (cidr,), file=sys.stderr)393 failures.append(cidr)394 subnets.delete_subnet(self.ldb, basedn, cidr)395 if failures:396 print("These bad subnet names were accepted:")397 for cidr in failures:398 print(" %s" % cidr)399 self.fail()400 def test_create_good_ranges(self):401 """All of these CIDRs are good, and the subnet creation should402 succeed."""403 basedn = self.ldb.get_config_basedn()404 cidrs = [405 # IPv4406 "10.11.12.0/24",407 "10.11.12.0/23",408 "10.11.12.0/25",409 "110.0.0.0/7",410 "1.0.0.0/32",411 "10.11.13.0/32",412 "10.11.13.1/32",413 "99.0.97.0/24",414 "1.2.3.4/30",415 "10.11.12.0/22",416 "0.12.13.0/24",417 # IPv6418 "aaaa:bbbb:cccc:dddd:eeee:ffff:2222:1100/120",419 "aaaa:bbbb:cccc:dddd:eeee:ffff:2222:11f0/124",420 "aaaa:bbbb:cccc:dddd:eeee:ffff:2222:11fc/126",421 # don't forget upper case422 "FFFF:FFFF:FFFF:FFFF:ABCD:EfFF:FFFF:FFeF/128",423 "9876::ab00/120",424 "9876::abf0/124",425 "9876::abfc/126",426 "aaaa:bbbb::/32",427 "aaaa:bbba::/31",428 "aaaa:ba00::/23",429 "aaaa:bb00::/24",430 "aaaa:bb00::/77",431 "::/48",432 "a:b::/32",433 "c000::/2",434 "a::b00/120",435 "1::2/127",436 # this pattern of address suffix == mask is forbidden with437 # IPv4 but OK for IPv6.438 "8000::/1",439 "c000::/2",440 "ffff:ffff:ffc0::/42",441 "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/128",442 # leading zeros are forbidden, but implicit IPv6 zeros443 # (via "::") are OK.444 "::1000/116",445 "::8000/113",446 # taken to the logical conclusion, "::/0" should be OK, but no.447 "::/48",448 # Try some reserved ranges, which it might be reasonable449 # to exclude, but which are not excluded in practice.450 "129.0.0.0/16",451 "129.255.0.0/16",452 "100.64.0.0/10",453 "127.0.0.0/8",454 "127.0.0.0/24",455 "169.254.0.0/16",456 "169.254.1.0/24",457 "192.0.0.0/24",458 "192.0.2.0/24",459 "198.18.0.0/15",460 "198.51.100.0/24",461 "203.0.113.0/24",462 "224.0.0.0/4",463 "130.129.0.0/16",464 "130.255.0.0/16",465 "192.12.0.0/24",466 "223.255.255.0/24",467 "240.255.255.0/24",468 "224.0.0.0/8",469 "::/96",470 "100::/64",471 "2001:10::/28",472 "fec0::/10",473 "ff00::/8",474 "::1/128",475 "2001:db8::/32",476 "2001:10::/28",477 "2002::/24",478 "2002:a00::/24",479 "2002:7f00::/24",480 "2002:a9fe::/32",481 "2002:ac10::/28",482 "2002:c000::/40",483 "2002:c000:200::/40",484 "2002:c0a8::/32",485 "2002:c612::/31",486 "2002:c633:6400::/40",487 "2002:cb00:7100::/40",488 "2002:e000::/20",489 "2002:f000::/20",490 "2002:ffff:ffff::/48",491 "2001::/40",492 "2001:0:a00::/40",493 "2001:0:7f00::/40",494 "2001:0:a9fe::/48",495 "2001:0:ac10::/44",496 "2001:0:c000::/56",497 "2001:0:c000:200::/56",498 "2001:0:c0a8::/48",499 "2001:0:c612::/47",500 "2001:0:c633:6400::/56",501 "2001:0:cb00:7100::/56",502 "2001:0:e000::/36",503 "2001:0:f000::/36",504 "2001:0:ffff:ffff::/64",505 # non-RFC-5952 versions of these are tested in create_bad_ranges506 "2001:0:c633:63::1:0/120",507 "10:0:0:42::/64",508 "1::4:5:0:0:8/127",509 "2001:db8:0:1:1:1:1:1/128",510 # The "well-known prefix" 64::ff9b is another IPv4511 # embedding scheme. Let's try that.512 "64:ff9b::aaaa:aaaa/127",513 "64:ff9b::/120",514 "64:ff9b::ffff:2:3/128",515 ]516 failures = []517 for cidr in cidrs:518 try:519 subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)520 except subnets.SubnetInvalid as e:521 print(e)522 failures.append(cidr)523 continue524 ret = self.ldb.search(base=basedn, scope=SCOPE_SUBTREE,525 expression=('(&(objectclass=subnet)(cn=%s))' %526 cidr))527 if len(ret) != 1:528 print("%s was not created" % cidr)529 failures.append(cidr)530 continue531 subnets.delete_subnet(self.ldb, basedn, cidr)532 if failures:533 print("These good subnet names were not accepted:")534 for cidr in failures:535 print(" %s" % cidr)536 self.fail()...
test_subnets.py
Source:test_subnets.py
...31 data = cls.client.create_vpc(CidrBlock=cls.VPC_CIDR)32 cls.vpc_id = data['Vpc']['VpcId']33 cls.addResourceCleanUpStatic(cls.client.delete_vpc, VpcId=cls.vpc_id)34 cls.get_vpc_waiter().wait_available(cls.vpc_id)35 def test_create_delete_subnet(self):36 cidr = self.BASE_CIDR + '/24'37 data = self.client.create_subnet(VpcId=self.vpc_id,38 CidrBlock=cidr)39 subnet_id = data['Subnet']['SubnetId']40 res_clean = self.addResourceCleanUp(self.client.delete_subnet,41 SubnetId=subnet_id)42 self.assertEqual(cidr, data['Subnet']['CidrBlock'])43 self.assertIsNotNone(data['Subnet'].get('AvailableIpAddressCount'))44 self.get_subnet_waiter().wait_available(subnet_id)45 data = self.client.delete_subnet(SubnetId=subnet_id)46 self.cancelResourceCleanUp(res_clean)47 self.get_subnet_waiter().wait_delete(subnet_id)48 self.assertRaises('InvalidSubnetID.NotFound',49 self.client.describe_subnets,50 SubnetIds=[subnet_id])51 self.assertRaises('InvalidSubnetID.NotFound',52 self.client.delete_subnet,53 SubnetId=subnet_id)54 def test_dependency_subnet_to_vpc(self):55 data = self.client.create_vpc(CidrBlock=self.VPC_CIDR)56 vpc_id = data['Vpc']['VpcId']57 vpc_clean = self.addResourceCleanUp(self.client.delete_vpc,58 VpcId=vpc_id)59 self.get_vpc_waiter().wait_available(vpc_id)60 cidr = self.BASE_CIDR + '/24'61 data = self.client.create_subnet(VpcId=vpc_id, CidrBlock=cidr)62 subnet_id = data['Subnet']['SubnetId']63 res_clean = self.addResourceCleanUp(self.client.delete_subnet,64 SubnetId=subnet_id)65 self.get_subnet_waiter().wait_available(subnet_id)66 self.assertRaises('DependencyViolation',67 self.client.delete_vpc,68 VpcId=vpc_id)69 data = self.client.delete_subnet(SubnetId=subnet_id)70 self.cancelResourceCleanUp(res_clean)71 self.get_subnet_waiter().wait_delete(subnet_id)72 self.client.delete_vpc(VpcId=vpc_id)73 self.cancelResourceCleanUp(vpc_clean)74 @testtools.skipUnless(75 CONF.aws.run_incompatible_tests,76 "bug with overlapped subnets")77 def test_create_overlapped_subnet(self):78 cidr = self.BASE_CIDR + '/24'79 data = self.client.create_subnet(VpcId=self.vpc_id, CidrBlock=cidr)80 subnet_id = data['Subnet']['SubnetId']81 res_clean = self.addResourceCleanUp(self.client.delete_subnet,82 SubnetId=subnet_id)83 self.get_subnet_waiter().wait_available(subnet_id)84 cidr = '10.2.0.128/26'85 def _rollback(fn_data):86 self.client.delete_subnet(SubnetId=data['Subnet']['SubnetId'])87 self.assertRaises('InvalidSubnet.Conflict',88 self.client.create_subnet, rollback_fn=_rollback,89 VpcId=self.vpc_id, CidrBlock=cidr)90 data = self.client.delete_subnet(SubnetId=subnet_id)91 self.cancelResourceCleanUp(res_clean)92 self.get_subnet_waiter().wait_delete(subnet_id)93 def test_create_subnet_invalid_cidr(self):94 def _rollback(fn_data):95 self.client.delete_subnet(SubnetId=fn_data['Subnet']['SubnetId'])96 # NOTE(andrey-mp): another cidr than VPC has97 cidr = '10.1.0.0/24'98 self.assertRaises('InvalidSubnet.Range',99 self.client.create_subnet, rollback_fn=_rollback,100 VpcId=self.vpc_id, CidrBlock=cidr)101 # NOTE(andrey-mp): bigger cidr than VPC has102 cidr = self.BASE_CIDR + '/19'103 self.assertRaises('InvalidSubnet.Range',104 self.client.create_subnet, rollback_fn=_rollback,105 VpcId=self.vpc_id, CidrBlock=cidr)106 # NOTE(andrey-mp): too small cidr107 cidr = self.BASE_CIDR + '/29'108 self.assertRaises('InvalidSubnet.Range',109 self.client.create_subnet, rollback_fn=_rollback,110 VpcId=self.vpc_id, CidrBlock=cidr)111 def test_describe_subnets_base(self):112 cidr = self.BASE_CIDR + '/24'113 data = self.client.create_subnet(VpcId=self.vpc_id, CidrBlock=cidr)114 subnet_id = data['Subnet']['SubnetId']115 res_clean = self.addResourceCleanUp(self.client.delete_subnet,116 SubnetId=subnet_id)117 self.get_subnet_waiter().wait_available(subnet_id)118 # NOTE(andrey-mp): by real id119 data = self.client.describe_subnets(SubnetIds=[subnet_id])120 self.assertEqual(1, len(data['Subnets']))121 # NOTE(andrey-mp): by fake id122 self.assertRaises('InvalidSubnetID.NotFound',123 self.client.describe_subnets,124 SubnetIds=['subnet-0'])125 data = self.client.delete_subnet(SubnetId=subnet_id)126 self.cancelResourceCleanUp(res_clean)127 self.get_subnet_waiter().wait_delete(subnet_id)128 def test_describe_subnets_filters(self):129 cidr = self.BASE_CIDR + '/24'130 data = self.client.create_subnet(VpcId=self.vpc_id, CidrBlock=cidr)131 subnet_id = data['Subnet']['SubnetId']132 res_clean = self.addResourceCleanUp(self.client.delete_subnet,133 SubnetId=subnet_id)134 self.get_subnet_waiter().wait_available(subnet_id)135 # NOTE(andrey-mp): by filter real cidr136 data = self.client.describe_subnets(137 Filters=[{'Name': 'cidr', 'Values': [cidr]}])138 self.assertEqual(1, len(data['Subnets']))139 # NOTE(andrey-mp): by filter fake cidr140 data = self.client.describe_subnets(141 Filters=[{'Name': 'cidr', 'Values': ['123.0.0.0/16']}])142 self.assertEqual(0, len(data['Subnets']))143 # NOTE(andrey-mp): by fake filter144 self.assertRaises('InvalidParameterValue',145 self.client.describe_subnets,146 Filters=[{'Name': 'fake', 'Values': ['fake']}])147 data = self.client.delete_subnet(SubnetId=subnet_id)148 self.cancelResourceCleanUp(res_clean)...
test015_delete_subnet.py
Source:test015_delete_subnet.py
...5 subnet_name_id = str(raw_input("Please provide Subnet name or id to delete: ")).strip()6 # get_subnet(name_or_id, filters=None)7 subnet = conn.get_subnet(subnet_name_id)8 if subnet is not None:9 # delete_subnet(name_or_id)10 conn.delete_subnet(subnet.id)11 print("Subnet " + subnet_name_id + " deleted")12 else:13 print("Subnet " + subnet_name_id + " doesn't exists")14 except Exception as e:
...
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!!