キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
139
閲覧回数
2
いいね!
0
コメント
Asami Agarie
Cisco Employee
Cisco Employee

 

 

はじめに

NSO では config data とは別にデバイスの runtime data も取得することができます。config data と runtime data は YANG で分られており、前者が /devices/device/config、後者が /devices/device/live-status にマウントされています。
本記事は live-status を使用し runtime data を取得する ( CLI と RESTCONF ) 例を紹介します。

NED のサポート

一般的なデバイスにおいて、通常 runtime データは show interface や、show router 等、show コマンドを使用し取得します。以下を実装することで、 NED で定義したモデルを適用した runtime data を取得することができます。

1. デバイスの runtime データをモデル化する (config false)
2. Java NED code を書いて NEDに実装する

上記モジュールをコンパイルすることで、runtime データが /devices/device/live-status にマウントされます。詳細については下記 NED Development をご参照下さい。https://developer.cisco.com/docs/nso/guides/#!network-element-drivers-neds/statistics

CLI demo

cisco-nx デバイスで /devices/device/live-status から参照可能な情報を確認します。

 

admin@ncs# show devices device nx1 live-status ?
Description: Status data fetched from the device
Possible completions:
  bgp             Display BGP status and configuration
  cdp             Show information about cdp
  forwarding      
  interface       
  inventory       Inventory information
  ip              
  l2route         Layer 2 routing information base
  lldp            Show information about lldp
  mac             MAC configuration commands
  modules-state   
  nve             NVE information
  port-channel    
  system          System-related show commands
  vlan            
  vpc             
  vtp             
  yang-library    
  |               Output modifiers
  <cr>   

 

show コマンドの結果を表示

 

admin@ncs# show devices device nx1 live-status inventory Chassis     
                                                   VENDOR               
NAME     DESCRIPTION                PRODUCT ID     ID      SERIAL       
------------------------------------------------------------------------
Chassis  Nexus9000 C9372PX chassis  N9K-C9372PX-E  V01     SAL1950USVB  

 

対象の情報がモデル化されていないケースではアクションとして実行することもできます。

 

admin@ncs# devices device nx1 live-status exec show inventory Chassis
result 
NAME: "Chassis",  DESCR: "Nexus9000 C9372PX chassis"             
PID: N9K-C9372PX-E       ,  VID: V01 ,  SN: SAL1950USVB    

 

 

RESTCONF demo

 

$ curl -u admin:admin http://localhost:8080/restconf/data/tailf-ncs:devices/device=nx1/live-status/tailf-ned-cisco-nx-stats:inventory=Chassis                   

<inventory xmlns="http://tail-f.com/ned/cisco-nx/stats"  xmlns:nx-stats="http://tail-f.com/ned/cisco-nx/stats"  xmlns:ncs="http://tail-f.com/ns/ncs">
  <name>Chassis</name>
  <description>Nexus9000 C9372PX chassis</description>
  <product-id>N9K-C9372PX-E</product-id>
  <vendor-id>V01</vendor-id>
  <serial>SAL1950USVB</serial>
</inventory>

 

アクションを実行する場合、 operation resource に対して POST method を使用します。( GET は使用できません )

 

$ curl -s -X POST 'http://admin:admin@localhost:8080/restconf/operations/devices/device=nx1/live-status/exec/show' -H "Content-Type: application/yang-data+xml" -d '<input><args>inventory chassis</args></input>'
<output xmlns='http://tail-f.com/ned/cisco-nx/stats'>
  <result>&#13;&#13;
NAME: "Chassis",  DESCR: "Nexus9000 C9372PX chassis"             &#13;
PID: N9K-C9372PX-E       ,  VID: V01 ,  SN: SAL1950USVB          &#13;
&#13;
&#13;</result>
</output>

$ curl -s -X POST 'http://admin:admin@localhost:8080/restconf/operations/devices/device=nx1/live-status/exec/any' -H "Content-Type: application/yang-data+xml" -d '<input><args>show inventory chassis</args></input>'
<output xmlns='http://tail-f.com/ned/cisco-nx/stats'>
  <result>&#13;&#13;
NAME: "Chassis",  DESCR: "Nexus9000 C9372PX chassis"             &#13;
PID: N9K-C9372PX-E       ,  VID: V01 ,  SN: SAL1950USVB          &#13;
&#13;
&#13;</result>
</output>

 

Getting Started

検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう

シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします