/**
  * Import CONNECTION
  *@param $p_connection CONNECTION code to import
  *@param $p_oPort Port object to connect
  *@param $p_cdp CDP value (1 or <>1)
  *@return errors string to be alimented if import ko / '' if ok
  **/
 function importConnection($p_connection, $p_oPort, $p_cdp)
 {
     global $LANG;
     $this->addLog('Function importConnection().');
     $errors = '';
     $portID = '';
     $mac = '';
     $ip = '';
     $ptsnmp = new PluginFusioninventorySNMP();
     if ($p_cdp == 1) {
         $ifdescr = '';
         foreach ($p_connection->children() as $name => $child) {
             switch ($child->getName()) {
                 case 'IP':
                     $ip = $child;
                     $p_oPort->addIp($ip);
                     break;
                 case 'IFDESCR':
                     $ifdescr = $child;
                     break;
                 default:
                     $errors .= $LANG['plugin_fusioninventory']["errors"][22] . ' CONNECTION (CDP=' . $p_cdp . ') : ' . $child->getName() . "\n";
             }
         }
         $portID = $ptsnmp->getPortIDfromDeviceIP($ip, $ifdescr);
     } else {
         foreach ($p_connection->children() as $name => $child) {
             switch ($child->getName()) {
                 case 'MAC':
                     $mac = $child;
                     $portID = $ptsnmp->getPortIDfromDeviceMAC($child, $p_oPort->getValue('ID'));
                     $p_oPort->addMac($mac);
                     break;
                 case 'IP':
                     //TODO : si ip ajouter une tache de decouverte sur l'ip pour recup autre info // utile seulement si mac inconnu dans glpi
                     $ip = $child;
                     $p_oPort->addIp($ip);
                     break;
                 default:
                     $errors .= $LANG['plugin_fusioninventory']["errors"][22] . ' CONNECTION (CDP=' . $p_cdp . ') : ' . $child->getName() . "\n";
             }
         }
     }
     if ($portID != '') {
         $p_oPort->addConnection($portID);
         if ($ip != '') {
             $p_oPort->setValue('ifaddr', $ip);
         }
     } else {
         $p_oPort->addUnknownConnection($mac, $ip);
         //TODO : si ip ajouter une tache de decouverte sur l'ip pour recup autre info
     }
     return $errors;
 }