diff --git a/dist/clab-topoviewer.tmpl b/dist/clab-topoviewer.tmpl index e186dd9ef..ad7a09326 100644 --- a/dist/clab-topoviewer.tmpl +++ b/dist/clab-topoviewer.tmpl @@ -34,19 +34,22 @@ ], "links": [{{range $i, $l := .Clab.Links}}{{if $i}},{{end}}{{ $endpointA := index $l.Endpoints 0 }}{{ $endpointB := index $l.Endpoints 1 }}{{ $endpointAList := split (printf "%s" $endpointA) ":" }}{{ $endpointBList := split (printf "%s" $endpointB) ":" }} + {{- $eps := $l.GetEndpoints }} + {{- $ep := index $eps 0 }} { "a": { "node": "{{ index $endpointAList 0 }}", "nodeLongName": "{{ $type }}-{{ $labName}}-{{ index $endpointAList 0 }}", - "interface": "{{ index $endpointAList 1 }}", - "mac": "", + "interface": "{{ $ep.GetIfaceName }}", + "mac": "{{ $ep.GetMac }}", "peer": "z" }, + {{- $ep := index $eps 1 }} "z": { "node": "{{ index $endpointBList 0 }}", "nodeLongName": "{{ $type }}-{{ $labName}}-{{ index $endpointBList 0 }}", - "interface": "{{ index $endpointBList 1 }}", - "mac": "", + "interface": "{{ $ep.GetIfaceName }}", + "mac": "{{ $ep.GetMac }}", "peer": "a" } }{{end}} diff --git a/dist/dist.zip b/dist/dist.zip index 0e804d1aa..a32133d8e 100644 Binary files a/dist/dist.zip and b/dist/dist.zip differ diff --git a/dist/html-static/template/clab/button copy.tmpl b/dist/html-static/template/clab/button copy.tmpl deleted file mode 100644 index 166d62d3e..000000000 --- a/dist/html-static/template/clab/button copy.tmpl +++ /dev/null @@ -1,3295 +0,0 @@ - - - - - - TopoViewer - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - diff --git a/dist/html-static/template/clab/button.tmpl b/dist/html-static/template/clab/button.tmpl index 15cf7d54b..66b2c8bab 100644 --- a/dist/html-static/template/clab/button.tmpl +++ b/dist/html-static/template/clab/button.tmpl @@ -1241,8 +1241,8 @@ divPanelBlock02 = panelBlockContainer.divPanelBlock const Panel02ColumnsConfig = [ - { idSuffix: 'Source', columnLabelTextContent: 'Source', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, - { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Source', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, + { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('extraData').clabSourceMacAddress}, { idSuffix: 'labelSourceImpairment', @@ -1406,8 +1406,8 @@ divPanelBlock03 = panelBlockContainer.divPanelBlock const Panel03ColumnsConfig = [ - { idSuffix: 'Target', columnLabelTextContent: 'Target', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, - { idSuffix: 'TargetMac', columnLabelTextContent: 'Mac', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Target', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, + { idSuffix: 'TargetMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('extraData').clabTargetMacAddress}, { idSuffix: 'labelTargetImpairment', columnLabelTextContent: 'Impairment', diff --git a/dist/html-static/template/clab/button.tmpl.bak_20240127113505 b/dist/html-static/template/clab/button.tmpl.bak_20240127113505 deleted file mode 100644 index 987039538..000000000 --- a/dist/html-static/template/clab/button.tmpl.bak_20240127113505 +++ /dev/null @@ -1,3304 +0,0 @@ - - - - - - TopoViewer - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - diff --git a/dist/html-static/template/clab/button.tmpl.bak_20240127125026 b/dist/html-static/template/clab/button.tmpl.bak_20240127125026 deleted file mode 100644 index cb826a4f9..000000000 --- a/dist/html-static/template/clab/button.tmpl.bak_20240127125026 +++ /dev/null @@ -1,3311 +0,0 @@ - - - - - - TopoViewer - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - diff --git a/dist/html-static/template/clab/button.tmpl.bak_20240127145552 b/dist/html-static/template/clab/button.tmpl.bak_20240127145552 deleted file mode 100644 index 32b23d331..000000000 --- a/dist/html-static/template/clab/button.tmpl.bak_20240127145552 +++ /dev/null @@ -1,3657 +0,0 @@ - - - - - - TopoViewer - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - diff --git a/dist/html-static/template/clab/button.tmpl.bak_20240127154155 b/dist/html-static/template/clab/button.tmpl.bak_20240127154155 deleted file mode 100644 index d1c0c365a..000000000 --- a/dist/html-static/template/clab/button.tmpl.bak_20240127154155 +++ /dev/null @@ -1,3666 +0,0 @@ - - - - - - TopoViewer - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - diff --git a/html-static/template/clab/button.tmpl.bak_20240130205638 b/dist/html-static/template/clab/button.tmpl.bak_20240130220649 similarity index 99% rename from html-static/template/clab/button.tmpl.bak_20240130205638 rename to dist/html-static/template/clab/button.tmpl.bak_20240130220649 index c86f2a0da..acf71ad97 100644 --- a/html-static/template/clab/button.tmpl.bak_20240130205638 +++ b/dist/html-static/template/clab/button.tmpl.bak_20240130220649 @@ -303,7 +303,7 @@ {{rawJSComment "## // WebSocket for uptime"}} const socketUptime = initializeWebSocket('/uptime', (msgUptime) => { - const string01 = 'Containerlab Topology: ' + "demo"; + const string01 = 'Containerlab Topology: ' + "{{.}}"; const string02 = ' ::: Uptime: ' + msgUptime.data; const ClabSubtitle = document.getElementById("ClabSubtitle"); @@ -362,7 +362,7 @@ } {{rawJSComment "## // Fetch and load element data from a JSON file"}} - fetch('dataCytoMarshall-demo.json') + fetch('dataCytoMarshall-{{.}}.json') .then(response => response.json()) .then(elements => { diff --git a/html-static/template/clab/button.tmpl.bak_20240130205623 b/dist/html-static/template/clab/button.tmpl.bak_20240130220755 similarity index 99% rename from html-static/template/clab/button.tmpl.bak_20240130205623 rename to dist/html-static/template/clab/button.tmpl.bak_20240130220755 index 15cf7d54b..f1a67e358 100644 --- a/html-static/template/clab/button.tmpl.bak_20240130205623 +++ b/dist/html-static/template/clab/button.tmpl.bak_20240130220755 @@ -303,7 +303,7 @@ {{rawJSComment " // WebSocket for uptime"}} const socketUptime = initializeWebSocket('/uptime', (msgUptime) => { - const string01 = 'Containerlab Topology: ' + "{{.}}"; + const string01 = 'Containerlab Topology: ' + "{{.}}b"; const string02 = ' ::: Uptime: ' + msgUptime.data; const ClabSubtitle = document.getElementById("ClabSubtitle"); @@ -1241,8 +1241,8 @@ divPanelBlock02 = panelBlockContainer.divPanelBlock const Panel02ColumnsConfig = [ - { idSuffix: 'Source', columnLabelTextContent: 'Source', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, - { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Source', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, + { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('extraData').clabSourceMacAddress}, { idSuffix: 'labelSourceImpairment', @@ -1406,8 +1406,8 @@ divPanelBlock03 = panelBlockContainer.divPanelBlock const Panel03ColumnsConfig = [ - { idSuffix: 'Target', columnLabelTextContent: 'Target', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, - { idSuffix: 'TargetMac', columnLabelTextContent: 'Mac', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Target', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, + { idSuffix: 'TargetMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, { idSuffix: 'labelTargetImpairment', columnLabelTextContent: 'Impairment', diff --git a/dist/html-static/template/clab/button.tmpl.bak_20240127170746 b/dist/html-static/template/clab/button.tmpl.bak_20240130220812 similarity index 96% rename from dist/html-static/template/clab/button.tmpl.bak_20240127170746 rename to dist/html-static/template/clab/button.tmpl.bak_20240130220812 index e49f90b42..de1a3067e 100644 --- a/dist/html-static/template/clab/button.tmpl.bak_20240127170746 +++ b/dist/html-static/template/clab/button.tmpl.bak_20240130220812 @@ -303,7 +303,7 @@ {{rawJSComment " // WebSocket for uptime"}} const socketUptime = initializeWebSocket('/uptime', (msgUptime) => { - const string01 = 'Containerlab Topology: ' + "demo"; + const string01 = 'Containerlab Topology: ' + "nokia-MAGc-lab"; const string02 = ' ::: Uptime: ' + msgUptime.data; const ClabSubtitle = document.getElementById("ClabSubtitle"); @@ -362,7 +362,7 @@ } {{rawJSComment " // Fetch and load element data from a JSON file"}} - fetch('dataCytoMarshall-demo.json') + fetch('dataCytoMarshall-nokia-MAGc-lab.json') .then(response => response.json()) .then(elements => { @@ -1241,8 +1241,8 @@ divPanelBlock02 = panelBlockContainer.divPanelBlock const Panel02ColumnsConfig = [ - { idSuffix: 'Source', columnLabelTextContent: 'Source', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, - { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Source', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('source') + "::" + edge.data('sourceEndpoint') }, + { idSuffix: 'SourceMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('extraData').clabSourceMacAddress}, { idSuffix: 'labelSourceImpairment', @@ -1323,7 +1323,7 @@ iconClass: 'fas fa-play', hoverMessage: 'Click to START the link impairment.', hrefFunction: 'linkImpairmentSsh', - hrefLink: `ssh ${edge.data("extraData").clabServerUsername}@${location.hostname} sudo /usr/bin/containerlab tools netem set -n ${edge.data('extraData').clabSourceLongName} -i ${edge.data("sourceEndpoint")}`, + hrefLink: `/usr/bin/containerlab tools netem set -n ${edge.data('extraData').clabSourceLongName} -i ${edge.data("sourceEndpoint")}`, hrefFunctionArg: 'start-source', }, { @@ -1406,8 +1406,8 @@ divPanelBlock03 = panelBlockContainer.divPanelBlock const Panel03ColumnsConfig = [ - { idSuffix: 'Target', columnLabelTextContent: 'Target', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, - { idSuffix: 'TargetMac', columnLabelTextContent: 'Mac', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: '' }, + { idSuffix: 'Target', columnLabelTextContent: 'Endpoint', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: edge.data('target') + "::" + edge.data('targetEndpoint') }, + { idSuffix: 'TargetMac', columnLabelTextContent: 'MAC address', columnLabelClass: 'column is-4 p-1', columnInputType: 'label', columnInputContent: columnInputContent: edge.data('extraData').clabTargetMacAddress}, { idSuffix: 'labelTargetImpairment', columnLabelTextContent: 'Impairment', @@ -3295,8 +3295,63 @@ appendMessage(alert_msg) } + + function linkImpairmentManagerSsh(toggle, baseCommand) { + + console.log("linkImpairmentManagerSsh-Function-Called") + + fullCommand = baseCommand + + if (toggle == 'start-source') { + delayValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelSourceImpairmentDelay-panelContentlabelSourceImpairmentDelay-columnsPanelContentlabelSourceImpairmentDelay-labelColumnlabelSourceImpairmentDelay-inputColumnlabelSourceImpairmentDelay-labellabelSourceImpairmentDelay').value + jitterValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelSourceImpairmentJitter-panelContentlabelSourceImpairmentJitter-columnsPanelContentlabelSourceImpairmentJitter-labelColumnlabelSourceImpairmentJitter-inputColumnlabelSourceImpairmentJitter-labellabelSourceImpairmentJitter').value + rateValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelSourceImpairmentRate-panelContentlabelSourceImpairmentRate-columnsPanelContentlabelSourceImpairmentRate-labelColumnlabelSourceImpairmentRate-inputColumnlabelSourceImpairmentRate-labellabelSourceImpairmentRate').value + lossValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelSourceImpairmentLoss-panelContentlabelSourceImpairmentLoss-columnsPanelContentlabelSourceImpairmentLoss-labelColumnlabelSourceImpairmentLoss-inputColumnlabelSourceImpairmentLoss-labellabelSourceImpairmentLoss').value + + console.log(`delayValue: ${delayValue}`) + console.log(`jitterValue: ${jitterValue}`) + console.log(`rateValue: ${rateValue}`) + console.log(`lossValue: ${lossValue}`) + + fullCommand = baseCommand + ` --delay ${delayValue}ms --jitter ${jitterValue}ms --rate ${rateValue} --loss ${lossValue}` + alert_msg = `SSH command to start link impairment is lit 🔥 and copied to your clipboard, ready to drop it in your terminal console like a boss! 🚀💻` + } + else if (toggle == 'stop-source') { + fullCommand = baseCommand + alert_msg = `SSH command to stop link impairment is lit 🔥 and copied to your clipboard, ready to drop it in your terminal console like a boss! 🚀💻` + } + else if (toggle == 'start-target') { + delayValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelTargetImpairmentDelay-panelContentlabelTargetImpairmentDelay-columnsPanelContentlabelTargetImpairmentDelay-labelColumnlabelTargetImpairmentDelay-inputColumnlabelTargetImpairmentDelay-labellabelTargetImpairmentDelay').value + jitterValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelTargetImpairmentJitter-panelContentlabelTargetImpairmentJitter-columnsPanelContentlabelTargetImpairmentJitter-labelColumnlabelTargetImpairmentJitter-inputColumnlabelTargetImpairmentJitter-labellabelTargetImpairmentJitter').value + rateValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelTargetImpairmentRate-panelContentlabelTargetImpairmentRate-columnsPanelContentlabelTargetImpairmentRate-labelColumnlabelTargetImpairmentRate-inputColumnlabelTargetImpairmentRate-labellabelTargetImpairmentRate').value + lossValue = document.getElementById('panelBlock-tabContainer-LinkProperties-divPanelBlock-columnContainerlabelTargetImpairmentLoss-panelContentlabelTargetImpairmentLoss-columnsPanelContentlabelTargetImpairmentLoss-labelColumnlabelTargetImpairmentLoss-inputColumnlabelTargetImpairmentLoss-labellabelTargetImpairmentLoss').value + + console.log(`delayValue: ${delayValue}`) + console.log(`jitterValue: ${jitterValue}`) + console.log(`rateValue: ${rateValue}`) + console.log(`lossValue: ${lossValue}`) + + fullCommand = baseCommand + ` --delay ${delayValue}ms --jitter ${jitterValue}ms --rate ${rateValue} --loss ${lossValue}` + alert_msg = `SSH command to start link impairment is lit 🔥 and copied to your clipboard, ready to drop it in your terminal console like a boss! 🚀💻` + } + else if (toggle == 'stop-target') { + fullCommand = baseCommand + alert_msg = `SSH command to stop link impairment is lit 🔥 and copied to your clipboard, ready to drop it in your terminal console like a boss! 🚀💻` + } + + + console.log(`baseCommand: ${baseCommand}`) + console.log(`fullCommand: ${fullCommand}`) + + callGoFunction(fullCommand, 'padding') + + } + {{rawJSComment " // Call Go BackEnd function"}} function callGoFunction(parameter1, parameter2) { + + console.log("callGoFunction-Called") + const data = { param1: parameter1, param2: parameter2, diff --git a/dist/topoviewer b/dist/topoviewer index 8831cfccd..ca3ed5c2e 100755 Binary files a/dist/topoviewer and b/dist/topoviewer differ diff --git a/go_cloudshellwrapper/constants.go b/go_cloudshellwrapper/constants.go index 97f5c5dbb..2acaa2055 100644 --- a/go_cloudshellwrapper/constants.go +++ b/go_cloudshellwrapper/constants.go @@ -1,3 +1,3 @@ package cloudshellwrapper -var VersionInfo string = "nightly-24.01.26" +var VersionInfo string = "nightly-24.01.30b" diff --git a/go_cloudshellwrapper/constants.go.bak b/go_cloudshellwrapper/constants.go.bak index 02defc0de..4aca08aa3 100644 --- a/go_cloudshellwrapper/constants.go.bak +++ b/go_cloudshellwrapper/constants.go.bak @@ -1,11 +1,3 @@ package cloudshellwrapper -<<<<<<< HEAD -var VersionInfo string = "nightly-24.01.24d" -======= -<<<<<<< HEAD -var VersionInfo string = "nightly-24.01.21o" -======= -var VersionInfo string = "nightly-24.01.21j" ->>>>>>> 086a68742ab98e626a7a3b18058f719644aaaddd ->>>>>>> d14e5c344ebf83e4b4ac85b517d7e5ae5238600f +var VersionInfo string = "nightly-24.01.30a" diff --git a/go_topoengine/adaptorClabv2.go b/go_topoengine/adaptorClabv2.go index d9a696a82..ff08faad9 100644 --- a/go_topoengine/adaptorClabv2.go +++ b/go_topoengine/adaptorClabv2.go @@ -273,9 +273,11 @@ func (cyTopo *CytoTopology) UnmarshalContainerLabTopoV2(topoFile []byte, clabHos cytoJson.Data.TargetEndpoint = link.Z.Interface cytoJson.Data.ExtraData = map[string]interface{}{ - "clabServerUsername": Username, // needed for wireshark capture - "clabSourceLongName": link.A.NodeLongName, - "clabTargetLongName": link.Z.NodeLongName, + "clabServerUsername": Username, // needed for wireshark capture + "clabSourceLongName": link.A.NodeLongName, + "clabTargetLongName": link.Z.NodeLongName, + "clabSourceMacAddress": link.A.Mac, + "clabTargetMacAddress": link.Z.Mac, } cytoJsonList = append(cytoJsonList, cytoJson) } diff --git a/go_topoengine/cmd/main.go b/go_topoengine/cmd/main.go index 6578e5c35..3a89fdb7d 100644 --- a/go_topoengine/cmd/main.go +++ b/go_topoengine/cmd/main.go @@ -820,8 +820,8 @@ func main() { // panic(err) // } - // tools.CommentProcessor("./html-public/nokia-MAGc-lab/button.html", "./html-static/template/clab/button.tmpl") - tools.CommentProcessor("./html-public/demo/button.html", "./html-static/template/clab/button.tmpl") + tools.CommentProcessor("./html-public/nokia-MAGc-lab/button.html", "./html-static/template/clab/button.tmpl") + // tools.CommentProcessor("./html-public/demo/button.html", "./html-static/template/clab/button.tmpl") // cytoUiGo.GetDockerNodeStatusViaUnixSocket("clab-3tierSmall-dcgw-1", "localhost") diff --git a/html-static/template/clab/button.tmpl b/html-static/template/clab/button.tmpl index c86f2a0da..66b2c8bab 100644 --- a/html-static/template/clab/button.tmpl +++ b/html-static/template/clab/button.tmpl @@ -244,25 +244,25 @@