Skip to content

Commit 3a047f6

Browse files
authored
Merge pull request #732 from rackerlabs/revert-721-selective-svis
fix: Revert "feat: Only create SVIs for Prefixes of service_type "network:understack_svi""
2 parents 26c7844 + 59c6285 commit 3a047f6

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

python/neutron-understack/neutron_understack/neutron_understack_mech.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ def create_subnet_postcommit(self, context):
138138
Don't have an SVI, which means we don't associate them with a VNI in
139139
nautobot.
140140
"""
141-
subnet_uuid: str = context.current["id"]
142-
network_uuid: str = context.current["network_id"]
143-
prefix: str = context.current["cidr"]
144-
external: bool = context.current["router:external"]
145-
service_types: list[str] = context.current["service_types"]
141+
subnet_uuid = context.current["id"]
142+
network_uuid = context.current["network_id"]
143+
prefix = context.current["cidr"]
144+
external = context.current["router:external"]
146145

147146
if external:
148147
namespace = cfg.CONF.ml2_understack.shared_nautobot_namespace_name
@@ -155,7 +154,7 @@ def create_subnet_postcommit(self, context):
155154
namespace_name=namespace,
156155
)
157156

158-
if external and "network:understack_svi" in service_types:
157+
if external:
159158
self.nb.associate_subnet_with_network(
160159
role="svi_vxlan_anycast_gateway",
161160
network_uuid=network_uuid,

python/neutron-understack/neutron_understack/tests/test_neutron_understack_mech.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def test_create_subnet_postcommit_private(nautobot_client):
170170
"network_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
171171
"cidr": "1.0.0.0/24",
172172
"router:external": False,
173-
"service_types": [],
174173
}
175174
)
176175

@@ -184,14 +183,13 @@ def test_create_subnet_postcommit_private(nautobot_client):
184183
)
185184

186185

187-
def test_create_subnet_postcommit_public_svi(nautobot_client, undersync_client):
186+
def test_create_subnet_postcommit_public(nautobot_client, undersync_client):
188187
context = MagicMock(
189188
current={
190189
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
191190
"network_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
192191
"cidr": "1.0.0.0/24",
193192
"router:external": True,
194-
"service_types": ["network:understack_svi"],
195193
}
196194
)
197195

@@ -205,27 +203,6 @@ def test_create_subnet_postcommit_public_svi(nautobot_client, undersync_client):
205203
prefix="1.0.0.0/24",
206204
namespace_name="Global",
207205
)
208-
nautobot_client.associate_subnet_with_network.assert_called_once()
209-
210-
211-
def test_create_subnet_postcommit_public_non_svi(nautobot_client, undersync_client):
212-
context = MagicMock(
213-
current={
214-
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
215-
"network_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
216-
"cidr": "1.0.0.0/24",
217-
"router:external": True,
218-
"service_types": ["not_an_svi_type"],
219-
}
220-
)
221-
222-
driver.nb = nautobot_client
223-
driver.undersync = undersync_client
224-
225-
driver.create_subnet_postcommit(context)
226-
227-
nautobot_client.subnet_create.assert_called_once()
228-
nautobot_client.associate_subnet_with_network.assert_not_called()
229206

230207

231208
def test_delete_subnet_postcommit_public(nautobot_client, undersync_client):

0 commit comments

Comments
 (0)