-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have neutron ML2 driver pass port ID when invoking undersync workflow
- Loading branch information
Steve Keay
committed
Aug 30, 2024
1 parent
d835258
commit bdaf263
Showing
5 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../neutron-understack/neutron_understack/tests/fixtures/neutron_update_port_postcommit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"admin_state_up": true, | ||
"allowed_address_pairs": [], | ||
"binding:host_id": "", | ||
"binding:profile": {}, | ||
"binding:vif_details": {}, | ||
"binding:vif_type": "unbound", | ||
"binding:vnic_type": "normal", | ||
"created_at": "2024-07-24T13:42:24Z", | ||
"description": "", | ||
"device_id": "41d18c6a-5548-4ee9-926f-4e3ebf43153f", | ||
"device_owner": "compute:nova", | ||
"extra_dhcp_opts": [], | ||
"fixed_ips": [ | ||
{ | ||
"ip_address": "192.168.17.17", | ||
"subnet_id": "7f2f436c-fd65-44b0-9265-6b642cecbec5" | ||
} | ||
], | ||
"id": "e5d5cd73-ca9a-4b74-9d52-43188d0cdcaa", | ||
"mac_address": "fa:16:3e:35:1c:3d", | ||
"name": "", | ||
"network_id": "c2702769-5592-4555-8ae6-e670db82c31e", | ||
"port_security_enabled": true, | ||
"project_id": "ebc5b22e420d4dfc9e385a63b4583623", | ||
"revision_number": 2, | ||
"security_groups": [ | ||
"684dcc25-f419-44a5-b4e7-fdcad4335ecd" | ||
], | ||
"standard_attr_id": 56, | ||
"status": "DOWN", | ||
"tags": [], | ||
"tenant_id": "ebc5b22e420d4dfc9e385a63b4583623", | ||
"updated_at": "2024-07-24T13:42:25Z" | ||
} |
37 changes: 37 additions & 0 deletions
37
python/neutron-understack/neutron_understack/tests/test_neutron_understack_mech.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from dataclasses import dataclass | ||
from unittest.mock import patch, MagicMock | ||
import pytest | ||
from neutron_understack.argo.workflows import ArgoClient | ||
|
||
from neutron_understack.neutron_understack_mech import UnderstackDriver | ||
|
||
# TODO: I am not sure how we run tests in this project. | ||
|
||
@dataclass | ||
class ContextDouble: | ||
current: dict | ||
|
||
def mock_context_data(file): | ||
ref = pathlib.Path(__file__).joinpath(filename) | ||
with ref.open("r") as f: | ||
return ContextDouble(json.load(f)) | ||
|
||
@patch('neutron_understack.argo.workflows.ArgoClient') | ||
def test_update_port_postcommit(mock_argo_client): | ||
context_data = mock_context_data( | ||
"fixtures/neutron_update_port_postcommit.json" | ||
) | ||
|
||
UnderstackDriver.update_port_postcommit(context_data) | ||
|
||
mock_argo_client.assert_called_once_with( | ||
template_name="undersync-device", | ||
entrypoint="trigger-undersync", | ||
parameters={ | ||
"interface_uuid": "e5d5cd73-ca9a-4b74-9d52-43188d0cdcaa", | ||
"device_uuid": "41d18c6a-5548-4ee9-926f-4e3ebf43153f", | ||
"network_name": "provisioning", | ||
"dry_run": false, | ||
"force": false, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters