ConfD User Community

List name is part of entry parameter name,next entries overwrites with previous one


#1

We are using the following data model

list abc
{
     key abc_name;

     leaf abc_name{
       type string{
            length "min .. 31";
       }
     }

     leaf prio{
        type uint32;
     }
     leaf conditional_param{
          type uint32;
     }
     leaf abc_track{            <----- list name is part of parameter name and it is optional parameter
          type string{
             length "min .. 31";
          }
    }
}

Now, when we are configuring using the cli with 2 entries of abc list - 1st with abc_track become 2nd entry name
e.g. lets the output be like

it(config)#abc grp10
it(config-abc-grp10)#    prio 1
it(config-abc-grp10)#    conditional_param 20
it(config-abc-grp10)#	 abc_track track1
it(config-abc-grp10)#!
it(config-abc-grp10)#abc grp20
it(config-abc-grp10)#    prio 2
it(config-abc-grp10)#    conditional_param 30
it(config-abc-grp10)#!
it(config-abc-grp10)# commit
Commit complete.
it(config)#end
it#
it#
if# show running-config

!
abc grp10
      prio 2
      conditional_param 30
      abc_track grp20                 <--- abc_track name changed to next entry name (abc grp20)
!

Due to list name is part of entry parameter name here “abc” is part of parameter “abc_track”
next entry is merged with first entry.

How to avoid this ?

Thanks


#2

I think you need to leave list entry grp10 before starting grp20 with use of exit.

it(config)#abc grp10
it(config-abc-grp10)#    prio 1
it(config-abc-grp10)#    conditional_param 20
it(config-abc-grp10)#	 abc_track track1
it(config-abc-grp10)# exit
it(config-abc-grp10)#abc grp20
it(config-abc-grp10)#    prio 2
it(config-abc-grp10)#    conditional_param 30
it(config-abc-grp10)#!
it(config-abc-grp10)# commit

In your case when you type abc grp20 CLI assumes you want to modify abc_track and it auto-fills missing letters (_track). If there is no abc_track in he list entry, then CLI would look automatically up and behavior would be as you need.


#3

We copy pasting show running-config output from one machine to another machine in for config
i.e on machine1
it# show running-config
!
abc grp10

  prio 1
  conditional_param 20
  abc_track track1       

!
abc grp20

  prio 2
  conditional_param 30 

!

Copied to other machine

it(config)#abc grp10
it(config-abc-grp10)# prio 1
it(config-abc-grp10)# conditional_param 20
it(config-abc-grp10)# abc_track track1
it(config-abc-grp10)#!
it(config-abc-grp10)#abc grp20
it(config-abc-grp10)# prio 2
it(config-abc-grp10)# conditional_param 30
it(config-abc-grp10)#!
it(config-abc-grp10)# commit

Here “!” is not treated as “exit” in config mode. Is there way to change "!’ --> exit ?

Thanks


#4

Ok, this can be fixed with in confd.conf

<cli>
    <prioritizeSubmodeCmds>false</prioritizeSubmodeCmds>
  </cli>

Also you need to have spaceCompletion disabled, but probably you already have it:

 <cli>
    <spaceCompletion>
      <enabled>false</enabled>
    </spaceCompletion>
  </cli>

#5

@mnovak,
Thanks for your response. I have tried your suggestion but still issue is not resolved. i have tried another approach where i have modified leaf name abc_track to track_abc , it working fine. But I cont change this data model due to some internal issue. Any alternative suggestion ?

Thanks,


#6

I following config seems OK:

config
abc grp10
prio 1
conditional_param 20
abc_track track1
abc grp20
prio 2
conditional_param 30
commit
top
do show running-config abc

result

abc grp10
 prio              1
 conditional_param 20
 abc_track         track1
!
abc grp20
 prio              2
 conditional_param 30
!

Example can be found here (see README)
https://cisco.box.com/s/yk9g41fkaizwtzi9v0fcasz6tdu7aavu