2
0

filtered-aws-network.res 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. cloudbridge.test.test_network_service.CloudNetworkServiceTestCase
  2. Test output
  3. ........
  4. ----------------------------------------------------------------------
  5. Ran 8 tests in 30.995s
  6. OK
  7. Wrote profile results to run_single.py.lprof
  8. Timer unit: 1e-06 s
  9. Total time: 3.05072 s
  10. Function: create at line 990
  11. Line # Hits Time Per Hit % Time Line Contents
  12. ==============================================================
  13. 990 @dispatch(event="provider.networking.networks.create",
  14. 991 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  15. 992 @profile
  16. 993 def create(self, label, cidr_block):
  17. 994 14 195.0 13.9 0.0 AWSNetwork.assert_valid_resource_label(label)
  18. 995
  19. 996 4 1045892.0 261473.0 34.3 cb_net = self.svc.create('create_vpc', CidrBlock=cidr_block)
  20. 997 # Wait until ready to tag instance
  21. 998 4 1455860.0 363965.0 47.7 cb_net.wait_till_ready()
  22. 999 4 2.0 0.5 0.0 if label:
  23. 1000 4 548765.0 137191.2 18.0 cb_net.label = label
  24. 1001 4 4.0 1.0 0.0 return cb_net
  25. Total time: 1.91408 s
  26. Function: list at line 1049
  27. Line # Hits Time Per Hit % Time Line Contents
  28. ==============================================================
  29. 1049 @dispatch(event="provider.networking.subnets.list",
  30. 1050 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  31. 1051 @profile
  32. 1052 def list(self, network=None, limit=None, marker=None):
  33. 1053 14 67.0 4.8 0.0 network_id = network.id if isinstance(network, AWSNetwork) else network
  34. 1054 14 14.0 1.0 0.0 if network_id:
  35. 1055 6 16.0 2.7 0.0 return self.svc.find(
  36. 1056 6 2.0 0.3 0.0 filter_name='vpc-id', filter_value=network_id,
  37. 1057 6 806283.0 134380.5 42.1 limit=limit, marker=marker)
  38. 1058 else:
  39. 1059 8 1107701.0 138462.6 57.9 return self.svc.list(limit=limit, marker=marker)
  40. Total time: 1.73717 s
  41. Function: get_or_create at line 1273
  42. Line # Hits Time Per Hit % Time Line Contents
  43. ==============================================================
  44. 1273 @dispatch(event="provider.networking.gateways.get_or_create",
  45. 1274 priority=BaseGatewayService.STANDARD_EVENT_PRIORITY)
  46. 1275 @profile
  47. 1276 def get_or_create(self, network):
  48. 1277 3 6.0 2.0 0.0 network_id = network.id if isinstance(
  49. 1278 3 30.0 10.0 0.0 network, AWSNetwork) else network
  50. 1279 # Don't filter by label because it may conflict with at least the
  51. 1280 # default VPC that most accounts have but that network is typically
  52. 1281 # without a name.
  53. 1282 3 8.0 2.7 0.0 gtw = self.svc.find(filter_name='attachment.vpc-id',
  54. 1283 3 422247.0 140749.0 24.3 filter_value=network_id)
  55. 1284 3 6.0 2.0 0.0 if gtw:
  56. 1285 return gtw[0] # There can be only one gtw attached to a VPC
  57. 1286 # Gateway does not exist so create one and attach to the supplied net
  58. 1287 3 406758.0 135586.0 23.4 cb_gateway = self.svc.create('create_internet_gateway')
  59. 1288 3 6.0 2.0 0.0 cb_gateway._gateway.create_tags(
  60. 1289 3 3.0 1.0 0.0 Tags=[{'Key': 'Name',
  61. 1290 3 511906.0 170635.3 29.5 'Value': AWSInternetGateway.CB_DEFAULT_INET_GATEWAY_NAME
  62. 1291 }])
  63. 1292 3 396197.0 132065.7 22.8 cb_gateway._gateway.attach_to_vpc(VpcId=network_id)
  64. 1293 3 5.0 1.7 0.0 return cb_gateway
  65. Total time: 1.50173 s
  66. Function: list at line 1335
  67. Line # Hits Time Per Hit % Time Line Contents
  68. ==============================================================
  69. 1335 @dispatch(event="provider.networking.floating_ips.list",
  70. 1336 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  71. 1337 @profile
  72. 1338 def list(self, gateway, limit=None, marker=None):
  73. 1339 10 1501728.0 150172.8 100.0 return self.svc.list(limit, marker)
  74. Total time: 1.45562 s
  75. Function: list at line 1238
  76. Line # Hits Time Per Hit % Time Line Contents
  77. ==============================================================
  78. 1238 @dispatch(event="provider.networking.routers.list",
  79. 1239 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  80. 1240 @profile
  81. 1241 def list(self, limit=None, marker=None):
  82. 1242 22 1455619.0 66164.5 100.0 return self.svc.list(limit=limit, marker=marker)
  83. Total time: 1.21929 s
  84. Function: delete at line 1003
  85. Line # Hits Time Per Hit % Time Line Contents
  86. ==============================================================
  87. 1003 @dispatch(event="provider.networking.networks.delete",
  88. 1004 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  89. 1005 @profile
  90. 1006 def delete(self, network):
  91. 1007 4 10.0 2.5 0.0 network = (network if isinstance(network, AWSNetwork)
  92. 1008 else self.get(network))
  93. 1009 4 3.0 0.8 0.0 if network:
  94. 1010 # pylint:disable=protected-access
  95. 1011 4 1219278.0 304819.5 100.0 network._vpc.delete()
  96. Total time: 1.21166 s
  97. Function: create at line 1076
  98. Line # Hits Time Per Hit % Time Line Contents
  99. ==============================================================
  100. 1076 @dispatch(event="provider.networking.subnets.create",
  101. 1077 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  102. 1078 @profile
  103. 1079 def create(self, label, network, cidr_block, zone):
  104. 1080 13 222.0 17.1 0.0 AWSSubnet.assert_valid_resource_label(label)
  105. 1081 3 3.0 1.0 0.0 zone_name = zone.name if isinstance(
  106. 1082 3 6.0 2.0 0.0 zone, AWSPlacementZone) else zone
  107. 1083
  108. 1084 3 24.0 8.0 0.0 network_id = network.id if isinstance(network, AWSNetwork) else network
  109. 1085
  110. 1086 3 11.0 3.7 0.0 subnet = self.svc.create('create_subnet',
  111. 1087 3 2.0 0.7 0.0 VpcId=network_id,
  112. 1088 3 2.0 0.7 0.0 CidrBlock=cidr_block,
  113. 1089 3 695845.0 231948.3 57.4 AvailabilityZone=zone_name)
  114. 1090 3 7.0 2.3 0.0 if label:
  115. 1091 3 515534.0 171844.7 42.5 subnet.label = label
  116. 1092 3 4.0 1.3 0.0 return subnet
  117. Total time: 1.15518 s
  118. Function: list at line 969
  119. Line # Hits Time Per Hit % Time Line Contents
  120. ==============================================================
  121. 969 @dispatch(event="provider.networking.networks.list",
  122. 970 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  123. 971 @profile
  124. 972 def list(self, limit=None, marker=None):
  125. 973 8 1155181.0 144397.6 100.0 return self.svc.list(limit=limit, marker=marker)
  126. Total time: 1.07916 s
  127. Function: find at line 1061
  128. Line # Hits Time Per Hit % Time Line Contents
  129. ==============================================================
  130. 1061 @dispatch(event="provider.networking.subnets.find",
  131. 1062 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  132. 1063 @profile
  133. 1064 def find(self, network=None, **kwargs):
  134. 1065 6 12.0 2.0 0.0 label = kwargs.pop('label', None)
  135. 1066
  136. 1067 # All kwargs should have been popped at this time.
  137. 1068 6 5.0 0.8 0.0 if len(kwargs) > 0:
  138. 1069 1 0.0 0.0 0.0 raise InvalidParamException(
  139. 1070 1 1.0 1.0 0.0 "Unrecognised parameters for search: %s. Supported "
  140. 1071 1 10.0 10.0 0.0 "attributes: %s" % (kwargs, 'label'))
  141. 1072
  142. 1073 5 49.0 9.8 0.0 log.debug("Searching for AWS Subnet Service %s", label)
  143. 1074 5 1079080.0 215816.0 100.0 return self.svc.find(filter_name='tag:Name', filter_value=label)
  144. Total time: 1.00426 s
  145. Function: get_or_create_default at line 1103
  146. Line # Hits Time Per Hit % Time Line Contents
  147. ==============================================================
  148. 1103 @profile
  149. 1104 def get_or_create_default(self, zone):
  150. 1105 3 12.0 4.0 0.0 zone_name = zone.name if isinstance(zone, AWSPlacementZone) else zone
  151. 1106
  152. 1107 # # Look for provider default subnet in current zone
  153. 1108 # if zone_name:
  154. 1109 # snl = self.svc.find('availabilityZone', zone_name)
  155. 1110 #
  156. 1111 # else:
  157. 1112 # snl = self.svc.list()
  158. 1113 # # Find first available default subnet by sorted order
  159. 1114 # # of availability zone. Prefer zone us-east-1a over 1e,
  160. 1115 # # because newer zones tend to have less compatibility
  161. 1116 # # with different instance types (e.g. c5.large not available
  162. 1117 # # on us-east-1e as of 14 Dec. 2017).
  163. 1118 # # pylint:disable=protected-access
  164. 1119 # snl.sort(key=lambda sn: sn._subnet.availability_zone)
  165. 1120 #
  166. 1121 # for sn in snl:
  167. 1122 # # pylint:disable=protected-access
  168. 1123 # if sn._subnet.default_for_az:
  169. 1124 # return sn
  170. 1125
  171. 1126 # If no provider-default subnet has been found, look for
  172. 1127 # cloudbridge-default by label. We suffix labels by availability zone,
  173. 1128 # thus we add the wildcard for the regular expression to find the
  174. 1129 # subnet
  175. 1130 3 1004144.0 334714.7 100.0 snl = self.find(label=AWSSubnet.CB_DEFAULT_SUBNET_LABEL + "*")
  176. 1131
  177. 1132 3 5.0 1.7 0.0 if snl:
  178. 1133 # pylint:disable=protected-access
  179. 1134 3 37.0 12.3 0.0 snl.sort(key=lambda sn: sn._subnet.availability_zone)
  180. 1135 3 3.0 1.0 0.0 if not zone_name:
  181. 1136 return snl[0]
  182. 1137 3 3.0 1.0 0.0 for subnet in snl:
  183. 1138 3 54.0 18.0 0.0 if subnet.zone.name == zone_name:
  184. 1139 3 3.0 1.0 0.0 return subnet
  185. 1140
  186. 1141 # No default Subnet exists, try to create a CloudBridge-specific
  187. 1142 # subnet. This involves creating the network, subnets, internet
  188. 1143 # gateway, and connecting it all together so that the network has
  189. 1144 # Internet connectivity.
  190. 1145
  191. 1146 # Check if a default net already exists and get it or create on
  192. 1147 default_net = self.provider.networking.networks.get_or_create_default()
  193. 1148
  194. 1149 # Get/create an internet gateway for the default network and a
  195. 1150 # corresponding router if it does not already exist.
  196. 1151 # NOTE: Comment this out because the docs instruct users to setup
  197. 1152 # network connectivity manually. There's a bit of discrepancy here
  198. 1153 # though because the provider-default network will have Internet
  199. 1154 # connectivity (unlike the CloudBridge-default network with this
  200. 1155 # being commented) and is hence left in the codebase.
  201. 1156 # default_gtw = default_net.gateways.get_or_create()
  202. 1157 # router_label = "{0}-router".format(
  203. 1158 # AWSNetwork.CB_DEFAULT_NETWORK_LABEL)
  204. 1159 # default_routers = self.provider.networking.routers.find(
  205. 1160 # label=router_label)
  206. 1161 # if len(default_routers) == 0:
  207. 1162 # default_router = self.provider.networking.routers.create(
  208. 1163 # router_label, default_net)
  209. 1164 # default_router.attach_gateway(default_gtw)
  210. 1165 # else:
  211. 1166 # default_router = default_routers[0]
  212. 1167
  213. 1168 # Create a subnet in each of the region's zones
  214. 1169 region = self.provider.compute.regions.get(self.provider.region_name)
  215. 1170 default_sn = None
  216. 1171
  217. 1172 # Determine how many subnets we'll need for the default network and the
  218. 1173 # number of available zones. We need to derive a non-overlapping
  219. 1174 # network size for each subnet within the parent net so figure those
  220. 1175 # subnets here. `<net>.subnets` method will do this but we need to give
  221. 1176 # it a prefix. Determining that prefix depends on the size of the
  222. 1177 # network and should be incorporate the number of zones. So iterate
  223. 1178 # over potential number of subnets until enough can be created to
  224. 1179 # accommodate the number of available zones. That is where the fixed
  225. 1180 # number comes from in the for loop as that many iterations will yield
  226. 1181 # more potential subnets than any region has zones.
  227. 1182 ip_net = ipaddress.ip_network(AWSNetwork.CB_DEFAULT_IPV4RANGE)
  228. 1183 for x in range(5):
  229. 1184 if len(region.zones) <= len(list(ip_net.subnets(
  230. 1185 prefixlen_diff=x))):
  231. 1186 prefixlen_diff = x
  232. 1187 break
  233. 1188 subnets = list(ip_net.subnets(prefixlen_diff=prefixlen_diff))
  234. 1189
  235. 1190 for i, z in reversed(list(enumerate(region.zones))):
  236. 1191 sn_label = "{0}-{1}".format(AWSSubnet.CB_DEFAULT_SUBNET_LABEL,
  237. 1192 z.id[-1])
  238. 1193 log.info("Creating a default CloudBridge subnet %s: %s" %
  239. 1194 (sn_label, str(subnets[i])))
  240. 1195 sn = self.create(sn_label, default_net, str(subnets[i]), z)
  241. 1196 # Create a route table entry between the SN and the inet gateway
  242. 1197 # See note above about why this is commented
  243. 1198 # default_router.attach_subnet(sn)
  244. 1199 if zone and zone_name == z.name:
  245. 1200 default_sn = sn
  246. 1201 # No specific zone was supplied; return the last created subnet
  247. 1202 # The list was originally reversed to have the last subnet be in zone a
  248. 1203 if not default_sn:
  249. 1204 default_sn = sn
  250. 1205 return default_sn
  251. Total time: 0.932473 s
  252. Function: find at line 1223
  253. Line # Hits Time Per Hit % Time Line Contents
  254. ==============================================================
  255. 1223 @dispatch(event="provider.networking.routers.find",
  256. 1224 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  257. 1225 @profile
  258. 1226 def find(self, **kwargs):
  259. 1227 3 7.0 2.3 0.0 label = kwargs.pop('label', None)
  260. 1228
  261. 1229 # All kwargs should have been popped at this time.
  262. 1230 3 5.0 1.7 0.0 if len(kwargs) > 0:
  263. 1231 1 0.0 0.0 0.0 raise InvalidParamException(
  264. 1232 1 0.0 0.0 0.0 "Unrecognised parameters for search: %s. Supported "
  265. 1233 1 14.0 14.0 0.0 "attributes: %s" % (kwargs, 'label'))
  266. 1234
  267. 1235 2 13.0 6.5 0.0 log.debug("Searching for AWS Router Service %s", label)
  268. 1236 2 932434.0 466217.0 100.0 return self.svc.find(filter_name='tag:Name', filter_value=label)
  269. Total time: 0.887973 s
  270. Function: delete at line 1352
  271. Line # Hits Time Per Hit % Time Line Contents
  272. ==============================================================
  273. 1352 @dispatch(event="provider.networking.floating_ips.delete",
  274. 1353 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  275. 1354 @profile
  276. 1355 def delete(self, gateway, fip):
  277. 1356 2 5.0 2.5 0.0 if isinstance(fip, AWSFloatingIP):
  278. 1357 # pylint:disable=protected-access
  279. 1358 aws_fip = fip._ip
  280. 1359 else:
  281. 1360 2 524012.0 262006.0 59.0 aws_fip = self.svc.get_raw(fip)
  282. 1361 2 363956.0 181978.0 41.0 aws_fip.release()
  283. Total time: 0.855001 s
  284. Function: get at line 963
  285. Line # Hits Time Per Hit % Time Line Contents
  286. ==============================================================
  287. 963 @dispatch(event="provider.networking.networks.get",
  288. 964 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  289. 965 @profile
  290. 966 def get(self, network_id):
  291. 967 8 855001.0 106875.1 100.0 return self.svc.get(network_id)
  292. Total time: 0.854453 s
  293. Function: label at line 896
  294. Line # Hits Time Per Hit % Time Line Contents
  295. ==============================================================
  296. 896 @label.setter
  297. 897 # pylint:disable=arguments-differ
  298. 898 @profile
  299. 899 def label(self, value):
  300. 900 15 164.0 10.9 0.0 self.assert_valid_resource_label(value)
  301. 901 7 854289.0 122041.3 100.0 self._vpc.create_tags(Tags=[{'Key': 'Name', 'Value': value or ""}])
  302. Total time: 0.846852 s
  303. Function: label at line 975
  304. Line # Hits Time Per Hit % Time Line Contents
  305. ==============================================================
  306. 975 @label.setter
  307. 976 # pylint:disable=arguments-differ
  308. 977 @profile
  309. 978 def label(self, value):
  310. 979 14 157.0 11.2 0.0 self.assert_valid_resource_label(value)
  311. 980 6 846695.0 141115.8 100.0 self._subnet.create_tags(Tags=[{'Key': 'Name', 'Value': value or ""}])
  312. Total time: 0.710526 s
  313. Function: delete at line 1094
  314. Line # Hits Time Per Hit % Time Line Contents
  315. ==============================================================
  316. 1094 @dispatch(event="provider.networking.subnets.delete",
  317. 1095 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  318. 1096 @profile
  319. 1097 def delete(self, subnet):
  320. 1098 3 6.0 2.0 0.0 sn = subnet if isinstance(subnet, AWSSubnet) else self.get(subnet)
  321. 1099 3 3.0 1.0 0.0 if sn:
  322. 1100 # pylint:disable=protected-access
  323. 1101 3 710517.0 236839.0 100.0 sn._subnet.delete()
  324. Total time: 0.70085 s
  325. Function: delete at line 1295
  326. Line # Hits Time Per Hit % Time Line Contents
  327. ==============================================================
  328. 1295 @dispatch(event="provider.networking.gateways.delete",
  329. 1296 priority=BaseGatewayService.STANDARD_EVENT_PRIORITY)
  330. 1297 @profile
  331. 1298 def delete(self, network, gateway):
  332. 1299 3 8.0 2.7 0.0 gw = (gateway if isinstance(gateway, AWSInternetGateway)
  333. 1300 else self.svc.get(gateway))
  334. 1301 3 4.0 1.3 0.0 try:
  335. 1302 3 46.0 15.3 0.0 if gw.network_id:
  336. 1303 # pylint:disable=protected-access
  337. 1304 2 292032.0 146016.0 41.7 gw._gateway.detach_from_vpc(VpcId=gw.network_id)
  338. 1305 except ClientError as e:
  339. 1306 log.warn("Error deleting gateway {0}: {1}".format(self.id, e))
  340. 1307 # pylint:disable=protected-access
  341. 1308 3 408760.0 136253.3 58.3 gw._gateway.delete()
  342. Total time: 0.537054 s
  343. Function: refresh at line 930
  344. Line # Hits Time Per Hit % Time Line Contents
  345. ==============================================================
  346. 930 @profile
  347. 931 def refresh(self):
  348. 932 7 11.0 1.6 0.0 try:
  349. 933 7 537026.0 76718.0 100.0 self._vpc.reload()
  350. 934 7 17.0 2.4 0.0 self._unknown_state = False
  351. 935 except ClientError:
  352. 936 # The network no longer exists and cannot be refreshed.
  353. 937 # set the status to unknown
  354. 938 self._unknown_state = True
  355. Total time: 0.50429 s
  356. Function: create at line 1341
  357. Line # Hits Time Per Hit % Time Line Contents
  358. ==============================================================
  359. 1341 @dispatch(event="provider.networking.floating_ips.create",
  360. 1342 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  361. 1343 @profile
  362. 1344 def create(self, gateway):
  363. 1345 2 20.0 10.0 0.0 log.debug("Creating a floating IP under gateway %s", gateway)
  364. 1346 2 20.0 10.0 0.0 ip = self.provider.ec2_conn.meta.client.allocate_address(
  365. 1347 2 501672.0 250836.0 99.5 Domain='vpc')
  366. 1348 2 5.0 2.5 0.0 return AWSFloatingIP(
  367. 1349 2 7.0 3.5 0.0 self.provider,
  368. 1350 2 2566.0 1283.0 0.5 self.provider.ec2_conn.VpcAddress(ip.get('AllocationId')))
  369. Total time: 0.500526 s
  370. Function: label at line 1061
  371. Line # Hits Time Per Hit % Time Line Contents
  372. ==============================================================
  373. 1061 @label.setter
  374. 1062 # pylint:disable=arguments-differ
  375. 1063 @profile
  376. 1064 def label(self, value):
  377. 1065 12 158.0 13.2 0.0 self.assert_valid_resource_label(value)
  378. 1066 4 5.0 1.2 0.0 self._route_table.create_tags(Tags=[{'Key': 'Name',
  379. 1067 4 500363.0 125090.8 100.0 'Value': value or ""}])
  380. Total time: 0.442382 s
  381. Function: find at line 375
  382. Line # Hits Time Per Hit % Time Line Contents
  383. ==============================================================
  384. 375 @dispatch(event="provider.networking.floating_ips.find",
  385. 376 priority=BaseCloudService.STANDARD_EVENT_PRIORITY)
  386. 377 @profile
  387. 378 def find(self, gateway, **kwargs):
  388. 379 3 12.0 4.0 0.0 obj_list = gateway.floating_ips
  389. 380 3 2.0 0.7 0.0 filters = ['name', 'public_ip']
  390. 381 3 442312.0 147437.3 100.0 matches = cb_helpers.generic_find(filters, kwargs, obj_list)
  391. 382 2 56.0 28.0 0.0 return ClientPagedResultList(self._provider, list(matches))
  392. Total time: 0.276254 s
  393. Function: create at line 1244
  394. Line # Hits Time Per Hit % Time Line Contents
  395. ==============================================================
  396. 1244 @dispatch(event="provider.networking.routers.create",
  397. 1245 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  398. 1246 @profile
  399. 1247 def create(self, label, network):
  400. 1248 1 7.0 7.0 0.0 network_id = network.id if isinstance(network, AWSNetwork) else network
  401. 1249
  402. 1250 1 131667.0 131667.0 47.7 cb_router = self.svc.create('create_route_table', VpcId=network_id)
  403. 1251 1 1.0 1.0 0.0 if label:
  404. 1252 1 144578.0 144578.0 52.3 cb_router.label = label
  405. 1253 1 1.0 1.0 0.0 return cb_router
  406. Total time: 0.247562 s
  407. Function: refresh at line 1069
  408. Line # Hits Time Per Hit % Time Line Contents
  409. ==============================================================
  410. 1069 @profile
  411. 1070 def refresh(self):
  412. 1071 3 4.0 1.3 0.0 try:
  413. 1072 3 247558.0 82519.3 100.0 self._route_table.reload()
  414. 1073 except ClientError:
  415. 1074 self._route_table.associations = None
  416. Total time: 0.177915 s
  417. Function: delete at line 1255
  418. Line # Hits Time Per Hit % Time Line Contents
  419. ==============================================================
  420. 1255 @dispatch(event="provider.networking.routers.delete",
  421. 1256 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  422. 1257 @profile
  423. 1258 def delete(self, router):
  424. 1259 1 3.0 3.0 0.0 r = router if isinstance(router, AWSRouter) else self.get(router)
  425. 1260 1 1.0 1.0 0.0 if r:
  426. 1261 # pylint:disable=protected-access
  427. 1262 1 177911.0 177911.0 100.0 r._route_table.delete()
  428. Total time: 0.175809 s
  429. Function: get at line 1043
  430. Line # Hits Time Per Hit % Time Line Contents
  431. ==============================================================
  432. 1043 @dispatch(event="provider.networking.subnets.get",
  433. 1044 priority=BaseSubnetService.STANDARD_EVENT_PRIORITY)
  434. 1045 @profile
  435. 1046 def get(self, subnet_id):
  436. 1047 2 175809.0 87904.5 100.0 return self.svc.get(subnet_id)
  437. Total time: 0.164269 s
  438. Function: find at line 975
  439. Line # Hits Time Per Hit % Time Line Contents
  440. ==============================================================
  441. 975 @dispatch(event="provider.networking.networks.find",
  442. 976 priority=BaseNetworkService.STANDARD_EVENT_PRIORITY)
  443. 977 @profile
  444. 978 def find(self, **kwargs):
  445. 979 3 6.0 2.0 0.0 label = kwargs.pop('label', None)
  446. 980
  447. 981 # All kwargs should have been popped at this time.
  448. 982 3 4.0 1.3 0.0 if len(kwargs) > 0:
  449. 983 1 0.0 0.0 0.0 raise InvalidParamException(
  450. 984 1 1.0 1.0 0.0 "Unrecognised parameters for search: %s. Supported "
  451. 985 1 9.0 9.0 0.0 "attributes: %s" % (kwargs, 'label'))
  452. 986
  453. 987 2 13.0 6.5 0.0 log.debug("Searching for AWS Network Service %s", label)
  454. 988 2 164236.0 82118.0 100.0 return self.svc.find(filter_name='tag:Name', filter_value=label)
  455. Total time: 0.13601 s
  456. Function: get at line 1328
  457. Line # Hits Time Per Hit % Time Line Contents
  458. ==============================================================
  459. 1328 @dispatch(event="provider.networking.floating_ips.get",
  460. 1329 priority=BaseFloatingIPService.STANDARD_EVENT_PRIORITY)
  461. 1330 @profile
  462. 1331 def get(self, gateway, fip_id):
  463. 1332 2 12.0 6.0 0.0 log.debug("Getting AWS Floating IP Service with the id: %s", fip_id)
  464. 1333 2 135998.0 67999.0 100.0 return self.svc.get(fip_id)
  465. Total time: 0.109509 s
  466. Function: get at line 1217
  467. Line # Hits Time Per Hit % Time Line Contents
  468. ==============================================================
  469. 1217 @dispatch(event="provider.networking.routers.get",
  470. 1218 priority=BaseRouterService.STANDARD_EVENT_PRIORITY)
  471. 1219 @profile
  472. 1220 def get(self, router_id):
  473. 1221 2 109509.0 54754.5 100.0 return self.svc.get(router_id)
  474. Total time: 0.068226 s
  475. Function: refresh at line 1006
  476. Line # Hits Time Per Hit % Time Line Contents
  477. ==============================================================
  478. 1006 @profile
  479. 1007 def refresh(self):
  480. 1008 1 1.0 1.0 0.0 try:
  481. 1009 1 68223.0 68223.0 100.0 self._subnet.reload()
  482. 1010 1 2.0 2.0 0.0 self._unknown_state = False
  483. 1011 except ClientError:
  484. 1012 # subnet no longer exists
  485. 1013 self._unknown_state = True