|
|
@ -1,7 +1,23 @@ |
|
|
|
|
|
|
|
import { sub } from '../../accessModule'; |
|
|
|
|
|
|
|
|
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
|
|
|
|
|
|
|
|
export const getNetworkInterface = buildGetRequestHandler( |
|
|
|
export const getNetworkInterface = buildGetRequestHandler( |
|
|
|
(request, buildQueryOptions) => { |
|
|
|
(request, buildQueryOptions) => { |
|
|
|
|
|
|
|
let localHostUUID: string; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
localHostUUID = sub('host_uuid', { |
|
|
|
|
|
|
|
subModuleName: 'Get', |
|
|
|
|
|
|
|
}).stdout; |
|
|
|
|
|
|
|
} catch (subError) { |
|
|
|
|
|
|
|
console.log(`Failed to get local host UUID; CAUSE: ${subError}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw subError; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(`localHostUUID=[${localHostUUID}]`); |
|
|
|
|
|
|
|
|
|
|
|
if (buildQueryOptions) { |
|
|
|
if (buildQueryOptions) { |
|
|
|
buildQueryOptions.afterQueryReturn = (queryStdout) => { |
|
|
|
buildQueryOptions.afterQueryReturn = (queryStdout) => { |
|
|
|
let result = queryStdout; |
|
|
|
let result = queryStdout; |
|
|
@ -35,9 +51,16 @@ export const getNetworkInterface = buildGetRequestHandler( |
|
|
|
network_interface_uuid, |
|
|
|
network_interface_uuid, |
|
|
|
network_interface_mac_address, |
|
|
|
network_interface_mac_address, |
|
|
|
network_interface_name, |
|
|
|
network_interface_name, |
|
|
|
network_interface_operational, |
|
|
|
CASE |
|
|
|
|
|
|
|
WHEN network_interface_link_state = '1' |
|
|
|
|
|
|
|
AND network_interface_operational = 'up' |
|
|
|
|
|
|
|
THEN 'up' |
|
|
|
|
|
|
|
ELSE 'down' |
|
|
|
|
|
|
|
END AS network_interface_state, |
|
|
|
network_interface_speed, |
|
|
|
network_interface_speed, |
|
|
|
ROW_NUMBER() OVER(ORDER BY modified_date ASC) AS network_interface_order |
|
|
|
ROW_NUMBER() OVER(ORDER BY modified_date ASC) AS network_interface_order |
|
|
|
FROM network_interfaces;`;
|
|
|
|
FROM network_interfaces |
|
|
|
|
|
|
|
WHERE network_interface_operational != 'DELETE' |
|
|
|
|
|
|
|
AND network_interface_host_uuid = '${localHostUUID}';`;
|
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|