Skip to content

Commit 4d1603b

Browse files
committed
Add filters to ports, floating ips and routers
1 parent 0dc6c30 commit 4d1603b

5 files changed

Lines changed: 72 additions & 6 deletions

File tree

src/corelib/Networking/v2/Layer3/FloatingIPListOptions.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,41 @@ public class FloatingIPListOptions : FilterOptions
1212
/// </summary>
1313
public FloatingIPStatus Status { get; set; }
1414

15+
/// <summary>
16+
/// Filter by the network that contains the floating IP address.
17+
/// </summary>
18+
public Identifier NetworkId { get; set; }
19+
20+
/// <summary>
21+
/// Filter by the associated router.
22+
/// </summary>
23+
public Identifier RouterId { get; set; }
24+
25+
/// <summary>
26+
/// Filter by the associated port.
27+
/// </summary>
28+
public Identifier PortId { get; set; }
29+
30+
/// <summary>
31+
/// Filter by the floating ip address.
32+
/// </summary>
33+
public string FloatingIPAddress { get; set; }
34+
35+
/// <summary>
36+
/// Filter by the associated fixed ip address.
37+
/// </summary>
38+
public string FixedIPAddress { get; set; }
39+
1540
/// <summary />
1641
protected override IDictionary<string, object> BuildQueryString()
1742
{
1843
var queryString = new Dictionary<string, object>
1944
{
45+
["floating_network_id"] = NetworkId,
46+
["router_id"] = RouterId,
47+
["port_id"] = PortId,
48+
["floating_ip_address"] = FloatingIPAddress,
49+
["fixed_ip_address"] = FixedIPAddress,
2050
["status"] = Status
2151
};
2252

src/corelib/Networking/v2/Layer3/RouterListOptions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ public class RouterListOptions : FilterOptions
1212
/// </summary>
1313
public RouterStatus Status { get; set; }
1414

15+
/// <summary>
16+
/// Filter by router name.
17+
/// </summary>
18+
public string Name { get; set; }
19+
1520
/// <summary />
1621
protected override IDictionary<string, object> BuildQueryString()
1722
{
1823
var queryString = new Dictionary<string, object>
1924
{
20-
["status"] = Status
25+
["status"] = Status,
26+
["name"] = Name
2127
};
2228

2329
return queryString;

src/corelib/Networking/v2/PortListOptions.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,46 @@ namespace OpenStack.Networking.v2
88
public class PortListOptions : FilterOptions
99
{
1010
/// <summary>
11-
/// Filter by the associated device identifier
11+
/// Filter by the associated device identifier.
1212
/// </summary>
1313
public Identifier DeviceId { get; set; }
1414

15+
/// <summary>
16+
/// Filter by the entity that is using the port.
17+
/// </summary>
18+
public Identifier DeviceOwner { get; set; }
19+
20+
/// <summary>
21+
/// Filter by the associated network.
22+
/// </summary>
23+
public Identifier NetworkId { get; set; }
24+
25+
/// <summary>
26+
/// Filter by the MAC address.
27+
/// </summary>
28+
public string MACAddress { get; set; }
29+
30+
/// <summary>
31+
/// Filter by the port status.
32+
/// </summary>
33+
public PortStatus Status { get; set; }
34+
35+
/// <summary>
36+
/// Filter by the port name.
37+
/// </summary>
38+
public string Name { get; set; }
39+
1540
/// <summary />
1641
protected override IDictionary<string, object> BuildQueryString()
1742
{
1843
var queryString = new Dictionary<string, object>
1944
{
20-
["device_id"] = DeviceId
45+
["device_id"] = DeviceId,
46+
["device_owner"] = DeviceOwner,
47+
["network_id"] = NetworkId,
48+
["mac_address"] = MACAddress,
49+
["status"] = Status,
50+
["display_name"] = Name
2151
};
2252

2353
return queryString;

src/testing/unit/Networking/v2/Layer3/Level3ExtensionTests.cs renamed to src/testing/unit/Networking/v2/Layer3/Layer3Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
namespace OpenStack.Networking.v2.Layer3
1616
{
17-
public class Level3ExtensionTests
17+
public class Layer3Tests
1818
{
1919
private readonly NetworkingService _networking;
2020

21-
public Level3ExtensionTests()
21+
public Layer3Tests()
2222
{
2323
_networking = new NetworkingService(Stubs.AuthenticationProvider, "region");
2424
}

src/testing/unit/OpenStack.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<Compile Include="Extensions\TypeExtensionsTests.cs" />
119119
<Compile Include="IdentifierTests.cs" />
120120
<Compile Include="Networking\v2\DHCPOptionConverterTests.cs" />
121-
<Compile Include="Networking\v2\Layer3\Level3ExtensionTests.cs" />
121+
<Compile Include="Networking\v2\Layer3\Layer3Tests.cs" />
122122
<Compile Include="Networking\v2\PortTests.cs" />
123123
<Compile Include="Networking\v2\SubnetTests.cs" />
124124
<Compile Include="Networking\v2\NetworkTests.cs" />

0 commit comments

Comments
 (0)