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

Add reset config to nodes which support and add cli command #29

Merged
merged 5 commits into from
Aug 20, 2021

Conversation

mhines01
Copy link
Contributor

This adds

kne_cli topology reset

to reset the configuration of the node to a default config

if no devices are provides all nodes in the topology will be attempted
--skip will skip nodes which don't support resetcfg but will continue through all nodes

@coveralls
Copy link

coveralls commented Aug 19, 2021

Pull Request Test Coverage Report for Build 1148945467

  • 19 of 27 (70.37%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 69.861%

Changes Missing Coverage Covered Lines Changed/Added Lines %
topo/node/ceos/ceos.go 19 27 70.37%
Totals Coverage Status
Change from base Build 1145085791: 0.02%
Covered Lines: 452
Relevant Lines: 647

💛 - Coveralls

alexmasi
alexmasi previously approved these changes Aug 19, 2021
cmd/topology/topology.go Outdated Show resolved Hide resolved
}
ctx := cmd.Context()
t.Load(ctx)
var nodes []*node.Node
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should simplify this block a bit:

nodes := t.Nodes()
if len(args) > 1 {
n, err := t.Node(args[1])
if err != nil {
return err
}
nodes = []*node.Node{n}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
nodes = append(nodes, n)
}
var resetable []node.Reseter
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: resettable and later in the interface its resetter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

alexmasi
alexmasi previously approved these changes Aug 19, 2021
return err
}
nodes = append(nodes, n)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will add the specified node to the entire collection of nodes a second time.

Copy link
Contributor

Choose a reason for hiding this comment

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

grr this why i didn't want to have that pattern

@marcushines marcushines merged commit d2e03e7 into openconfig:main Aug 20, 2021
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.

None yet

5 participants