cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
393
Views
1
Helpful
2
Replies

How to change "no shutdown" configs into xml templates in NSO

jhur
Level 1
Level 1

Hello, this is my first post so apologies if this is not posted in the correct forum. Please help me move it to the correct one if it shouldnt be here.

 

We are using NSO service package with python and template.

And using NSO version, NED below

NSO version: 5.7.1.1

NED: cisco-nx-cli-5.22

 

In NSO cli config mode, I'm trying to put "no shutdown" configuration in Ethernet 1/X, They said 

% No modifications to commit.

"shutdown" command looks like work for me , but "no shutdown" is not.

 

admin@ncs# config
admin@ncs(config)# devices device MY_DEVICE_NAME
admin@ncs(config-device-MY_DEVICE_NAME)# config
admin@ncs(config-config)# interface Ethernet 1/8
admin@ncs(config-if)# no shutdown 
admin@ncs(config-if)# commit dry-run outformat xml
% No modifications to commit.
admin@ncs(config-if)# shutdown
admin@ncs(config-if)# commit dry-run outformat xml
result-xml {
local-node {
data <devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>MY_DEVICE_NAME</name>
<config>
<interface xmlns="http://tail-f.com/ned/cisco-nx">
<Ethernet>
<name>1/8</name>
<shutdown/>
</Ethernet>
</interface>
</config>
</device>
</devices>
}
}

 

Is this normal ? Or my command wrong...

Please help me out this ..

 

 

2 Replies 2

snovello
Cisco Employee
Cisco Employee

Yes this is normal behavior if shutdown is not configured under the interface. In that case NSO computes the minimum diff and determines there is nothing to do.
If you apply the shutdown command, commit and then apply the no shutdown, you should see the transition. to 'no shutdown' from the shutdown state.

Note that this is just the default NSO behavior - However on NX-OS that assumption turns out not to be always true because you can configure 'system default switchport shutdown', in which case the port is shutdown even if 'shutdown' is not configured, and only comes up if you explicitly configure 'no shutdown'.

To deal with that possibility there is a ned-setting 'system-interface-defaults/handling' which can be set to 'auto'. By default that setting is disbled and you get the default behaviour that you are seeing.

 

 

Thanks a lot! And I have another question..

I changed the config on the Nexus device.

eth 1/8 : no shutdown -> shutdown

Device Configuration:

N92160-001# conf t
Enter configuration commands, one per line. End with CNTL/Z. N92160-001(config)# interface ethernet 1/8
N92160-001(config-if)# shutdown
N92160-001(config-if)# end
N92160-001#
N92160-001# show run interface ethernet 1/8
!Command: show running-config interface Ethernet1/8
!Running configuration last done at: Thu Nov 23 07:47:30 2023
!Time: Thu Nov 23 07:47:40 2023
version 9.3(10) Bios:version 07.65

interface Ethernet1/8

N92160-001#

 And on sync-from Device in NSO. And I configured below.

NSO cli:

admin@ncs# config
admin@ncs(config)# devices device MY_DEVICE_NAME
admin@ncs(config-device-MY_DEVICE_NAME)# config
admin@ncs(config-config)# interface Ethernet 1/8
admin@ncs(config-if)# no shutdown 
admin@ncs(config-if)# commit dry-run outformat xml
result-xml {
local-node {
data <devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>MY_DEVICE_NAME</name>
<config>
<interface xmlns="http://tail-f.com/ned/cisco-nx">
<Ethernet>
<name>1/8</name>
<shutdown xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete"/>
</Ethernet>
</interface>
</config>
</device>
</devices>
}
}

Next-step, I put outformat xml to packages, make compile , and in NSO cli typing packages reload

reload-result {
package NSO_Onprem_VPN_Internet
result false
info [TabError: inconsistent use of tabs and spaces in indentation],  [NSO_test-template.xml:9 unknown attribute: operation in shutdown], 

 

It said TabError, I fixed indentation. And Also same error appeared..

How can I make this template - no shutdown -..?

 

I can't upload .xml directly, So I upload xml file by zip.