Paul Greyson | 8d1c636 | 2013-03-27 13:05:24 -0700 | [diff] [blame] | 1 | /*global d3*/ |
| 2 | |
| 3 | function callURL(url) { |
| 4 | d3.text(url, function (error, result) { |
| 5 | if (error) { |
| 6 | alert(url + ' : ' + error.status); |
| 7 | } else { |
| 8 | console.log(result); |
| 9 | } |
| 10 | }); |
Paul Greyson | 4e6dc3a | 2013-03-27 11:37:14 -0700 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | |
Paul Greyson | 8d1c636 | 2013-03-27 13:05:24 -0700 | [diff] [blame] | 14 | var controllerFunctions = { |
| 15 | l: function (cmd, link) { |
| 16 | var url = '/proxy/gui/link/' + [cmd, link['src-switch'], link['src-port'], link['dst-switch'], link['dst-port']].join('/'); |
| 17 | callURL(url); |
| 18 | |
| 19 | }, |
| 20 | s: function (cmd, s) { |
| 21 | var url = '/proxy/gui/switch/' + [cmd, s.dpid].join('/'); |
| 22 | callURL(url); |
Paul Greyson | 2913af8 | 2013-03-27 14:53:17 -0700 | [diff] [blame] | 23 | }, |
| 24 | c: function (cmd, c) { |
| 25 | var url = '/proxy/gui/controller/' + [cmd, c].join('/'); |
| 26 | callURL(url); |
Paul Greyson | 8d1c636 | 2013-03-27 13:05:24 -0700 | [diff] [blame] | 27 | } |
| 28 | }; |
| 29 | |
| 30 | |
Paul Greyson | 4e6dc3a | 2013-03-27 11:37:14 -0700 | [diff] [blame] | 31 | // if (parseURLParameters().mock) { |
| 32 | // urls = mockURLs; |
| 33 | // } |
| 34 | |
| 35 | |
Paul Greyson | 8d1c636 | 2013-03-27 13:05:24 -0700 | [diff] [blame] | 36 | function linkUp(link) { |
| 37 | controllerFunctions.l('up', link); |
Paul Greyson | 4e6dc3a | 2013-03-27 11:37:14 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Paul Greyson | 8d1c636 | 2013-03-27 13:05:24 -0700 | [diff] [blame] | 40 | function linkDown(link) { |
| 41 | controllerFunctions.l('down', link); |
| 42 | } |
| 43 | |
| 44 | function switchUp(s) { |
| 45 | controllerFunctions.s('up', s); |
| 46 | } |
| 47 | |
| 48 | function switchDown(s) { |
| 49 | controllerFunctions.s('down', s); |
Paul Greyson | 4e6dc3a | 2013-03-27 11:37:14 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Paul Greyson | 2913af8 | 2013-03-27 14:53:17 -0700 | [diff] [blame] | 52 | function controllerUp(c) { |
| 53 | controllerFunctions.c('up', c); |
| 54 | } |
| 55 | |
| 56 | function controllerDown(c) { |
| 57 | controllerFunctions.c('down', c); |
| 58 | } |
| 59 | |
Paul Greyson | 4e6dc3a | 2013-03-27 11:37:14 -0700 | [diff] [blame] | 60 | function createFlow(src, dst) { |
| 61 | |
| 62 | } |
| 63 | |
| 64 | function deleteFlow(src, dst) { |
| 65 | |
| 66 | } |