How to make the leaf only display something and not allow user to enter any value from CLI

I want to have a yang structure

list service {
key “”

leaf server {
this will have some default value but don’t want user to enter any value from CLI

Ideally want this leaf to be constant in terms of implementation

Not sure if this is what you’re looking for. You can define the server leaf as config false and give it a default value such as follows:

leaf server {
  config false;
  type string;
  default "default_value";


Will try this and see if it works.