Find Communities by: Category | Product
Brocade FabricOS 8.2 release notes said REST API is ready.
I introduce how REST API works using curl(1) command for some fundamental usage.
At the first, you need to verify REST API is enabled to run "mgmtapp --show" on your switches.
Above showed already enabled. If "Disabled", please run "mgmtapp --enable rest" to enable.
1. Login to switch
curl(1) command has a option "--user <user:password>". We use this option for login user and password.
And we specify
http command: POST
url: http://<ip-addr>/rest/login ("https" is recommended.)
Authorization-Header orange-circled is "session-key". This is used for next requests.
User/Password is not required but you need session-key received when login request.
You can logout following curl command,
curl -v -X POST -H "Content-Type: application/yang-data+xml" -H "Authorization: Custom_Basic YWRtaW46eHh4OjlhMmU3NTUyNmZhY2QxN2ZjNGQ0ZTViNjkyZDczMmUyMjgzMWI0Y2JjYzU0ZmZlM2YzNGJkODRkZTI0NmExM2Y=" "http://<ip-addr>/rest/logout"
3. logout (Using FOS command)
You can force logout session by "mgmtapp --terminate <session>" on your switch.
3-1. Confirm current sessions by "apploginhistory --show" command.
3-2. Terminate session by "mgmtapp -terminare <session>" (rounded pink color)
After the terminate session, this session was gone. (rounded sky blue color)
4. Reading switch information
GET command with http://<ip-addr>/rest/running/fabric/fabric-switch
<fcid>16776193</fcid> is same as switchID by switchShow command 0xfffc01 (=16776193) bellow,
5. Reading ports information
GET command with http://<ip-addr>/rest/running/brocade-interface/fibrechannel.
This is similar to switchShow + portCfgShow.
Information for all ports are read unless port number <slot#>/<port#> is specifed.
speed: 32Gb: 32000000000
operational-status: 2: Online/Testing
enabled-state: 2: Port is enabled
6: Port is disabled
The first entry was matched with following switchShow information.
6. Changing port speed setting
PATCH command with http://<ip-addr>/rest/running/brocade-interface/fibrechannel.
6-1. Current setting
Auto speed (32Gb)
6-2. Changing to 8Gb auto speed (Same as "portcfgspeed 5 0 -m8)
Errored. Setting was changed to fixed 8Gb speed settings bellow,
According to API reference, auto-negotiate member is read-only.
You can see <auto-negotiate>1</auto-negotiate> when you run "portcfgspeed 5 0 -m 8".
7. Reading port error count.
GET command with http://<ip-addr>/rest/running/brocade-interface/fibrechannel-statistics/......
You can also reset counters via REST API, but port basis.
8. Those are very summary introduction for Brocade FabricOS REST API.
Now logging out session.