FutureNet

NXR,VXRシリーズ

REST-API編

2. メンテナンス

2-8. exec系,showコマンドの実行(maint/cli)

 処理概要

exec 系および show コマンドに関する処理を実行します。

 

URI およびメソッド

機能 Version URI メソッド
POST PUT GET DELETE
CLI v1 /api/v1/maint/cli
v2 /api/v2/maint/cli
/api/v2/maint/cli/{ID}

凡例:

● : 読み取り専用ユーザも含めアクセス可

〇 : 読み取り専用ユーザはアクセス不可

- : 未対応

※ NXR-G100 シリーズ以外の機種では REST-APIv2 の利用を推奨します。

 

実行例

exec 系コマンドの実行

メソッド URI
POST /api/v2/maint/cli

 

 

reset interface ethernet の実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset interface ethernet 0"
}

 

レスポンス

200 OK

 

reset interface ethernet の実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset interface ethernet 0</exec>
</config>

 

レスポンス

200 OK

 

reset mobile コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset mobile 1"
}

 

レスポンス

200 OK

 

reset mobile コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset mobile 1</exec>
</config>

 

レスポンス

200 OK

 

reset poe ethernet コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset poe ethernet 0 enable"
}

 

レスポンス

200 OK

 

reset poe ethernet コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset poe ethernet 0 disable</exec>
</config>

 

レスポンス

200 OK

 

reset sim コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset sim mobile 2 otherslot"
}

 

レスポンス

200 OK

 

reset sim コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset sim mobile 2 otherslot</exec>
</config>

 

レスポンス

200 OK

 

reset netevent track コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset netevent track 255 down"
}

 

レスポンス

200 OK

 

reset netevent track コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset netevent track 255 up</exec>
</config>

 

レスポンス

200 OK

 

reset netevent track コマンド(timer指定)の実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "reset netevent track 255 down timer 30"
}

 

レスポンス

200 OK

 

reset netevent track コマンド(timer指定)の実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>reset netevent track 255 down timer 00:01:00</exec>
</config>

 

レスポンス

200 OK

 

get system statistics cpu コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "get system statistics cpu all 1 10"
}

 

レスポンス

202 Accepted
Content-Type: application/json

 

{
"exec-id": "1234",
"expire": 600
}

 

get system statistics cpu コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>get system statistics cpu all 1 10</exec>
</config>

 

レスポンス

202 Accepted
Content-Type: application/xml

 

<cli>
<exec-id>1234</exec-id>
<expire>600</expire>
</cli>

 

clear ip bgp コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "clear ip bgp *"
}

 

レスポンス

200 OK

 

clear ip bgp コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>clear ip bgp *</exec>
</config>

 

レスポンス

200 OK

 

clear dump コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "clear dump"
}

 

レスポンス

200 OK

 

clear dump コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>clear dump</exec>
</config>

 

レスポンス

200 OK

 

delete dump コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/json

 

{
"exec" : "delete dump"
}

 

レスポンス

200 OK

 

delete dump コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Content-Type: application/xml

 

<config>
<exec>delete dump</exec>
</config>

 

レスポンス

200 OK

 

speed-test コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Accept: application/json
Content-Type: application/json

 

{
"exec" : "speed-test 1 start"
}

 

レスポンス

202 Accepted
Content-Type: application/json

 

{
"exec-id": "1234",
"expire": 600
}

 
speed-test コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Accept: application/xml
Content-Type: application/xml

 

<config>
<exec>speed-test 1 start</exec>
</config>

 

レスポンス

202 Accepted
Content-Type: application/xml

 

<cli>
<exec-id>1234</exec-id>
<expire>600</expire>
</cli>

 

dio output コマンドの実行(JSON)
リクエスト

POST /api/v2/maint/cli
Accept: application/json
Content-Type: application/json

 

{
"exec" : "dio output 1 on"
}

 

レスポンス

