add network configuration screen
smbaker [Tue, 15 Jan 2013 07:48:04 +0000 (23:48 -0800)]
apps/gacksadmin/action.php
apps/gacksadmin/gacks_functions.php
apps/gacksadmin/user_network.php [new file with mode: 0644]

index 1a73caa..b4747a0 100644 (file)
@@ -172,6 +172,15 @@ try {
             break;
         }
 
+        case 'set-network': {
+            $account_name = $_POST['account_name'];
+            $network_method = $_POST['network_method'];
+            $api->SliceAutoConfig($account_name, array("network_method" => $network_method));
+            drupal_set_message('Network Set');
+            plc_redirect(l_gacks_network());
+            break;
+        }
+
         case 'set-syndicate': {
             $account_name = $_POST['account_name'];
             $enable_syndicate = $_POST['enable_syndicate'];
index 7ade13b..d53a2c4 100644 (file)
@@ -32,6 +32,7 @@ function l_gacks_wizard ()         { return "/db/gacks/wizard.php"; }
 function l_gacks_nodelist ($account_name=NULL)         { return "/db/gacks/user_nodelist.php?account_name=$account_name"; }
 function l_gacks_nodelist_download ($acctname) { return "/db/gacks/action.php?action=download-nodelist&account_name=$acctname&format=CSV"; }
 function l_gacks_image ()         { return "/db/gacks/user_image.php"; }
+function l_gacks_network ()       { return "/db/gacks/user_network.php"; }
 function l_gacks_syndicate ()     { return "/db/gacks/user_syndicate.php"; }
 function l_gacks_user_reservations() { return "/db/gacks/user_reservations.php"; }
 function l_gacks_edit($item)       { return "/db/gacks/edit.php"; }
@@ -747,6 +748,10 @@ function manage_slivers_tabs()
                                'url'=>l_gacks_wizard(),
                                'bubble'=>"Add slivers (also known as nodes or VMs) to your slice");
 
+    $tabs['Configure Network'] = array('method'=>'GET',
+                               'url'=>l_gacks_network(),
+                               'bubble'=>"Configure a private network for your slivers to communicate with each other");
+
     $tabs['Select Image'] = array('method'=>'GET',
                                'url'=>l_gacks_image(),
                                'bubble'=>"Select image to use in this slice");
diff --git a/apps/gacksadmin/user_network.php b/apps/gacksadmin/user_network.php
new file mode 100644 (file)
index 0000000..355732c
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+// this must occur before linetabs.php, or linetabs won't work. I have no idea why.
+drupal_add_js("misc/popup.js");
+
+// Require login
+require_once 'plc_login.php';
+
+// Get session and API handles
+require_once 'plc_session.php';
+global $plc, $api, $adm;
+
+// Common functions
+require_once 'plc_functions.php';
+require_once 'plc_peers.php';
+require_once 'gacks_functions.php';
+require_once 'gacksclient.php';
+require_once 'linetabs.php';
+require_once 'table.php';
+require_once 'details.php';
+require_once 'toggle.php';
+require_once 'form.php';
+require_once 'nifty.php';
+
+// find person roles
+$_person= $plc->person;
+$_person_id = $plc->person['person_id'];
+$_roles= $_person['role_ids'];
+
+// Print header
+require_once 'plc_drupal.php';
+drupal_set_title('Manage Slivers: Configure Network');
+include 'plc_header.php';
+
+$tabs = manage_slivers_tabs();
+$_GET['active_line_tab'] = "Configure Network";
+plekit_linetabs($tabs);
+
+$nifty=new PlekitNifty ('slicenetwork','objects-list','big');
+$nifty->start();
+print '<div style="width: 640px; margin-left: auto; margin-right: auto;">';
+
+$account_name = get_account_name($api, $_person_id);
+
+if ($account_name != NULL) {
+    $gacksapi = new GACKSAPI();
+
+    $wizard_config = $api->SliceGetConfig($account_name);
+    $network_method = $wizard_config["network_method"];
+    if (!$network_method) {
+        $network_method = "";
+    }
+
+    $network_selectors = array();
+    $network_selectors []= array("display"=>"Default - No Private Network", "value"=>"");
+    $network_selectors []= array("display"=>"Private Bridge with GRE Tunnels", "value"=>"gre");
+    $network_selectors []= array("display"=>"IPv4 partitioned shared 10.x.x.x", "value"=>"ipv4_shared");
+    $network_selectors []= array("display"=>"IPv6 partitioned shared fec0::", "value"=>"ipv6_shared");
+    select_selector($network_method, $network_selectors);
+
+    $form = new PlekitForm(l_gacks_actions(), array("action"=>"set-network",
+                                                    "account_name"=> $account_name));
+    $form->start();
+
+    print "<br><br>Select a network method for your slice:<br>";
+    print $form->select_html("network_method", $network_selectors);
+    print "<br><br>";
+    print $form->submit_html("submit", "submit");
+    print "<br><br>";
+    print "Note: If you have slivers already instantiated in your slice, then you ";
+    print "will need to delete them, wait 15 minutes, and re-add them for the network ";
+    print "changes to take effect.";
+
+    $form->end();
+}
+
+print "</div>";
+$nifty->end();
+
+include 'plc_footer.php';
+
+?>
+
+