0

我在使用 NCCLIENT (0.6.9) 查询多个配置元素时遇到问题。你能帮我找到正确的语法吗?我需要在一次调用中查询所有这些以重现错误。

下面的过滤器返回错误:

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>'''

但是,单个模块查询 - 如下所示 - 有效:

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>'''
4

0 回答 0