Skip to content

Commit

Permalink
Merge pull request #133 from juztas/senseobacklink
Browse files Browse the repository at this point in the history
Add SENSE-O Backlink on Grafana Page
  • Loading branch information
juztas authored Oct 11, 2024
2 parents 5e68738 + 1b5fd9b commit 128ea33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions autogole-api/packaging/files/etc/rtmon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ template_links:
url: 'https://autogole-grafana.nrp-nautilus.io/d/D7xOxim4z/full-dtn-monitoring-variable?orgId=1&refresh=1m'
- title: 'All Switches Monitoring $$REPLACEMESITENAME$$'
url: 'https://autogole-grafana.nrp-nautilus.io/d/efe9ac84-9df5-47a4-bea8-67a196771a0d/switch-monitoring?orgId=1&refresh=1m&var-Sitename=$$REPLACEMESITENAME$$&var-switch=All'
- title: 'SENSE-O WebUI for Instance'
url: 'https://$$REPLACEMESENSEODOMAIN$$:8443/StackV-web/portal/details/$$REPLACEMEDELTAUUID$$'

# Override URL for the NSI,ESnet,Fabric mermaid diagrams. Most of those RMs report everything in a single SwitchingSubnet
# and we need to override it to show the actual topology (joint, or not). Additionally - most of those have no site name or
Expand Down
13 changes: 9 additions & 4 deletions autogole-api/src/python/RTMonLibs/Template.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,17 @@ def _clean(self):
self.annotationids = []
self.nextid = 0

def __getTitlesUrls(self, site, link):
def __getTitlesUrls(self, site, link, **kwargs):
"""Get Titles and URLs"""
title = link.get('title', "Link-Title-Not-Present-in-Config")
url = link.get('url', "https://link-not-present-in-config")
title = title.replace("$$REPLACEMESITENAME$$", site)
url = url.replace("$$REPLACEMESITENAME$$", site)
uuid = kwargs.get('referenceUUID', None)
senseodomain = kwargs.get('orchestrator', None)
if uuid and senseodomain:
url = url.replace("$$REPLACEMESENSEODOMAIN$$", senseodomain)
url = url.replace("$$REPLACEMEDELTAUUID$$", uuid)
return title, url

def _getNextID(self, recordAnnotations=False):
Expand Down Expand Up @@ -348,7 +353,7 @@ def t_addRow(self, *_args, **kwargs):
out["id"] = self._getNextRowID()
return out

def t_addLinks(self, *_args):
def t_addLinks(self, *_args, **kwargs):
"""Add Links to the Dashboard"""
if not self.config.get('template_links', []):
return []
Expand All @@ -373,7 +378,7 @@ def t_addLinks(self, *_args):
tmpcopy["url"] = f"{self.config['grafana_host']}/d/{self.dashboards[site]['uid']}"
ret.append(tmpcopy)
for link in self.config['template_links']:
title, url = self.__getTitlesUrls(site, link)
title, url = self.__getTitlesUrls(site, link, **kwargs)
if url not in addedUrls:
tmpcopy = copy.deepcopy(out)
tmpcopy["title"] = title
Expand Down Expand Up @@ -622,7 +627,7 @@ def t_createTemplate(self, *args, **kwargs):
orig_args = copy.deepcopy(args)
self.generated['panels'] += self.t_createMermaid(*orig_args)
# Add Links on top of the page
self.generated['links'] = self.t_addLinks(*args)
self.generated['links'] = self.t_addLinks(*args, **kwargs)
# Add Debug Info (manifest, instance)
self.generated['panels'] += self.t_addDebug(*args)
# Add Host Flow
Expand Down

0 comments on commit 128ea33

Please sign in to comment.