public function setVirtualInterface(\Entities\VirtualInterface $virtualInterface = NULL) { $this->__load(); return parent::setVirtualInterface($virtualInterface); }
/** * @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 */ protected function addPostValidate($form, $object, $isEdit) { $sp = $this->getD2R('\\Entities\\SwitchPort')->find($form->getElement('switchportid')->getValue()); // set the switch port type to peering $sp->setType(\Entities\SwitchPort::TYPE_PEERING); $object->setSwitchPort($sp); $vi = $this->getD2EM()->getRepository('\\Entities\\VirtualInterface')->find($form->getElement('virtualinterfaceid')->getValue()); $object->setVirtualInterface($vi); // FIXME We should do more than just ensure it's not an edit here. You could edit to a non-unique value... if (!$isEdit && !$vi->getCustomer()->isUniqueMonitorIndex($form->getValue('monitorindex'))) { $this->addMessage('The monitor index must be unique. It has been reset below to a unique value.', OSS_Message::ERROR); $form->getElement('monitorindex')->setValue($this->getD2R('\\Entities\\PhysicalInterface')->getNextMonitorIndex($vi->getCustomer())); return false; } if ($form->getElement('fanout')) { if (!$this->processFanoutPhysicalInterface($form, $object, $vi)) { return false; } } if ($object->getRelatedInterface()) { $object->getRelatedInterface()->setSpeed($form->getValue("speed")); $object->getRelatedInterface()->setStatus($form->getValue("status")); $object->getRelatedInterface()->setDuplex($form->getValue("duplex")); } return true; }
/** * 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; }