Hi, Andy:

Thanks for your response.

I write an RESTCONF sample code, could you check which option is good.

The module is still that example on the last mail.

Example 1
The Request:
GET /restconf/data/interface-module:interfaces
HTTP/1.1
Host: example.com
Accept: application/yang.data+xml

For the above request, which response is correct? Response 1 or Response 2?
Response 1
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

<interfaces xmlns="http://example.com/schema/interfaces"; 
xmlns:ds0="http://example.com/schema/ds0";>
   <ifEntry>
     <ifIndex>1</ifIndex>
     <ifDescr>Flintstone Inc Ethernet A562</ifDescr>
     <ifType>ethernetCsmacd</ifType>
     <ifMtu>1500</ifMtu>
   </ifEntry>
   <ifEntry>
     <ifIndex>2</ifIndex>
     <ifDescr>Flintstone Inc DS0</ifDescr>
     <ifType>ds0</ifType>
     <ds0:ds0ChannelNumber>1</ds0:ds0ChannelNumber>
   </ifEntry>
 </interfaces>

Response 2
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

<interfaces xmlns="http://example.com/schema/interfaces";>
   <ifEntry>
     <ifIndex>1</ifIndex>
     <ifDescr>Flintstone Inc Ethernet A562</ifDescr>
     <ifType>ethernetCsmacd</ifType>
     <ifMtu>1500</ifMtu>
   </ifEntry>
   <ifEntry>
     <ifIndex>2</ifIndex>
     <ifDescr>Flintstone Inc DS0</ifDescr>
     <ifType>ds0</ifType>
   </ifEntry>
 </interfaces>


Example 2
If we want to get elements of ifEntry(ifIndex, ifDescr, ifType, ifMTU) and 
augment element ‘ds0ChannelNumber’, which Request is correct? Request 1,Request 
2 or Request 3?
Request 1:
GET /restconf/data/ds0-module:interfaces
HTTP/1.1
Host: example.com
Accept: application/yang.data+xml

Request 2:
GET /restconf/data/interfaces-module:interfaces
HTTP/1.1
Host: example.com
Accept: application/yang.data+xml

Request 3:
GET 
/restconf/data?fields=interfaces-module:interfaces;ds0-module:ds0ChannelNumber
HTTP/1.1
Host: example.com
Accept: application/yang.data+xml

Thanks
Yangang

发件人: Andy Bierman [mailto:[email protected]]
发送时间: 2015年10月9日 0:40
收件人: Yangang
抄送: [email protected]; [email protected]; Zhangxianping (A)
主题: Re: [netmod] One questions about the RESTCONF.



On Thu, Oct 8, 2015 at 4:48 AM, Yangang 
<[email protected]<mailto:[email protected]>> wrote:
Hi, All:

Recently, I try to use RESTCONF to support some functions. But I get one issue. 
Maybe somebody can help me to make it clear.

It is about how to use the "augment", there is one example in RFC6020, and it 
is clear. But maybe there is a little confused in RESTCONF draft.

>From the example in RFC6020, the namespace 
>http://example.com/schema/interfaces,

 container interfaces {
     list ifEntry {
         key "ifIndex";
         leaf ifIndex {
             type uint32;
         }
         leaf ifDescr {
             type string;
         }
         leaf ifType {
             type iana:IfType;
         }
         leaf ifMtu {
             type int32;
         }
    }
 }

 Then, in namespace http://example.com/schema/ds0, we have:

 import interface-module {
     prefix "if";
 }

 augment "/if:interfaces/if:ifEntry" {
     when "if:ifType='ds0'";
     leaf ds0ChannelNumber {
         type ChannelNumber;
     }
 }

 A corresponding netconf XML instance example:

 <interfaces xmlns="http://example.com/schema/interfaces"; 
xmlns:ds0="http://example.com/schema/ds0";>
   <ifEntry>
     <ifIndex>1</ifIndex>
     <ifDescr>Flintstone Inc Ethernet A562</ifDescr>
     <ifType>ethernetCsmacd</ifType>
     <ifMtu>1500</ifMtu>
   </ifEntry>
   <ifEntry>
     <ifIndex>2</ifIndex>
     <ifDescr>Flintstone Inc DS0</ifDescr>
     <ifType>ds0</ifType>
     <ds0:ds0ChannelNumber>1</ds0:ds0ChannelNumber>
   </ifEntry>
 </interfaces>

About the RESTCONF, my problems are:

1. In the GET operation, how to support it, we have download the GET two times? 
To get "http://example.com/schema/interfaces"; and 
"http://example.com/schema/ds0"; separately? Or something I missed to get all 
information in one request.

You don't get namespaces, you get subtrees.
The "fields" parameter is available to select multiple disjoint
subtrees in one request.


2. In the PUT operation. The question is same, how to set the namespace, may I 
change the MTU and ChannelNumber together?

You would use PATCH for that, not PUT.
Either YANG Patch or a plain patch on the interface entry
would allow multiple descendant nodes to be changed at once.


Maybe I miss some important operation, can somebody provide a example?

Thanks
Yangang.

Andy


_______________________________________________
netmod mailing list
[email protected]<mailto:[email protected]>
https://www.ietf.org/mailman/listinfo/netmod

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to