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

refactored type init #203

Merged
merged 2 commits into from
Dec 23, 2020
Merged

refactored type init #203

merged 2 commits into from
Dec 23, 2020

Conversation

hellt
Copy link
Member

@hellt hellt commented Dec 18, 2020

close #199

clab/config.go Outdated
// default type if not defined
switch nodeCfg.Kind {
case "srl":
return "ixr6"
Copy link
Collaborator

@steiler steiler Dec 18, 2020

Choose a reason for hiding this comment

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

This should maybe not be a hardcoded value but rather reference the srlTypes map.
My approach considered the first key in the map.

case "srl":
			for k = range srlTypes {
				return k
			}

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont think its a good idea. The map might be shuffled by someone without noticing that its values are used in something like default type

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just do not like arbitrary strings that much. I'd rather opt for an enum kind of type.
If someone messes with that string it breaks and if ixr6 is entirely removed from the list there is inconsistency as well.
But ok.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made it a constant, so that this will be visible better 53c7b4c

Copy link
Member Author

@hellt hellt Dec 18, 2020

Choose a reason for hiding this comment

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

btw, range over dict will yield inconsistent results, as map access is random https://repl.it/@RomanDodin/EnragedSlightSpool

@hellt hellt merged commit f4d66f3 into master Dec 23, 2020
@hellt hellt deleted the srl-def-type branch January 31, 2021 09:23
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.

make srlinux default type to be ixr6
2 participants