Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Get-FGTMonitorSystemInterfaceDHCPStatus #264

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions PowerFGT/Public/monitor/system/interface/dhcp-status.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright 2024, Cedric Moreau <moreaucedric0 at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
#
function Get-FGTMonitorSystemInterfaceDHCPStatus {

<#
.SYNOPSIS
Get Interface DHCP Status

.DESCRIPTION
Get Client DHCP Status for an interface

.EXAMPLE
Get-FGTMonitorSystemInterfaceDHCPStatus -interface wan

Get DHCP Client status for the specified interface wan

#>

Param(
[Parameter (Mandatory = $true, Position = 1)]
alagoutte marked this conversation as resolved.
Show resolved Hide resolved
[string]$interface,
[Parameter(Mandatory = $false)]
[String[]]$vdom,
[Parameter(Mandatory = $false)]
[psobject]$connection = $DefaultFGTConnection
)

Begin {
}

Process {

if ( $PsBoundParameters.ContainsKey('vdom') ) {
$invokeParams.add( 'vdom', $vdom )
}

$uri = "api/v2/monitor/system/interface/dhcp-status?mkey=$($interface)"
$response = Invoke-FGTRestMethod -uri $uri -method 'GET' -connection $connection
$response.results
}

End {
}
}
3 changes: 3 additions & 0 deletions Tests/integration/Connection.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ Describe "Connect to a FortiGate (using multi connection)" {
It "Use Multi connection for call Get Monitor System HA Checksum (< 6.2.0 with no HA)" -skip:( -Not $VersionIs60WithNoHA) {
{ Get-FGTMonitorSystemHAChecksum -connection $fgt } | Should -Throw "You can't check HA Checksum with FortiOS < 6.2.0"
}
It "Use Multi connection for call Get Monitor System Interface DHCP Status" {
{ Get-FGTMonitorSystemInterfaceDHCPStatus -interface $pester_port1 -connection $fgt } | Should -Not -Throw
}
It "Use Multi connection for call Get Monitor License Status" {
{ Get-FGTMonitorLicenseStatus -connection $fgt } | Should -Not -Throw
}
Expand Down