Example demonstrating how to use the NI System Configuration API to automate the deployment of an NI Real-Time system through the command line.
- NI System Configuration
- Open
src/nirtconfig.c
in Visual Studio Code - Run the command
Tasks: Configure Default Build Task
and selectC/C++: g++ build active file
which is the task defined in.vscode/tasks.json
- Run the command
Tasks: Run Build Task
to build the nirtconfig executable into the build folder
Command: find
Description: Finds all available hardware on the network and reports back the hostname, IP address, model, and serial number of each target.
Example
> nirtconfig find
Finding Available Targets...
HOSTNAME IP ADDR MODEL SERIAL NUMBER
NI-cDAQ-9134-01A044B2 10.1.128.222 cDAQ-9134 01A044B2
NI-cRIO-9030-01A0CF0D 10.1.128.52 cRIO-9030 01A0CF0D
NI-PXIe-8880-03182D37 10.1.128.113 PXIe-8880 03182D37
NI-PXIe8840-2F215A8E 10.1.128.48 PXIe-8840 2F215A8E
Relevant Function Calls
Implemented: nirtconfig_findAllTargets
Command: find [TARGET_NAME]
Description: Discover Real-Time system on the network from an IP address or hostname and reports back the hostname, IP address, model, and serial number.
Example
> nirtconfig find 10.1.128.113
HOSTNAME IP ADDR MODEL SERIAL NUMBER
NI-PXIe-8880-03182D37 10.1.128.113 PXIe-8880 03182D37
Relevant Function Calls
Implemented: nirtconfig_findSingleTarget
Command: findsn [SERIAL_NUMBER]
Description: Discover Real-Time system on the network corresponding to some serial number. Call returns the IP address of that target.
Example
> nirtconfig findsn 03182D37
10.1.128.113
Relevant Function Calls
Implemented: nirtconfig_ipFromSerialNumber
Command: format <TARGET_NAME>
Description: Formats the system identified by the TARGET_NAME parameter.
Example
> nirtconfig format 10.1.128.42
Formatting...
Relevant Function Calls
Implemented: nirtconfig_format
Command: setimage [TARGET_NAME] [IMAGE_PATH]
Description: Sets the system image located at IMAGE_PATH to designated TARGET_NAME.
Example
> nirtconfig setimage 10.1.128.131 "/home/mjacobson/Desktop/NI-PXIe-8861-BenJ"
Imaging Target: 10.1.128.131
Image Used: /home/mjacobson/Desktop/NI-PXIe-8861-BenJ
Relevant Function Calls
Implemented: nirtconfig_setImage
Command: getimage [TARGET_NAME]
Description: Gets the system image of TARGET_NAME and saves it to the present working directory. The hostname of the system will be used as the image folder's name.
Example
> nirtconfig getimage 10.1.128.131
Getting Image: 10.1.128.131
Saving To: "/home/mjacobson/Desktop/NI-PXIe-8861-BenJ"
Relevant Function Calls
Implemented: nirtconfig_getImage
Command: updatefirmware [TARGET_NAME] [FIRMWARE_PATH] [-u USERNAME] [-p PASSWORD]
Description: Updates firmware of TARGET_NAME with firmware located at FIRMWARE_PATH. Use the -u and -p flags to pass the username and password into the function call.
Example
> nirtconfig updatefirmware 10.1.128.42 "/home/mjacobson/Desktop/cRIO-9058_8.5.0.cfg" -u admin -p hunter2
Updating Firmware...
Target: 10.1.128.42
Firmware: /home/mjacobson/Desktop/SCM/NISystemConfigurationCLI/build/firmware/cRIO-9058_8.5.0.cfg
Relevant Function Calls
Implemented: nirtconfig_updateFirmware
Command: selftest [TARGET_NAME]
Description: Self tests all hardware in TARGET_NAME. Prints the pass/fail results of every module.
Example
> nirtconfig selftest 10.1.128.42
Running Self Tests...
RESOURCE NAME PRODUCT NAME PASS/FAIL DETAILED RESULTS
cRIO1 NI cRIO-9058 Pass
Mod1 NI 9871 Not Supported
Mod2 NI 9237 Pass
Mod3 NI 9205 Pass
Relevant Function Calls
Implemented: nirtconfig_selfTest
Command: sethostname [TARGET_NAME] [NEW_TARGET_NAME]
Description: Sets the hostname of TARGET_NAME to NEW_TARGET_NAME.
Example
> nirtconfig sethostname 10.1.128.131 Lab1-HIL1-8861
Updating Hostname of 10.1.128.131 to Lab1-HIL1-8861
Relevant Function Calls
- NISysCfgSetSystemProperty
- NISysCfgSystemPropertyHostname
- NISysCfgSaveSystemChanges
Implemented: nirtconfig_setHostname
Command: setip [TARGET_NAME] [NEW_IP_ADDRESS]
Description: Sets the IP address of TARGET_NAME to NEW_IP_ADDRESS.
Example
> nirtconfig setip 10.1.128.42 10.1.128.43
Updating IP Address of 10.1.128.42 to 10.1.128.43
Relevant Function Calls
- NISysCfgSetSystemProperty
- NISysCfgSystemPropertyIpAddress
- NISysCfgSystemPropertyIpAddressMode
- NISysCfgSaveSystemChanges
Implemented: nirtconfig_setIpAddress
Command: restart [TARGET_NAME]
Description: Restarts system identified by TARGET_NAME.
Example
> /nirtconfig restart 10.1.128.131
Restarting...
Restarted With IP Address: 10.1.128.131
Relevant Function Calls
Implemented: nirtconfig_restartTarget
Command: setmode [TARGET_NAME] [scan|fpga|daq]
Description: Sets the programming mode of every module in TARGET_NAME to scan engine (scan), real-time (daq), or FPGA (fpga).
Example
> nirtconfig setmode 10.1.128.42 fpga
Setting Module Mode: Mod1 (NI 9871)
Setting Module Mode: Mod2 (NI 9237)
Setting Module Mode: Mod3 (NI 9205)
Relevant Function Calls
- NISysCfgSetSystemProperty
- NISysCfgResourcePropertyModuleProgramMode
- NISysCfgSaveSystemChanges
Implemented: nirtconfig_setModuleMode
Command: setalias [TARGETNAME] [SLOT] [NEW_ALIAS]
Description: Changes the alias of the resouce in slot number SLOT to NEW_ALIAS.
Example
> nirtconfig setalias 10.1.128.131 5 serialModule
Relevant Function Calls
Implemented: nirtconfig_setAlias