Skip to content

Cli config rewrite#1802

Open
HanzlikPetr wants to merge 3 commits intoCESNET:develfrom
HanzlikPetr:cli_config_rewrite
Open

Cli config rewrite#1802
HanzlikPetr wants to merge 3 commits intoCESNET:develfrom
HanzlikPetr:cli_config_rewrite

Conversation

@HanzlikPetr
Copy link
Copy Markdown

No description provided.

@HanzlikPetr HanzlikPetr force-pushed the cli_config_rewrite branch 3 times, most recently from b101bf4 to bec425b Compare April 24, 2026 10:08
Comment thread cli/configuration.c Outdated
}

if (lyd_parse_data_path(ctx, config_file, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_OPAQ, 0, &config)) {
if (lyd_parse_data_path(ctx, config_file, LYD_XML, LYD_PARSE_ONLY, 0, &config)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data can be validated now, so remove LYD_PARSE_ONLY and add the validation flag LYD_PARSE_PRESENT. So when you know the data are valid, some later checks can be skipped.

Comment thread cli/configuration.c Outdated
/* <netconf-client> -> <searchpath> */
opts.config_editor = strdup(lyd_get_value(match));
}
match = NULL;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant, it does not have to be initialized for lyd_find_path(), at other places, too.

Comment thread cli/configuration.c Outdated
lyd_find_path(auth_pref, "knownhost-mode", 0, &match);
if (match) {
mode = lyd_get_value(match);
if (!strcmp(mode, "accept")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good opportunity for a str2knownhosts_mode() function.

Comment thread cli/configuration.c Outdated

/* knownhost-mode */
if (opts.knownhosts_mode) {
if (opts.knownhosts_mode == NC_SSH_KNOWNHOSTS_ACCEPT) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, reverse function knownhosts_mode2str() should be used.

Comment thread cli/netopeer2-cli.yang Outdated
module netopeer2-cli {
yang-version 1.1;
namespace "urn:cesnet:netopeer2:cli";
prefix "cli";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add common module metadata similarly to netopeer-notifications such as yang-version, organization, contact, or revision.

leaf knownhost-mode {
type string;
description
"Specifies the mode for handling known host keys.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention what is the behavior in case the leaf does not exist at all.

Comment thread cli/netopeer2-cli.yang Outdated
}
}
}
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants