How to query multiple config elements simultaneously?

114 views Asked by At

I am having trouble with querying multiple config elements with NCCLIENT (0.6.9). Could you please, help me to find the correct syntax? I need to query all those in one call to reproduce a bug.

The filter below returns an error:

lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 14, column 1

FILTER = '''
<devm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0"
format-version="1.0">
    <ports>
      <port>
        <ethernetPort>
          <negotiation/>
          <speed/>
          <duplex/>
        </ethernetPort>
      </port>
    </ports>
</devm>
<evc xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0"
format-version="1.0">
    <bds>
      <bd>
        <bdId/>
        <bdDesc/>
        <servicePoints>
          <servicePoint>
            <ifName/>
          </servicePoint>
        </servicePoints>
      </bd>
    </bds>
</evc>
<ifm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0"
format-version="1.0">
    <interfaces>
      <interface>
        <ifName/>
        <ifIndex/>
        <ifClass/>
        <ifPhyType/>
        <ifParentIfName/>
        <ifNumber/>
        <ifDescr/>
        <ifTrunkIfName/>
        <ifAdminStatus/>
        <ifLinkProtocol/>
       <ifMtu/>
        <ipv4Config>
          <am4CfgAddrs>
            <am4CfgAddr>
              <ifIpAddr/>
              <subnetMask/>
               </am4CfgAddr>
          </am4CfgAddrs>
        </ipv4Config>
        <ipv6Config>
          <am6CfgAddrs>
            <am6CfgAddr>
              <ifIp6Addr/>
              <addrPrefixLen/>
            </am6CfgAddr>
          </am6CfgAddrs>
        </ipv6Config>
      </interface>
    </interfaces>
</ifm>
<nvo3 xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0"
format-version="1.0">
    <nvo3Vni2Bds>
      <nvo3Vni2Bd>
        <vniId/>
        <bdId/>
      </nvo3Vni2Bd>
    </nvo3Vni2Bds>
    <nvo3Nves>
      <nvo3Nve>
        <ifName/>
        <srcAddr/>
        <srcIpv6Addr/>
        <vniMembers>
          <vniMember/>
        </vniMembers>
      </nvo3Nve>
    </nvo3Nves>
</nvo3>'''

However, a single module query - such below - works:

FILTER = '''
<devm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0"
format-version="1.0">
    <ports>
      <port>
        <ethernetPort>
          <negotiation/>
          <speed/>
          <duplex/>
        </ethernetPort>
      </port>
    </ports>
</devm>'''
0

There are 0 answers