Paul Greyson | 7a30082 | 2013-04-09 12:57:49 -0700 | [diff] [blame] | 1 | /*************************************************************************************************** |
| 2 | find the links that include the switch with this dpid |
| 3 | ***************************************************************************************************/ |
| 4 | function debug_findlink(model, dpid) { |
| 5 | var links = []; |
| 6 | model.links.forEach(function (link) { |
| 7 | if (link['src-switch'] == dpid || link['dst-switch'] == dpid) { |
| 8 | links.push(link); |
| 9 | } |
| 10 | }); |
| 11 | return links; |
Paul Greyson | 14919c4 | 2013-04-10 17:50:36 -0700 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | function debug_findswitch(model, dpid) { |
| 15 | var sw; |
| 16 | |
| 17 | model.edgeSwitches.forEach(function (s) { |
| 18 | if (s.dpid == dpid) |
| 19 | sw = s; |
| 20 | }); |
| 21 | model.aggregationSwitches.forEach(function (s) { |
| 22 | if (s.dpid == dpid) |
| 23 | sw = s; |
| 24 | }); |
| 25 | model.coreSwitches.forEach(function (s) { |
| 26 | if (s.dpid == dpid) |
| 27 | sw = s; |
| 28 | }); |
| 29 | |
| 30 | return sw; |
Paul Greyson | 7a30082 | 2013-04-09 12:57:49 -0700 | [diff] [blame] | 31 | } |