コード例 #1
0
 function run($iterations)
 {
     global $taskWorkArea;
     for ($i = 0; $i < $iterations; $i++) {
         $taskWorkArea->holdCount = 0;
         $taskWorkArea->qpktCount = 0;
         $task_state = new TaskState();
         new IdleTask(I_IDLE, 1, 10000, $task_state->running(), new IdleTaskRec());
         $wkq = new Packet(null, 0, K_WORK);
         $wkq = new Packet($wkq, 0, K_WORK);
         $task_state = new TaskState();
         new WorkTask(I_WORK, 1000, $wkq, $task_state->waitingWithPacket(), new WorkTaskRec());
         $wkq = new Packet(null, I_DEVA, K_DEV);
         $wkq = new Packet($wkq, I_DEVA, K_DEV);
         $wkq = new Packet($wkq, I_DEVA, K_DEV);
         $task_state = new TaskState();
         new HandlerTask(I_HANDLERA, 2000, $wkq, $task_state->waitingWithPacket(), new HandlerTaskRec());
         $wkq = new Packet(null, I_DEVB, K_DEV);
         $wkq = new Packet($wkq, I_DEVB, K_DEV);
         $wkq = new Packet($wkq, I_DEVB, K_DEV);
         $task_state = new TaskState();
         new HandlerTask(I_HANDLERB, 3000, $wkq, $task_state->waitingWithPacket(), new HandlerTaskRec());
         $wkq = null;
         $task_state = new TaskState();
         new DeviceTask(I_DEVA, 4000, $wkq, $task_state->waiting(), new DeviceTaskRec());
         $task_state = new TaskState();
         new DeviceTask(I_DEVB, 5000, $wkq, $task_state->waiting(), new DeviceTaskRec());
         schedule();
         if (!($taskWorkArea->holdCount == 9297 && $taskWorkArea->qpktCount == 23246)) {
             return false;
         }
     }
     return true;
 }
コード例 #2
0
 /** multicast()
 		Creates the multicast session.
 	*/
 public function multicast()
 {
     // Set title
     $this->title = $this->foglang['Multicast'];
     unset($this->headerData);
     $this->attributes = array(array(), array());
     $this->templates = array('${field}', '${input}');
     $fields = array(_('Session Name') => '<input type="text" name="name" id="iName" autocomplete="off" value="" />', _('Client Count') => '<input type="text" name="count" id="iCount" autocomplete="off" />', _('Timeout') . '(' . _('minutes') . ')' => '<input type="text" name="timeout" id="iTimeout" autocomplete="off" />', _('Select Image') => '${select_image}', '<input type="hidden" name="start" value="1" />' => '<input type="submit" value="' . _('Start') . '" /><!--<i class="icon fa fa-question" title="TODO!"></i>-->');
     print "\n\t\t\t<h2>" . _('Start Multicast Session') . '</h2>';
     print "\n\t\t\t" . '<form method="post" action="' . $this->formAction . '">';
     foreach ((array) $fields as $field => $input) {
         $this->data[] = array('field' => $field, 'input' => $input, 'session_name' => $_REQUEST['name'], 'client_count' => $_REQUEST['count'], 'session_timeout' => $_REQUEST['timeout'], 'select_image' => $this->getClass('ImageManager')->buildSelectBox($_REQUEST['image'], '', 'name'));
     }
     // Hook
     $this->HookManager->processEvent('IMAGE_MULTICAST_SESS', array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes));
     // Output
     $this->render();
     unset($this->data);
     $this->headerData = array(_('Task Name'), _('Clients'), _('Start Time'), _('Percent'), _('State'), _('Stop Task'));
     $this->attributes = array(array(), array(), array(), array(), array(), array('class' => 'r'));
     $this->templates = array('${mc_name}<br/><small>${image_name}:${os}</small>', '${mc_count}', '<small>${mc_start}</small>', '${mc_percent}', '${mc_state}', '<a href="?node=' . $this->node . '&sub=stop&mcid=${mc_id}" title="Remove"><i class="fa fa-minus-circle" alt="' . _('Kill') . '"></i></a>');
     $MulticastSessions = $this->getClass('MulticastSessionsManager')->find(array('stateID' => array(0, 1, 2, 3)));
     foreach ($MulticastSessions as $MulticastSession) {
         if ($MulticastSession && $MulticastSession->isValid()) {
             $Image = new Image($MulticastSession->get('image'));
             $TaskState = new TaskState($MulticastSession->get('stateID'));
             $this->data[] = array('mc_name' => $MulticastSession->get('name'), 'mc_count' => $MulticastSession->get('sessclients'), 'image_name' => $Image->get('name'), 'os' => $Image->getOS(), 'mc_start' => $this->formatTime($MulticastSession->get('starttime'), 'Y-m-d H:i:s'), 'mc_percent' => $MulticastSession->get('percent'), 'mc_state' => $TaskState->get('name'), 'mc_id' => $MulticastSession->get('id'));
         }
     }
     // Hook
     $this->HookManager->processEvent('IMAGE_MULTICAST_START', array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes));
     // Output
     $this->render();
     print '</form>';
 }
コード例 #3
0
 public function active_multicast()
 {
     // Set title
     $this->title = _('Active Multi-cast Tasks');
     // Header row
     $this->headerData = array(_('Task Name'), _('Hosts'), _('Start Time'), _('State'), _('Status'), _('Kill'));
     // Row templates
     $this->templates = array('${name}', '${count}', '${start_date}', '${state}', '${percent}', '<a href="?node=task&sub=remove-multicast-task&id=${id}"><i class="icon fa fa-minus-circle" title="Kill Task"></i></a>');
     // Row attributes
     $this->attributes = array(array(), array('class' => 'c'), array('class' => 'c'), array('class' => 'c'), array('class' => 'c'), array('width' => 40, 'class' => 'c'));
     // Multicast data
     foreach ((array) $this->getClass('MulticastSessionsManager')->find(array('stateID' => array(1, 2, 3))) as $MS) {
         $TS = new TaskState($MS->get('stateID'));
         $this->data[] = array('id' => $MS->get('id'), 'name' => $MS->get('name') ? $MS->get('name') : 'Multicast Task', 'count' => $this->getClass('MulticastSessionsAssociationManager')->count(array('msID' => $MS->get('id'))), 'start_date' => $MS->get('starttime'), 'state' => $TS->get('name') ? $TS->get('name') : null, 'percent' => $MS->get('percent'));
     }
     // Hook
     $this->HookManager->processEvent('TaskActiveMulticastData', array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes));
     // Output
     $this->render();
 }