filtered-azure-network.res 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. cloudbridge.test.test_network_service.CloudNetworkServiceTestCase
  2. Test output
  3. ........
  4. ----------------------------------------------------------------------
  5. Ran 8 tests in 685.382s
  6. OK
  7. Wrote profile results to run_single.py.lprof
  8. Timer unit: 1e-06 s
  9. Total time: 190.776 s
  10. Function: label at line 957
  11. Line # Hits Time Per Hit % Time Line Contents
  12. ==============================================================
  13. 957 @label.setter
  14. 958 # pylint:disable=arguments-differ
  15. 959 @profile
  16. 960 def label(self, value):
  17. 961 14 168.0 12.0 0.0 self.assert_valid_resource_label(value)
  18. 962 6 1815558.0 302593.0 1.0 network = self.network
  19. 963 # pylint:disable=protected-access
  20. 964 6 6.0 1.0 0.0 az_network = network._network
  21. 965 6 33.0 5.5 0.0 kwargs = {self.tag_name: value or ""}
  22. 966 6 8.0 1.3 0.0 az_network.tags.update(**kwargs)
  23. 967 6 42.0 7.0 0.0 self._provider.azure_client.update_network_tags(
  24. 968 6 188960422.0 31493403.7 99.0 az_network.id, az_network)
  25. Total time: 127.148 s
  26. Function: delete at line 1308
  27. Line # Hits Time Per Hit % Time Line Contents
  28. ==============================================================
  29. 1308 @dispatch(event="provider.networking.subnets.delete",
  30. 1309 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  31. 1310 @profile
  32. 1311 def delete(self, subnet):
  33. 1312 3 5.0 1.7 0.0 sn = subnet if isinstance(subnet, AzureSubnet) else self.get(subnet)
  34. 1313 3 2.0 0.7 0.0 if sn:
  35. 1314 3 32107906.0 10702635.3 25.3 self.provider.azure_client.delete_subnet(sn.id)
  36. 1315 # Although Subnet doesn't support labels, we use the parent
  37. 1316 # Network's tags to track the subnet's labels, thus that
  38. 1317 # network-level tag must be deleted with the subnet
  39. 1318 3 169.0 56.3 0.0 net_id = sn.network_id
  40. 1319 3 916549.0 305516.3 0.7 az_network = self.provider.azure_client.get_network(net_id)
  41. 1320 3 16.0 5.3 0.0 az_network.tags.pop(sn.tag_name)
  42. 1321 3 22.0 7.3 0.0 self.provider.azure_client.update_network_tags(
  43. 1322 3 94123007.0 31374335.7 74.0 az_network.id, az_network)
  44. Total time: 107.812 s
  45. Function: create at line 1283
  46. Line # Hits Time Per Hit % Time Line Contents
  47. ==============================================================
  48. 1283 @dispatch(event="provider.networking.subnets.create",
  49. 1284 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  50. 1285 @profile
  51. 1286 def create(self, label, network, cidr_block, zone):
  52. 1287 13 176.0 13.5 0.0 AzureSubnet.assert_valid_resource_label(label)
  53. 1288 # Although Subnet doesn't support tags in Azure, we use the parent
  54. 1289 # Network's tags to track its subnets' labels
  55. 1290 3 157.0 52.3 0.0 subnet_name = AzureSubnet._generate_name_from_label(label, "cb-sn")
  56. 1291
  57. 1292 network_id = network.id \
  58. 1293 3 12.0 4.0 0.0 if isinstance(network, Network) else network
  59. 1294
  60. 1295 3 17.0 5.7 0.0 subnet_info = self.provider.azure_client\
  61. 1296 .create_subnet(
  62. 1297 3 11.0 3.7 0.0 network_id,
  63. 1298 3 22.0 7.3 0.0 subnet_name,
  64. 1299 {
  65. 1300 3 12313650.0 4104550.0 11.4 'address_prefix': cidr_block
  66. 1301 }
  67. 1302 )
  68. 1303
  69. 1304 3 61.0 20.3 0.0 subnet = AzureSubnet(self.provider, subnet_info)
  70. 1305 3 95497765.0 31832588.3 88.6 subnet.label = label
  71. 1306 3 5.0 1.7 0.0 return subnet
  72. Total time: 94.4434 s
  73. Function: label at line 757
  74. Line # Hits Time Per Hit % Time Line Contents
  75. ==============================================================
  76. 757 @label.setter
  77. 758 # pylint:disable=arguments-differ
  78. 759 @profile
  79. 760 def label(self, value):
  80. 761 """
  81. 762 Set the network label.
  82. 763 """
  83. 764 11 141.0 12.8 0.0 self.assert_valid_resource_label(value)
  84. 765 3 14.0 4.7 0.0 self._network.tags.update(Label=value or "")
  85. 766 3 20.0 6.7 0.0 self._provider.azure_client. \
  86. 767 3 94443273.0 31481091.0 100.0 update_network_tags(self.id, self._network)
  87. Total time: 94.3677 s
  88. Function: label at line 1461
  89. Line # Hits Time Per Hit % Time Line Contents
  90. ==============================================================
  91. 1461 @label.setter
  92. 1462 # pylint:disable=arguments-differ
  93. 1463 @profile
  94. 1464 def label(self, value):
  95. 1465 """
  96. 1466 Set the router label.
  97. 1467 """
  98. 1468 11 156.0 14.2 0.0 self.assert_valid_resource_label(value)
  99. 1469 3 10.0 3.3 0.0 self._route_table.tags.update(Label=value or "")
  100. 1470 3 19.0 6.3 0.0 self._provider.azure_client. \
  101. 1471 3 3.0 1.0 0.0 update_route_table_tags(self._route_table.name,
  102. 1472 3 94367482.0 31455827.3 100.0 self._route_table)
  103. Total time: 22.1054 s
  104. Function: delete at line 1468
  105. Line # Hits Time Per Hit % Time Line Contents
  106. ==============================================================
  107. 1468 @dispatch(event="provider.networking.floating_ips.delete",
  108. 1469 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  109. 1470 @profile
  110. 1471 def delete(self, gateway, fip):
  111. 1472 2 5.0 2.5 0.0 fip_id = fip.id if isinstance(fip, AzureFloatingIP) else fip
  112. 1473 2 22105367.0 11052683.5 100.0 self.provider.azure_client.delete_floating_ip(fip_id)
  113. Total time: 19.7348 s
  114. Function: create at line 1189
  115. Line # Hits Time Per Hit % Time Line Contents
  116. ==============================================================
  117. 1189 @dispatch(event="provider.networking.networks.create",
  118. 1190 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  119. 1191 @profile
  120. 1192 def create(self, label, cidr_block):
  121. 1193 14 176.0 12.6 0.0 AzureNetwork.assert_valid_resource_label(label)
  122. 1194 params = {
  123. 1195 4 1410464.0 352616.0 7.1 'location': self.provider.azure_client.region_name,
  124. 1196 'address_space': {
  125. 1197 4 11.0 2.8 0.0 'address_prefixes': [cidr_block]
  126. 1198 },
  127. 1199 4 12.0 3.0 0.0 'tags': {'Label': label}
  128. 1200 }
  129. 1201
  130. 1202 4 208.0 52.0 0.0 network_name = AzureNetwork._generate_name_from_label(label, 'cb-net')
  131. 1203
  132. 1204 4 23.0 5.8 0.0 az_network = self.provider.azure_client.create_network(network_name,
  133. 1205 4 18323820.0 4580955.0 92.9 params)
  134. 1206 4 124.0 31.0 0.0 cb_network = AzureNetwork(self.provider, az_network)
  135. 1207 4 2.0 0.5 0.0 return cb_network
  136. Total time: 11.9861 s
  137. Function: create at line 1369
  138. Line # Hits Time Per Hit % Time Line Contents
  139. ==============================================================
  140. 1369 @dispatch(event="provider.networking.routers.create",
  141. 1370 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  142. 1371 @profile
  143. 1372 def create(self, label, network):
  144. 1373 1 64.0 64.0 0.0 router_name = AzureRouter._generate_name_from_label(label, "cb-router")
  145. 1374
  146. 1375 1 6.0 6.0 0.0 parameters = {"location": self.provider.region_name,
  147. 1376 1 1.0 1.0 0.0 "tags": {'Label': label}}
  148. 1377
  149. 1378 1 10.0 10.0 0.0 route = self.provider.azure_client. \
  150. 1379 1 11985961.0 11985961.0 100.0 create_route_table(router_name, parameters)
  151. 1380 1 25.0 25.0 0.0 return AzureRouter(self.provider, route)
  152. Total time: 11.5771 s
  153. Function: get at line 1168
  154. Line # Hits Time Per Hit % Time Line Contents
  155. ==============================================================
  156. 1168 @dispatch(event="provider.networking.networks.get",
  157. 1169 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  158. 1170 @profile
  159. 1171 def get(self, network_id):
  160. 1172 46 52.0 1.1 0.0 try:
  161. 1173 46 11575576.0 251643.0 100.0 network = self.provider.azure_client.get_network(network_id)
  162. 1174 45 1350.0 30.0 0.0 return AzureNetwork(self.provider, network)
  163. 1175 1 4.0 4.0 0.0 except (CloudError, InvalidValueException) as cloud_error:
  164. 1176 # Azure raises the cloud error if the resource not available
  165. 1177 1 126.0 126.0 0.0 log.exception(cloud_error)
  166. 1178 1 1.0 1.0 0.0 return None
  167. Total time: 11.1098 s
  168. Function: delete at line 1382
  169. Line # Hits Time Per Hit % Time Line Contents
  170. ==============================================================
  171. 1382 @dispatch(event="provider.networking.routers.delete",
  172. 1383 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  173. 1384 @profile
  174. 1385 def delete(self, router):
  175. 1386 1 2.0 2.0 0.0 r = router if isinstance(router, AzureRouter) else self.get(router)
  176. 1387 1 0.0 0.0 0.0 if r:
  177. 1388 1 11109796.0 11109796.0 100.0 self.provider.azure_client.delete_route_table(r.name)
  178. Total time: 10.0241 s
  179. Function: create at line 1452
  180. Line # Hits Time Per Hit % Time Line Contents
  181. ==============================================================
  182. 1452 @dispatch(event="provider.networking.floating_ips.create",
  183. 1453 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  184. 1454 @profile
  185. 1455 def create(self, gateway):
  186. 1456 public_ip_parameters = {
  187. 1457 2 31.0 15.5 0.0 'location': self.provider.azure_client.region_name,
  188. 1458 2 5.0 2.5 0.0 'public_ip_allocation_method': 'Static'
  189. 1459 }
  190. 1460
  191. 1461 2 8.0 4.0 0.0 public_ip_name = AzureFloatingIP._generate_name_from_label(
  192. 1462 2 118.0 59.0 0.0 None, 'cb-fip-')
  193. 1463
  194. 1464 2 11.0 5.5 0.0 floating_ip = self.provider.azure_client.\
  195. 1465 2 10023918.0 5011959.0 100.0 create_floating_ip(public_ip_name, public_ip_parameters)
  196. 1466 2 42.0 21.0 0.0 return AzureFloatingIP(self.provider, floating_ip)
  197. Total time: 7.66637 s
  198. Function: find at line 1272
  199. Line # Hits Time Per Hit % Time Line Contents
  200. ==============================================================
  201. 1272 @dispatch(event="provider.networking.subnets.find",
  202. 1273 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  203. 1274 @profile
  204. 1275 def find(self, network=None, **kwargs):
  205. 1276 6 4676201.0 779366.8 61.0 obj_list = self._list_subnets(network)
  206. 1277 6 16.0 2.7 0.0 filters = ['label']
  207. 1278 6 2989973.0 498328.8 39.0 matches = cb_helpers.generic_find(filters, kwargs, obj_list)
  208. 1279
  209. 1280 5 12.0 2.4 0.0 return ClientPagedResultList(self.provider,
  210. 1281 5 167.0 33.4 0.0 matches if matches else [])
  211. Total time: 5.74256 s
  212. Function: list at line 1180
  213. Line # Hits Time Per Hit % Time Line Contents
  214. ==============================================================
  215. 1180 @dispatch(event="provider.networking.networks.list",
  216. 1181 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  217. 1182 @profile
  218. 1183 def list(self, limit=None, marker=None):
  219. 1184 18 24.0 1.3 0.0 networks = [AzureNetwork(self.provider, network)
  220. 1185 18 5741811.0 318989.5 100.0 for network in self.provider.azure_client.list_networks()]
  221. 1186 18 62.0 3.4 0.0 return ClientPagedResultList(self.provider, networks,
  222. 1187 18 662.0 36.8 0.0 limit=limit, marker=marker)
  223. Total time: 5.57723 s
  224. Function: list at line 1264
  225. Line # Hits Time Per Hit % Time Line Contents
  226. ==============================================================
  227. 1264 @dispatch(event="provider.networking.subnets.list",
  228. 1265 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  229. 1266 @profile
  230. 1267 def list(self, network=None, limit=None, marker=None):
  231. 1268 11 28.0 2.5 0.0 return ClientPagedResultList(self.provider,
  232. 1269 11 5576772.0 506979.3 100.0 self._list_subnets(network),
  233. 1270 11 428.0 38.9 0.0 limit=limit, marker=marker)
  234. Total time: 4.13445 s
  235. Function: get_or_create_default at line 320
  236. Line # Hits Time Per Hit % Time Line Contents
  237. ==============================================================
  238. 320 @profile
  239. 321 def get_or_create_default(self, zone):
  240. 322 # Look for a CB-default subnet
  241. 323 3 4134440.0 1378146.7 100.0 matches = self.find(label=BaseSubnet.CB_DEFAULT_SUBNET_LABEL)
  242. 324 3 3.0 1.0 0.0 if matches:
  243. 325 3 5.0 1.7 0.0 return matches[0]
  244. 326
  245. 327 # No provider-default Subnet exists, try to create it (net + subnets)
  246. 328 network = self.provider.networking.networks.get_or_create_default()
  247. 329 subnet = self.create(BaseSubnet.CB_DEFAULT_SUBNET_LABEL, network,
  248. 330 BaseSubnet.CB_DEFAULT_SUBNET_IPV4RANGE, zone)
  249. 331 return subnet
  250. Total time: 1.65222 s
  251. Function: list at line 1442
  252. Line # Hits Time Per Hit % Time Line Contents
  253. ==============================================================
  254. 1442 @dispatch(event="provider.networking.floating_ips.list",
  255. 1443 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  256. 1444 @profile
  257. 1445 def list(self, gateway, limit=None, marker=None):
  258. 1446 7 12.0 1.7 0.0 floating_ips = [AzureFloatingIP(self.provider, floating_ip)
  259. 1447 7 1651954.0 235993.4 100.0 for floating_ip in self.provider.azure_client.
  260. 1448 list_floating_ips()]
  261. 1449 7 24.0 3.4 0.0 return ClientPagedResultList(self.provider, floating_ips,
  262. 1450 7 230.0 32.9 0.0 limit=limit, marker=marker)
  263. Total time: 1.55898 s
  264. Function: refresh at line 1474
  265. Line # Hits Time Per Hit % Time Line Contents
  266. ==============================================================
  267. 1474 @profile
  268. 1475 def refresh(self):
  269. 1476 6 49.0 8.2 0.0 self._route_table = self._provider.azure_client. \
  270. 1477 6 1558927.0 259821.2 100.0 get_route_table(self._route_table.name)
  271. Total time: 1.50925 s
  272. Function: refresh at line 782
  273. Line # Hits Time Per Hit % Time Line Contents
  274. ==============================================================
  275. 782 @profile
  276. 783 def refresh(self):
  277. 784 """
  278. 785 Refreshes the state of this network by re-querying the cloud provider
  279. 786 for its latest state.
  280. 787 """
  281. 788 5 18.0 3.6 0.0 try:
  282. 789 5 74.0 14.8 0.0 self._network = self._provider.azure_client.\
  283. 790 5 1508606.0 301721.2 100.0 get_network(self.id)
  284. 791 1 2.0 2.0 0.0 self._state = self._network.provisioning_state
  285. 792 4 11.0 2.8 0.0 except (CloudError, ValueError) as cloud_error:
  286. 793 4 531.0 132.8 0.0 log.exception(cloud_error.message)
  287. 794 # The network no longer exists and cannot be refreshed.
  288. 795 # set the state to unknown
  289. 796 4 8.0 2.0 0.0 self._state = 'unknown'
  290. Total time: 1.44414 s
  291. Function: list at line 1358
  292. Line # Hits Time Per Hit % Time Line Contents
  293. ==============================================================
  294. 1358 @dispatch(event="provider.networking.routers.list",
  295. 1359 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  296. 1360 @profile
  297. 1361 def list(self, limit=None, marker=None):
  298. 1362 6 10.0 1.7 0.0 routes = [AzureRouter(self.provider, route)
  299. 1363 for route in
  300. 1364 6 1443836.0 240639.3 100.0 self.provider.azure_client.list_route_tables()]
  301. 1365 6 32.0 5.3 0.0 return ClientPagedResultList(self.provider,
  302. 1366 6 4.0 0.7 0.0 routes,
  303. 1367 6 259.0 43.2 0.0 limit=limit, marker=marker)
  304. Total time: 1.06759 s
  305. Function: refresh at line 999
  306. Line # Hits Time Per Hit % Time Line Contents
  307. ==============================================================
  308. 999 @profile
  309. 1000 def refresh(self):
  310. 1001 """
  311. 1002 Refreshes the state of this network by re-querying the cloud provider
  312. 1003 for its latest state.
  313. 1004 """
  314. 1005 4 16.0 4.0 0.0 try:
  315. 1006 4 53.0 13.2 0.0 self._subnet = self._provider.azure_client. \
  316. 1007 4 1067113.0 266778.2 100.0 get_subnet(self.id)
  317. 1008 1 5.0 5.0 0.0 self._state = self._subnet.provisioning_state
  318. 1009 3 7.0 2.3 0.0 except (CloudError, ValueError) as cloud_error:
  319. 1010 3 388.0 129.3 0.0 log.exception(cloud_error.message)
  320. 1011 # The subnet no longer exists and cannot be refreshed.
  321. 1012 # set the state to unknown
  322. 1013 3 13.0 4.3 0.0 self._state = 'unknown'
  323. Total time: 0.710938 s
  324. Function: get at line 1430
  325. Line # Hits Time Per Hit % Time Line Contents
  326. ==============================================================
  327. 1430 @dispatch(event="provider.networking.floating_ips.get",
  328. 1431 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  329. 1432 @profile
  330. 1433 def get(self, gateway, fip_id):
  331. 1434 2 3.0 1.5 0.0 try:
  332. 1435 2 710652.0 355326.0 100.0 az_ip = self.provider.azure_client.get_floating_ip(fip_id)
  333. 1436 1 4.0 4.0 0.0 except (CloudError, InvalidValueException) as cloud_error:
  334. 1437 # Azure raises the cloud error if the resource not available
  335. 1438 1 264.0 264.0 0.0 log.exception(cloud_error)
  336. 1439 1 1.0 1.0 0.0 return None
  337. 1440 1 14.0 14.0 0.0 return AzureFloatingIP(self.provider, az_ip)
  338. Total time: 0.518986 s
  339. Function: get at line 1329
  340. Line # Hits Time Per Hit % Time Line Contents
  341. ==============================================================
  342. 1329 @dispatch(event="provider.networking.routers.get",
  343. 1330 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  344. 1331 @profile
  345. 1332 def get(self, router_id):
  346. 1333 2 2.0 1.0 0.0 try:
  347. 1334 2 518821.0 259410.5 100.0 route = self.provider.azure_client.get_route_table(router_id)
  348. 1335 1 17.0 17.0 0.0 return AzureRouter(self.provider, route)
  349. 1336 1 3.0 3.0 0.0 except (CloudError, InvalidValueException) as cloud_error:
  350. 1337 # Azure raises the cloud error if the resource not available
  351. 1338 1 141.0 141.0 0.0 log.exception(cloud_error)
  352. 1339 1 2.0 2.0 0.0 return None
  353. Total time: 0.487832 s
  354. Function: find at line 283
  355. Line # Hits Time Per Hit % Time Line Contents
  356. ==============================================================
  357. 283 @dispatch(event="provider.networking.networks.find",
  358. 284 priority=BaseCloudService.STANDARD_EVENT_PRIORITY)
  359. 285 @profile
  360. 286 def find(self, **kwargs):
  361. 287 3 4.0 1.3 0.0 obj_list = self
  362. 288 3 3.0 1.0 0.0 filters = ['label']
  363. 289 3 487780.0 162593.3 100.0 matches = cb_helpers.generic_find(filters, kwargs, obj_list)
  364. 290
  365. 291 # All kwargs should have been popped at this time.
  366. 292 2 2.0 1.0 0.0 if len(kwargs) > 0:
  367. 293 raise TypeError("Unrecognised parameters for search: %s."
  368. 294 " Supported attributes: %s" % (kwargs,
  369. 295 ", ".join(filters)))
  370. 296
  371. 297 2 3.0 1.5 0.0 return ClientPagedResultList(self.provider,
  372. 298 2 40.0 20.0 0.0 matches if matches else [])
  373. Total time: 0.478273 s
  374. Function: find at line 1341
  375. Line # Hits Time Per Hit % Time Line Contents
  376. ==============================================================
  377. 1341 @dispatch(event="provider.networking.routers.find",
  378. 1342 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  379. 1343 @profile
  380. 1344 def find(self, **kwargs):
  381. 1345 3 8.0 2.7 0.0 obj_list = self
  382. 1346 3 4.0 1.3 0.0 filters = ['label']
  383. 1347 3 478208.0 159402.7 100.0 matches = cb_helpers.generic_find(filters, kwargs, obj_list)
  384. 1348
  385. 1349 # All kwargs should have been popped at this time.
  386. 1350 2 2.0 1.0 0.0 if len(kwargs) > 0:
  387. 1351 raise InvalidParamException(
  388. 1352 "Unrecognised parameters for search: %s. Supported "
  389. 1353 "attributes: %s" % (kwargs, ", ".join(filters)))
  390. 1354
  391. 1355 2 3.0 1.5 0.0 return ClientPagedResultList(self.provider,
  392. 1356 2 48.0 24.0 0.0 matches if matches else [])
  393. Total time: 0.429782 s
  394. Function: find at line 375
  395. Line # Hits Time Per Hit % Time Line Contents
  396. ==============================================================
  397. 375 @dispatch(event="provider.networking.floating_ips.find",
  398. 376 priority=BaseCloudService.STANDARD_EVENT_PRIORITY)
  399. 377 @profile
  400. 378 def find(self, gateway, **kwargs):
  401. 379 3 16.0 5.3 0.0 obj_list = gateway.floating_ips
  402. 380 3 3.0 1.0 0.0 filters = ['name', 'public_ip']
  403. 381 3 429720.0 143240.0 100.0 matches = cb_helpers.generic_find(filters, kwargs, obj_list)
  404. 382 2 43.0 21.5 0.0 return ClientPagedResultList(self._provider, list(matches))
  405. Total time: 0.302909 s
  406. Function: get at line 1245
  407. Line # Hits Time Per Hit % Time Line Contents
  408. ==============================================================
  409. 1245 @dispatch(event="provider.networking.subnets.get",
  410. 1246 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  411. 1247 @profile
  412. 1248 def get(self, subnet_id):
  413. 1249 """
  414. 1250 Azure does not provide an api to get the subnet directly by id.
  415. 1251 It also requires the network id.
  416. 1252 To make it consistent across the providers the following code
  417. 1253 gets the specific code from the subnet list.
  418. 1254 """
  419. 1255 2 3.0 1.5 0.0 try:
  420. 1256 2 302739.0 151369.5 99.9 azure_subnet = self.provider.azure_client.get_subnet(subnet_id)
  421. 1257 return AzureSubnet(self.provider,
  422. 1258 1 16.0 16.0 0.0 azure_subnet) if azure_subnet else None
  423. 1259 1 2.0 2.0 0.0 except (CloudError, InvalidValueException) as cloud_error:
  424. 1260 # Azure raises the cloud error if the resource not available
  425. 1261 1 147.0 147.0 0.0 log.exception(cloud_error)
  426. 1262 1 2.0 2.0 0.0 return None
  427. Total time: 0.14658 s
  428. Function: get at line 1109
  429. Line # Hits Time Per Hit % Time Line Contents
  430. ==============================================================
  431. 1109 @dispatch(event="provider.compute.regions.get",
  432. 1110 priority=BaseRegionService.STANDARD_EVENT_PRIORITY)
  433. 1111 @profile
  434. 1112 def get(self, region_id):
  435. 1113 1 2.0 2.0 0.0 region = None
  436. 1114 3 146507.0 48835.7 100.0 for azureRegion in self.provider.azure_client.list_locations():
  437. 1115 3 4.0 1.3 0.0 if azureRegion.name == region_id:
  438. 1116 1 23.0 23.0 0.0 region = AzureRegion(self.provider, azureRegion)
  439. 1117 1 43.0 43.0 0.0 break
  440. 1118 1 1.0 1.0 0.0 return region
  441. Total time: 0.000112 s
  442. Function: get_or_create at line 1403
  443. Line # Hits Time Per Hit % Time Line Contents
  444. ==============================================================
  445. 1403 @dispatch(event="provider.networking.gateways.get_or_create",
  446. 1404 priority=BaseGatewayService.STANDARD_EVENT_PRIORITY)
  447. 1405 @profile
  448. 1406 def get_or_create(self, network):
  449. 1407 3 112.0 37.3 100.0 return self._gateway_singleton(network)