Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from macartur/update_api_links
Browse files Browse the repository at this point in the history
Update to support new version of napps endpoints
  • Loading branch information
beraldoleal authored Mar 9, 2018
2 parents d316bbb + b3774a4 commit 28d98a9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/kytos/map/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
map_zoom: 2,
extraComponent: undefined,
topology: {
url: this.$kytos_server_api + "kytos/topology/v2/",
url: this.$kytos_server_api + "kytos/topology/v3/",
graph: null
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@ export default {
this.$kytos.$emit("statusMessage", msg, true)
throw error
} else {
this.topology.graph = graph
this.topology.graph = graph.topology
this.extraComponent = KytosTopology
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/kytos/switch/Interface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
},
endpoint () {
let url = this.$kytos_server_api + "kytos/of_stats/v1/"
return url + this.dpid + "/ports/" + this.port_number
return url + this.dpid + "/ports/" + Number(this.port_number)
},
utilization_color_class: function () {
if (this.speed === null) return ''
Expand Down
26 changes: 15 additions & 11 deletions src/components/kytos/topology/Topology.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
props: ["map", "original_graph"],
data () {
return {
topology_url: this.$kytos_server_api + "kytos/topology/v2/",
topology_url: this.$kytos_server_api + "kytos/topology/v3/",
map_container: undefined,
graph: {},
svg: undefined,
Expand Down Expand Up @@ -190,8 +190,8 @@ export default {
b: "00:24:38:af:17:00:00:00:290" // Miami Pacific
}
}
this.graph.links.forEach((link, index) => {
/**
$.each(this.graph.links,function( link_id, link) {
if (link.a == atlantic_link.id || link.b == atlantic_link.id) {
this.graph.links.splice(index, 1, atlantic_link.link1, atlantic_link.link2)
}
Expand All @@ -202,6 +202,7 @@ export default {
this.graph.links.splice(index, 1, pacific_link.link1, pacific_link.link2)
}
})
**/
},
update_graph_data () {
this.graph = JSON.parse(JSON.stringify(this.original_graph)) // Make a copy
Expand All @@ -211,16 +212,19 @@ export default {
// have a link attached to it.
let interfaces_with_links = []
this.graph.links.forEach((link) => {
link.source = link.a
interfaces_with_links.push(link.a)
link.target= link.b
interfaces_with_links.push(link.b)
$.each(this.graph.links , function(link_id, link ){
link.source = link.endpoint_a.id
interfaces_with_links.push(link.endpoint_a.id)
link.target= link.endpoint_b.id
interfaces_with_links.push(link.endpoint_b.id)
link.type = "link"
link.id = this.fix_name(link.a) + "___" + this.fix_name(link.b)
})
link.id = this.fix_name(link.endpoint_a.id) + "___" +
this.fix_name(link.endpoint_b.id)
}.bind(this))
this.graph.links = Object.values(this.graph.links)
this.graph.nodes = Object.values(this.graph.switches)
this.graph.nodes = Object.values(this.graph.devices)
this.graph.nodes.forEach((node) => {
if (node.type == "host"){
node.name = node.mac
Expand Down
2 changes: 1 addition & 1 deletion src/kytos/switchInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
},
get_flows() {
var dpid = this.metadata.dpid
var endpoint = this.$kytos_server_api + "kytos/flow_manager/v1/flows/" + dpid
var endpoint = this.$kytos_server_api + "kytos/flow_manager/v2/flows/" + dpid
var self = this
d3.json(endpoint, function(error, result) {
self.flows = result[dpid].flows
Expand Down

0 comments on commit 28d98a9

Please sign in to comment.