LoginSignup
0
0

More than 3 years have passed since last update.

Azure で Juniper vMX - [2] REST APIを使う

Last updated at Posted at 2020-05-24

はじめに

前回 の続き。REST API を使えるようにしないとな

REST API の設定

以下で、REST APIが有効になる。公式などでは https を含めた方法が書かれているが、とりあえず http 使うだけなら以下の3行でできる

# set system services rest control allowed-sources [<your-client-ip-here>]
# set system services rest http port 3000
# set system services rest enable-explorer 

確認してみる

user@vmx-1> show configuration system services rest 
http {
    port 3000;
}
control {
    allowed-sources <your-client-ip-here>;
}
enable-explorer;

curl でアクセス

 curl -u "user:pass" http://ip-address:port/rpc/get-software-information -H "Content-Type: application/xml" -H "Accept: application/json"

{
    "software-information" : [
    {
        "host-name" : [
        {
            "data" : "vmx-1"
        }
        ], 
        "product-model" : [
        {
            "data" : "vmx"
        }
        ], 
        "product-name" : [
        {
            "data" : "vmx"
        }
        ], 
        "junos-version" : [
        {
            "data" : "18.3X3.2"
        }

     :
     : 長いので省略
     :

        {
            "name" : [
            {
                "data" : "jail-runtime"
            }
            ], 
            "comment" : [
            {
                "data" : "JUNOS jail runtime [20190907.2386fa2_builder_stable_11]"
            }
            ]
        }
        ]
    }
    ]
}

API Explorer

ブラウザで http:/juniper-vmx-ip-address:port/ にアクセスするだけ

image.png

一通り試せる。いろいろできる

シリーズ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0