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 TACACS Server configuration (Add/Get/Set/Remove) #46

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

CedricMoreau
Copy link

No description provided.

@alagoutte alagoutte changed the title Add Tacacs Server configuration (Add/Get/Set/Remove) Add TACACS Server configuration (Add/Get/Set/Remove) Nov 30, 2021
PowerArubaCX/Private/Confirm.ps1 Outdated Show resolved Hide resolved

<#
.SYNOPSIS
Add Aruba CX Tacacs Server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tacacs => TACACS (for other after too)

PowerArubaCX/Public/Tacacs.ps1 Outdated Show resolved Hide resolved
[string]$auth_type = "pap",
[Parameter (Mandatory = $true)]
[ValidateRange(1, 9223372036854775807)]
[int]$default_group_priority,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int64 ? (for validateRange)

PowerArubaCX/Public/Tacacs.ps1 Outdated Show resolved Hide resolved
Tests/integration/Tacacs.Tests.ps1 Outdated Show resolved Hide resolved
Tests/integration/Tacacs.Tests.ps1 Outdated Show resolved Hide resolved
Tests/integration/Tacacs.Tests.ps1 Outdated Show resolved Hide resolved
Tests/integration/Tacacs.Tests.ps1 Outdated Show resolved Hide resolved
Tests/integration/Tacacs.Tests.ps1 Show resolved Hide resolved
Copy link
Contributor

@alagoutte alagoutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update README(.md) add on list of supported feature/commands and add also some example...

PowerArubaCX/Private/Confirm.ps1 Outdated Show resolved Hide resolved
PowerArubaCX/Public/Tacacs.ps1 Outdated Show resolved Hide resolved
Configure TACACS Server (Timeout, port...)

.EXAMPLE
Set-ArubaCXTacacsServer -timeout 15 -address 192.2.0.1 -port 49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All example with Pipeline ?


$_group = @()

$_group += "/rest/" + $($connection.version) + "/system/aaa_server_groups/" + $group
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always needed to be update ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


if ($PSCmdlet.ShouldProcess("Tacacs Server (VRF: ${vrf})", "Remove ${address},${port}")) {
Invoke-ArubaCXRestMethod -method "DELETE" -uri $uri -connection $connection
Write-Progress -activity "Remove Tacacs Server" -completed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this write-progress too

. ../common.ps1

Describe "Get TACACS Server" {
BeforeALL {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BeforeAll


It "Get TACACS Server with one attribute (auth_type)" {
$tacacs = Get-ArubaCXTacacsServer -address $pester_tacacs_address -port $pester_tacacs_port -attribute auth_type
@($tacacs).count | Should -be 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-be -> -Be (same issue after)

[Parameter(Mandatory = $false)]
[ValidateRange(1, 4)]
[Int]$depth,
[Parameter(Mandatory = $false, ParameterSetName = "address")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why parameter set ?

[Parameter (Mandatory = $true, ParameterSetName = "address")]
[ipaddress]$address,
[Parameter (Mandatory = $false)]
[int]$port = 49,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing parameter set name for port ?

[CmdletBinding(DefaultParametersetname = "Default")]
Param(
[Parameter (Mandatory = $true, ParameterSetName = "address")]
[ipaddress]$address,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TACACS can't be a FQDN ?


$uri = "system/vrfs/${vrf}/tacacs_servers/${address},${port}"

if ($PSCmdlet.ShouldProcess("Tacacs Server (VRF: ${vrf})", "Remove ${address},${port}")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TACACS Server

README.md Show resolved Hide resolved
Get-ArubaCXTacacsServer -address 192.2.0.1 | Remove-ArubaCXTacacsServer
```

For configure a vlan to an interface, need to use [Set-ArubaCXInterfaces](#Interface)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

@alagoutte alagoutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix some stuff before merge

}
}

$response = Invoke-ArubaCXRestMethod -uri $uri -method 'POST' -body $_tacacs -connection $connection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove $response



# Remove a TACACS Server
Get-ArubaCXTacacsServer -address 192.2.0.1 | Remove-ArubaCXTacacsServer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add example of remove...

@@ -13,6 +13,8 @@ $script:pester_interface2 = "1/1/2" #interface id for test...
$script:pester_lag = "2" #lag id for test...
$script:pester_loopback = "2" #loopback id for test...
$script:pester_vrf = "pester_vrf" #interface id for test...
$script:pester_tacacs_address = "192.2.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is 192.0.2.0/24 for example network

@@ -0,0 +1,227 @@
#
# Copyright 2020, Cédric Moreau <moreaucedric0 at gmail dot com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright :D


Context "Search" {
It "Search TACACS Server by address ($pester_tacacs_address)" {
$tacacs = Get-ArubaCXTacacsServer -address $pester_tacacs_address -port $pester_tacacs_port
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add search without port

and also with position = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants