public function addAction()
 {
     $this->addMessage("<h4>Use of this method is discouraged!</h4>\n\n                Switch ports are best added using the\n                <a href=\"https://github.com/inex/IXP-Manager/wiki/Updating-Switches-and-Ports-via-SNMP\">CLI scripts</a>\n                or the <em>View / Edit Ports (with SNMP poll)</em> option from the <a href=\"" . OSS_Utils::genUrl('switch', 'list') . "\">switch list page</a>. See <a href=\"" . "https://github.com/inex/IXP-Manager/wiki/Switch-and-Switch-Port-Management\">the documentation\n                for more information</a>.", OSS_Message::INFO, OSS_Message::TYPE_BLOCK);
     $this->view->form = $form = new IXP_Form_Switch_AddPorts();
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         if (!($switch = $this->getD2EM()->getRepository('\\Entities\\Switcher')->find($form->getValue('switchid')))) {
             throw new IXP_Exception('Unknown switch in request');
         }
         for ($i = 0; $i < $form->getValue('numports'); $i++) {
             $sp = new \Entities\SwitchPort();
             $sp->setSwitcher($switch);
             $sp->setType(intval($_POST['np_type' . $i]));
             $sp->setName(trim(stripslashes($_POST['np_name' . $i])));
             $sp->setActive(true);
             $this->getD2EM()->persist($sp);
         }
         $this->getD2EM()->flush();
         $msg = "{$form->getValue('numports')} new ports created for switch {$switch->getName()}.";
         $this->getLogger()->info($msg);
         $this->addMessage($msg, OSS_Message::SUCCESS);
         $this->redirect('switch-port/list/switch/' . $switch->getId());
     }
     $this->render('add-ports');
 }