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

PyATS - Genie Diff Exclude for "config" ops

SeanGannon0551
Level 1
Level 1

I am looking to use 'genie diff' to find discrepancies in my production environment, gathered with 'genie learn config', against our golden configs. Problem I am running into is I want to exclude variable keys such as 'interface *'. I tried using manual exclusion on the diff but couldn't get that to exclude any key, no matter what I referenced. Ideally I would like to find a way to edit the exclude list in the 'genie learn config', much the same way that other ops use. OSPF ops for example:

"_exclude": [
"age",
"uptime",
"last_change",
"cksum",
"seq",
"dead_timer",
"hello_timer",
"checksum",
"seq_num",
"statistics",
"lsas",
"last_state_change",
"bdr_ip_addr",
"dr_ip_addr",
"state",
"bdr_router_id",
"dr_router_id",
"area_scope_lsa_cksum_sum"
],

 

Any assistance is appreciated.

2 Replies 2

Sergiu.Daniluk
VIP Alumni
VIP Alumni

Hi @SeanGannon0551 

Have you tried this option:

 

(genie) bash-4.1$ genie diff --help
Usage:
  genie diff [commands] [options]

Example
-------
  genie diff file1 file2
  genie diff dir1 dir2
  genie diff dir1 dir2 --exclude "age"
  genie diff dir1 dir2 --no-default-exclusion --exclude "age" "uptime"

Description:
  Diff two feature or parser snapshots saved to file or directory
  Default exclusion can be found at $VIRTUAL_ENV/genie_yamls/pts_datafile.yaml

Diff Options:
  [file or directory]   file/directory of pre=snapshot
  [file or directory]   file/directory of post-snapshot
  --output OUTPUT       Which directory to store logs, by default it will be current directory
                        (Optional)
  --exclude                     [EXCLUDE [EXCLUDE ...]]
                        Keys to exclude when saving the Feature (Optional)
  --no-default-exclusion
                        Do not use the default exclude keys (Optional)

Stay safe,

Sergiu

@Sergiu.Daniluk 

 

Thanks for the reply. Yes, I have tried that and found that I can exclude specific interfaces, "interface Bundle-Ether31" for example. However, I would like to exclude all interfaces. I did try regex to try to filter on all interfaces but this didn't work. Do you know how to exclude with wildcard filters? Also, it would be great to just use the default exclusion file to add exclusion keys to but I do not even see the "config" ops listed under my pts_datafile.yaml. I do see the osfp ops:

 

ospf:
source:
pkg: genie.libs.ops
class: ospf.ospf.Ospf
devices: ['uut']
exclude: [] 

 

Question is how does this correspond to the default exclusions used on the command when I learn devices ospf parameters. They are listed in the top post.

 

Thanks!