mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Change appropriate ADD to NEW commands
- New-NetboxIPAMAddress - New-NetboxVirtualMachine
This commit is contained in:
parent
cf4f2e3a0f
commit
6aea89d687
4 changed files with 20 additions and 19 deletions
|
|
@ -414,13 +414,13 @@ function Get-NetboxIPAMPrefix {
|
||||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
}
|
}
|
||||||
|
|
||||||
function Add-NetboxIPAMAddress {
|
function New-NetboxIPAMAddress {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Add a new IP address to Netbox
|
Create a new IP address to Netbox
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Adds a new IP address to Netbox with a status of Active by default.
|
Create a new IP address to Netbox with a status of Active by default.
|
||||||
|
|
||||||
.PARAMETER Address
|
.PARAMETER Address
|
||||||
IP address in CIDR notation: 192.168.1.1/24
|
IP address in CIDR notation: 192.168.1.1/24
|
||||||
|
|
@ -453,7 +453,7 @@ function Add-NetboxIPAMAddress {
|
||||||
Return raw results from API service
|
Return raw results from API service
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS C:\> Add-NetboxIPAMAddress
|
PS C:\> Create-NetboxIPAMAddress
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
Additional information about the function.
|
Additional information about the function.
|
||||||
|
|
|
||||||
|
|
@ -459,9 +459,9 @@ function Get-NetboxVirtualizationClusterGroup {
|
||||||
#endregion GET commands
|
#endregion GET commands
|
||||||
|
|
||||||
|
|
||||||
#region ADD commands
|
#region ADD/NEW commands
|
||||||
|
|
||||||
function Add-NetboxVirtualMachine {
|
function New-NetboxVirtualMachine {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
param
|
param
|
||||||
|
|
@ -577,7 +577,7 @@ function Set-NetboxVirtualMachine {
|
||||||
[switch]$Force
|
[switch]$Force
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = VerifyVirtualizationChoices -ProvidedValue $Status -VirtualMachineStatus
|
$PSBoundParameters.Status = VerifyVirtualizationChoices -ProvidedValue $Status -VirtualMachineStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -644,6 +644,7 @@ function Set-NetboxVirtualMachineInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -352,9 +352,9 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context -Name "Add-NetboxIPAMAddress" -Fixture {
|
Context -Name "New-NetboxIPAMAddress" -Fixture {
|
||||||
It "Should add a basic IP address" {
|
It "Should create a basic IP address" {
|
||||||
$Result = Add-NetboxIPAMAddress -Address '10.0.0.1/24'
|
$Result = New-NetboxIPAMAddress -Address '10.0.0.1/24'
|
||||||
|
|
||||||
Assert-VerifiableMock
|
Assert-VerifiableMock
|
||||||
|
|
||||||
|
|
@ -364,8 +364,8 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
||||||
$Result.Body | Should -Be '{"status":1,"address":"10.0.0.1/24"}'
|
$Result.Body | Should -Be '{"status":1,"address":"10.0.0.1/24"}'
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should add an IP with a status and role names" {
|
It "Should create an IP with a status and role names" {
|
||||||
$Result = Add-NetboxIPAMAddress -Address '10.0.0.1/24' -Status 'Reserved' -Role 'Anycast'
|
$Result = New-NetboxIPAMAddress -Address '10.0.0.1/24' -Status 'Reserved' -Role 'Anycast'
|
||||||
|
|
||||||
Assert-VerifiableMock
|
Assert-VerifiableMock
|
||||||
|
|
||||||
|
|
@ -375,8 +375,8 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
||||||
$Result.Body | Should -Be '{"status":2,"address":"10.0.0.1/24","role":30}'
|
$Result.Body | Should -Be '{"status":2,"address":"10.0.0.1/24","role":30}'
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should add an IP with a status and role values" {
|
It "Should create an IP with a status and role values" {
|
||||||
$Result = Add-NetboxIPAMAddress -Address '10.0.1.1/24' -Status '1' -Role '10'
|
$Result = New-NetboxIPAMAddress -Address '10.0.1.1/24' -Status '1' -Role '10'
|
||||||
|
|
||||||
Assert-VerifiableMock
|
Assert-VerifiableMock
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,9 +306,9 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context -Name "Add-NetboxVirtualMachine" -Fixture {
|
Context -Name "New-NetboxVirtualMachine" -Fixture {
|
||||||
It "Should add a basic VM" {
|
It "Should create a basic VM" {
|
||||||
$Result = Add-NetboxVirtualMachine -Name 'testvm' -Cluster 1
|
$Result = New-NetboxVirtualMachine -Name 'testvm' -Cluster 1
|
||||||
|
|
||||||
Assert-VerifiableMock
|
Assert-VerifiableMock
|
||||||
|
|
||||||
|
|
@ -318,8 +318,8 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
||||||
$Result.Body | Should -Be '{"cluster":1,"name":"testvm","status":1}'
|
$Result.Body | Should -Be '{"cluster":1,"name":"testvm","status":1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should add a VM with CPUs, Memory, Disk, tenancy, and comments" {
|
It "Should create a VM with CPUs, Memory, Disk, tenancy, and comments" {
|
||||||
$Result = Add-NetboxVirtualMachine -Name 'testvm' -Cluster 1 -Status Active -vCPUs 4 -Memory 4096 -Tenant 11 -Disk 50 -Comments "these are comments"
|
$Result = New-NetboxVirtualMachine -Name 'testvm' -Cluster 1 -Status Active -vCPUs 4 -Memory 4096 -Tenant 11 -Disk 50 -Comments "these are comments"
|
||||||
|
|
||||||
Assert-VerifiableMock
|
Assert-VerifiableMock
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue