Xml Juniper NETCONF RPC-未返回任何数据

Xml Juniper NETCONF RPC-未返回任何数据,xml,rpc,juniper,netconf,Xml,Rpc,Juniper,Netconf,我正在尝试向我的JuniperVM发送一个自定义XMLRPC。命令如下所示: netconf控制台--主机192.168.1.100--端口830--用户xxxx--密码xxxx--rpc junos-get-interfaces.xml <nc:get-config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:source> <nc:running/> </nc:s

我正在尝试向我的JuniperVM发送一个自定义XMLRPC。命令如下所示:

netconf控制台--主机192.168.1.100--端口830--用户xxxx--密码xxxx--rpc junos-get-interfaces.xml

<nc:get-config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<nc:source>
<nc:running/>
</nc:source>
<nc:filter type="xpath" select="/interfaces">
</nc:filter>
</nc:get-config>

自定义RPC正在尝试筛选正在运行的配置,以便仅检索接口节。但我得到了以下回应:

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/12.1R1/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f0b4fd48-fcb5-4e03-815b-961a19a9b525">
<data>
</data>
</rpc-reply>

但是,在框上的Interfaces节下有一个配置。你知道怎么回事吗?我还尝试在netconf console CLI命令中使用xpath,但它说服务器不支持它

netconf控制台--主机192.168.1.100--端口830--用户xxxx--密码xxxx--获取配置/本机/接口
操作失败:MissingCapabilityError-服务器不支持[:xpath]

xpath不是get-config的有效筛选器类型

-将标记元素括起来。强制类型属性表示用于表示请求的配置元素的语法类型;
仅可接受的值是子树。

您可以使用过滤器类型子树,如下所述

注意:GET-CONF没有用于继承的属性。如果需要拉取最终配置,即使用“组”节,则需要使用GET-configuration。我将在下面的附加输出中显示差异。

使用get conf获取get-interfaces.xml的内容

获取配置的示例输出:

root@Ubuntu-服务器:~#netconf控制台--主机10.49.162.162--端口830--用户根目录--密码Embe1mpls--rpc get-interfaces.xml
xe-0/0/0
0
172.20.0.12/32
xe-0/0/1
0
172.20.20.0/32
使用带继承的get配置获取get-interfaces.xml的内容


get configuration的示例输出:[注意在同一主机上继承的所有其他接口]

root@Ubuntu-服务器:~#netconf控制台--主机10.49.162.162--端口830--用户根目录--密码xxxx--rpc get-interfaces.xml
xe-0/0/0
0
172.20.0.12/32
xe-0/0/1
0
172.20.20.0/32
lo0
0
128.49.162.162/32
47.0005.80ff.f800.0000.0108.0001.1280.4916.2162.00
abcd::128:49:162:162/128
em0
0
10.49.162.162/19
em1
0
169.254.0.2/24
注意:为了帮助查找过滤器级别,可以在主机上运行“| display xml”命令,以帮助识别正确的标记

root@vqfx-leaf-01>显示配置界面|显示xml |显示继承
xe-0/0/0
0
172.20.0.12/32
xe-0/0/1
0
172.20.20.0/32
lo0
0
128.49.162.162/32
47.0005.80ff.f800.0000.0108.0001.1280.4916.2162.00
abcd::128:49:162:162/128
<get-config>
    <source>
        <running/>
    </source>
    <filter type="subtree">
        <configuration>
            <interfaces/>
        </configuration>
    </filter>
</get-config>
netconf-console --host 10.49.162.162 --port 830 --user root --password xxxx --rpc get-interfaces.xml
root@Ubuntu-Server:~# netconf-console --host 10.49.162.162 --port 830 --user root --password Embe1mpls --rpc get-interfaces.xml 
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.3I0/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ae0be5f0-4f9d-45fa-b92f-c161d2a92f2b">
<data>
<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm" junos:commit-seconds="1608495419" junos:commit-localtime="2020-12-20 12:16:59 PST" junos:commit-user="root">
    <interfaces>
        <interface>
            <name>xe-0/0/0</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>172.20.0.12/32</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
        <interface>
            <name>xe-0/0/1</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>172.20.20.0/32</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
    </interfaces>
