cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1116
Views
0
Helpful
2
Replies

Using device templates to standardize configurations

kjdhghsghsfg
Level 1
Level 1

Hi

I'm running NSO 6.1.7.1 with juniper-junos-nc-4.12 NED.
I'm trying to use NSO device templates to standardize certain parts of device configurations.
In this particular case I'm trying to force a certain set of "apply-groups" on a given Junos configuration level. For example: I want the Junos devices to be configured like this:

protocols {                             
    ospf {                              
        apply-groups [ GROUP1 GROUP2 GROUP3 ];
    }
}

It's easy to use device templates to add apply-groups. But I haven't found a way to delete them. For example if Junos device already has following config:

protocols {                             
    ospf {                              
        apply-groups [ GROUP1 GROUP2 GROUP3 GROUP4 ];
    }
}

I haven't been able to figure out the way to delete GROUP4.
More specifically I would like to find a way to force the set of groups instead of configuring template to delete GROUP4, because on some other device there might be, for example, GROUP5. And I don't want to check all of them manually...

For example I have tried to use the replace tag:

[edit devices template TEST2 ned-id juniper-junos-nc-4.12 config configuration protocols ospf]
user@nso-server% annotate ?
Description: OSPF configuration
Possible completions:
  apply-groups         
  apply-macro          
  area                 Configure an OSPF area
  backup-spf-options   Configure options for backup SPF
  domain-id            Configure domain ID
  graceful-restart     Configure graceful restart attributes
  spf-options          Configure options for SPF
  topology             Topology parameters
  traceoptions         Trace options for OSPF
  undocumented         
user@nso-server% annotate apply-groups ?
Possible completions:
  string  [
user@nso-server% annotate apply-groups "Tags: replace"
Error: the operation is not supported on 'devices template TEST2 ned-id juniper-junos-nc-4.12 config configuration protocols ospf apply-groups'

And equivalent in Cisco cli where the result is no error but the "! Tags: replace" does not appear in the template config.

I have succesfully used the "Tags: replace" in multiple other configuration stanzas.


Please advice
Or should I create a tac case and request enhancement?
Or am I trying to do something totally unsupported?

https://developer.cisco.com/docs/nso/guides/compliance-reporting/

2 Replies 2

huayyang
Cisco Employee
Cisco Employee

kjdhghsghsfg
Level 1
Level 1

Hi!

Thanks for the hint. Here's what I have tried so far. I cannot get it working either..

 

[edit devices template TEST2 ned-id juniper-junos-nc-4.12 config]
user@nso-server% tag add configuration protocols ospf apply-groups [ GROUP1 GROUP2 GROUP3 ] replace
Error: internal error
[error][2024-04-25 14:07:06]

Or:

[edit devices template TEST2 ned-id juniper-junos-nc-4.12 config configuration protocols ospf]
user@nso-server% tag add apply-groups replace
Error: the operation is not supported on 'devices template TEST2 ned-id juniper-junos-nc-4.12 config configuration protocols ospf apply-groups'
[error][2024-04-25 14:14:22]


Or:

[edit devices template TEST2 ned-id juniper-junos-nc-4.12 config configuration protocols ospf]
user@nso-server% tag add apply-groups [ GROUP1 GROUP2 GROUP3 ] replace
Error: internal error
[error][2024-04-25 14:15:11]


Or equivalent in cisco cli

user@nso-server(config)# do show running-config devices template TEST2
devices template TEST2
ned-id juniper-junos-nc-4.12
config
configuration protocols ospf apply-groups [ GROUP1 GROUP2 GROUP3 ]
!
!
!
user@nso-server(config)# devices template TEST2
user@nso-server(config-template-TEST2)# ned-id juniper-junos-nc-4.12
user@nso-server(config-ned-id-juniper-junos-nc-4.12)# config
user@nso-server(config-config)# ! Tags: replace
user@nso-server(config-config)# configuration protocols ospf apply-groups [ GROUP1 GROUP2 GROUP3 ]
user@nso-server(config-config)# top
user@nso-server(config)# show conf
% No configuration changes found.
user@nso-server(config)# commit
% No modifications to commit.
user@nso-server(config)# do show running-config devices template TEST2
devices template TEST2
ned-id juniper-junos-nc-4.12
config
configuration protocols ospf apply-groups [ GROUP1 GROUP2 GROUP3 ]


 

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?