200 OK

 
dio output コマンドの実行(XML)
リクエスト

POST /api/v2/maint/cli
Accept: application/xml
Content-Type: application/xml

 

<config>
<exec>dio output 1 on</exec>
</config>

 

レスポンス

200 OK

 

show コマンドの実行

メソッド URI
PUT /api/{VERSION}/maint/cli

※show syslog message monitor コマンドは実行できません。

 

 

include 指定なし(JSON)
リクエスト

PUT /api/v2/maint/cli
Accept: text/plain
Content-Type: application/json

 


{
"show": "mobile 1 signal-info"
}

 

レスポンス

200 OK
Content-Type: text/plain

 

BAND : 1 (2100 MHz)
Cell ID : 1a0
RSRP : -101dBm
RSRQ : -15dB
RSSI : -65dBm
SINR : -1dB
TAC : 35105

 

include 指定なし(XML)
リクエスト

PUT /api/v2/maint/cli
Accept: text/plain
Content-Type: application/xml

 

<config>
<show>mobile 1 signal-info</show>
</config>

 

レスポンス

200 OK
Content-Type: text/plain

 

BAND : 1 (2100 MHz)
Cell ID : 1a0
RSRP : -101dBm
RSRQ : -15dB
RSSI : -65dBm
SINR : -1dB
TAC : 35105

 

include 指定あり(JSON)
リクエスト

PUT /api/v2/maint/cli
Accept: text/plain
Content-Type: application/json

 


{
"show": "interface ethernet 0",
"include": "inet addr"
}

 

レスポンス

200 OK
Content-Type: text/plain

 

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

 

include 指定あり(XML)
リクエスト

PUT /api/v2/maint/cli
Accept: text/plain
Content-Type: application/xml

 

<config>
<show>interface ethernet 0</show>
<include>inet addr</include>
</config>

 

レスポンス

200 OK
Content-Type: text/plain

 

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

 

CLI 実行結果の取得(非同期コマンド用)

本 API は、実行に時間を要するため非同期で処理される CLI コマンドについて、その実行結果を取得するために使用します。

処理の流れ

  1. 任意の CLI 実行 API を呼び出し、レスポンスとして 実行 ID(exec-id) を取得する。
  2. 本 API(GET)に実行 ID を渡して、コマンドの実行結果を確認する。

 

メソッド URI
GET /api/v2/maint/cli/{ID}
  • 実行 ID(exec-id)は、0000 ~ ffff(4桁の16進数)で指定します。
  • 実行結果の保持期間は、コマンド完了から 600 秒間 です。時間を過ぎると ID は無効となり削除されます。
  • speed-test コマンドの制限:
    本 API で取得できるのは、「コマンドの実行状態(実行中・終了・エラー等)」のみです。スループット等の測定データ(測定結果)を取得する場合は、PUT /maint/cli を別途使用してください。

 

TEXT/PLAIN
リクエスト

GET /api/v2/maint/cli/0001
Accept: text/plain

 

レスポンス

200 OK
Content-Type: text/plain

 

  • 出力例 1 : get system statistics cpu

 

[started: 2023/05/09 12:32:15]
 12:32:15   CPU#     %CPU    %user   %nice   %system     %idle   %iowait    %irq    %soft
 12:32:16    all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:16      0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:16      1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:17    all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:17      0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:17      1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:18    all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:18      0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:18      1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:19    all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:19      0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:19      1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:20    all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:20      0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 12:32:20      1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 AVERAGE     all     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 AVERAGE       0     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00
 AVERAGE       1     0.00     0.00    0.00      0.00    100.00      0.00    0.00     0.00

  • 出力例 2 : speed-test

 

[started: 2026/01/15 17:13:57]
Starting ....
finished(seq number 1)

CLI 実行の停止・実行結果の削除(非同期コマンド用)

メソッド URI
DELETE /api/v2/maint/cli/{ID}
 
リクエスト

DELETE /api/v2/maint/cli/0001

 

レスポンス

204 No content

目次