Skip to content

Commit 5044f22

Browse files
authored
Add network type
1 parent 2d7551e commit 5044f22

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

inc/sccmxml.class.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,31 @@ function setUsers() {
323323
$USERS->addChild('LOGIN', $this->username);
324324
}
325325

326+
function determineNetworkType($network_description) {
327+
$description = strtolower($network_description);
328+
329+
$networkTypes = [
330+
'wifi' => ['wi-fi', 'wireless', 'wifi'],
331+
'infiniband' => ['infiniband'],
332+
'aggregate' => ['aggregation', 'aggregate'],
333+
'alias' => ['alias'],
334+
'dialup' => ['dialup', 'dial-up'],
335+
'loopback' => ['loop'],
336+
'bridge' => ['bridge'],
337+
'fibrechannel' => ['fibre', 'fiber'],
338+
'bluetooth' => ['bluetooth'],
339+
];
340+
341+
foreach ($networkTypes as $type => $keywords) {
342+
foreach ($keywords as $keyword) {
343+
if (str_contains($description, $keyword)) {
344+
return $type;
345+
}
346+
}
347+
}
348+
return "ethernet";
349+
}
350+
326351
function setNetworks() {
327352

328353
$PluginSccmSccm = new PluginSccmSccm();
@@ -354,6 +379,7 @@ function setNetworks() {
354379
$NETWORKS->addChild('IPDHCP', $value['ND-DHCPServer']);
355380
$NETWORKS->addChild('IPGATEWAY', $value['ND-IpGateway']);
356381
$NETWORKS->addChild('MACADDR', $value['ND-MacAddress']);
382+
$NETWORKS->addChild('TYPE', $this->determineNetworkType($value['ND-Name']));
357383

358384
$i++;
359385
}

0 commit comments

Comments
 (0)