public function getVirtualInterface()
 {
     $this->__load();
     return parent::getVirtualInterface();
 }
 /**
  * You can add `OSS_Message`s here and redirect to a custom destination after a
  * successful add / edit operation.
  *
  * @param IXP_Form_Interface_Physical $form The form object
  * @param \Entities\PhysicalInterface $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True of we are editing an object, false otherwise
  * @return bool `false` for standard message and redirection, otherwise redirect within this function
  */
 protected function addDestinationOnSuccess($form, $object, $isEdit)
 {
     if ($this->getParam('rtn', false) == 'pi') {
         return false;
     }
     $this->addMessage('Physical interface successfully ' . ($isEdit ? 'edited.' : 'added.'), OSS_Message::SUCCESS);
     $this->redirectAndEnsureDie('virtual-interface/edit/id/' . $object->getVirtualInterface()->getId());
 }
Example #3
0
/**
 * Creates or updates physical interface for port
 *
 * @param \Entities\PhysicalInterface $phInt    Ports physical interface to get or create virtual interface
 * @param array                       $port     Parsed port data from csv to check if is LAG or simple port
 * @param \Entities\Switcher          $switcher Switch to look for port
 * @param \Entities\Customer          $cust     Customer to assign new virtual interface
 * @param object                      $em       Entity manager
 * @return \Entities\VirutalInterface
 */
function createUpdateVirtualInterface($phInt, $port, $switcher, $cust, $em)
{
    $viInt = $phInt->getVirtualInterface();
    if (!$viInt) {
        if ($port['pchan_master']) {
            foreach ($switcher->getPorts() as $sport) {
                if ($sport->getIfName() == $port['pchan_master']) {
                    $viInt = $sport->getPhysicalInterface()->getVirtualInterface();
                    break;
                }
            }
        }
        if (!$viInt) {
            $viInt = new \Entities\VirtualInterface();
            $em->persist($viInt);
            $viInt->setCustomer($cust);
            $cust->addVirtualInterface($viInt);
            $viInt->setMtu(0);
            $viInt->setTrunk(0);
            $viInt->setChannelgroup(0);
        }
        $phInt->setVirtualInterface($viInt);
        $viInt->addPhysicalInterface($phInt);
    }
    return $viInt;
}