PowerAruba / PowerArubaCX

PowerShell module to manage ArubaCX switches
Apache License 2.0
14 stars 4 forks source link

Serial number and product name #59

Open fre4ki opened 2 years ago

fre4ki commented 2 years ago

Hey Alexis,

i found another useful option for Get-ArubaCXSystem.

The device serial number and product name (from the "show system" output).

Maybe for the next release?

Andy

alagoutte commented 2 years ago

Hi Andy,

For product_name, it is the model ?

you can look on

Invoke-ArubaCXRestMethod "system/subsystems"
chassis,1                                line_card,1/1                                  management_module,1/1
---------                                -------------                                  ---------------------
/rest/v10.09/system/subsystems/chassis,1 /rest/v10.09/system/subsystems/line_card,1%2F1 /rest/v10.09/system/subsystems/management_module,1%2F1

Invoke-ArubaCXRestMethod "system/subsystems/chassis,1"

acl_init_status                      : none
admin_state                          : up
asic_info                            : 
buttons                              : /rest/v10.09/system/subsystems/chassis,1/buttons
capabilities                         : {poe_plus_power}
capacities                           : 
daemons                              : /rest/v10.09/system/subsystems/chassis,1/daemons
data_plane_connectivity_state        : 
data_plane_connectivity_target_state : 
data_plane_error                     : 
data_plane_state                     : 
data_plane_target_state              : 
data_planes                          : /rest/v10.09/system/subsystems/chassis,1/data_planes
diag_test_results                    : /rest/v10.09/system/subsystems/chassis,1/diag_test_results
diagnostic_disable                   : False
diagnostic_last_run_timestamp        : 0
diagnostic_performed                 : 0
diagnostic_requested                 : 0
entity_state                         : 
fan_configuration_state              : 
fans                                 : /rest/v10.09/system/subsystems/chassis,1/fans
interfaces                           : 
leds                                 : /rest/v10.09/system/subsystems/chassis,1/leds
macs_remaining                       : 0
name                                 : 1
next_mac_address                     : 00:00:00:00:00:00
pac_gbp_init_status                  : none
part_number_cfg                      : 
poe_persistency_disable              : False
poe_power                            : 
policy_init_status                   : none
power_consumed                       : 
power_supplies                       : /rest/v10.09/system/subsystems/chassis,1/power_supplies
product_info                         : @{base_mac_address=08:00:09:0d:2d:06; device_version=0; instance=1; number_of_macs=74; part_number=ABC123; product_description=ArubaOS-CX_OVA; product_name=ArubaOS-CX_OVA; 
                                       serial_number=OVA0D2D06; vendor=Aruba}
psu_redundancy_oper                  : none
psu_redundancy_set                   : none
quick_poe                            : False
reboot_statistics                    : @{configuration=0; error=0; hotswap=0; isp=0; thermal=0; user=0}
resets_performed                     : 
resets_requested                     : 
resource_capacity                    : 
resource_reservation_per_feature     : 
resource_unreserved                  : 
resource_utilization                 : 
resource_utilization_per_feature     : 
resource_width_per_feature           : 
selftest                             : @{status=pending}
selftest_disable                     : False
software_images                      : 
state                                : ready
storage                              : 
temp_sensors                         : /rest/v10.09/system/subsystems/chassis,1/temp_sensors
thermal_state                        : 
type                                 : chassis
usb_status                           : empty
fre4ki commented 2 years ago

I get an error: Error details: 404 Not Found Unable to use ArubaCX API

It is useful to have a field with serial number and product type:

image

The data can be used for exporting in an csv-file in the rolling-out stage (documentation).

alagoutte commented 2 years ago

What do you have with the first cmdlet ?

fre4ki commented 2 years ago

image

alagoutte commented 2 years ago

can you try without the first "/"

Invoke-ArubaCXRestMethod "system/subsystems"
fre4ki commented 2 years ago

I get an output but no useful information

image

alagoutte commented 2 years ago

you need to add info

Invoke-ArubaCXRestMethod "system/subsystems/chassis,1" ...
fre4ki commented 2 years ago

ok, i get now a field "product_info" which contains all informations but now i have to filter it out.

alagoutte commented 2 years ago

It is good ?

I will look for add a Get-ArubaCXSubSystem

fre4ki commented 2 years ago

i'm new with powershell and i searched yesterday a solution for that.

1 way was to working with substring() in part_number and product_description but as the serial_number has a different start-point it is not ideal and difficult to export this way.

the best way would be: searching for text serial_number= and extract all data after = to ;

Maybe you have a way?

alagoutte commented 2 years ago

Hi

it is an array you can use .product_info.serial_number for example

fre4ki commented 2 years ago

I'm sorry but can you give me an example?

alagoutte commented 2 years ago

can you try

(Invoke-ArubaCXRestMethod "system/subsystems/chassis,1").product_info
fre4ki commented 2 years ago

Amazing!

(Invoke-ArubaCXRestMethod "system/subsystems/chassis,1").product_info.part_number

(Invoke-ArubaCXRestMethod "system/subsystems/chassis,1").product_info.serial_number

(Invoke-ArubaCXRestMethod "system/subsystems/chassis,1").product_info.product_description

give me all necessary information.

fre4ki commented 2 years ago

You are great! :-)