01-18-2016 03:13 PM - edited 03-01-2019 02:52 AM
Hi All,
I thought i would post this here as it did not receive much feed back on he support forum....perhaps the wrong place for an api question
I'm wondering if some one may assist with netconf-yang on IOS-XR version 6, Cisco documentation seems to be very limited here.
<edit-config> and <commit> seem to work well but i am having trouble with basic things like "no <command>".
Example: "no shutdown" for an interface. the "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"; yang file state that the existence <shutdown> tag will shut the desired interface. So the following XML works fine on an admin up interface.
<edit-config>
<target>
<candidate />
</target>
<config>
<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
<interface-configuration>
<active>act</active>
<interface-name>GigabitEthernet0/0/0/1</interface-name>
<InterfaceModeNonPhysical>0</InterfaceModeNonPhysical>
<shutdown/>
</interface-configuration>
</interface-configurations>
</config>
</edit-config>
There seems to be no reference to how to enable "no shut" the interface. I would except the below
<edit-config>
<target>
<candidate />
</target>
<config>
<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
<interface-configuration>
<active>act</active>
<interface-name>GigabitEthernet0/0/0/1</interface-name>
<InterfaceModeNonPhysical>0</InterfaceModeNonPhysical>
</interface-configuration>
</interface-configurations>
</config>
</edit-config>
This is accepted by the router and committed but the interface admin state does not change
Thanks in advance
Solved! Go to Solution.
01-19-2016 09:42 AM
We can do the no shutdown operation as follows:
*****************************
Jan 19, 2016: 19:20:39:287770
*****************************
NETCONF SEND
------------
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target><candidate/></target>
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
<interface-configuration>
<shutdown xc:operation="delete"/>
<active>act</active>
<interface-name>HundredGigE0/4/0/0</interface-name>
</interface-configuration>
</interface-configurations>
</config>
</edit-config>
</rpc>
corresponding config change:
RP/0/RP0/CPU0:fretta53#show configuration commit changes last 1
Building configuration...
!! IOS XR Configuration version = 6.0.1.14I
interface HundredGigE0/4/0/0
no shutdown
!
end
01-19-2016 09:42 AM
We can do the no shutdown operation as follows:
*****************************
Jan 19, 2016: 19:20:39:287770
*****************************
NETCONF SEND
------------
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target><candidate/></target>
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
<interface-configuration>
<shutdown xc:operation="delete"/>
<active>act</active>
<interface-name>HundredGigE0/4/0/0</interface-name>
</interface-configuration>
</interface-configurations>
</config>
</edit-config>
</rpc>
corresponding config change:
RP/0/RP0/CPU0:fretta53#show configuration commit changes last 1
Building configuration...
!! IOS XR Configuration version = 6.0.1.14I
interface HundredGigE0/4/0/0
no shutdown
!
end
02-11-2016 02:04 AM
Thanks yawchen, this works perfectly!!
Is it actually documented anywhere?
Thanks again
Olaf
12-14-2016 01:11 PM
Olaf,
You should take a look at YDK to dramatically simplify model-driven automation. Here are some pointers you may find useful:
https://developer.cisco.com/site/ydk/
NANOG 68 Ok We Got YANG Data Models Now What - YouTube
Plus, there's a community dedicated to the APIs:
HTH!
05-19-2023 07:22 AM
Thank you, i tried it and it actually works, but couldn't guess it anyway.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide