/** * @param IXP_Form_Interface_Virtual $form The form object * @param \Entities\VirtualInterface $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @param array $options Options passed onto Zend_Form * @param string $cancelLocation Where to redirect to if 'Cancal' is clicked * @return void */ protected function formPostProcess($form, $object, $isEdit, $options = null, $cancelLocation = null) { if ($isEdit) { $form->getElement('custid')->setValue($object->getCustomer()->getId()); $this->view->ptypes = \Entities\SwitchPort::$TYPES; $this->view->cust = $object->getCustomer(); $this->view->physInts = $object->getPhysicalInterfaces(); $this->view->vlanInts = $object->getVlanInterfaces(); $this->view->type = $object->getType(); } }
public function getVlanInterfaces() { $this->__load(); return parent::getVlanInterfaces(); }
/** * Creates or updates virtual interface for port * * @param \Entities\VirtualInterface $virtInt VirtualInterface for add or load vlan interface * @param \Entities\Vlan $vlan Vlan for IP addresses and to assign vlan interface. * @param array $port Parsed port data from csv file * @param object $em Entity manager * @return void */ function createUpdateVlanInterface($virtInt, $vlan, $port, $em) { $ip4 = loadIPv4($port, $vlan, $em); if (!$ip4) { echo "ERROR: ip {$port['ipv4addr']} does not exist in Vlan {$vlan->getName()}"; return false; } $ip6 = createLoadIPv6($port, $vlan, $em); $vlInt = false; foreach ($virtInt->getVlanInterfaces() as $vint) { if ($vint->getIPv4Address() == $ip4) { $vlInt = $vint; break; } } if (!$vlInt) { $vlInt = new \Entities\VlanInterface(); $em->persist($vlInt); $vlInt->setVirtualInterface($virtInt); $virtInt->addVlanInterface($vlInt); $vlInt->setVlan($vlan); $vlan->addVlanInterface($vlInt); $vlInt->setIPv4Address($ip4); $vlInt->setIpv4enabled(1); $vlInt->setRsclient(0); $vlInt->setMaxbgpprefix(100); } $vlInt->setIpv4hostname($port['ipv4_ptr']); if ($port['ipv4_mcast']) { $vlInt->setMcastenabled(1); } else { $vlInt->setMcastenabled(0); } if ($ip6) { $vlInt->setIPv6Address($ip6); $vlInt->setIpv6enabled(1); $vlInt->setIpv6hostname($port['ipv6_ptr']); } else { $vlInt->setIPv6Address(null); $vlInt->setIpv6enabled(0); $vlInt->setIpv6hostname(null); } }