Junos Genstate YANGデータモデル
ジュニパーネットワークス genstate YANGスキーマは、Junosデバイスの運用状態を表すYANGデータモデルを定義します。gRPC ネットワーク管理インターフェイス(gNMI)クライアントは、モデルで定義されたリソースパスをサブスクライブして、状態データをリクエストできます。
Genstate YANG データ モデルの概要
Junos OS Evolvedリリース24.2R1以降、ジュニパーネットワークスは生成 状態 YANGデータモデルを公開しています。 genstate モデルは、Junosデバイスの運用状態データ用のサブスクライブ可能なYANGモデルです。これらは、Junos デバイスでの運用コマンド出力を YANG で表現したものです。 genstate モデルは、最上位のモジュールで構成され、公開および使用可能になると、さまざまな運用状態領域ごとにモジュールが強化されます。 genstate スキーマはオリジン「genstate」を使用します。
Junos デバイスには、豊富なネイティブ状態データが含まれています。デバイス上で運用コマンドまたは Junos XML RPC を実行することで、Junos デバイスから運用状態情報を取得できます。ただし、特定のデータを抽出するには、コマンド出力を解析する必要があります。ジュニパーは、テレメトリコレクターが使用できる厳選されたネイティブ junos-state YANG状態モデルも提供していますが、現在のモデルには運用エリアと状態のサブセットのみが含まれています。
genstate YANG モデルは、gNMI サブスクライブ RPC を介して、動作中の show コマンドで利用可能な状態データを公開します。モジュールは、ターゲット・ネットワーク・デバイス上の特定の状態データ・インスタンスに関連するリソース・パスを記述します。gNMI テレメトリ コレクターは、公開された YANG モデルの対応するリソース パスをサブスクライブして、そのインスタンスの状態データをクエリーできます。
Junos デバイスで操作コマンドや RPC を実行すると、デバイスは最上位の要素で囲まれた XML 出力を返します。ルートレベルのタグ名は、囲まれたデータを記述します。例えば、 show interfaces コマンドは、 <interface-information> タグで囲まれた XML 出力を返します。 genstate モジュールでは、モジュールに記述されているデータを簡単に識別できるように、YANG モジュール名とファイル名に最上位の XML タグ名が含まれています。
gRPC ダイヤルイン環境の gNMI クライアントは、 genstate パブリッシュされたパスをサブスクライブできます。クライアントは、SAMPLE モードで STREAM サブスクリプションを使用して、データを要求することしかできません。ON_CHANGEモードはサポートされていません。gNMI を使用してテレメトリ データをサブスクライブする方法については、 Junos Telemetry Interface ユーザ ガイドを参照してください。
genstate YANG データ モデルは、さまざまなリリースで公開および更新されます。特定のリリースで使用可能なモデルとサポートされているパスは、次の方法で確認できます。
-
Juniper/yang GitHubリポジトリからモジュールを表示またはダウンロードします。
-
ジュニパーネットワークスのウェブサイト( https://www.juniper.net/support/downloads)からモジュールをダウンロードします。
Genstate YANGステートモデルの利点
-
gNMI を介して利用可能な動作状態の表面積を増やすことで、gNMI を使用して状態を監視する際に、デバイスとネットワークについてより多くの情報に基づいて使用上の決定を下せるようになります。
-
単一のノースバウンドインターフェイスに移行することで、デバイスの状態を監視する方法を簡素化します。
Genstate モジュールの概要
genstate YANG データ モデルは、利用可能な各動作状態領域のモジュールによって拡張された最上位ルート モジュールで構成されています。genstateスキーマはオリジン「genstate」を使用します。
最上位のモジュールは次のとおりです。
module junos-genstate {
namespace "http://yang.juniper.net/junos/genstate/";
prefix jgs;
organization
"Juniper Networks, Inc.";
contact
"Juniper Networks, Inc.
1133 Innovation Way
Sunnyvale, CA
+1 888 314-5822
E-mail: yang-support@juniper.net";
description
"This module contains a collection of top level nodes for JUNOS genstate data.
Copyright (c) 2023 Juniper Networks, Inc.
All rights reserved.";
revision 2023-01-01 {
description "Junos: ";
}
grouping genstate-top {
description "Top-level grouping for JUNOS genstate data";
container genstate {
description "Encapsulating top-level state container for all JUNOS genstate data";
config false;
}
}
uses genstate-top;
}
最上位の genstate モジュールは、運用状態領域ごとに公開されるモジュールによって拡張されます。運用コマンドやRPCを発行すると、結果のXML出力に動作エリアを記述するルートタグが定義されます。 genstate モジュールでは、動作状態エリアを簡単に識別できるように、モジュール名とファイル名の一部としてこのルート タグ名が含まれています。モジュールプレフィックスはルートタグ名に基づいているため、モジュールごとに異なります。
例えば、 junos-genstate-interface-information モジュールは、通常、JunosコマンドとRPC出力の <interface-information> 要素に含まれるデータを記述します。このように、このモデルは、テレメトリ コレクターがインターフェイス状態データのサブスクリプションに使用できるリソース パスを定義します。
module junos-genstate-interface-information {
namespace "http://yang.juniper.net/junos/genstate/interface-information";
prefix jgii;
import junos-genstate {
prefix jgs;
revision-date 2023-01-01;
}
import junos-common-types {
prefix jt;
revision-date 2023-01-01;
}
organization
"Juniper Networks, Inc.";
contact
"Juniper Networks, Inc.
1133 Innovation Way
Sunnyvale, CA
+1 888 314-5822
E-mail: yang-support@juniper.net";
description "Junos genstate data model for interface-information";
revision 2023-01-01 {
description "Junos: ";
}
grouping interface-information-top {
description "Top-level grouping";
container interface-information {
config false;
description "Top-level container";
list physical-interface {
leaf name {
type string;
description "Name of this item";
}
leaf oper-status {
type string;
description "Current operational state of the interface";
}
leaf local-index {
type int32;
description "Local kernel index for this interface";
}
leaf snmp-index {
type int32;
description "SNMP ifIndex for this interface";
}
container if-config-flags {
leaf iff-none {
type empty;
}
leaf iff-hardware-down {
type empty;
}
leaf iff-down {
type empty;
}
leaf iff-up {
type empty;
}
leaf iff-admin-down {
type empty;
}
leaf iff-admin-up {
type empty;
}
leaf iff-link-down {
type empty;
}
leaf iff-device-down {
type empty;
}
leaf iff-point-to-point {
type empty;
}
leaf iff-point-to-multipoint {
type empty;
}
leaf plp-to-clp {
type empty;
}
leaf iff-multiaccess {
type empty;
}
leaf iff-snmp-traps {
type empty;
}
leaf iff-looped {
type empty;
}
leaf iff-framing-conflict {
type empty;
}
leaf internal-flags {
type string;
description "Hexadecimal value of internal flag bits";
}
}
list logical-interface {
leaf name {
type string;
description "Name of this item";
}
leaf local-index {
type int32;
description "Local kernel index for this interface";
}
leaf snmp-index {
type int32;
description "SNMP ifIndex for this interface";
}
leaf generation {
type string;
description "Generation number used to distinguish between successive instances of this interface";
}
leaf description {
type string;
description "Description of this interface";
}
leaf link-address {
type string;
description "Link address on this logical interface";
}
leaf encapsulation {
type string;
description "Encapsulation on the logical interface";
}
leaf subunit {
type int32;
description "Subunit for this interface";
}
container if-config-flags {
leaf iff-none {
type empty;
}
leaf iff-hardware-down {
type empty;
}
leaf iff-down {
type empty;
}
leaf iff-up {
type empty;
}
leaf iff-admin-down {
type empty;
}
leaf iff-admin-up {
type empty;
}
leaf iff-link-down {
type empty;
}
leaf iff-device-down {
type empty;
}
leaf iff-point-to-point {
type empty;
}
leaf iff-point-to-multipoint {
type empty;
}
leaf plp-to-clp {
type empty;
}
leaf iff-multiaccess {
type empty;
}
leaf iff-snmp-traps {
type empty;
}
leaf iff-looped {
type empty;
}
leaf iff-framing-conflict {
type empty;
}
leaf internal-flags {
type string;
description "Hexadecimal value of internal flag bits";
}
}
leaf admin-status {
type string;
description "Desired state of the interface";
}
leaf oper-status {
type string;
description "Current operational state of the interface";
}
}
}
}
}
augment "/jgs:genstate" {
description "Adds interface-information to top-level genstate";
uses interface-information-top;
}
}
テレメトリコレクターは、 genstate モデルで定義されているさまざまなリソースパスをサブスクライブして、状態データを照会できます。 genstate モデルパス構文では、起点 genstateを使用し、 genstateという名前のルートタグを含み、その後に運用状態領域の最上位のタグ名(例: interface-information)が続きます。
genstate:/genstate/interface-information/
たとえば、gNMI クライアントは、次のパスを使用して et-1/0/1 インターフェイスの管理状態を取得できます。
genstate:/genstate/interface-information/physical-interface[name=et-1/0/1]/admin-status
生成状態モデルのリソース パスの CLI コマンドへのマッピング
show system data-models genstate操作コマンドを使用して、特定のgenstateモデルリソースパス(Xpath式)に対応する出力を生成するCLIコマンドを検証できます。コマンドを取得するには、xpath-cli-command-mapping オプションを含め、目的のリソースへのパスを指定します。
次の例では、 /genstate/system-information/os-version リソースパスに対応する状態データを生成するコマンドを取得します。
user@host> show system data-models genstate xpath-cli-command-mapping /genstate/system-information/os-version Genstate xpath to CLI command mapping information (sometimes multiple commands might be mapped): > show system information
同様に、次の例では、 /genstate/interface-information/physical-interface[name=et-1/0/1]/admin-status パスを CLI コマンドにマッピングし、その情報を出力に含めています。
user@host> show system data-models genstate xpath-cli-command-mapping /genstate/interface-information/physical-interface[name=et-1/0/1]/admin-status Genstate xpath to CLI command mapping information (sometimes multiple commands might be mapped): > show interfaces extensive
CLIコマンドを実行する権限がない場合、対応する genstate サブスクリプションパスにアクセスできません。有効なパーミッションを持つコマンドの 生成状態 パスのみをサブスクライブできます。