Skip to content

Commit eae2194

Browse files
platanus-krhalucinor
authored andcommitted
feat(network): rename neutron to network package name (#33)
1 parent c49b5fa commit eae2194

File tree

5 files changed

+118
-101
lines changed

5 files changed

+118
-101
lines changed

src/openstack_mcp_server/tools/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ def register_tool(mcp: FastMCP):
55
"""
66
Register Openstack MCP tools.
77
"""
8-
8+
99
from .compute_tools import ComputeTools
1010
from .identity_tools import IdentityTools
1111
from .image_tools import ImageTools
12-
from .neutron_tools import NeutronTools
12+
from .network_tools import NetworkTools
1313

1414
ComputeTools().register_tools(mcp)
1515
ImageTools().register_tools(mcp)
1616
IdentityTools().register_tools(mcp)
17-
NeutronTools().register_tools(mcp)
17+
NetworkTools().register_tools(mcp)

src/openstack_mcp_server/tools/neutron_tools.py renamed to src/openstack_mcp_server/tools/network_tools.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
from .base import get_openstack_conn
21
from fastmcp import FastMCP
3-
from openstack_mcp_server.tools.response.neutron import Network
42

3+
from openstack_mcp_server.tools.response.network import Network
4+
5+
from .base import get_openstack_conn
56

6-
class NeutronTools:
7+
8+
class NetworkTools:
79
"""
810
A class to encapsulate Neutron-related tools and utilities.
911
"""
@@ -13,14 +15,16 @@ def register_tools(self, mcp: FastMCP):
1315
Register Neutron-related tools with the FastMCP instance.
1416
"""
1517

16-
mcp.tool()(self.get_neutron_networks)
18+
mcp.tool()(self.get_networks)
1719
mcp.tool()(self.create_network)
1820
mcp.tool()(self.get_network_detail)
1921
mcp.tool()(self.update_network)
2022
mcp.tool()(self.delete_network)
2123

22-
def get_neutron_networks(
23-
self, status_filter: str | None = None, shared_only: bool = False
24+
def get_networks(
25+
self,
26+
status_filter: str | None = None,
27+
shared_only: bool = False,
2428
) -> list[Network]:
2529
"""
2630
Get the list of Neutron networks with optional filtering.

tests/conftest.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import pytest
21
from unittest.mock import Mock, patch
32

3+
import pytest
4+
45

56
@pytest.fixture
67
def mock_get_openstack_conn():
@@ -9,9 +10,8 @@ def mock_get_openstack_conn():
910

1011
with patch(
1112
"openstack_mcp_server.tools.compute_tools.get_openstack_conn",
12-
return_value=mock_conn
13-
) as mock_func:
14-
13+
return_value=mock_conn,
14+
):
1515
yield mock_conn
1616

1717

@@ -22,9 +22,8 @@ def mock_get_openstack_conn_image():
2222

2323
with patch(
2424
"openstack_mcp_server.tools.image_tools.get_openstack_conn",
25-
return_value=mock_conn
26-
) as mock_func:
27-
25+
return_value=mock_conn,
26+
):
2827
yield mock_conn
2928

3029

@@ -35,9 +34,8 @@ def mock_get_openstack_conn_identity():
3534

3635
with patch(
3736
"openstack_mcp_server.tools.identity_tools.get_openstack_conn",
38-
return_value=mock_conn
39-
) as mock_func:
40-
37+
return_value=mock_conn,
38+
):
4139
yield mock_conn
4240

4341

@@ -54,12 +52,12 @@ def mock_openstack_base():
5452

5553

5654
@pytest.fixture
57-
def mock_openstack_connect_neutron():
58-
"""Mock get_openstack_conn function for neutron_tools."""
55+
def mock_openstack_connect_network():
56+
"""Mock get_openstack_conn function for network_tools."""
5957
mock_conn = Mock()
6058

6159
with patch(
62-
"openstack_mcp_server.tools.neutron_tools.get_openstack_conn",
60+
"openstack_mcp_server.tools.network_tools.get_openstack_conn",
6361
return_value=mock_conn,
6462
):
6563
yield mock_conn

0 commit comments

Comments
 (0)