1
+ #
2
+ # Copyright 2021, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
3
+ #
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ function Get-ArubaCXNeighbors {
7
+
8
+
9
+ <#
10
+ . SYNOPSIS
11
+ Get list of Neighbors (MAC Address)
12
+
13
+ . DESCRIPTION
14
+ Get list of Neighbors (Mac Address, type, vlan...)
15
+
16
+ . EXAMPLE
17
+ Get-ArubaCXNeighbors
18
+
19
+ Get Neighbors (MAC Address) information on all VRF
20
+
21
+ #>
22
+ Param (
23
+ [Parameter (Mandatory = $false , position = 1 )]
24
+ [String ]$vrf = " *" ,
25
+ [Parameter (Mandatory = $false )]
26
+ [ValidateRange (1 , 4 )]
27
+ [Int ]$depth ,
28
+ [Parameter (Mandatory = $false )]
29
+ [ValidateSet (" configuration" , " status" , " statistics" , " writable" )]
30
+ [String ]$selector ,
31
+ [Parameter (Mandatory = $false )]
32
+ [String []]$attributes ,
33
+ [Parameter (Mandatory = $false )]
34
+ [switch ]$vsx_peer ,
35
+ [Parameter (Mandatory = $False )]
36
+ [ValidateNotNullOrEmpty ()]
37
+ [PSObject ]$connection = $DefaultArubaCXConnection
38
+ )
39
+
40
+ Begin {
41
+ }
42
+
43
+ Process {
44
+
45
+ $invokeParams = @ { }
46
+ if ( $PsBoundParameters.ContainsKey (' depth' ) ) {
47
+ $invokeParams.add ( ' depth' , $depth )
48
+ }
49
+ if ( $PsBoundParameters.ContainsKey (' selector' ) ) {
50
+ $invokeParams.add ( ' selector' , $selector )
51
+ }
52
+ if ( $PsBoundParameters.ContainsKey (' attributes' ) ) {
53
+ $invokeParams.add ( ' attributes' , $attributes )
54
+ }
55
+ if ( $PsBoundParameters.ContainsKey (' vsx_peer' ) ) {
56
+ $invokeParams.add ( ' vsx_peer' , $true )
57
+ }
58
+
59
+ $uri = " system/vrfs/$vrf /neighbors"
60
+
61
+ $response = Invoke-ArubaCXRestMethod - uri $uri - method ' GET' - connection $connection @invokeParams
62
+ $response
63
+ }
64
+
65
+ End {
66
+ }
67
+ }
0 commit comments