/** * Updates vlan interface * * Script looks for vlan interface by IPv4 or IPv6 found in parsed data from CFG file. * If vlan interface is founded then its rsclient field is set to true. If $row[4] is set * then maxbgprefix field is set to $row[4] value. * * @param array $row Data row parsed form cfg file. * @param \Entities\Vlan $vlan Vlan for IP addresses and vlan interface search * @param object $em Entity manager * @return */ function updateVlanInterface($row, $vlan, $em) { if (strpos($row[0], ":")) { $ip4 = false; } elseif (strpos($row[0], ".")) { $ip4 = true; } else { return false; } $vlInt = false; if ($ip4) { $ip = $em->getRepository("\\Entities\\IPv4Address")->findOneBy(['Vlan' => $vlan->getId(), 'address' => $row[0]]); if ($ip) { $vlInt = $em->getRepository("\\Entities\\VlanInterface")->findOneBy(['Vlan' => $vlan->getId(), 'IPv4Address' => $ip]); } } else { $ip = $em->getRepository("\\Entities\\IPv6Address")->findOneBy(['Vlan' => $vlan->getId(), 'address' => strtolower($row[0])]); if ($ip) { $vlInt = $em->getRepository("\\Entities\\VlanInterface")->findOneBy(['Vlan' => $vlan->getId(), 'IPv6Address' => $ip]); } } if ($vlInt) { $vlInt->setRsclient(1); if (isset($row[4])) { $vlInt->setMaxbgpprefix($row[4]); } return true; } else { return false; } }
/** * * @param IXP_Form $form The form object * @param \Entities\Vlan $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->setInfrastructure($this->getD2EM()->getRepository('\\Entities\\Infrastructure')->find($form->getElement('infrastructure')->getValue())); return true; }
/** * Creates or loads IPv6Address * * @param array $port Parsed port data from csv file * @param \Entities\Vlan $vlan Vlan to assing or load ip address * @param object $em Entity manager * @return \Entities\IPv6Address */ function createLoadIPv6($port, $vlan, $em) { $ip6 = false; if ($port['ipv6addr']) { foreach ($vlan->getIPv6Addresses() as $ip) { if ($ip->getAddress() == $port['ipv6addr']) { $ip6 = $ip; break; } } if (!$ip6) { $ip6 = new \Entities\IPv6Address(); $em->persist($ip6); $ip6->setAddress($port['ipv6addr']); $ip6->setVlan($vlan); $vlan->addIPv6Addresses($ip6); } } return $ip6; }
public function getPeeringManager() { $this->__load(); return parent::getPeeringManager(); }