6 <!-- <link rel="stylesheet" type="text/css" href="/styles/main.css" /> -->
7 <%include ../../partials/head%>
8 <link rel="stylesheet" type="text/css" href="/styles/starter.css" />
9 <link rel="stylesheet" href="/node_modules/xterm/css/xterm.css" />
10 <!-- <link rel="stylesheet" href="/node_modules/xterm/dist/addons/fullscreen/fullscreen.css" /> -->
11 <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
12 <script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
13 <script src="/node_modules/xterm/lib/xterm.js"></script>
14 <script src="/node_modules/xterm-addon-fit/lib/xterm-addon-fit.js"></script>
15 <script src="/node_modules/xterm-addon-attach/lib/xterm-addon-attach.js"></script>
16 <!-- <script src="/node_modules/xterm/dist/addons/winptyCompat/winptyCompat.js"></script> -->
20 <%include ../../partials/header%>
30 <textarea class="text" rows="20" cols="7" id="comandos" placeholder="Definicion de la red como: h1:s1"></textarea>
32 <button type="button" name="button" onclick="startvsorc()">Iniciar VSoRC</button>
33 <button type="button" name="button" onclick="stopvsorc()">Detener VSoRC</button>
34 <button type="button" name="button" onclick="startcontroller()">Iniciar controlador</button>
35 <button type="button" name="button" onclick="stopcontroller()">Detener controlador</button>
40 <textarea class="text" style="font-size: 12px;" disabled rows="20" cols="7" id="vsorcout" placeholder="Salida del sistema de consola"></textarea>
42 <button type="button" name="button" onclick="pingall()">Ping all</button>
43 <button type="button" name="button" onclick="placement()">Placement</button>
44 <button type="button" name="button" onclick="iperf()">Iperf3</button>
45 <button type="button" name="button" onclick="net()">Network</button>
46 <button type="button" name="button" onclick="nodes()">Nodes</button>
47 <button type="button" name="button" onclick="status()">Status</button>
48 <button type="button" name="button" onclick="intfs()">Interfaces</button>
52 <textarea class="text" style="font-size: 12px;" rows="20" cols="7" id="vsorccommand" placeholder="Enviar comandos a la terminal"></textarea>
54 <button type="button" name="button" onclick="sendcommand()">Send</button>
55 <!-- <button type="button" name="button" onclick="cancel()">Cancel</button> -->
63 <textarea class="text" style="font-size: 12px;" disabled rows="20" cols="7" id="controllerout" placeholder="Salida del controlador"></textarea>
68 <script type="text/javascript">
72 let topo = document.getElementById('comandos'); //Donde van escrito el DSL
73 let comando = document.getElementById('vsorccommand'); //Donde va escrito el comando para la terminal
74 let vsorcout = document.getElementById('vsorcout'); //salida del vsorc
75 let controllerout = document.getElementById('controllerout'); //salida del controlador
78 let timeController = 2000;
79 //Estos time son para especificar cada cuantos ms se pedira leer la data de los archivos aichivo y controllerout
81 let intervalController = null;//Para tener el id del interval para obtener data del controller
82 let intervalVsorc = null; //Para tener el id del interval para obtener data del vsorc
84 intervalVsorc = setInterval(getvsorcdata, timeVsorc);
85 intervalController=setInterval(getcontrollerdata, timeController);
87 function startcontroller() {
88 let xhr = new XMLHttpRequest();
89 xhr.open('GET', '/startcontroller', true);
90 //console.log(xhr); //para ver en la consola
91 xhr.onload = function() {
92 if (xhr.status == 200) { //can use this.status instead
93 console.log("controller started");
100 let xhr = new XMLHttpRequest();
101 xhr.open('GET', '/cancel', true);
102 //console.log(xhr); //para ver en la consola
103 xhr.onload = function() {
104 if (xhr.status == 200) { //can use this.status instead
105 console.log("cancelled");
112 function stopcontroller() {
113 let xhr = new XMLHttpRequest();
114 xhr.open('GET', '/stopcontroller', true);
115 xhr.onload = function() {
116 if (xhr.status == 200) { //can use this.status instead
117 //console.log(xhr.responseText);// para ver en la consola
118 console.log("controller stoped");
122 //clearInterval(intervalController);
123 controllerout.value='';
125 function getcontrollerdata() {
126 let xhr = new XMLHttpRequest();
127 xhr.open('GET', '/getcontrollerdata', true);
128 xhr.onload = function() {
129 if (xhr.status == 200) { //can use this.status instead
130 //console.log(xhr.responseText);// para ver en la consola
131 controllerout.value=xhr.response;
132 console.log("getting controller data");
137 controllerout.scrollTop = controllerout.scrollHeight;
139 function sendcommand() {
140 let xhr = new XMLHttpRequest();
141 cmd = JSON.stringify(comando.value);
142 xhr.open('GET', '/sendcommand?cmd=' + cmd, true);
143 xhr.onload = function() {
144 if (xhr.status == 200) { //can use this.status instead
145 //console.log(xhr.responseText);// para ver en la consola
146 console.log("command sended is "+cmd);
153 function startvsorc() {
154 let xhr = new XMLHttpRequest();
155 topology = JSON.stringify(topo.value)
156 xhr.open('GET', '/startvsorc?topology=' + topology, true);
157 xhr.onload = function() {
158 if (xhr.status == 200) { //can use this.status instead
159 //console.log(xhr.responseText);// para ver en la consola
160 console.log("vsorc started");
167 function stopvsorc() {
168 let xhr = new XMLHttpRequest();
169 xhr.open('GET', '/stopvsorc', true);
170 xhr.onload = function() {
171 if (xhr.status == 200) { //can use this.status instead
172 //console.log(xhr.responseText);// para ver en la consola
174 console.log("vsorc stopped");
178 //clearInterval(intervalVsorc);
182 function getvsorcdata() {
183 let xhr = new XMLHttpRequest();
184 xhr.open('GET', '/getvsorcdata', true);
185 xhr.onload = function() {
186 if (xhr.status == 200) { //can use this.status instead
187 //console.log(xhr.responseText);// para ver en la consola
188 vsorcout.value=xhr.response;
189 console.log("getting vsorc data");
196 vsorcout.scrollTop = vsorcout.scrollHeight;
201 let xhr = new XMLHttpRequest();
202 xhr.open('GET', '/pingall', true);
203 xhr.onload = function() {
204 if (xhr.status == 200) { //can use this.status instead
205 //console.log(xhr.responseText);// para ver en la consola
206 vsorcout.value+=xhr.response;
207 console.log("pingall");
216 let xhr = new XMLHttpRequest();
217 xhr.open('GET', '/iperf', true);
218 xhr.onload = function() {
219 if (xhr.status == 200) { //can use this.status instead
220 //console.log(xhr.responseText);// para ver en la consola
221 vsorcout.value+=xhr.response;
222 console.log("iperf");
230 function placement() {
231 let xhr = new XMLHttpRequest();
232 xhr.open('GET', '/placement', true);
233 xhr.onload = function() {
234 if (xhr.status == 200) { //can use this.status instead
235 //console.log(xhr.responseText);// para ver en la consola
236 vsorcout.value+=xhr.response;
237 console.log("placement");
246 let xhr = new XMLHttpRequest();
247 xhr.open('GET', '/net', true);
248 xhr.onload = function() {
249 if (xhr.status == 200) { //can use this.status instead
250 //console.log(xhr.responseText);// para ver en la consola
251 vsorcout.value+=xhr.response;
261 let xhr = new XMLHttpRequest();
262 xhr.open('GET', '/nodes', true);
263 xhr.onload = function() {
264 if (xhr.status == 200) { //can use this.status instead
265 //console.log(xhr.responseText);// para ver en la consola
266 vsorcout.value+=xhr.response;
267 console.log("nodes");
276 let xhr = new XMLHttpRequest();
277 xhr.open('GET', '/statusnodes', true);
278 xhr.onload = function() {
279 if (xhr.status == 200) { //can use this.status instead
280 //console.log(xhr.responseText);// para ver en la consola
281 vsorcout.value+=xhr.response;
282 console.log("statusnodes");
291 let xhr = new XMLHttpRequest();
292 xhr.open('GET', '/intfs', true);
293 xhr.onload = function() {
294 if (xhr.status == 200) { //can use this.status instead
295 //console.log(xhr.responseText);// para ver en la consola
296 vsorcout.value+=xhr.response;
297 console.log("interfaces");
309 <%include ../../partials/footer%>