Subject: [I2rs-proto-dt] my example

From: Kent Watsen <[email-masked]>
Date: Fri, 4 Sep 2015 13:56:53 +0000

I made up this goofy example, but it illustrates my view...

K.

Yang:

module thermostat { ...
namespace "https://example.com/ns/thermostat";
leaf desired-temp {
type int32;
units "degrees Celsius";
description "The desired temperature";
}
leaf actual-temp {
type int32;
config false;
units "degrees Celsius";
description "The measured temperature";
}
leaf lsp-id {
config false;     <---- opstate value
type uint16;
}
}

module thermostat-ephemeral {
import thermostat { prefix t; }  <!--- import
module-type ephemeral;  <---- type declaration
rpc do-stuff-with-lsp-id {
input {
leaf lsp-id {
type leafref {
path "/t:thermostat/lsp-id
}
}
}
notify if ! /t:thermostat/lsp-id {
message "lsp id $(/t:thermostat/lsp-id) is gone.";
target notification-target;  <--- e.g., SSE, syslog, etc.
}
}
}

Usage:

Request:
      GET/restconf/data/thermostat:lsp-id?content=nonconfig
      Host: example.com
      Accept: application/yang.data+xml

Response:
      HTTP/1.1 200 OK
      Date: Mon, 23 Apr 2012 17:02:40 GMT
      Server: example-server
      Content-Type: application/yang.data+xml
      Cache-Control: no-cache
      Pragma: no-cache
      ETag: a74eefc993a2b
      Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT
      <lsp-id xmlns="https://example.com/ns/thermostat">123</lsp-id>

Request:
     POST /restconf/operations/thermostat-ephemeral:do-stuff-with-lsp-id=123 HTTP/1.1
     Server: example.com

Response:
     HTTP/1.1 200 OK
     Date: Mon, 25 Apr 2012 11:01:00 GMT
     Server: example-server

Notification:
    POST /<notification-target's URL> HTTP/1.1
    Host: example.com
    Content-Type: application/yang.operation+xml
    <input xmlns="https://example.com/ns/thermostat">
           <lsp-id>-123</lsp--id>
           <message>LSP-id 123 is gone</message>
    </input>

---

From: "Susan Hares" <[email-masked]>
Date: Fri, 4 Sep 2015 09:58:51 -0400

Kent: 

Thank you for the example!  I'll have it ready for display at the meeting. 

Sue 

From: I2rs-proto-dt [mailto:[email-masked]] On Behalf Of
Kent Watsen
Sent: Friday, September 04, 2015 9:57 AM
To: [email-masked]
Subject: [I2rs-proto-dt] my example

K.

Yang:

module thermostat { ...

leaf desired-temp {

type int32;

units "degrees Celsius";

}

leaf actual-temp {

type int32;

config false;

units "degrees Celsius";

} 

leaf lsp-id {

type uint16;

}

}

input {

leaf lsp-id {

type leafref {

}

}

}

}

}

}

Usage:

Request:

      Host: example.com

Response:

      HTTP/1.1 200 OK

      Server: example-server

      Cache-Control: no-cache

      Pragma: no-cache

      ETag: a74eefc993a2b

      <lsp-id xmlns="https://example.com/ns/thermostat
<https://example.com/ns/thermostat%22%3e> ">123</lsp-id>

Request:

     POST /restconf/operations/thermostat-ephemeral:do-stuff-with-lsp-id=123
HTTP/1.1

     Server: example.com

Response:

     HTTP/1.1 200 OK

     Server: example-server

Notification:

    Host: example.com

           <lsp-id>-123</lsp--id>

    </input>