Skip to content

Add TACACS Server configuration (Add/Get/Set/Remove)#46

Open
CedricMoreau wants to merge 7 commits intoPowerAruba:masterfrom
CedricMoreau:tacacs
Open

Add TACACS Server configuration (Add/Get/Set/Remove)#46
CedricMoreau wants to merge 7 commits intoPowerAruba:masterfrom
CedricMoreau:tacacs

Conversation

@CedricMoreau
Copy link
Copy Markdown

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

<#
.SYNOPSIS
Add Aruba CX Tacacs Server
Copy link
Copy Markdown
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)

[string]$auth_type = "pap",
[Parameter (Mandatory = $true)]
[ValidateRange(1, 9223372036854775807)]
[int]$default_group_priority,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

int64 ? (for validateRange)

Copy link
Copy Markdown
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...

Configure TACACS Server (Timeout, port...)

.EXAMPLE
Set-ArubaCXTacacsServer -timeout 15 -address 192.2.0.1 -port 49
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TACACS Server

Get-ArubaCXTacacsServer -address 192.2.0.1 | Remove-ArubaCXTacacsServer
```

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

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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...

$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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@alagoutte
Copy link
Copy Markdown
Contributor

any update @CedricMoreau ? :)

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