Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected CLI behavior for lists in edit mode #590

Open
devibinoy opened this issue Jan 9, 2025 · 2 comments
Open

Unexpected CLI behavior for lists in edit mode #590

devibinoy opened this issue Jan 9, 2025 · 2 comments
Labels

Comments

@devibinoy
Copy link

devibinoy commented Jan 9, 2025

In edit mode, CLI allows moving to the context of a list without specifying the required key. This leads to some inconsistencies:

  • Commands like edit <list> are accepted without providing the required key for the list, even though it's mandatory.

eg., edit unit is accepted without providing <unit-id>, even though it's a mandatory key.

  • Pressing ? after edit unit shows <cr> as a valid option, which allows incomplete commands to succeed.

  • The up command generates incorrect paths and substitution when the key is omitted.

eg.,
/interface=hostif-0/0/0/ cfg> edit unit

/interface=hostif-0/0/0/unit cfg> up

/interface/ cfg> edit unit 100

/interface=100/unit/ cfg>

@olofhagsand
Copy link
Member

Can you please submit the YANG for your examples above?
If I use the YANG as follows:

    container table{
        list parameter{
            key name;
            leaf name{
                type string;
            }
            list sublist{
                key name;
                leaf name{
                    type string;
                }
            }

Then I cannot enter a list via edit:

olof@alarik> clixon_cli -f /usr/local/etc/clixon/example.xml 
olof@alarik /> edit table parameter 
CLI syntax error: "edit table parameter": Incomplete command          
olof@alarik /> edit table parameter a 
olof@alarik parameter=a/> edit sublist 
CLI syntax error: "edit sublist": Incomplete command
olof@alarik parameter=a/> 

@devibinoy
Copy link
Author

grouping subinterface-top {
    list unit {
        key "unit-id";
        leaf unit-id {
            type uint16;
        }
    }
}

list interface {
    key "name";
    uses subinterface-top;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants