Same name in container and leaf node

Having same name for a leaf and a container cause any problems if the leaf node is contained within the container?

My yang has it and facing issue in the CLI.

Also, what is the detail that comes in ‘Possible Completion’ (PC) and ‘Possible Match Completion’ (PMC)?
I thought we had only ‘Possible Completion’. I’m asking the difference because, when the same name is there, the PC shows and PMC shows ‘leaf_name’.
Now when I change the names, PC shows ‘leaf_1’ and PMC shows ‘leaf_2’

Suggestions?

I’m not sure if I understand the issue in your description. Let me demonstrate the typical CLI behavior with a concrete example.

Given the following YANG snippet:

container cont_name {
  leaf cont_name {
    type string;
  }
  leaf leaf_2 {
    type string;
  }
}

in which both the name of the container and the name of the first leaf are the same.

Following is the CLI behavior:

localhost(config)# ?
Possible completions:
  aaa         AAA management
  alias       Create command alias.
  cont_name   
  nacm        Access control
  session     Global default CLI session parameters
  user        User specific command aliases and default CLI session parameters
  webui       Web UI specific configuration
  ---         
  …
localhost(config)# cont_name 
Possible completions:
  cont_name  leaf_2
localhost(config)# cont_name 

The possible completions that I get after entering the name of the container are as expected.

When I change the name of the first leaf to leaf_1 instead of cont_name, the possible completions shown will be changed to “leaf_1 leaf_2”. Again, as expected.

I am not seeing any difference between both scenarios. Please clarify your issue.

What is the difference between the two possible completion statements here.?

Error part:
root@rtr100% show protocols protocol
Possible completions:
|
Possible match completions:
lldp - LLDP configurable
type - The type of the protocol like NAT,LLDP etc.

Correct actual part:
root@rtr100% show protocols protocol
Possible completions:
| lldp - protocol name
Possible match completions:
lldp - LLDP configurable
type - The type of the protocol like NAT,LLDP etc.

I wanted to know what would be the issue for lldp being absent from ‘possible completion’ in the wrong part.

Hi,

What does your YANG model look like?

Seems like you in the fist example haven’t configured a protocol yet, so the protocol list(?) is empty.