diff options
Diffstat (limited to 'admportal/views/mobility')
-rw-r--r-- | admportal/views/mobility/displayVnfData.ejs | 36 | ||||
-rw-r--r-- | admportal/views/mobility/displayVnfNetworkData.ejs | 36 | ||||
-rw-r--r-- | admportal/views/mobility/vmNetworks.ejs | 198 | ||||
-rw-r--r-- | admportal/views/mobility/vmProfile.ejs | 173 | ||||
-rw-r--r-- | admportal/views/mobility/vnfNetworks.ejs | 163 | ||||
-rw-r--r-- | admportal/views/mobility/vnfPreloadData.ejs | 244 | ||||
-rw-r--r-- | admportal/views/mobility/vnfPreloadNetworkData.ejs | 242 | ||||
-rw-r--r-- | admportal/views/mobility/vnfProfile.ejs | 177 |
8 files changed, 1269 insertions, 0 deletions
diff --git a/admportal/views/mobility/displayVnfData.ejs b/admportal/views/mobility/displayVnfData.ejs new file mode 100644 index 00000000..596feb66 --- /dev/null +++ b/admportal/views/mobility/displayVnfData.ejs @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>SDN-C AdminPortal</title> + <meta charset="UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> +</head> +<body> + + +<div class="actions" style="padding:0px 25px;"> +<h2>VNF Data</h2> +</div> + +<div class="container-fluid"> +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <pre class='alert alert-success' role='alert'><%=JSON.stringify(result.msg,null,4) %></pre> + <% } else { %> + <pre class='alert alert-danger' role='danger'><%=result.msg %></pre> + <% } %> + <% } %> +<% } %> +</div> + + +<footer> + <% include ../partials/footer %> +</footer> + +</body> +</html> + diff --git a/admportal/views/mobility/displayVnfNetworkData.ejs b/admportal/views/mobility/displayVnfNetworkData.ejs new file mode 100644 index 00000000..e2bcd637 --- /dev/null +++ b/admportal/views/mobility/displayVnfNetworkData.ejs @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>SDN-C AdminPortal</title> + <meta charset="UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> +</head> +<body> + + +<div class="actions" style="padding:0px 25px;"> +<h2>VNF Network Data</h2> +</div> + +<div class="container-fluid"> +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <pre class='alert alert-success' role='alert'><%=JSON.stringify(result.msg,null,4) %></pre> + <% } else { %> + <pre class='alert alert-danger' role='danger'><%=result.msg %></pre> + <% } %> + <% } %> +<% } %> +</div> + + +<footer> + <% include ../partials/footer %> +</footer> + +</body> +</html> + diff --git a/admportal/views/mobility/vmNetworks.ejs b/admportal/views/mobility/vmNetworks.ejs new file mode 100644 index 00000000..6394c44d --- /dev/null +++ b/admportal/views/mobility/vmNetworks.ejs @@ -0,0 +1,198 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#vm_networks').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + +</head> +<body> + +<div class="well well-sm"> +<h3>VM Networks </h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <% if (priv == 'A'){ %> + <div class="actions" style="padding:15px 0px;"> + <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_vm_network"> + Add VM Network + </button> + </div> + <% } %> + + <table id="vm_networks" class="table table-hover table-condensed"> + <thead> + <tr> + <th>*VNF_TYPE</th> + <th>*VM_TYPE</th> + <th>*NETWORK_ROLE</th> + <th>IP_COUNT</th> + <th>ASSIGN_IPS</th> + <th>ASSIGN_MACS</th> + <th>ASSIGN_FLOATING_IP</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% rows.forEach( function(row) { %> + <tr> + <td><%= row.vnf_type %></td> + <td><%= row.vm_type %></td> + <td><%= row.network_role %></td> + <td><%= row.ip_count %></td> + <td><%= (row.assign_ips == '1') ? 'true' : 'false' %></td> + <td><%= (row.assign_macs == '1') ? 'true' : 'false' %></td> + <td><%= (row.assign_floating_ip == '1') ? 'true' : 'false' %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVmNetwork('<%= row.vnf_type %>', '<%= row.vm_type %>', '<%= row.network_role %>');">Delete</button> + </td> + <% } %> + </tr> + <% }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> + <div class="actions" style="padding:0px 25px;"> + <form method="POST" action="/mobility/uploadVmNetworks" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">File input</label> + <input name="filename" type="file" id="dest"> + <p class="help-block">Choose a file to upload.</p> + </div> + <button type="button" class="btn btn-default" + onclick="uploadFile(this.form);">Upload File</button> + </form> + </div> + <% } %> +</div> + +<% include ../partials/vm_networks %> +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function addVmNetwork(form) +{ + var errorMsg=''; + var vnf_type=''; + var vm_type=''; + var network_role=''; + var ip_count = ''; + var assign_ips=''; + var assign_macs=''; + var assign_floating_ip=''; + + if ( form.name == 'addForm' ) + { + vnf_type = form.nf_vnf_type; + vm_type = form.nf_vm_type; + network_role = form.nf_network_role; + ip_count = form.nf_ip_count; + assign_ips = form.nf_assign_ips; + assign_macs = form.nf_assign_macs; + assign_floating_ip = form.nf_assign_floating_ip; + } + + if ( (vnf_type.value == null) || (vnf_type.value == "") || isblank(vnf_type.value) ) + { + errorMsg += 'VNF Type is required.<br>'; + } + if ( (vm_type.value == null) || (vm_type.value == "") || isblank(vm_type.value) ) + { + errorMsg += 'VM Type is required.<br>'; + } + if ( (network_role.value == null) || (network_role.value == "") || isblank(network_role.value) ){ + errorMsg += 'Network Role is required.<br>'; + } + if( errorMsg.length > 0 ) { + bootbox.alert(errorMsg); + return; + } + if (ip_count.value.length >0 && !isDigit(ip_count.value) ) + { + bootbox.alert('VM Count must be a number.'); + return; + } + if (assign_ips.value == 'true' && ip_count.value.length == 0) + { + bootbox.alert("If ASSIGN IPS equals 'true', IP COUNT must be populated with a number."); + return; + } + + form.submit(); +} + +function deleteVmNetwork(vnf_type,vm_type,network_role) { + + bootbox.confirm({ + message: "Are you sure you want to delete VM_NETWORK [" + vnf_type + "]" + "[" + vm_type + "][" + network_role + "]", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVmNetwork?vnf_type=" + vnf_type + "&vm_type=" + vm_type + "&network_role=" + network_role); + + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + diff --git a/admportal/views/mobility/vmProfile.ejs b/admportal/views/mobility/vmProfile.ejs new file mode 100644 index 00000000..f702e51a --- /dev/null +++ b/admportal/views/mobility/vmProfile.ejs @@ -0,0 +1,173 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#vm_profile').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + +</head> +<body> + +<div class="well well-sm"> +<h3>VM Profile </h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <% if (priv == 'A'){ %> + <div class="actions" style="padding:15px 0px;"> + <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_vm_profile"> + Add VM Profile + </button> + </div> + <% } %> + + <table id="vm_profile" class="table table-hover table-condensed"> + <thead> + <tr> + <th>*VNF_TYPE</th> + <th>*VM_TYPE</th> + <th>VM_COUNT</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% rows.forEach( function(row) { %> + <tr> + <td><%= row.vnf_type %></td> + <td><%= row.vm_type %></td> + <td><%= row.vm_count %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVmProfile('<%= row.vnf_type %>', '<%= row.vm_type %>');">Delete</button> + </td> + <% } %> + </tr> + <% }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> + <div class="actions" style="padding:0px 25px;"> + <form method="POST" action="/mobility/uploadVmProfile" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">File input</label> + <input name="filename" type="file" id="dest"> + <p class="help-block">Choose a file to upload.</p> + </div> + <button type="button" class="btn btn-default" + onclick="uploadFile(this.form);">Upload File</button> + </form> + </div> + <% } %> +</div> + +<% include ../partials/vm_profile %> +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function addVmProfile(form) +{ + var errorMsg=''; + var vnf_type=''; + var vm_type=''; + var vm_count=''; + + if ( form.name == 'addForm' ) + { + vnf_type = form.nf_vnf_type; + vm_type = form.nf_vm_type; + vm_count = form.nf_vm_count; + } + + if ( (vnf_type.value == null) || (vnf_type.value == "") || isblank(vnf_type.value) ) + { + errorMsg += 'VNF Type is required.<br>'; + } + if ( (vm_type.value == null) || (vm_type.value == "") || isblank(vm_type.value) ) + { + errorMsg += 'VM Type is required.<br>'; + } + if( errorMsg.length > 0 ) { + bootbox.alert(errorMsg); + return; + } + + if ( vm_count.value.length > 0 && !isDigit(vm_count.value) ) + { + bootbox.alert('VM Count must be a number.'); + return; + } + form.submit(); +} + +function deleteVmProfile(vnf_type, vm_type) { + + bootbox.confirm({ + message: "Are you sure you want to delete VM_PROFILE [" + vnf_type + "][" + vm_type + "]", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVmProfile?vnf_type=" + vnf_type + "&vm_type=" + vm_type); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + diff --git a/admportal/views/mobility/vnfNetworks.ejs b/admportal/views/mobility/vnfNetworks.ejs new file mode 100644 index 00000000..a4a9f170 --- /dev/null +++ b/admportal/views/mobility/vnfNetworks.ejs @@ -0,0 +1,163 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#vnf_networks').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + +</head> +<body> + +<div class="well well-sm"> +<h3>VNF Networks </h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <% if (priv == 'A'){ %> + <div class="actions" style="padding:15px 0px;"> + <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_vnf_network"> + Add VNF Network + </button> + </div> + <% } %> + + <table id="vnf_networks" class="table table-hover table-condensed"> + <thead> + <tr> + <th>*VNF_TYPE</th> + <th>*NETWORK_ROLE</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% rows.forEach( function(row) { %> + <tr> + <td><%= row.vnf_type %></td> + <td><%= row.network_role %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVnfNetwork('<%= row.vnf_type %>', '<%= row.network_role %>');">Delete</button> + </td> + <% } %> + </tr> + <% }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> + <div class="actions" style="padding:0px 25px;"> + <form method="POST" action="/mobility/uploadVnfNetworks" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">File input</label> + <input name="filename" type="file" id="dest"> + <p class="help-block">Choose a file to upload.</p> + </div> + <button type="button" class="btn btn-default" + onclick="uploadFile(this.form);">Upload File</button> + </form> + </div> + <% } %> +</div> + +<% include ../partials/vnf_network %> +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function addVnfNetwork(form) +{ + var errorMsg=''; + var vnf_type=''; + var network_role=''; + + if ( form.name == 'addForm' ) + { + vnf_type = form.nf_vnf_type; + network_role = form.nf_network_role; + } + + if ( (vnf_type.value == null) || (vnf_type.value == "") || isblank(vnf_type.value) ) + { + errorMsg += 'VNF Type is required.<br>'; + } + if ( (network_role.value == null) || (network_role.value == "") || isblank(network_role.value) ) + { + errorMsg += 'Network Role is required.<br>'; + } + if( errorMsg.length > 0 ) { + bootbox.alert(errorMsg); + return; + } + form.submit(); +} + +function deleteVnfNetwork(vnf_type, network_role) { + + bootbox.confirm({ + message: "Are you sure you want to delete VNF_NETWORK [" + vnf_type + "][" + network_role + "]", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVnfNetwork?vnf_type=" + vnf_type + "&network_role=" + network_role); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + diff --git a/admportal/views/mobility/vnfPreloadData.ejs b/admportal/views/mobility/vnfPreloadData.ejs new file mode 100644 index 00000000..69f02e59 --- /dev/null +++ b/admportal/views/mobility/vnfPreloadData.ejs @@ -0,0 +1,244 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#vnf_data').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + + +</head> +<body> + +<div class="well well-sm"> +<h3>Pre-load VNF Data</h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <table id="vnf_data" class="table table-hover table-condensed"> + <thead> + <tr> + <th>ID</th> + <th>SVC_REQUEST_ID</th> + <th>VNF_NAME</th> + <th>VNF_TYPE</th> + <th>SVC_ACTION</th> + <th>UPLOAD STATUS</th> + <th>FILENAME</th> + <th>IMPORT/UPLOAD TIMESTAMP</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% var i=0; retData.forEach( function(rowObj) { %> + <tr> + <td><%= rowObj.row.id %></td> + <td><a href="javascript:getVnfData('<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');"><%= rowObj.row.svc_request_id %></a></td> + <td><%= rowObj.vnf_name %></td> + <td><%= rowObj.vnf_type %></td> + <td><%= rowObj.row.svc_action %></td> + <td><%= rowObj.row.status %></td> + <td> + <a data-toggle="collapse" + href="#collapseExample<%= i %>" aria-expanded="false" + aria-controls="collapseExample"><%= rowObj.row.filename %> + </a> + <div class="collapse" id="collapseExample<%= i %>"> + <div class="well"> + <pre><%= JSON.stringify(rowObj.filecontent,null,4) %></pre> + </div> + </div> + </td> + + <td><%= rowObj.row.ts %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVnfData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.filename %>','<%= rowObj.row.status %>','<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');">Delete</button> + <% if (typeof rowObj.vnf_name != 'undefined' || typeof rowObj.vnf_type != 'undefined'){ %> + <button type="button" class="btn btn-default btn-xs" + onclick="loadVnfData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.svc_action %>','<%= rowObj.row.status %>','<%= rowObj.row.filename %>','<%= rowObj.row.ts %>');">Load Data</button> + <% } %> + </td> + <% } %> + </tr> + <% i++; }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> + <div class="row"> + <div class="col-md-8 col-md-push-4"> + <form method="POST" action="/mobility/uploadVnfData" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">Upload pre processed JSON file.</label> + <input name="filename" type="file" id="dest"> + <p class="help-block">Choose a JSON file to upload.</p> + <button type="button" class="btn btn-default" + data-toggle="tooltip" data-placement="bottom" + title="Upload a JSON file that has already been pre processed." + onclick="uploadFile(this.form);">Upload JSON File</button> + </div> + </form> + </div> + <div class="col-md-4 col-md-pull-8"> + <form method="POST" action="/preload/uploadVnfCsv" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">Upload Worksheet CSV files from the <%= preloadImportDirectory %> directory.</label> + <input name="filename" type="file" id="dest" multiple> + <p class="help-block">Choose Worksheet CSV files to upload.</p> + <button type="button" class="btn btn-default" + data-toggle="tooltip" data-placement="bottom" + title="Must upload all the VNF CSV files from <%= preloadImportDirectory %>" + onclick="importWorksheet(this.form);">Upload VNF Worksheet CSV files + </button> + </div> + </form> + </div> + </div> + <% } %> +</div> + +<% include ../partials/add_service_homing %> +<% include ../partials/update_service_homing %> +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function importWorksheet(form) +{ + if ( form.filename.value.length == 0) + { + bootbox.alert('Must select a file.'); + return false; + } + else { + + bootbox.confirm({ + message: "Are you sure you want to import VNF WORKSHEET .csv files from <%= preloadImportDirectory %>", + callback: function(result) { + if ( result ) + { + form.submit(); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); + } +} + + +function getVnfData(vnf_name,vnf_type,svc_request_id) +{ + location.assign("/mobility/viewVnfData?vnf_name=" + vnf_name + "&vnf_type=" + vnf_type ); + return; +} +function loadVnfData(id,svc_request_id,svc_action,status,filename,ts) +{ + if ( status != 'pending' ) + { + bootbox.alert("Upload Status must be in 'pending' state."); + return; + } + bootbox.confirm({ + message: "Are you sure you want to load file [" + filename + "]? ", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/loadVnfData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +function deleteVnfData(id,svc_request_id,filename,status,vnf_name,vnf_type) { + + bootbox.confirm({ + message: "Are you sure you want to delete uploaded file [" + filename + "]? ", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVnfData?id=" + + id + + "&svc_request_id=" + svc_request_id + + "&filename=" + filename + + "&status=" + status + + "&vnf_name=" + vnf_name + + "&vnf_type=" + vnf_type); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + diff --git a/admportal/views/mobility/vnfPreloadNetworkData.ejs b/admportal/views/mobility/vnfPreloadNetworkData.ejs new file mode 100644 index 00000000..099dcba5 --- /dev/null +++ b/admportal/views/mobility/vnfPreloadNetworkData.ejs @@ -0,0 +1,242 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#preload_vnf_data').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + + +</head> +<body> + +<div class="well well-sm"> +<h3>Pre-load VNF Network Data</h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <table id="preload_vnf_data" class="table table-hover table-condensed"> + <thead> + <tr> + <th>ID</th> + <th>SVC_REQUEST_ID</th> + <th>NETWORK_NAME</th> + <th>NETWORK_TYPE</th> + <th>SVC_ACTION</th> + <th>UPLOAD STATUS</th> + <th>FILENAME</th> + <th>IMPORT/UPLOAD TIMESTAMP</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% var i=0; retData.forEach( function(rowObj) { %> + <tr> + <td><%= rowObj.row.id %></td> + <td><a href="javascript:getVnfNetworkData('<%= rowObj.network_name %>','<%= rowObj.network_type %>');"><%= rowObj.row.svc_request_id %></a></td> + <td><%= rowObj.network_name %></td> + <td><%= rowObj.network_type %></td> + <td><%= rowObj.row.svc_action %></td> + <td><%= rowObj.row.status %></td> + <td> + <a data-toggle="collapse" + href="#collapseExample<%= i %>" aria-expanded="false" + aria-controls="collapseExample"><%= rowObj.row.filename %> + </a> + <div class="collapse" id="collapseExample<%= i %>"> + <div class="well"> + <pre><%= JSON.stringify(rowObj.filecontent,null,4) %></pre> + </div> + </div> + </td> + + <td><%= rowObj.row.ts %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVnfNetworkData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.filename %>','<%= rowObj.row.status %>','<%= rowObj.network_name %>','<%= rowObj.network_type %>');">Delete</button> + <% if (typeof rowObj.network_name != 'undefined' || typeof rowObj.network_type != 'undefined'){ %> + <button type="button" class="btn btn-default btn-xs" + onclick="loadVnfNetworkData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.svc_action %>','<%= rowObj.row.status %>','<%= rowObj.row.filename %>','<%= rowObj.row.ts %>');">Load Data</button> + <% } %> + </td> + <% } %> + </tr> + <% i++; }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> +<div class="row"> + <div class="col-md-8 col-md-push-4"> + <form method="POST" action="/mobility/uploadVnfNetworkData" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">Upload pre processed JSON file.</label> + <input name="filename" type="file" id="dest"></input> + <p class="help-block">Choose a JSON file to upload.</p> + <button type="button" class="btn btn-default" + data-toggle="tooltip" data-placement="bottom" + title="Upload a JSON file that has already been pre processed." + onclick="uploadFile(this.form);">Upload JSON File + </button> + </div> + </form> + </div> + <div class="col-md-4 col-md-pull-8"> + <form method="POST" action="/preload/uploadNetworkCsv" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">Upload Worksheet CSV files from the <%= preloadImportDirectory %> directory.</label> + <input name="filename" type="file" id="dest" multiple></input> + <p class="help-block">Choose Worksheet CSV files to upload.</p> + <button type="button" class="btn btn-default" + data-toggle="tooltip" data-placement="bottom" + title="Must upload all the VNF CSV files from <%= preloadImportDirectory %>" + onclick="importWorksheet(this.form);">Upload Network Worksheet CSV files + </button> + </div> + </form> + </div> +</div> + <% } %> +</div> + +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function importWorksheet(form) +{ + if ( form.filename.value.length == 0) + { + bootbox.alert('Must select a file.'); + return false; + } + else { + + bootbox.confirm({ + message: "Are you sure you want to import Network WORKSHEET .csv files from <%= preloadImportDirectory %>", + callback: function(result) { + if ( result ) + { + form.submit(); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); + } +} + +function getVnfNetworkData(network_name,network_type) +{ + location.assign("/mobility/viewVnfNetworkData?network_name=" + network_name + "&network_type=" + network_type ); + return; +} +function loadVnfNetworkData(id,svc_request_id,svc_action,status,filename,ts) +{ + if ( status != 'pending' ) + { + bootbox.alert("Upload Status must be in 'pending' state."); + return; + } + bootbox.confirm({ + message: "Are you sure you want to load file [" + filename + "]? ", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/loadVnfNetworkData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +function deleteVnfNetworkData(id,svc_request_id,filename,status,network_name,network_type) { + + bootbox.confirm({ + message: "Are you sure you want to delete uploaded file [" + filename + "]? ", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVnfNetworkData?id=" + + id + + "&svc_request_id=" + svc_request_id + + "&filename=" + filename + + "&status=" + status + + "&network_name=" + network_name + + "&network_type=" + network_type); + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + diff --git a/admportal/views/mobility/vnfProfile.ejs b/admportal/views/mobility/vnfProfile.ejs new file mode 100644 index 00000000..1a494985 --- /dev/null +++ b/admportal/views/mobility/vnfProfile.ejs @@ -0,0 +1,177 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <% include ../partials/head %> + <% include ../partials/header %> + <script type="text/javascript" src="/javascripts/admportal.js" async></script> + <title>SDN-C AdminPortal</title> +<script class="init"> + $(document).ready(function() { + $('#vnf_profile').DataTable( { + "order": [[ 0, "asc" ]] + } ); +} ); +</script> + +</head> +<body> + +<div class="well well-sm"> +<h3>VNF Profile </h3> +</div> + +<% if ( typeof result != 'undefined' ) { + if (result.code.length > 0) { + if ( result.code == 'success' ) { %> + <div class='alert alert-success' role='alert'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } else { %> + <div class='alert alert-danger' role='danger'> + <% + for ( x in result.msg ){ %> + <div><%= result.msg[x] %></div> + <% } %> + </div> + <% } %> + <% } %> +<% } %> + +<% if( typeof privilege != 'undefined'){ + var priv = privilege.privilege; +} else { + var priv = 'A'; +} %> + + +<div class="container-fluid"> + + <% if (priv == 'A'){ %> + <div class="actions" style="padding:15px 0px;"> + <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_vnf_profile"> + Add VNF Profile + </button> + </div> + <% } %> + + <table id="vnf_profile" class="table table-hover table-condensed"> + <thead> + <tr> + <th>*VNF_TYPE</th> + <th>AVAILABILITY_ZONE_COUNT</th> + <th>EQUIPMENT_ROLE</th> + <% if(priv == 'A'){ %> + <th>Action</th> + <% } %> + </tr> + </thead> + <tbody> + <% rows.forEach( function(row) { %> + <tr> + <td><%= row.vnf_type %></td> + <td><%= row.availability_zone_count %></td> + <td><%= row.equipment_role %></td> + <% if(priv == 'A' ) { %> + <td> + <button type="button" class="btn btn-default btn-xs" + onclick="deleteVnfProfile('<%= row.vnf_type %>');">Delete</button> + </td> + <% } %> + </tr> + <% }); %> + </tbody> + </table> + + <% if(priv == 'A'){ %> + <div class="actions" style="padding:0px 25px;"> + <form method="POST" action="/mobility/uploadVnfProfile" enctype="multipart/form-data"> + <div class="form-group"> + <label for="dest">File input</label> + <input name="filename" type="file" id="dest"> + <p class="help-block">Choose a file to upload.</p> + </div> + <button type="button" class="btn btn-default" + onclick="uploadFile(this.form);">Upload File</button> + </form> + </div> + <% } %> +</div> + +<% include ../partials/vnf_profile %> +<footer> + <% include ../partials/footer %> +</footer> + +<script type="text/javascript"> + +function addVnfProfile(form) +{ + var errorMsg=''; + var vnf_type=''; + var availability_zone_count=''; + var equipment_role=''; + + if ( form.name == 'addForm' ) + { + vnf_type = form.nf_vnf_type; + availability_zone_count = form.nf_availability_zone_count; + equipment_role = form.nf_equipment_role; + } + + if ( (vnf_type.value == null) || (vnf_type.value == "") || isblank(vnf_type.value) ) + { + errorMsg += 'VNF Type is required.<br>'; + } + if ( (availability_zone_count.value == null) || (availability_zone_count.value == "") || isblank(availability_zone_count.value) ) + { + errorMsg += 'Availability Zone Count is a required field.<br>'; + } + if ( (equipment_role.value == null) || (equipment_role.value == "") || isblank(equipment_role.value) ) + { + errorMsg += 'Equipment Role is a required field.<br>'; + } + if( errorMsg.length > 0 ) { + bootbox.alert(errorMsg); + return; + } + if ( availability_zone_count.value.length > 0 && !isDigit(availability_zone_count.value) ) + { + bootbox.alert('Availability Zone Count must be a number.'); + return; + } + form.submit(); +} + +function deleteVnfProfile(vnf_type) { + + bootbox.confirm({ + message: "Are you sure you want to delete VNF_PROFILE [" + vnf_type + "]", + callback: function(result) { + if ( result ) + { + location.assign("/mobility/deleteVnfProfile?vnf_type=" + vnf_type); + + } + return; + }, + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Yes" + } + } + }); +} + +</script> + +</body> +</html> + |