CABUORCH-1799
来自qingwei personal wiki
remove L3 static routes by NSO REST API not using no command
目录
描述
remove L3 static routes by NSO REST API not using no command
wiki
scope
ipv4 - nso delete
no vrf
# ios cmd
ip route 60.10.13.61 255.255.255.255 100.1.1.0
# 不带vrf
curl -i -u admin:admin http://127.0.0.1:8080/api/running/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ip/route
<ip-route-forwarding-list>
<prefix>60.10.13.61</prefix>
<mask>255.255.255.255</mask>
<forwarding-address>100.1.1.0</forwarding-address>
</ip-route-forwarding-list>
# delete 第一种情况
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ip/route/ip-route-forwarding-list/60.10.13.61,255.255.255.255,100.1.1.0
vrf
# ios cmd
ip route vrf lcha-617 60.10.13.61 255.255.255.255 100.1.1.2
# 带vrf
curl -i -u admin:admin http://127.0.0.1:8080/api/running/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ip/route/vrf
<vrf xmlns="urn:ios">
<name>lcha-617</name> # 只要删除这一条
<ip-route-forwarding-list xmlns="urn:ios">
<prefix>60.10.13.61</prefix>
<mask>255.255.255.255</mask>
<forwarding-address>100.1.1.2</forwarding-address>
</ip-route-forwarding-list>
<ip-route-forwarding-list xmlns="urn:ios">
<prefix>60.10.13.62</prefix>
<mask>255.255.255.255</mask>
<forwarding-address>100.1.1.2</forwarding-address>
</ip-route-forwarding-list>
</vrf>
# 删除带vrf的
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ip/route/vrf/lcha-617/ip-route-forwarding-list/60.10.13.62,255.255.255.255,100.1.1.2
ipv6 - nso delete
no vrf
# ios cmd
ipv6 route 2001:20:1:1::33/128 2001:20:5:30::1
# 不带vrf
curl -i -u admin:admin http://127.0.0.1:8080/api/running/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route
<no-vrf>
<ipv6-route-destination-list>
<prefix>2001:20:1:1::33/128</prefix>
<destination>2001:20:5:30::1</destination>
</ipv6-route-destination-list>
</no-vrf>
# delete 第一种情况
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/no-vrf/ipv6-route-destination-list/2001:20:1:1::33/128,2001:20:5:30::1
### : 要URL转意
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/no-vrf/ipv6-route-destination-list/2001%3a20%3a1%3a1%3a%3a33%2f128,2001%3a20%3a5%3a30%3a%3a1
# 2001:20:1:1::33 === 2001:20:1:1:0:0:0:33 (2001%3a20%3a1%3a1%3a0%3a0%3a0%3a33)
# 验证NSO是否支持 -> 支持!
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/no-vrf/ipv6-route-destination-list/2001%3a20%3a1%3a1%3a0%3a0%3a0%3a33%2f128,2001%3a20%3a5%3a30%3a%3a1
# 当前只要 prefix,这样一次可以删除下面两条
# ipv6 route 2001:20:1:1::33/128 2001:20:5:33::1
# ipv6 route 2001:20:1:1::33/128 2001:20:5:30::1
### : 要URL转意
# !!!不行, nso not support!!! curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/no-vrf/ipv6-route-destination-list/2001%3a20%3a1%3a1%3a%3a33%2f128
vrf
# ios cmd
ipv6 route vrf lcha-617 2001:60:10:13::25C/128 2001:100:1:1::4
# 带vrf
curl -i -u admin:admin http://127.0.0.1:8080/api/running/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/vrf
<vrf xmlns="urn:ios">
<name>lcha-617</name>
<ipv6-route-destination-list xmlns="urn:ios">
<prefix>2001:60:10:13::25c/128</prefix>
<destination>2001:100:1:1::4</destination>
</ipv6-route-destination-list>
</vrf>
# 删除带vrf的
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/vrf/lcha-617/ipv6-route-destination-list/2001:60:10:13::25c/128,2001:100:1:1::4
### : 要URL转意
curl -i -u admin:admin -X "DELETE" http://127.0.0.1:8080/api/config/devices/device/f0bf1cdf-bee1-3525-817c-b593fcb8c8bb/config/ios:ipv6/route/vrf/lcha-617/ipv6-route-destination-list/2001%3a60%3a10%3a13%3a%3a25c%2f128,2001%3a100%3a1%3a1%3a%3a4