Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
 /**
  *
  * @param IXP_Form_Switch $form The form object
  * @param \Entities\Switcher $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True of we are editing an object, false otherwise
  * @return void
  */
 protected function addPostValidate($form, $object, $isEdit)
 {
     $object->setCabinet($this->getD2EM()->getRepository('\\Entities\\Cabinet')->find($form->getElement('cabinetid')->getValue()));
     $object->setVendor($this->getD2EM()->getRepository('\\Entities\\Vendor')->find($form->getElement('vendorid')->getValue()));
     if ($form->getElement('infrastructure')->getValue()) {
         $object->setInfrastructure($this->getD2EM()->getRepository('\\Entities\\Infrastructure')->find($form->getElement('infrastructure')->getValue()));
     }
     return true;
 }
 public function getMauSupported()
 {
     $this->__load();
     return parent::getMauSupported();
 }