octavia 12.0.0.0rc2__py3-none-any.whl → 13.0.0.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. octavia/amphorae/backends/agent/api_server/osutils.py +1 -0
  2. octavia/amphorae/backends/agent/api_server/plug.py +21 -7
  3. octavia/amphorae/backends/agent/api_server/templates/amphora-netns.systemd.j2 +2 -2
  4. octavia/amphorae/backends/agent/api_server/util.py +21 -0
  5. octavia/amphorae/backends/health_daemon/health_daemon.py +9 -3
  6. octavia/amphorae/backends/health_daemon/health_sender.py +2 -0
  7. octavia/amphorae/backends/utils/interface.py +14 -6
  8. octavia/amphorae/backends/utils/interface_file.py +6 -3
  9. octavia/amphorae/backends/utils/keepalivedlvs_query.py +8 -9
  10. octavia/amphorae/drivers/driver_base.py +1 -2
  11. octavia/amphorae/drivers/haproxy/rest_api_driver.py +11 -25
  12. octavia/amphorae/drivers/health/heartbeat_udp.py +34 -24
  13. octavia/amphorae/drivers/keepalived/jinja/jinja_cfg.py +3 -12
  14. octavia/amphorae/drivers/noop_driver/driver.py +3 -5
  15. octavia/api/common/pagination.py +4 -4
  16. octavia/api/drivers/amphora_driver/v2/driver.py +11 -5
  17. octavia/api/drivers/driver_agent/driver_get.py +22 -14
  18. octavia/api/drivers/driver_agent/driver_updater.py +8 -4
  19. octavia/api/drivers/utils.py +4 -2
  20. octavia/api/healthcheck/healthcheck_plugins.py +4 -2
  21. octavia/api/root_controller.py +4 -1
  22. octavia/api/v2/controllers/amphora.py +35 -38
  23. octavia/api/v2/controllers/availability_zone_profiles.py +43 -33
  24. octavia/api/v2/controllers/availability_zones.py +22 -18
  25. octavia/api/v2/controllers/flavor_profiles.py +37 -28
  26. octavia/api/v2/controllers/flavors.py +19 -15
  27. octavia/api/v2/controllers/health_monitor.py +44 -33
  28. octavia/api/v2/controllers/l7policy.py +52 -40
  29. octavia/api/v2/controllers/l7rule.py +68 -55
  30. octavia/api/v2/controllers/listener.py +88 -61
  31. octavia/api/v2/controllers/load_balancer.py +52 -34
  32. octavia/api/v2/controllers/member.py +63 -52
  33. octavia/api/v2/controllers/pool.py +55 -42
  34. octavia/api/v2/controllers/quotas.py +5 -3
  35. octavia/api/v2/types/listener.py +15 -0
  36. octavia/cmd/octavia_worker.py +0 -3
  37. octavia/cmd/status.py +1 -4
  38. octavia/common/clients.py +25 -45
  39. octavia/common/config.py +64 -22
  40. octavia/common/constants.py +3 -2
  41. octavia/common/data_models.py +7 -1
  42. octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py +12 -1
  43. octavia/common/jinja/haproxy/combined_listeners/templates/macros.j2 +5 -2
  44. octavia/common/jinja/lvs/jinja_cfg.py +4 -2
  45. octavia/common/keystone.py +58 -5
  46. octavia/common/validate.py +35 -0
  47. octavia/compute/drivers/noop_driver/driver.py +6 -0
  48. octavia/controller/healthmanager/health_manager.py +3 -6
  49. octavia/controller/housekeeping/house_keeping.py +36 -37
  50. octavia/controller/worker/amphora_rate_limit.py +5 -4
  51. octavia/controller/worker/task_utils.py +57 -41
  52. octavia/controller/worker/v2/controller_worker.py +160 -103
  53. octavia/controller/worker/v2/flows/listener_flows.py +3 -0
  54. octavia/controller/worker/v2/flows/load_balancer_flows.py +9 -14
  55. octavia/controller/worker/v2/tasks/amphora_driver_tasks.py +152 -91
  56. octavia/controller/worker/v2/tasks/compute_tasks.py +4 -2
  57. octavia/controller/worker/v2/tasks/database_tasks.py +542 -400
  58. octavia/controller/worker/v2/tasks/network_tasks.py +119 -79
  59. octavia/db/api.py +26 -23
  60. octavia/db/base_models.py +2 -2
  61. octavia/db/healthcheck.py +2 -1
  62. octavia/db/migration/alembic_migrations/versions/632152d2d32e_add_http_strict_transport_security_.py +42 -0
  63. octavia/db/models.py +12 -2
  64. octavia/db/prepare.py +2 -0
  65. octavia/db/repositories.py +462 -482
  66. octavia/hacking/checks.py +1 -1
  67. octavia/network/base.py +0 -14
  68. octavia/network/drivers/neutron/allowed_address_pairs.py +92 -135
  69. octavia/network/drivers/neutron/base.py +65 -77
  70. octavia/network/drivers/neutron/utils.py +69 -85
  71. octavia/network/drivers/noop_driver/driver.py +0 -7
  72. octavia/statistics/drivers/update_db.py +10 -10
  73. octavia/tests/common/constants.py +91 -84
  74. octavia/tests/common/sample_data_models.py +13 -1
  75. octavia/tests/fixtures.py +32 -0
  76. octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py +9 -10
  77. octavia/tests/functional/api/drivers/driver_agent/test_driver_agent.py +260 -15
  78. octavia/tests/functional/api/test_root_controller.py +3 -28
  79. octavia/tests/functional/api/v2/base.py +5 -3
  80. octavia/tests/functional/api/v2/test_amphora.py +18 -5
  81. octavia/tests/functional/api/v2/test_availability_zone_profiles.py +1 -0
  82. octavia/tests/functional/api/v2/test_listener.py +51 -19
  83. octavia/tests/functional/api/v2/test_load_balancer.py +10 -1
  84. octavia/tests/functional/db/base.py +31 -16
  85. octavia/tests/functional/db/test_models.py +27 -28
  86. octavia/tests/functional/db/test_repositories.py +407 -50
  87. octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py +2 -0
  88. octavia/tests/unit/amphorae/backends/agent/api_server/test_osutils.py +1 -1
  89. octavia/tests/unit/amphorae/backends/agent/api_server/test_plug.py +54 -6
  90. octavia/tests/unit/amphorae/backends/agent/api_server/test_util.py +35 -0
  91. octavia/tests/unit/amphorae/backends/health_daemon/test_health_daemon.py +8 -0
  92. octavia/tests/unit/amphorae/backends/health_daemon/test_health_sender.py +18 -0
  93. octavia/tests/unit/amphorae/backends/utils/test_interface.py +81 -0
  94. octavia/tests/unit/amphorae/backends/utils/test_interface_file.py +2 -0
  95. octavia/tests/unit/amphorae/backends/utils/test_keepalivedlvs_query.py +129 -5
  96. octavia/tests/unit/amphorae/drivers/haproxy/test_rest_api_driver_1_0.py +42 -20
  97. octavia/tests/unit/amphorae/drivers/health/test_heartbeat_udp.py +18 -20
  98. octavia/tests/unit/amphorae/drivers/keepalived/jinja/test_jinja_cfg.py +4 -4
  99. octavia/tests/unit/amphorae/drivers/noop_driver/test_driver.py +4 -1
  100. octavia/tests/unit/api/drivers/driver_agent/test_driver_get.py +3 -3
  101. octavia/tests/unit/api/drivers/driver_agent/test_driver_updater.py +11 -13
  102. octavia/tests/unit/base.py +6 -0
  103. octavia/tests/unit/cmd/test_interface.py +2 -2
  104. octavia/tests/unit/cmd/test_status.py +2 -2
  105. octavia/tests/unit/common/jinja/haproxy/combined_listeners/test_jinja_cfg.py +152 -1
  106. octavia/tests/unit/common/sample_configs/sample_configs_combined.py +10 -3
  107. octavia/tests/unit/common/test_clients.py +0 -39
  108. octavia/tests/unit/common/test_keystone.py +54 -0
  109. octavia/tests/unit/common/test_validate.py +67 -0
  110. octavia/tests/unit/controller/healthmanager/test_health_manager.py +8 -22
  111. octavia/tests/unit/controller/housekeeping/test_house_keeping.py +3 -64
  112. octavia/tests/unit/controller/worker/test_amphora_rate_limit.py +1 -1
  113. octavia/tests/unit/controller/worker/test_task_utils.py +44 -24
  114. octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py +0 -1
  115. octavia/tests/unit/controller/worker/v2/tasks/test_amphora_driver_tasks.py +49 -26
  116. octavia/tests/unit/controller/worker/v2/tasks/test_database_tasks.py +399 -196
  117. octavia/tests/unit/controller/worker/v2/tasks/test_database_tasks_quota.py +37 -64
  118. octavia/tests/unit/controller/worker/v2/tasks/test_network_tasks.py +3 -14
  119. octavia/tests/unit/controller/worker/v2/test_controller_worker.py +2 -2
  120. octavia/tests/unit/network/drivers/neutron/test_allowed_address_pairs.py +456 -561
  121. octavia/tests/unit/network/drivers/neutron/test_base.py +181 -194
  122. octavia/tests/unit/network/drivers/neutron/test_utils.py +14 -30
  123. octavia/tests/unit/statistics/drivers/test_update_db.py +7 -5
  124. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/README.rst +1 -1
  125. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/AUTHORS +4 -0
  126. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/METADATA +4 -4
  127. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/RECORD +141 -189
  128. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/entry_points.txt +1 -2
  129. octavia-13.0.0.0rc1.dist-info/pbr.json +1 -0
  130. octavia/api/drivers/amphora_driver/v1/__init__.py +0 -11
  131. octavia/api/drivers/amphora_driver/v1/driver.py +0 -547
  132. octavia/controller/queue/v1/__init__.py +0 -11
  133. octavia/controller/queue/v1/consumer.py +0 -64
  134. octavia/controller/queue/v1/endpoints.py +0 -160
  135. octavia/controller/worker/v1/__init__.py +0 -11
  136. octavia/controller/worker/v1/controller_worker.py +0 -1157
  137. octavia/controller/worker/v1/flows/__init__.py +0 -11
  138. octavia/controller/worker/v1/flows/amphora_flows.py +0 -610
  139. octavia/controller/worker/v1/flows/health_monitor_flows.py +0 -105
  140. octavia/controller/worker/v1/flows/l7policy_flows.py +0 -94
  141. octavia/controller/worker/v1/flows/l7rule_flows.py +0 -100
  142. octavia/controller/worker/v1/flows/listener_flows.py +0 -128
  143. octavia/controller/worker/v1/flows/load_balancer_flows.py +0 -692
  144. octavia/controller/worker/v1/flows/member_flows.py +0 -230
  145. octavia/controller/worker/v1/flows/pool_flows.py +0 -127
  146. octavia/controller/worker/v1/tasks/__init__.py +0 -11
  147. octavia/controller/worker/v1/tasks/amphora_driver_tasks.py +0 -453
  148. octavia/controller/worker/v1/tasks/cert_task.py +0 -51
  149. octavia/controller/worker/v1/tasks/compute_tasks.py +0 -335
  150. octavia/controller/worker/v1/tasks/database_tasks.py +0 -2756
  151. octavia/controller/worker/v1/tasks/lifecycle_tasks.py +0 -173
  152. octavia/controller/worker/v1/tasks/model_tasks.py +0 -41
  153. octavia/controller/worker/v1/tasks/network_tasks.py +0 -970
  154. octavia/controller/worker/v1/tasks/retry_tasks.py +0 -74
  155. octavia/tests/unit/api/drivers/amphora_driver/v1/__init__.py +0 -11
  156. octavia/tests/unit/api/drivers/amphora_driver/v1/test_driver.py +0 -824
  157. octavia/tests/unit/controller/queue/v1/__init__.py +0 -11
  158. octavia/tests/unit/controller/queue/v1/test_consumer.py +0 -61
  159. octavia/tests/unit/controller/queue/v1/test_endpoints.py +0 -189
  160. octavia/tests/unit/controller/worker/v1/__init__.py +0 -11
  161. octavia/tests/unit/controller/worker/v1/flows/__init__.py +0 -11
  162. octavia/tests/unit/controller/worker/v1/flows/test_amphora_flows.py +0 -474
  163. octavia/tests/unit/controller/worker/v1/flows/test_health_monitor_flows.py +0 -72
  164. octavia/tests/unit/controller/worker/v1/flows/test_l7policy_flows.py +0 -67
  165. octavia/tests/unit/controller/worker/v1/flows/test_l7rule_flows.py +0 -67
  166. octavia/tests/unit/controller/worker/v1/flows/test_listener_flows.py +0 -91
  167. octavia/tests/unit/controller/worker/v1/flows/test_load_balancer_flows.py +0 -431
  168. octavia/tests/unit/controller/worker/v1/flows/test_member_flows.py +0 -106
  169. octavia/tests/unit/controller/worker/v1/flows/test_pool_flows.py +0 -77
  170. octavia/tests/unit/controller/worker/v1/tasks/__init__.py +0 -11
  171. octavia/tests/unit/controller/worker/v1/tasks/test_amphora_driver_tasks.py +0 -792
  172. octavia/tests/unit/controller/worker/v1/tasks/test_cert_task.py +0 -46
  173. octavia/tests/unit/controller/worker/v1/tasks/test_compute_tasks.py +0 -634
  174. octavia/tests/unit/controller/worker/v1/tasks/test_database_tasks.py +0 -2615
  175. octavia/tests/unit/controller/worker/v1/tasks/test_database_tasks_quota.py +0 -415
  176. octavia/tests/unit/controller/worker/v1/tasks/test_lifecycle_tasks.py +0 -401
  177. octavia/tests/unit/controller/worker/v1/tasks/test_model_tasks.py +0 -44
  178. octavia/tests/unit/controller/worker/v1/tasks/test_network_tasks.py +0 -1788
  179. octavia/tests/unit/controller/worker/v1/tasks/test_retry_tasks.py +0 -47
  180. octavia/tests/unit/controller/worker/v1/test_controller_worker.py +0 -2096
  181. octavia-12.0.0.0rc2.dist-info/pbr.json +0 -1
  182. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/LICENSE +0 -0
  183. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/README.rst +0 -0
  184. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/diskimage-create.sh +0 -0
  185. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/image-tests.sh +0 -0
  186. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/requirements.txt +0 -0
  187. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/test-requirements.txt +0 -0
  188. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/tox.ini +0 -0
  189. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/data/share/octavia/diskimage-create/version.txt +0 -0
  190. {octavia-12.0.0.0rc2.data → octavia-13.0.0.0rc1.data}/scripts/octavia-wsgi +0 -0
  191. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/LICENSE +0 -0
  192. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/WHEEL +0 -0
  193. {octavia-12.0.0.0rc2.dist-info → octavia-13.0.0.0rc1.dist-info}/top_level.txt +0 -0
