跳转到内容
Ask AI

IP

此内容尚不支持你的语言。

This chapter provides an example of how to use Netconf to manage configuring IPv4 addresses on AsterNOS devices.

Request example to create Ipv4 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv4>
<address operation="create">
<ip-prefix>100.1.1.1/24</ip-prefix>
</address>
</ipv4>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a4c9a7e0-dfcb-4c63-b6c6-61e55b074876">
<ok/>
</rpc-reply>

Request example to delete Ipv4 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv4>
<address operation="delete">
<ip-prefix>100.1.1.1/24</ip-prefix>
</address>
</ipv4>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f6cebf76-83c5-4386-b4b4-f9e25b1701d0">
<ok/>
</rpc-reply>

Request example to get Ipv4 address for interface via get-config with subtree filter.

<filter type="subtree">
<top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv4>
<address/>
</ipv4>
</interface>
</interfaces>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:5e3eec58-8c96-4591-b140-0b84317134bd">
<data>
<top>
<interfaces xmlns="http://asterfusion.com/ns/yang/asternos-interfaces">
<interface>
<name>Ethernet1</name>
<ipv4 xmlns="http://asterfusion.com/ns/yang/asternos-ip">
<address>
<ip-prefix>100.1.1.1/24</ip-prefix>
</address>
</ipv4>
</interface>
</interfaces>
</top>
</data>
</rpc-reply>

Request example to replace Ipv4 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv4>
<address operation="replace">
<ip-prefix>100.1.1.2/24</ip-prefix>
</address>
</ipv4>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:bedd90c7-6283-4475-87f9-8f71887ee91d">
<ok/>
</rpc-reply>

Request example to create Ipv6 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv6>
<address operation="create">
<ip-prefix>2001:db8::1/64</ip-prefix>
</address>
</ipv6>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a432fe56-1d66-4641-9ee3-0488ef208eeb">
<ok/>
</rpc-reply>

Request example to replace Ipv6 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv6 operation="replace">
<address>
<ip-prefix>2001:db8::2/64</ip-prefix>
</address>
</ipv6>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:bedd90c7-6283-4475-87f9-8f71887ee91d">
<ok/>
</rpc-reply>

Request example to delete Ipv6 address for interface via edit-config.

<config><top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv6>
<address operation="delete">
<ip-prefix>2001:db8::1/64</ip-prefix>
</address>
</ipv6>
</interface>
</interfaces>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:fdf348d6-2516-4fa4-9dd7-c088576e5d20">
<ok/>
</rpc-reply>

Request example to get Ipv6 address for interface via get-config with subtree filter.

<filter type="subtree">
<top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv6>
<address/>
</ipv6>
</interface>
</interfaces>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f5d98bea-c776-4ac7-aa0c-ad73b85de951">
<data>
<top>
<interfaces xmlns="http://asterfusion.com/ns/yang/asternos-interfaces">
<interface>
<name>Ethernet1</name>
<ipv6 xmlns="http://asterfusion.com/ns/yang/asternos-ip">
<address>
<ip-prefix>2001:db8::1/64</ip-prefix>
</address>
</ipv6>
</interface>
</interfaces>
</top>
</data>
</rpc-reply>

Request example to get Ipv4 and Ipv6 address for interface via get-config with subtree filter.

<filter type="subtree">
<top>
<interfaces>
<interface>
<name>Ethernet1</name>
<ipv4>
<address/>
</ipv4>
<ipv6>
<address/>
</ipv6>
</interface>
</interfaces>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:4c510c84-6c2c-408d-8729-787541dfabc0">
<data>
<top>
<interfaces xmlns="http://asterfusion.com/ns/yang/asternos-interfaces">
<interface>
<name>Ethernet1</name>
<ipv4 xmlns="http://asterfusion.com/ns/yang/asternos-ip">
<address>
<ip-prefix>100.1.1.2/24</ip-prefix>
</address>
</ipv4>
<ipv6 xmlns="http://asterfusion.com/ns/yang/asternos-ip">
<address>
<ip-prefix>2001:db8::1/64</ip-prefix>
</address>
</ipv6>
</interface>
</interfaces>
</top>
</data>
</rpc-reply>