Xml input to netconf-console-tcp

Hi,

I have a xml file which does the functionality of assigning allocid to 8 ports with 8 message-ids.
Sample for 2 ports is given below, rest the same for other ports.
./netconf-console-tcp allocid.xml == triggers only for 3 message-id so 3 ports got assigned but others not assigned(port 4 to 8).

  1. is there any changes needed at confd.conf?
  2. i have 10 xml files with different functionalities, can i put all into one xml(some 100 message-ids) and excute one shot?
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
   <edit-config><target><running/></target><config><capable-switch xmlns="http://tail-f.com/ns/example/olt" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
            <logical-switch>   <port_mapping>
                        <dev_id>0</dev_id>
                        <chan_id>0</chan_id>
                        <alloc_id>400</alloc_id>
                        <port_id>1</port_id>
               </port_mapping>
            </logical-switch>
         </capable-switch>
      </config>
   </edit-config>
</rpc><img src="/uploads/default/original/1X/0b61ef83a0aec64b711a0f914ebf49d3c5215021.png" width="690" height="344">
]]>]]>

<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
   <edit-config>
      <target>
         <running/>
      </target>
      <config>
         <capable-switch xmlns="http://tail-f.com/ns/example/olt" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
            <logical-switch>
               <port_mapping>
                        <dev_id>0</dev_id>
                        <chan_id>0</chan_id>
                        <alloc_id>400</alloc_id>
                        <port_id>2</port_id>
               </port_mapping>
            </logical-switch>
         </capable-switch>
      </config>
   </edit-config>
</rpc>
]]>]]>

Thanks,
madhira

That should work fine for you. Example using the examples.confd/intro/1-2-3-start-query-model example:

$ diff -u cmd-set-subnet1.xml.bak cmd-set-subnet1.xml
--- cmd-set-subnet1.xml.bak	2017-11-29 11:25:18.000000000 +0100
+++ cmd-set-subnet1.xml	2017-11-29 11:22:44.000000000 +0100
@@ -30,6 +30,30 @@
 </rpc>
 ]]>]]>
 <?xml version="1.0" encoding="UTF-8"?>
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="2">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.129.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.129.60</lowAddr>
+              <hiAddr>192.168.129.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3">
   <close-session/>
 </rpc>

Hi cohult,

i am using baisc version.

i verified all xml files at examples dir, all consists of
message-id=“1” for
message-id=“2” for

but i have xml with 8 message-ids for out of 8 only 3 getting triggered.
so any changes needed to overcome this restriction for 3?
or any changes need at xml format to trigger all 8 ids?

please correct me if i am wrong.

Thanks,
Sasidhar

Example of multiple <edit-config> in one file can be found here:

https://cisco.box.com/s/hfys28s9kl7jl6dyowor73pnmi6fb7x8

Please, can you test it in your environment.

As suggested, it is always better to put all data to one <edit-config> as each <edit-config> into running target means separate transaction. For running target commit message at the end (in example) is not needed .

There is of course no limitation or restriction like that.

$ diff -u cmd-set-subnet1.xml.bak cmd-set-subnet1.xml
--- cmd-set-subnet1.xml.bak	2017-11-29 11:25:18.000000000 +0100
+++ cmd-set-subnet1.xml	2017-11-29 11:52:40.000000000 +0100
@@ -30,6 +30,174 @@
 </rpc>
 ]]>]]>
 <?xml version="1.0" encoding="UTF-8"?>
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="2">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.129.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.129.60</lowAddr>
+              <hiAddr>192.168.129.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="3">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.130.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.130.60</lowAddr>
+              <hiAddr>192.168.130.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="4">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.131.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.131.60</lowAddr>
+              <hiAddr>192.168.131.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="5">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.132.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.132.60</lowAddr>
+              <hiAddr>192.168.132.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="6">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.133.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.133.60</lowAddr>
+              <hiAddr>192.168.133.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="7">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.134.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.134.60</lowAddr>
+              <hiAddr>192.168.134.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  message-id="8">
+ <edit-config>
+    <target>
+      <running/>
+    </target>
+    <config>
+      <dhcp xmlns="http://tail-f.com/ns/example/dhcpd"
+            xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <SubNets>
+          <subNet nc:operation="create">
+            <net>192.168.135.0</net>
+            <mask>255.255.255.0</mask>
+            <range>
+              <lowAddr>192.168.135.60</lowAddr>
+              <hiAddr>192.168.135.89</hiAddr>
+            </range>
+          </subNet>
+        </SubNets>
+      </dhcp>
+    </config>
+  </edit-config>
+</rpc>
+]]>]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
   <close-session/>
 </rpc>

Thanks mnovak and cohult for helping.

it works with all data under one , means single message-id.