@@ -1,474 +0,0 @@
1
- # Copyright 2015 Hewlett-Packard Development Company, L.P.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
- # not use this file except in compliance with the License. You may obtain
5
- # a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
- # License for the specific language governing permissions and limitations
13
- # under the License.
14
- #
15
- from unittest import mock
16
-
17
- from oslo_config import cfg
18
- from oslo_config import fixture as oslo_fixture
19
- from oslo_utils import uuidutils
20
- from taskflow.patterns import linear_flow as flow
21
-
22
- from octavia.common import constants
23
- from octavia.common import data_models
24
- from octavia.controller.worker.v1.flows import amphora_flows
25
- import octavia.tests.unit.base as base
26
-
27
- AUTH_VERSION = '2'
28
-
29
-
30
- # NOTE: We patch the get_network_driver for all the calls so we don't
31
- # inadvertently make real calls.
32
- @mock.patch('octavia.common.utils.get_network_driver')
33
- class TestAmphoraFlows(base.TestCase):
34
-
35
- def setUp(self):
36
- super().setUp()
37
- self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
38
- self.conf.config(
39
- group="controller_worker",
40
- amphora_driver='amphora_haproxy_rest_driver')
41
- self.conf.config(group="nova", enable_anti_affinity=False)
42
- self.AmpFlow = amphora_flows.AmphoraFlows()
43
- self.amp1 = data_models.Amphora(id=1)
44
- self.amp2 = data_models.Amphora(id=2)
45
- self.amp3 = data_models.Amphora(id=3, status=constants.DELETED)
46
- self.amp4 = data_models.Amphora(id=uuidutils.generate_uuid())
47
- self.lb = data_models.LoadBalancer(
48
- id=4, amphorae=[self.amp1, self.amp2, self.amp3])
49
-
50
- def test_get_create_amphora_flow(self, mock_get_net_driver):
51
-
52
- amp_flow = self.AmpFlow.get_create_amphora_flow()
53
-
54
- self.assertIsInstance(amp_flow, flow.Flow)
55
-
56
- self.assertIn(constants.AMPHORA, amp_flow.provides)
57
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
58
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
59
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
60
-
61
- self.assertEqual(5, len(amp_flow.provides))
62
- self.assertEqual(4, len(amp_flow.requires))
63
-
64
- def test_get_create_amphora_flow_cert(self, mock_get_net_driver):
65
- self.AmpFlow = amphora_flows.AmphoraFlows()
66
-
67
- amp_flow = self.AmpFlow.get_create_amphora_flow()
68
-
69
- self.assertIsInstance(amp_flow, flow.Flow)
70
-
71
- self.assertIn(constants.AMPHORA, amp_flow.provides)
72
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
73
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
74
-
75
- self.assertEqual(5, len(amp_flow.provides))
76
- self.assertEqual(4, len(amp_flow.requires))
77
-
78
- def test_get_create_amphora_for_lb_flow(self, mock_get_net_driver):
79
-
80
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
81
- 'SOMEPREFIX', constants.ROLE_STANDALONE)
82
-
83
- self.assertIsInstance(amp_flow, flow.Flow)
84
-
85
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
86
-
87
- self.assertIn(constants.AMPHORA, amp_flow.provides)
88
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
89
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
90
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
91
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
92
-
93
- self.assertEqual(5, len(amp_flow.provides))
94
- self.assertEqual(5, len(amp_flow.requires))
95
-
96
- def test_get_cert_create_amphora_for_lb_flow(self, mock_get_net_driver):
97
-
98
- self.AmpFlow = amphora_flows.AmphoraFlows()
99
-
100
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
101
- 'SOMEPREFIX', constants.ROLE_STANDALONE)
102
-
103
- self.assertIsInstance(amp_flow, flow.Flow)
104
-
105
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
106
-
107
- self.assertIn(constants.AMPHORA, amp_flow.provides)
108
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
109
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
110
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
111
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
112
-
113
- self.assertEqual(5, len(amp_flow.provides))
114
- self.assertEqual(5, len(amp_flow.requires))
115
-
116
- def test_get_cert_master_create_amphora_for_lb_flow(
117
- self, mock_get_net_driver):
118
-
119
- self.AmpFlow = amphora_flows.AmphoraFlows()
120
-
121
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
122
- 'SOMEPREFIX', constants.ROLE_MASTER)
123
-
124
- self.assertIsInstance(amp_flow, flow.Flow)
125
-
126
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
127
-
128
- self.assertIn(constants.AMPHORA, amp_flow.provides)
129
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
130
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
131
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
132
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
133
-
134
- self.assertEqual(5, len(amp_flow.provides))
135
- self.assertEqual(5, len(amp_flow.requires))
136
-
137
- def test_get_cert_master_rest_anti_affinity_create_amphora_for_lb_flow(
138
- self, mock_get_net_driver):
139
-
140
- self.conf.config(group="nova", enable_anti_affinity=True)
141
-
142
- self.AmpFlow = amphora_flows.AmphoraFlows()
143
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
144
- 'SOMEPREFIX', constants.ROLE_MASTER)
145
-
146
- self.assertIsInstance(amp_flow, flow.Flow)
147
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
148
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
149
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
150
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
151
-
152
- self.assertEqual(5, len(amp_flow.provides))
153
- self.assertEqual(5, len(amp_flow.requires))
154
- self.conf.config(group="nova", enable_anti_affinity=False)
155
-
156
- def test_get_cert_backup_create_amphora_for_lb_flow(
157
- self, mock_get_net_driver):
158
- self.AmpFlow = amphora_flows.AmphoraFlows()
159
-
160
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
161
- 'SOMEPREFIX', constants.ROLE_BACKUP)
162
-
163
- self.assertIsInstance(amp_flow, flow.Flow)
164
-
165
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
166
-
167
- self.assertIn(constants.AMPHORA, amp_flow.provides)
168
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
169
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
170
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
171
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
172
-
173
- self.assertEqual(5, len(amp_flow.provides))
174
- self.assertEqual(5, len(amp_flow.requires))
175
-
176
- def test_get_cert_bogus_create_amphora_for_lb_flow(
177
- self, mock_get_net_driver):
178
- self.AmpFlow = amphora_flows.AmphoraFlows()
179
-
180
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
181
- 'SOMEPREFIX', 'BOGUS_ROLE')
182
-
183
- self.assertIsInstance(amp_flow, flow.Flow)
184
-
185
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
186
-
187
- self.assertIn(constants.AMPHORA, amp_flow.provides)
188
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
189
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
190
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
191
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
192
-
193
- self.assertEqual(5, len(amp_flow.provides))
194
- self.assertEqual(5, len(amp_flow.requires))
195
-
196
- def test_get_cert_backup_rest_anti_affinity_create_amphora_for_lb_flow(
197
- self, mock_get_net_driver):
198
- self.conf.config(group="nova", enable_anti_affinity=True)
199
-
200
- self.AmpFlow = amphora_flows.AmphoraFlows()
201
- amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
202
- 'SOMEPREFIX', constants.ROLE_BACKUP)
203
-
204
- self.assertIsInstance(amp_flow, flow.Flow)
205
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
206
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
207
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
208
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
209
-
210
- self.assertEqual(5, len(amp_flow.provides))
211
- self.assertEqual(5, len(amp_flow.requires))
212
- self.conf.config(group="nova", enable_anti_affinity=False)
213
-
214
- def test_get_delete_amphora_flow(self, mock_get_net_driver):
215
-
216
- amp_flow = self.AmpFlow.get_delete_amphora_flow(self.amp4)
217
-
218
- self.assertIsInstance(amp_flow, flow.Flow)
219
-
220
- # This flow injects the required data at flow compile time.
221
- self.assertEqual(0, len(amp_flow.provides))
222
- self.assertEqual(0, len(amp_flow.requires))
223
-
224
- def test_get_failover_flow_act_stdby(self, mock_get_net_driver):
225
- failed_amphora = data_models.Amphora(
226
- id=uuidutils.generate_uuid(), role=constants.ROLE_MASTER,
227
- load_balancer_id=uuidutils.generate_uuid())
228
-
229
- amp_flow = self.AmpFlow.get_failover_amphora_flow(
230
- failed_amphora, 2)
231
-
232
- self.assertIsInstance(amp_flow, flow.Flow)
233
-
234
- self.assertIn(constants.AVAILABILITY_ZONE, amp_flow.requires)
235
- self.assertIn(constants.BUILD_TYPE_PRIORITY, amp_flow.requires)
236
- self.assertIn(constants.FLAVOR, amp_flow.requires)
237
- self.assertIn(constants.LOADBALANCER, amp_flow.requires)
238
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
239
- self.assertIn(constants.VIP, amp_flow.requires)
240
-
241
- self.assertIn(constants.UPDATED_PORTS, amp_flow.provides)
242
- self.assertIn(constants.AMP_VRRP_INT, amp_flow.provides)
243
- self.assertIn(constants.AMPHORA, amp_flow.provides)
244
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
245
- self.assertIn(constants.AMPHORAE, amp_flow.provides)
246
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, amp_flow.provides)
247
- self.assertIn(constants.BASE_PORT, amp_flow.provides)
248
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
249
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
250
- self.assertIn(constants.DELTA, amp_flow.provides)
251
- self.assertIn(constants.LOADBALANCER, amp_flow.provides)
252
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
253
- self.assertIn(constants.VIP_SG_ID, amp_flow.provides)
254
-
255
- self.assertEqual(7, len(amp_flow.requires))
256
- self.assertEqual(13, len(amp_flow.provides))
257
-
258
- def test_get_failover_flow_standalone(self, mock_get_net_driver):
259
- failed_amphora = data_models.Amphora(
260
- id=uuidutils.generate_uuid(), role=constants.ROLE_STANDALONE,
261
- load_balancer_id=uuidutils.generate_uuid(), vrrp_ip='2001:3b8::32')
262
-
263
- amp_flow = self.AmpFlow.get_failover_amphora_flow(
264
- failed_amphora, 1)
265
-
266
- self.assertIsInstance(amp_flow, flow.Flow)
267
-
268
- self.assertIn(constants.AVAILABILITY_ZONE, amp_flow.requires)
269
- self.assertIn(constants.BUILD_TYPE_PRIORITY, amp_flow.requires)
270
- self.assertIn(constants.FLAVOR, amp_flow.requires)
271
- self.assertIn(constants.LOADBALANCER, amp_flow.requires)
272
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
273
- self.assertIn(constants.VIP, amp_flow.requires)
274
-
275
- self.assertIn(constants.UPDATED_PORTS, amp_flow.provides)
276
- self.assertIn(constants.AMPHORA, amp_flow.provides)
277
- self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
278
- self.assertIn(constants.AMPHORAE, amp_flow.provides)
279
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, amp_flow.provides)
280
- self.assertIn(constants.BASE_PORT, amp_flow.provides)
281
- self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
282
- self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
283
- self.assertIn(constants.DELTA, amp_flow.provides)
284
- self.assertIn(constants.LOADBALANCER, amp_flow.provides)
285
- self.assertIn(constants.SERVER_PEM, amp_flow.provides)
286
- self.assertIn(constants.VIP_SG_ID, amp_flow.provides)
287
-
288
- self.assertEqual(7, len(amp_flow.requires))
289
- self.assertEqual(12, len(amp_flow.provides))
290
-
291
- def test_get_failover_flow_bogus_role(self, mock_get_net_driver):
292
- failed_amphora = data_models.Amphora(id=uuidutils.generate_uuid(),
293
- role='bogus')
294
-
295
- amp_flow = self.AmpFlow.get_failover_amphora_flow(
296
- failed_amphora, 1)
297
-
298
- self.assertIsInstance(amp_flow, flow.Flow)
299
-
300
- self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
301
-
302
- self.assertIn(constants.VIP_SG_ID, amp_flow.provides)
303
-
304
- print(amp_flow.requires)
305
- self.assertEqual(1, len(amp_flow.requires))
306
- self.assertEqual(1, len(amp_flow.provides))
307
-
308
- def test_cert_rotate_amphora_flow(self, mock_get_net_driver):
309
- self.AmpFlow = amphora_flows.AmphoraFlows()
310
-
311
- amp_rotate_flow = self.AmpFlow.cert_rotate_amphora_flow()
312
- self.assertIsInstance(amp_rotate_flow, flow.Flow)
313
-
314
- self.assertIn(constants.SERVER_PEM, amp_rotate_flow.provides)
315
- self.assertIn(constants.AMPHORA, amp_rotate_flow.requires)
316
-
317
- self.assertEqual(1, len(amp_rotate_flow.provides))
318
- self.assertEqual(2, len(amp_rotate_flow.requires))
319
-
320
- def test_get_vrrp_subflow(self, mock_get_net_driver):
321
- vrrp_subflow = self.AmpFlow.get_vrrp_subflow('123')
322
-
323
- self.assertIsInstance(vrrp_subflow, flow.Flow)
324
-
325
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, vrrp_subflow.provides)
326
- self.assertIn(constants.AMP_VRRP_INT, vrrp_subflow.provides)
327
-
328
- self.assertIn(constants.LOADBALANCER_ID, vrrp_subflow.requires)
329
- self.assertIn(constants.AMPHORAE, vrrp_subflow.requires)
330
-
331
- self.assertEqual(2, len(vrrp_subflow.provides))
332
- self.assertEqual(2, len(vrrp_subflow.requires))
333
-
334
- def test_get_vrrp_subflow_dont_create_vrrp_group(
335
- self, mock_get_net_driver):
336
- vrrp_subflow = self.AmpFlow.get_vrrp_subflow('123',
337
- create_vrrp_group=False)
338
-
339
- self.assertIsInstance(vrrp_subflow, flow.Flow)
340
-
341
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, vrrp_subflow.provides)
342
- self.assertIn(constants.AMP_VRRP_INT, vrrp_subflow.provides)
343
-
344
- self.assertIn(constants.LOADBALANCER_ID, vrrp_subflow.requires)
345
- self.assertIn(constants.AMPHORAE, vrrp_subflow.requires)
346
-
347
- self.assertEqual(2, len(vrrp_subflow.provides))
348
- self.assertEqual(2, len(vrrp_subflow.requires))
349
-
350
- def test_get_post_map_lb_subflow(self, mock_get_net_driver):
351
-
352
- self.AmpFlow = amphora_flows.AmphoraFlows()
353
-
354
- amp_flow = self.AmpFlow._get_post_map_lb_subflow(
355
- 'SOMEPREFIX', constants.ROLE_MASTER)
356
-
357
- self.assertIsInstance(amp_flow, flow.Flow)
358
-
359
- self.assertIn(constants.FLAVOR, amp_flow.requires)
360
- self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
361
- self.assertIn(constants.AMPHORA, amp_flow.provides)
362
-
363
- self.assertEqual(1, len(amp_flow.provides))
364
- self.assertEqual(2, len(amp_flow.requires))
365
-
366
- amp_flow = self.AmpFlow._get_post_map_lb_subflow(
367
- 'SOMEPREFIX', constants.ROLE_BACKUP)
368
-
369
- self.assertIsInstance(amp_flow, flow.Flow)
370
-
371
- self.assertIn(constants.FLAVOR, amp_flow.requires)
372
- self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
373
- self.assertIn(constants.AMPHORA, amp_flow.provides)
374
-
375
- self.assertEqual(1, len(amp_flow.provides))
376
- self.assertEqual(2, len(amp_flow.requires))
377
-
378
- amp_flow = self.AmpFlow._get_post_map_lb_subflow(
379
- 'SOMEPREFIX', constants.ROLE_STANDALONE)
380
-
381
- self.assertIsInstance(amp_flow, flow.Flow)
382
-
383
- self.assertIn(constants.FLAVOR, amp_flow.requires)
384
- self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
385
- self.assertIn(constants.AMPHORA, amp_flow.provides)
386
-
387
- self.assertEqual(1, len(amp_flow.provides))
388
- self.assertEqual(2, len(amp_flow.requires))
389
-
390
- amp_flow = self.AmpFlow._get_post_map_lb_subflow(
391
- 'SOMEPREFIX', 'BOGUS_ROLE')
392
-
393
- self.assertIsInstance(amp_flow, flow.Flow)
394
-
395
- self.assertIn(constants.FLAVOR, amp_flow.requires)
396
- self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
397
- self.assertIn(constants.AMPHORA, amp_flow.provides)
398
-
399
- self.assertEqual(1, len(amp_flow.provides))
400
- self.assertEqual(2, len(amp_flow.requires))
401
-
402
- def test_update_amphora_config_flow(self, mock_get_net_driver):
403
-
404
- amp_flow = self.AmpFlow.update_amphora_config_flow()
405
-
406
- self.assertIsInstance(amp_flow, flow.Flow)
407
-
408
- self.assertIn(constants.AMPHORA, amp_flow.requires)
409
- self.assertIn(constants.FLAVOR, amp_flow.requires)
410
-
411
- self.assertEqual(2, len(amp_flow.requires))
412
- self.assertEqual(0, len(amp_flow.provides))
413
-
414
- def test_get_amphora_for_lb_failover_flow_single(self,
415
- mock_get_net_driver):
416
- FAILED_PORT_ID = uuidutils.generate_uuid()
417
- TEST_PREFIX = 'test_prefix'
418
-
419
- get_amp_flow = self.AmpFlow.get_amphora_for_lb_failover_subflow(
420
- TEST_PREFIX, role=constants.ROLE_STANDALONE,
421
- failed_amp_vrrp_port_id=FAILED_PORT_ID, is_vrrp_ipv6=True)
422
-
423
- self.assertIsInstance(get_amp_flow, flow.Flow)
424
-
425
- self.assertIn(constants.AVAILABILITY_ZONE, get_amp_flow.requires)
426
- self.assertIn(constants.BUILD_TYPE_PRIORITY, get_amp_flow.requires)
427
- self.assertIn(constants.FLAVOR, get_amp_flow.requires)
428
- self.assertIn(constants.LOADBALANCER, get_amp_flow.requires)
429
- self.assertIn(constants.LOADBALANCER_ID, get_amp_flow.requires)
430
- self.assertIn(constants.VIP, get_amp_flow.requires)
431
- self.assertIn(constants.VIP_SG_ID, get_amp_flow.requires)
432
-
433
- self.assertIn(constants.UPDATED_PORTS, get_amp_flow.provides)
434
- self.assertIn(constants.AMPHORA, get_amp_flow.provides)
435
- self.assertIn(constants.AMPHORA_ID, get_amp_flow.provides)
436
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, get_amp_flow.provides)
437
- self.assertIn(constants.BASE_PORT, get_amp_flow.provides)
438
- self.assertIn(constants.COMPUTE_ID, get_amp_flow.provides)
439
- self.assertIn(constants.COMPUTE_OBJ, get_amp_flow.provides)
440
- self.assertIn(constants.DELTA, get_amp_flow.provides)
441
- self.assertIn(constants.SERVER_PEM, get_amp_flow.provides)
442
-
443
- self.assertEqual(8, len(get_amp_flow.requires), get_amp_flow.requires)
444
- self.assertEqual(9, len(get_amp_flow.provides), get_amp_flow.provides)
445
-
446
- def test_get_amphora_for_lb_failover_flow_act_stdby(self,
447
- mock_get_net_driver):
448
- TEST_PREFIX = 'test_prefix'
449
-
450
- get_amp_flow = self.AmpFlow.get_amphora_for_lb_failover_subflow(
451
- TEST_PREFIX, role=constants.ROLE_MASTER)
452
-
453
- self.assertIsInstance(get_amp_flow, flow.Flow)
454
-
455
- self.assertIn(constants.AVAILABILITY_ZONE, get_amp_flow.requires)
456
- self.assertIn(constants.BUILD_TYPE_PRIORITY, get_amp_flow.requires)
457
- self.assertIn(constants.FLAVOR, get_amp_flow.requires)
458
- self.assertIn(constants.LOADBALANCER, get_amp_flow.requires)
459
- self.assertIn(constants.LOADBALANCER_ID, get_amp_flow.requires)
460
- self.assertIn(constants.VIP, get_amp_flow.requires)
461
- self.assertIn(constants.VIP_SG_ID, get_amp_flow.requires)
462
-
463
- self.assertIn(constants.UPDATED_PORTS, get_amp_flow.provides)
464
- self.assertIn(constants.AMPHORA, get_amp_flow.provides)
465
- self.assertIn(constants.AMPHORA_ID, get_amp_flow.provides)
466
- self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, get_amp_flow.provides)
467
- self.assertIn(constants.BASE_PORT, get_amp_flow.provides)
468
- self.assertIn(constants.COMPUTE_ID, get_amp_flow.provides)
469
- self.assertIn(constants.COMPUTE_OBJ, get_amp_flow.provides)
470
- self.assertIn(constants.DELTA, get_amp_flow.provides)
471
- self.assertIn(constants.SERVER_PEM, get_amp_flow.provides)
472
-
473
- self.assertEqual(8, len(get_amp_flow.requires), get_amp_flow.requires)
474
- self.assertEqual(9, len(get_amp_flow.provides), get_amp_flow.provides)
@@ -1,72 +0,0 @@
1
- # Copyright 2015 Hewlett-Packard Development Company, L.P.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
- # not use this file except in compliance with the License. You may obtain
5
- # a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
- # License for the specific language governing permissions and limitations
13
- # under the License.
14
- #
15
-
16
- from taskflow.patterns import linear_flow as flow
17
-
18
- from octavia.common import constants
19
- from octavia.controller.worker.v1.flows import health_monitor_flows
20
- import octavia.tests.unit.base as base
21
-
22
-
23
- class TestHealthMonitorFlows(base.TestCase):
24
-
25
- def setUp(self):
26
- self.HealthMonitorFlow = health_monitor_flows.HealthMonitorFlows()
27
-
28
- super().setUp()
29
-
30
- def test_get_create_health_monitor_flow(self):
31
-
32
- health_mon_flow = (self.HealthMonitorFlow.
33
- get_create_health_monitor_flow())
34
-
35
- self.assertIsInstance(health_mon_flow, flow.Flow)
36
-
37
- self.assertIn(constants.LISTENERS, health_mon_flow.requires)
38
- self.assertIn(constants.LOADBALANCER, health_mon_flow.requires)
39
- self.assertIn(constants.POOL, health_mon_flow.requires)
40
-
41
- self.assertEqual(4, len(health_mon_flow.requires))
42
- self.assertEqual(0, len(health_mon_flow.provides))
43
-
44
- def test_get_delete_health_monitor_flow(self):
45
-
46
- health_mon_flow = (self.HealthMonitorFlow.
47
- get_delete_health_monitor_flow())
48
-
49
- self.assertIsInstance(health_mon_flow, flow.Flow)
50
-
51
- self.assertIn(constants.HEALTH_MON, health_mon_flow.requires)
52
- self.assertIn(constants.LISTENERS, health_mon_flow.requires)
53
- self.assertIn(constants.LOADBALANCER, health_mon_flow.requires)
54
- self.assertIn(constants.POOL, health_mon_flow.requires)
55
-
56
- self.assertEqual(4, len(health_mon_flow.requires))
57
- self.assertEqual(0, len(health_mon_flow.provides))
58
-
59
- def test_get_update_health_monitor_flow(self):
60
-
61
- health_mon_flow = (self.HealthMonitorFlow.
62
- get_update_health_monitor_flow())
63
-
64
- self.assertIsInstance(health_mon_flow, flow.Flow)
65
-
66
- self.assertIn(constants.LISTENERS, health_mon_flow.requires)
67
- self.assertIn(constants.LOADBALANCER, health_mon_flow.requires)
68
- self.assertIn(constants.HEALTH_MON, health_mon_flow.requires)
69
- self.assertIn(constants.UPDATE_DICT, health_mon_flow.requires)
70
-
71
- self.assertEqual(5, len(health_mon_flow.requires))
72
- self.assertEqual(0, len(health_mon_flow.provides))
@@ -1,67 +0,0 @@
1
- # Copyright 2016 Blue Box, an IBM Company
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
- # not use this file except in compliance with the License. You may obtain
5
- # a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
- # License for the specific language governing permissions and limitations
13
- # under the License.
14
- #
15
-
16
- from taskflow.patterns import linear_flow as flow
17
-
18
- from octavia.common import constants
19
- from octavia.controller.worker.v1.flows import l7policy_flows
20
- import octavia.tests.unit.base as base
21
-
22
-
23
- class TestL7PolicyFlows(base.TestCase):
24
-
25
- def setUp(self):
26
- self.L7PolicyFlow = l7policy_flows.L7PolicyFlows()
27
-
28
- super().setUp()
29
-
30
- def test_get_create_l7policy_flow(self):
31
-
32
- l7policy_flow = self.L7PolicyFlow.get_create_l7policy_flow()
33
-
34
- self.assertIsInstance(l7policy_flow, flow.Flow)
35
-
36
- self.assertIn(constants.LISTENERS, l7policy_flow.requires)
37
- self.assertIn(constants.LOADBALANCER, l7policy_flow.requires)
38
-
39
- self.assertEqual(3, len(l7policy_flow.requires))
40
- self.assertEqual(0, len(l7policy_flow.provides))
41
-
42
- def test_get_delete_l7policy_flow(self):
43
-
44
- l7policy_flow = self.L7PolicyFlow.get_delete_l7policy_flow()
45
-
46
- self.assertIsInstance(l7policy_flow, flow.Flow)
47
-
48
- self.assertIn(constants.LISTENERS, l7policy_flow.requires)
49
- self.assertIn(constants.LOADBALANCER, l7policy_flow.requires)
50
- self.assertIn(constants.L7POLICY, l7policy_flow.requires)
51
-
52
- self.assertEqual(3, len(l7policy_flow.requires))
53
- self.assertEqual(0, len(l7policy_flow.provides))
54
-
55
- def test_get_update_l7policy_flow(self):
56
-
57
- l7policy_flow = self.L7PolicyFlow.get_update_l7policy_flow()
58
-
59
- self.assertIsInstance(l7policy_flow, flow.Flow)
60
-
61
- self.assertIn(constants.L7POLICY, l7policy_flow.requires)
62
- self.assertIn(constants.LISTENERS, l7policy_flow.requires)
63
- self.assertIn(constants.LOADBALANCER, l7policy_flow.requires)
64
- self.assertIn(constants.UPDATE_DICT, l7policy_flow.requires)
65
-
66
- self.assertEqual(4, len(l7policy_flow.requires))
67
- self.assertEqual(0, len(l7policy_flow.provides))
@@ -1,67 +0,0 @@
1
- # Copyright 2016 Blue Box, an IBM Company
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
- # not use this file except in compliance with the License. You may obtain
5
- # a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
- # License for the specific language governing permissions and limitations
13
- # under the License.
14
- #
15
-
16
- from taskflow.patterns import linear_flow as flow
17
-
18
- from octavia.common import constants
19
- from octavia.controller.worker.v1.flows import l7rule_flows
20
- import octavia.tests.unit.base as base
21
-
22
-
23
- class TestL7RuleFlows(base.TestCase):
24
-
25
- def setUp(self):
26
- self.L7RuleFlow = l7rule_flows.L7RuleFlows()
27
-
28
- super().setUp()
29
-
30
- def test_get_create_l7rule_flow(self):
31
-
32
- l7rule_flow = self.L7RuleFlow.get_create_l7rule_flow()
33
-
34
- self.assertIsInstance(l7rule_flow, flow.Flow)
35
-
36
- self.assertIn(constants.LISTENERS, l7rule_flow.requires)
37
- self.assertIn(constants.LOADBALANCER, l7rule_flow.requires)
38
-
39
- self.assertEqual(4, len(l7rule_flow.requires))
40
- self.assertEqual(0, len(l7rule_flow.provides))
41
-
42
- def test_get_delete_l7rule_flow(self):
43
-
44
- l7rule_flow = self.L7RuleFlow.get_delete_l7rule_flow()
45
-
46
- self.assertIsInstance(l7rule_flow, flow.Flow)
47
-
48
- self.assertIn(constants.LISTENERS, l7rule_flow.requires)
49
- self.assertIn(constants.LOADBALANCER, l7rule_flow.requires)
50
- self.assertIn(constants.L7RULE, l7rule_flow.requires)
51
-
52
- self.assertEqual(4, len(l7rule_flow.requires))
53
- self.assertEqual(0, len(l7rule_flow.provides))
54
-
55
- def test_get_update_l7rule_flow(self):
56
-
57
- l7rule_flow = self.L7RuleFlow.get_update_l7rule_flow()
58
-
59
- self.assertIsInstance(l7rule_flow, flow.Flow)
60
-
61
- self.assertIn(constants.L7RULE, l7rule_flow.requires)
62
- self.assertIn(constants.LISTENERS, l7rule_flow.requires)
63
- self.assertIn(constants.LOADBALANCER, l7rule_flow.requires)
64
- self.assertIn(constants.UPDATE_DICT, l7rule_flow.requires)
65
-
66
- self.assertEqual(5, len(l7rule_flow.requires))
67
- self.assertEqual(0, len(l7rule_flow.provides))