sandbox 提供給咱們一個免費的開發平臺,能夠基於該平臺作不少和思科網絡設備、軟件有關的代碼開發、腳本測試、自動化配置等工做:git
首次進入sandbox,連接爲:devnetsandbox.cisco.com/RM/Topology,登陸便可使用,支持不少種登陸方式:github
截止至2018年末,sandbox提供了約68個labs,按運行申請模式不一樣分爲:編程
該類lab比較簡單,爲了解cisco sandbox提供一種快捷的實現方式:json
若是須要個性化的設置和複雜的網絡拓撲結構,則須要申請使用regular sandbox。api
NX-OS Programmability是其中一個Always on sandbox,該lab提供nexus 3k/9K 的各類不一樣的設備訪問方式,實現:瀏覽器
咱們能夠經過首頁找到該LAB,詳細的信息請訪問網頁。bash
因爲是共享lab,訪問方式比較簡單和固定:cookie
若是須要嘗試一下經過nxapi訪問設備,能夠在瀏覽器中輸入地址:sbx-nxos-mgmt.cisco.com ,使用上述「demo帳戶」的用戶名和密碼登陸,便可以顯示Nexus 9K sandbox。網絡
如圖顯示命令"show interface brief"的輸出:ssh
咱們也可使用ssh登陸設備
ssh admin@sbx-nxos-mgmt.cisco.com -p 8181
複製代碼
檢查剛剛經過nxapi訪問設備的細節:
2018 December 30 09:57:55.897 ngx_http_auth_pam_authenticate:381 pid:31473 PAM: client ip len:12
2018 December 30 09:57:55.897 ngx_http_auth_pam_authenticate:389 pid:31473 PAM: remote ip:10.79.98.239
2018 December 30 09:57:55.919 ngx_http_auth_pam_authenticate:414 pid:31473 PAM: Successfully authenticated user ' admin', remote ip:10.79.98.239
2018 December 30 09:57:55.919 ngx_http_cookie_set:651 pid:31473 creating cookie cleanup_cnt:0
2018 December 30 09:57:55.919 ngx_http_ins_api_post_body_handler:550 pid:12186 Input Message [
{
"jsonrpc": "2.0",
"method": "cli",
"params": {
"cmd": "show interface brief",
"version": 1
},
"id": 1
}
]
2018 December 30 09:57:55.919 is_nxapi_jsonrpc_request:298 pid:12186 Found jsonrpc request
2018 December 30 09:57:55.919 nxapi_jsonrpc_input_handler:101 pid:12186 Parsing json rpc request
2018 December 30 09:57:55.919 nxapi_jsonrpc_parse_request:901 pid:12186 JSONRPC Batch request found, starting par
se.
2018 December 30 09:57:55.919 _parse_in_req_msg_jsonrpc_store_nxversion:75 pid:12186 Input request version: 0
2018 December 30 09:57:55.919 _parse_in_req_msg_jsonrpc_username:668 pid:12186 cookie had user ''
2018 December 30 09:57:55.920 _parse_in_req_msg_jsonrpc_username:682 pid:12186 auth header had user 'admin'
2018 December 30 09:57:55.920 nxapi_jsonrpc_input_handler:109 pid:12186 Running jsonrpc commands
2018 December 30 09:57:55.920 nxapi_jsonrpc_run_cmds:453 pid:12186 JSON-RPC method '0'
2018 December 30 09:57:55.920 pterm_idle_vsh_sweep:677 pid:12186 pterm_idle_vsh_sweep
2018 December 30 09:57:55.920 pterm_get_vsh:720 pid:12186 vsh found: child_pid = 12260, fprd = 0x817cfc0, fpwr =
0x817d120, fd = 18, user = admin, vdc id = 1
2018 December 30 09:57:55.920 pterm_write_to_vsh:447 pid:12186 In vsh [18] Writing cmd "configure terminal"
2018 December 30 09:57:55.922 pterm_write_to_vsh:532 pid:12186 Cmd 'configure terminal' returned with '0'
2018 December 30 09:57:55.922 pterm_write_to_vsh:637 pid:12186 Done processing vsh output (ret=0)
2018 December 30 09:57:55.922 pterm_write_to_vsh:447 pid:12186 In vsh [18] Writing cmd "show interface brief | xm l "
2018 December 30 09:57:56.230 pterm_write_to_vsh:532 pid:12186 Cmd 'show interface brief | xml ' returned with '0 '
2018 December 30 09:57:56.230 pterm_write_to_vsh:637 pid:12186 Done processing vsh output (ret=0)
2018 December 30 09:57:56.230 _jsonrpc_store_vsh_cmd:129 pid:12186 output size 47188
2018 December 30 09:57:56.238 _jsonrpc_store_result_xml:61 pid:12186 Sanitizing output from vsh
2018 December 30 09:57:56.241 _jsonrpc_store_result_xml:82 pid:12186 valid xml, build json for:show interface bri
ef
2018 December 30 09:57:56.244 pterm_write_to_vsh:447 pid:12186 In vsh [18] Writing cmd "end"
2018 December 30 09:57:56.246 pterm_write_to_vsh:532 pid:12186 Cmd 'end' returned with '0'
2018 December 30 09:57:56.246 pterm_write_to_vsh:637 pid:12186 Done processing vsh output (ret=0)
2018 December 30 09:57:56.246 nxapi_jsonrpc_input_handler:113 pid:12186 Formatting jsonrpc output
2018 December 30 09:57:56.246 nxapi_jsonrpc_input_handler:117 pid:12186 gather jsonrpc response
2018 December 30 09:57:56.248 nxapi_jsonrpc_input_handler:123 pid:12186 jsonrpc output ret:0
2018 December 30 09:57:56.248 ngx_http_ins_api_post_body_handler:575 pid:12186 Done processing request
2018 December 30 09:57:56.248 ngx_http_ins_api_post_body_handler:608 pid:12186 sent header
2018 December 30 09:57:56.248 ngx_http_ins_api_post_body_handler:650 pid:12186 Allocate response buffer:32667
2018 December 30 09:57:56.248 ngx_http_ins_api_post_body_handler:680 pid:12186 Sending response len: 32667
2018 December 30 09:57:56.248 ngx_http_ins_api_post_body_handler:681 pid:12186 Sending response now {
"jsonrpc": "2.0",
"result": {
"body": {
"TABLE_interface": {
"ROW_interface": [{
"interface": "mgmt0",
"state": "up",
"ip_addr": "10.10.20.95",
"speed": "1000",
"mtu": 1500
}, {
"i sbx-n9kv-ao# 複製代碼
-END