-
Notifications
You must be signed in to change notification settings - Fork 4
#186 #188
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
Merged
Merged
#186 #188
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9160fc0
#186
sunami09 fa8ed2d
#178
sunami09 4d7ad23
#178 #186
sunami09 b07ddb8
Debug = True
sunami09 2cd0e68
Documentation Added
sunami09 cf891ed
Order Fixed
sunami09 af56dcc
#171 remaining Doc
sunami09 3aa739a
#171 remaining Doc
sunami09 e88f22f
#171 remaining Doc
sunami09 2677b3e
Fix Code Change
sunami09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,7 +454,7 @@ def t_createDashboard(self, *args, **kwargs): | |
| out["uid"] = args[0]["intents"][0]["id"] | ||
| return out | ||
|
|
||
| def t_createHostFlow(self, sitehost, *args): | ||
| def t_createHostFlow(self, sitehost, num, *args): | ||
| """Create Host Flow Template""" | ||
| out = [] | ||
| interfaces = self.m_groups['Hosts'].get(sitehost, "") | ||
|
|
@@ -464,7 +464,7 @@ def t_createHostFlow(self, sitehost, *args): | |
| sitename = sitehost.split(":")[0] | ||
| hostname = sitehost.split(":")[1] | ||
| intfline = "|".join(interfaces.keys()) | ||
| row = self.t_addRow(*args, title=f"Host Flow Summary: {sitehost}") | ||
| row = self.t_addRow(*args, title=f"{num}. Host Flow Summary: {sitehost}") | ||
| panels = dumpJson(self._t_loadTemplate("hostflow.json"), self.logger) | ||
| panels = panels.replace("REPLACEME_DATASOURCE", str(self.t_dsourceuid)) | ||
| panels = panels.replace("REPLACEME_SITENAME", sitename) | ||
|
|
@@ -474,7 +474,7 @@ def t_createHostFlow(self, sitehost, *args): | |
| out += self.addRowPanel(row, panels, True) | ||
| return out | ||
|
|
||
| def t_createSwitchFlow(self, sitehost, *args): | ||
| def t_createSwitchFlow(self, sitehost, num, *args): | ||
| """Create Switch Flow Template""" | ||
| def findIntf(interfaces): | ||
| """Find Interface""" | ||
|
|
@@ -519,7 +519,7 @@ def findIntf(interfaces): | |
| sitename = sitehost.split(":")[0] | ||
| hostname = sitehost.split(":")[1] | ||
| intfline = findIntf(interfaces) | ||
| row = self.t_addRow(*args, title=f"Switch Flow Summary: {sitehost}") | ||
| row = self.t_addRow(*args, title=f"{num}. Switch Flow Summary: {sitehost}") | ||
| panels = dumpJson(self._t_loadTemplate("switchflow.json"), self.logger) | ||
| panels = panels.replace("REPLACEME_DATASOURCE", str(self.t_dsourceuid)) | ||
| panels = panels.replace("REPLACEME_SITENAME", sitename) | ||
|
|
@@ -721,21 +721,24 @@ def t_createTemplate(self, *args, **kwargs): | |
|
|
||
| # Add Links on top of the page | ||
| self.generated['links'] = self.t_addLinks(*args, **kwargs) | ||
| # Add Debug Info (manifest, instance) | ||
| self.generated['panels'] += self.t_addDebug(*args) | ||
| added = [] | ||
| hostnum, switchnum = 1, 1 | ||
| for item in self.orderlist: | ||
| if item['Type'] == 'Host' and item['Name'] not in added: | ||
| self.generated['panels'] += self.t_createHostFlow(item["Name"], *args) | ||
| self.generated['panels'] += self.t_createHostFlow(item["Name"], hostnum, *args) | ||
| added.append(item['Name']) | ||
| hostnum += 1 | ||
| elif item['Type'] == 'Switch' and item['Node'] not in added: | ||
| self.generated['panels'] += self.t_createSwitchFlow(item["Node"], *args) | ||
| self.generated['panels'] += self.t_createSwitchFlow(item["Node"], switchnum, *args) | ||
| added.append(item['Node']) | ||
| switchnum += 1 | ||
| else: | ||
| self.logger.error(f"Unknown Type: {item['Type']}. Skipping... {item}") | ||
| # Add L2 Debugging | ||
| self.generated['panels'] += self.t_addL2Debugging(*args) | ||
|
|
||
| if len(diagrams) > 1: | ||
| self.generated['panels'] += diagrams[1] | ||
| if self.config.get('Debug', True): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need documentation inside config file |
||
| if len(diagrams) > 1: | ||
| self.generated['panels'] += diagrams[1] | ||
| # Add Debug Info (manifest, instance) | ||
| self.generated['panels'] += self.t_addDebug(*args) | ||
| return {"dashboard": self.generated}, {"uid": self.generated['uid'], "annotation_panels": self.annotationids} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "collapsed": false, | ||
| "collapsed": true, | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "bdlb788gxxcsge" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at enumerate and use only 1 index from a list. No need separate numbers for hostnum, switchnum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets say I have [host, host, host, switch] will it not create
host1
host2
host3
and switch4?
but we want hostt1, host2, host3, switch1 right?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want it in a flow:
host1, switch2, switch3, switch4, host5