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

NSO 4.5.2 / 4.6 以降では RFC 8040 に記載されている RESTCONF Event Notification がサポートされています。

 

Event Steam のリストは以下のリソースにアクセスして確認することができます。

❯ curl -kisu admin:admin \
-X GET \
-H "Accept: application/yang-data+xml" \
"http://localhost:8080/restconf/data/ietf-restconf-monitoring:restconf-state/streams"
HTTP/1.1 200 OK
Server:
Date: Sun, 28 Oct 2018 12:43:05 GMT
Last-Modified: Sun, 28 Oct 2018 12:36:58 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Etag: 1540-730218-163393
Content-Type: application/yang-data+xml
Transfer-Encoding: chunked
Pragma: no-cache


<streams xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring" xmlns:rcmon="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
<stream>
<name>NETCONF</name>
<description>default NETCONF event stream</description>
<replay-support>false</replay-support>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/NETCONF/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/NETCONF/json</location>
</access>
</stream>
<stream>
<name>ncs-alarms</name>
<description>NCS alarms according to tailf-ncs-alarms.yang</description>
<replay-support>false</replay-support>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/ncs-alarms/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/ncs-alarms/json</location>
</access>
</stream>
<stream>
<name>ncs-events</name>
<description>NCS event according to tailf-ncs-devices.yang</description>
<replay-support>true</replay-support>
<replay-log-creation-time>2018-10-28T12:36:56+00:00</replay-log-creation-time>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/ncs-events/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/ncs-events/json</location>
</access>
</stream>
<stream>
<name>device-notifications</name>
<description>NCS events forwarded from devices</description>
<replay-support>true</replay-support>
<replay-log-creation-time>2018-10-28T12:36:56+00:00</replay-log-creation-time>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/device-notifications/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/device-notifications/json</location>
</access>
</stream>
<stream>
<name>service-state-changes</name>
<description>Plan state transitions according to
tailf-ncs-plan.yang</description>
<replay-support>false</replay-support>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/service-state-changes/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/service-state-changes/json</location>
</access>
</stream>
<stream>
<name>exevent</name>
<description>Example event of RESTCONF notification</description>
<replay-support>true</replay-support>
<replay-log-creation-time>2018-10-28T12:36:56+00:00</replay-log-creation-time>
<access>
<encoding>xml</encoding>
<location>http://localhost:8080/restconf/streams/exevent/xml</location>
</access>
<access>
<encoding>json</encoding>
<location>http://localhost:8080/restconf/streams/exevent/json</location>
</access>
</stream>
</streams>

 

Event Steam への subscribe は以下のように実施します。

❯ curl -kisu admin:admin \
-X GET \
-H "Accept: text/event-stream" \
"http://localhost:8080/restconf/streams/ncs-events/xml"

HTTP/1.1 200 OK
Server:
Date: Sun, 28 Oct 2018 12:57:19 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Type: text/event-stream
Transfer-Encoding: chunked
Pragma: no-cache

 

Notification の受信例

data: <notification xmlns='urn:ietf:params:xml:ns:netconf:notification:1.0'>
data: <eventTime>2018-10-28T21:58:47.442302+00:00</eventTime>
data: <test-notif xmlns='http://example.com/notif'>
data: <status>OK - Notif from service</status>
data: </test-notif>
data: </notification>
Getting Started

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

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