Commit 3c3f70c79b54f6cdedd9fec725701ac2b564b611

Authored by Eduardo Santos
1 parent e4ac1540
Exists in master and in 1 other branch 3.1

Adiciona mais uma possibilidade de identificar o MAC Address e a Máscara de rede

src/Cacic/CommonBundle/Entity/ComputadorColetaRepository.php
@@ -100,7 +100,7 @@ class ComputadorColetaRepository extends EntityRepository @@ -100,7 +100,7 @@ class ComputadorColetaRepository extends EntityRepository
100 { 100 {
101 $_dql = "SELECT c 101 $_dql = "SELECT c
102 FROM CacicCommonBundle:Classe c 102 FROM CacicCommonBundle:Classe c
103 - WHERE c.nmClassName NOT IN ('SoftwareList', 'Patrimonio') 103 + WHERE c.nmClassName NOT IN ('SoftwareList')
104 ORDER BY c.nmClassName"; 104 ORDER BY c.nmClassName";
105 105
106 $_dql = $this->getEntityManager()->createQuery( $_dql ); 106 $_dql = $this->getEntityManager()->createQuery( $_dql );
src/Cacic/WSBundle/Controller/ColetaController.php
@@ -58,10 +58,18 @@ class ColetaController extends Controller @@ -58,10 +58,18 @@ class ColetaController extends Controller
58 //$ultimo_login = TagValueHelper::getValueFromTags( 'UserName' , $strComputerSystem); 58 //$ultimo_login = TagValueHelper::getValueFromTags( 'UserName' , $strComputerSystem);
59 $grava_teste = ''; 59 $grava_teste = '';
60 60
  61 + // Caso não tenha encontrado, tenta pegar a variável da requisição
  62 + if (empty($te_node_address)) {
  63 + $te_node_adress = $request->get('te_node_address');
  64 + }
  65 +
61 //vefifica se existe SO coletado se não, insere novo SO 66 //vefifica se existe SO coletado se não, insere novo SO
62 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$te_so) ); 67 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$te_so) );
63 $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->findOneBy( array('idSo'=>$so, 'teNodeAddress'=>$te_node_adress) ); 68 $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->findOneBy( array('idSo'=>$so, 'teNodeAddress'=>$te_node_adress) );
64 $netmask = TagValueHelper::getValueFromTags( 'IPSubnet', $strNetworkAdapterConfiguration ); 69 $netmask = TagValueHelper::getValueFromTags( 'IPSubnet', $strNetworkAdapterConfiguration );
  70 + if (empty($netmask)) {
  71 + $netmask = $request->get('netmask');
  72 + }
65 $ip_computador = $request->get('te_ip_computador'); 73 $ip_computador = $request->get('te_ip_computador');
66 if ( empty($ip_computador) ){ 74 if ( empty($ip_computador) ){
67 $ip_computador = TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration ); 75 $ip_computador = TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration );
src/Cacic/WSBundle/Controller/DefaultController.php
@@ -96,6 +96,15 @@ class DefaultController extends Controller @@ -96,6 +96,15 @@ class DefaultController extends Controller
96 #$logger->debug("333333333333333333333333333333333333: $ip_computador"); 96 #$logger->debug("333333333333333333333333333333333333: $ip_computador");
97 $logger->debug("Teste de Conexão! Ip do computador: $ip_computador Máscara da rede: $netmask"); 97 $logger->debug("Teste de Conexão! Ip do computador: $ip_computador Máscara da rede: $netmask");
98 98
  99 + // Caso não tenha encontrado, tenta pegar a variável da requisição
  100 + if (empty($te_node_address)) {
  101 + $te_node_address = $request->get('te_node_address');
  102 + }
  103 +
  104 + if (empty($netmask)) {
  105 + $netmask = $request->get('netmask');
  106 + }
  107 +
99 //vefifica se existe SO coletado se não, insere novo SO 108 //vefifica se existe SO coletado se não, insere novo SO
100 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->createIfNotExist( $te_so ); 109 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->createIfNotExist( $te_so );
101 $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask ); 110 $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask );
@@ -181,6 +190,16 @@ class DefaultController extends Controller @@ -181,6 +190,16 @@ class DefaultController extends Controller
181 } 190 }
182 191
183 $te_node_adress = TagValueHelper::getValueFromTags( 'MACAddress', OldCacicHelper::deCrypt( $request, $request->get('NetworkAdapterConfiguration'))); 192 $te_node_adress = TagValueHelper::getValueFromTags( 'MACAddress', OldCacicHelper::deCrypt( $request, $request->get('NetworkAdapterConfiguration')));
  193 +
  194 + // Caso não tenha encontrado, tenta pegar a variável da requisição
  195 + if (empty($te_node_address)) {
  196 + $te_node_address = $request->get('te_node_address');
  197 + }
  198 +
  199 + if (empty($netmask)) {
  200 + $netmask = $request->get('netmask');
  201 + }
  202 +
184 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$request->get( 'te_so' ))); 203 $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$request->get( 'te_so' )));
185 $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask ); 204 $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask );
186 $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->getComputadorPreCole( $request, $request->get( 'te_so' ),$te_node_adress, $rede, $so, $ip_computador ); 205 $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->getComputadorPreCole( $request, $request->get( 'te_so' ),$te_node_adress, $rede, $so, $ip_computador );