/** * 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; }
public function getPorts() { $this->__load(); return parent::getPorts(); }