ichen
December 14, 2015, 3:11pm
1
How do I implement the callpoints for an external database for the YANG modules below so that the message below can be valid? In my experiment, I see that ConfD first performs validation by invoking get_elem() to find “/citizens/citizen{John}/name”, which is not in the external database, but is being created in the same message.
module test-citizens {
namespace “http://www.example.com/yang/test-citizens ”;
prefix “tc”;
organization “”;
contact “”;
container citizens {
list citizen {
key “name”;
leaf name {
type string;
}
}
}
}
module test-dependency {
namespace “http://www.example.com/yang/test-dependency ”;
prefix “td”;
import test-citizens {
prefix “tc”;
}
organization “”;
contact “”;
container cities {
list city {
key “name”;
leaf name {
type string;
}
leaf mayor {
type leafref {
path “/tc:citizens/tc:citizen/tc:name”;
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
td:cities
<td:city xc:operation=“create”>
td:name Seattle</td:name>
td:mayor John</td:mayor>
</td:city>
</td:cities>
tc:citizens
<tc:citizen xc:operation=“create”>
tc:name John</tc:name>
</tc:citizen>
</tc:citizens>
waitai
December 15, 2015, 7:49pm
2
Can you elaborate more on your question? Please explain what do you mean by “the message below can be valid”?
ichen
December 21, 2015, 2:40pm
3
I was wondering how ConfD replies to the edit-config message, whether it’s an error or ok.
The YANG modules and the edit-config message didn’t show up well in my initial message, so I’m attaching them with this message.
YANG modules as follows:
module test-citizens {
namespace "http://www.example.com/yang/test-citizens";
prefix "tc";
organization "";
contact "";
container citizens {
list citizen {
key "name";
leaf name {
type string;
}
}
}
}
module test-dependency {
namespace "http://www.example.com/yang/test-dependency";
prefix "td";
import test-citizens {
prefix "tc";
}
organization "";
contact "";
container cities {
list city {
key "name";
leaf name {
type string;
}
leaf mayor {
type leafref {
path "/tc:citizens/tc:citizen/tc:name";
}
}
}
}
}
NETCONF edit-config as follows:
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="104"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns:tc="http://www.example.com/yang/test-citizens"
xmlns:td="http://www.example.com/yang/test-dependency">
<edit-config>
<target>
<running />
</target>
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<td:cities>
<td:city xc:operation="create">
<td:name>Seattle</td:name>
<td:mayor>John</td:mayor>
</td:city>
</td:cities>
<tc:citizens>
<tc:citizen xc:operation="create">
<tc:name>John</tc:name>
</tc:citizen>
</tc:citizens>
</config>
</edit-config>
</rpc>
waitai
December 21, 2015, 8:08pm
4
You get an OK response as follows:
21-Dec-2015::12:05:12.350 **> sess:11 read:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
<capability>urn:ietf:params:netconf:base:1.0</capability>
</capabilities>
</hello>
]]>]]>
<rpc xmlns:td="http://www.example.com/yang/test-dependency" xmlns:tc="http://www.example.com/yang/test-citizens" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="104">
<edit-config>
<target>
<running/>
</target>
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<td:cities>
<td:city xc:operation="create">
<td:name>Seattle</td:name>
<td:mayor>John</td:mayor>
</td:city>
</td:cities>
<tc:citizens>
<tc:citizen xc:operation="create">
<tc:name>John</tc:name>
</tc:citizen>
</tc:citizens>
</config>
</edit-config>
</rpc>
]]>]]>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<get>
<filter type="xpath" select=" cities"/>
</get>
</rpc>
]]>]]>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<get>
<filter type="xpath" select=" citizens"/>
</get>
</rpc>
]]>]]>
<rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<close-session/>
</rpc>
21-Dec-2015::12:05:12.387 **< sess:11 write:
<rpc-reply xmlns:tc="http://www.example.com/yang/test-citizens" xmlns:td="http://www.example.com/yang/test-dependency" message-id="104" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<ok/>
</rpc-reply>
21-Dec-2015::12:05:12.400 **< sess:11 write:
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data>
<cities xmlns="http://www.example.com/yang/test-dependency">
<city>
<name>Seattle</name>
<mayor>John</mayor>
</city>
</cities>
</data>
</rpc-reply>
21-Dec-2015::12:05:12.401 **< sess:11 write:
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data>
<citizens xmlns="http://www.example.com/yang/test-citizens">
<citizen>
<name>John</name>
</citizen>
</citizens>
</data>
</rpc-reply>
21-Dec-2015::12:05:12.401 **< sess:11 write:
<rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<ok/>
</rpc-reply>
**< sess:11 session closed
ichen
December 21, 2015, 8:57pm
5
Did you try using an external database?
When I used CDB, I get an ok response.
When I used an external database, I get an error.
waitai
December 21, 2015, 9:35pm
6
Can you share your data provider code? I can help to debug it.
ichen
January 5, 2016, 9:30pm
7
Thanks for your demo. I got it to work now.