private function getListMemberInfo()
 {
     $memberinfo = array();
     $customers = OSS_Array::reindexObjects(OSS_Array::reorderObjects($this->getD2R('\\Entities\\Customer')->getConnected(false, false, true), 'getAutsys', SORT_NUMERIC), 'getId');
     foreach ($customers as $c) {
         $ixp = $this->getD2R('\\Entities\\IXP')->getDefault();
         $conn = array();
         $connlist = array();
         foreach ($c->getVirtualInterfaces() as $vi) {
             $iflist = array();
             foreach ($vi->getPhysicalInterfaces() as $pi) {
                 if ($pi->getStatus() == \Entities\PhysicalInterface::STATUS_CONNECTED) {
                     $iflist[] = array('switch_id' => $pi->getSwitchPort()->getSwitcher()->getID(), 'if_speed' => $pi->getSpeed());
                 }
             }
             $vlanentry = array();
             foreach ($vi->getVlanInterfaces() as $vli) {
                 $vlanentry['vlan_id'] = $vli->getVlan()->getId();
                 if ($vli->getIpv4enabled()) {
                     $vlanentry['ipv4']['address'] = $vli->getIPv4Address()->getAddress();
                     $vlanentry['ipv4']['routeserver'] = $vli->getRsclient();
                     $vlanentry['ipv4']['max_prefix'] = $vi->getCustomer()->getMaxprefixes();
                     $vlanentry['ipv4']['as_macro'] = $vi->getCustomer()->resolveAsMacro(4, "AS");
                 }
                 if ($vli->getIpv6enabled()) {
                     $vlanentry['ipv6']['address'] = $vli->getIPv6Address()->getAddress();
                     $vlanentry['ipv6']['routeserver'] = $vli->getRsclient();
                     $vlanentry['ipv6']['max_prefix'] = $vi->getCustomer()->getMaxprefixes();
                     $vlanentry['ipv6']['as_macro'] = $vi->getCustomer()->resolveAsMacro(6, "AS");
                 }
             }
             $conn = array();
             $conn['state'] = 'active';
             $conn['if_list'] = $iflist;
             $conn['vlan_list'][] = $vlanentry;
             $connlist[] = $conn;
         }
         $memberinfo[] = ['asnum' => $c->getAutsys(), 'name' => $c->getName(), 'url' => $c->getCorpwww(), 'contact_email' => array($c->getPeeringemail()), 'contact_phone' => array($c->getNocphone()), 'contact_hours' => $c->getNochours(), 'peering_policy' => $c->getPeeringpolicy(), 'peering_policy_url' => $c->getNocwww(), 'member_since' => $c->getDatejoin()->format('Y-m-d') . 'T00:00:00Z', 'connection_list' => $connlist];
     }
     return $memberinfo;
 }
Example #2
0
 /**
  * @see https://github.com/inex/IXP-Manager/wiki/RIR-Objects
  * @throws Zend_Controller_Action_Exception
  */
 public function updateObjectAction()
 {
     if (!($tmpl = $this->getParam('tmpl', false))) {
         throw new Zend_Controller_Action_Exception('You must specify a RIR template to update', 412);
     }
     // sanitise template name
     $tmpl = preg_replace('/[^\\da-z_\\-]/i', '', $tmpl);
     if (!$this->view->templateExists('rir/tmpl/' . $tmpl . '.tpl')) {
         throw new Zend_Controller_Action_Exception('The specified RIR template does not exist', 412);
     }
     $email = $this->getParam('email', false);
     // populate the template variables
     $this->view->customers = $customers = OSS_Array::reindexObjects(OSS_Array::reorderObjects($this->getD2R('\\Entities\\Customer')->getConnected(false, false, true), 'getAutsys', SORT_NUMERIC), 'getId');
     $this->view->asns = $this->generateASNs($customers);
     $this->view->rsclients = $this->generateRouteServerClientDetails($customers);
     $this->view->protocols = [4, 6];
     $content = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $this->view->render('rir/tmpl/' . $tmpl . '.tpl'));
     if ($email) {
         $this->emailRIR($tmpl, $content, $email, $this->getParam('force', false));
     } else {
         echo $content;
     }
 }