</configuration>
</data>
</rpc-reply>
<get-configuration inherit="inherit">
    <configuration>
        <interfaces/>
    </configuration>
</get-configuration>
root@Ubuntu-Server:~# netconf-console --host 10.49.162.162 --port 830 --user root --password xxxx --rpc get-interfaces.xml 
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.3I0/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:92751ca5-8d1f-449c-a3e8-10aba7be249c">
<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm" junos:changed-seconds="1608495419" junos:changed-localtime="2020-12-20 12:16:59 PST">
    <interfaces>
        <interface>
            <name>xe-0/0/0</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>172.20.0.12/32</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
        <interface>
            <name>xe-0/0/1</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>172.20.20.0/32</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
        <interface>
            <name>lo0</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>128.49.162.162/32</name>
                            <primary/>
                        </address>
                    </inet>
                    <iso>
                        <address>
                            <name>47.0005.80ff.f800.0000.0108.0001.1280.4916.2162.00</name>
                        </address>
                    </iso>
                    <inet6>
                        <address>
                            <name>abcd::128:49:162:162/128</name>
                            <primary/>
                        </address>
                    </inet6>
                </family>
            </unit>
        </interface>
        <interface>
            <name>em0</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>10.49.162.162/19</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
        <interface>
            <name>em1</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>169.254.0.2/24</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
    </interfaces>
</configuration>
</rpc-reply>
root@vqfx-leaf-01> show configuration interfaces | display xml | display inheritance 
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/18.3I0/junos">
    <configuration junos:commit-seconds="1608495419" junos:commit-localtime="2020-12-20 12:16:59 PST" junos:commit-user="root">
            <interfaces>
                <interface>
                    <name>xe-0/0/0</name>
                    <unit>
                        <name>0</name>
                        <family>
                            <inet>
                                <address>
                                    <name>172.20.0.12/32</name>
                                </address>
                            </inet>
                        </family>
                    </unit>
                </interface>
                <interface>
                    <name>xe-0/0/1</name>
                    <unit>
                        <name>0</name>
                        <family>
                            <inet>
                                <address>
                                    <name>172.20.20.0/32</name>
                                </address>
                            </inet>
                        </family>
                    </unit>
                </interface>
                <interface>
                    <name>lo0</name>
                    <unit>
                        <name>0</name>
                        <family>
                            <inet>
                                <address>
                                    <name>128.49.162.162/32</name>
                                    <primary/>
                                </address>
                            </inet>
                            <iso>
                                <address>
                                    <name>47.0005.80ff.f800.0000.0108.0001.1280.4916.2162.00</name>
                                </address>
                            </iso>
                            <inet6>
                                <address>
                                    <name>abcd::128:49:162:162/128</name>
                                    <primary/>
                                </address>
                            </inet6>
                        </family>
                    </unit>
                </interface>
                <interface>
                    <name>em0</name>
                    <unit>              
                        <name>0</name>
                        <family>
                            <inet>
                                <address>
                                    <name>10.49.162.162/19</name>
                                </address>
                            </inet>
                        </family>
                    </unit>
                </interface>
                <interface>
                    <name>em1</name>
                    <unit>
                        <name>0</name>
                        <family>
                            <inet>
                                <address>
                                    <name>169.254.0.2/24</name>
                                </address>
                            </inet>
                        </family>
                    </unit>
                </interface>
            </interfaces>
    </configuration>
    <cli>
        <banner>{master:0}</banner>
    </cli>
</rpc-reply>
netconf-console --host 192.168.1.100 --port 830 --user xxxx --password xxxx --get-config --xpath /native/interfaces