How To Send DGX Shell Commands From NetLinx Code
Question:
How To Send DGX Shell Commands From NetLinx Code?
Answer:
This is a working example of DGX shell commands from Netlinx code. The attached code shows connection to a DGX-3200. It can be adapted for all size frames. In this example, you can reboot whole cards, single ports and cycle POE to DXLink endpoints.
This code consists of an example main source code file, and an example touch panel file. In this code at line 490, is an example of being able to do something based on something else happening. In this case, if the switcher (device 5002) goes offline and comes back online, we can reset a card(s). We are also reporting times and dates for when this happens to a touch panel page, which can be checked to see if/when this happened. You can write code to send an email, SNMP, etc.
This code must run in the DGX. 198.18.128.1 is the IP address of the DGX shell.
Here is what is needed to open a connection and send shell commands:
IP_CLIENT_OPEN(dvPORTREBOOT.PORT,'198.18.128.1',23,1) // Opens connection
WAIT 1 'OPEN WAIT' // Needed timing
{
SEND_STRING dvPORTREBOOT,"13,10" // Send carriage return line feed
WAIT 10
{
SEND_STRING dvPORTREBOOT,"'su enova 12amx34',13,10" // User/Password
WAIT 8
{
//******* Do something here, for example:
SEND_STRING dvPORTREBOOT,"'power OFF i9;sleep 1000;power ON i9’,13,10"
}
}
}To reboot a port on a card:
SEND_STRING dvPORTREBOOT,"'reboot -iu6 BCPU1:0’,13,10"
BCPU1 is the first slot in a DGX Frame. The :0 is the first port on the card. For example:
BCPU1:0 = card in first slot, first port on card
BCPU1:1 = card in first slot, second port on card
BCPU1:2 = card in first slot, third port on card
BCPU1:3 = card in first slot, fourth port on card
BCPU2:0 = card in second slot, first port on card
BCPU2:1 = card in second slot, second port on card
BCPU2:2 = card in second slot, third port on card
BCPU2:3 = card in second slot, fourth port on cardETC.
To recycle POE to a DXLink port (this will mimic unplugging the DXLink for a hard power cycle):
SEND_STRING dvPORTREBOOT,"'power OFF i9;sleep 1000;power ON i9’,13,10"
i1 = input 1
i2 = input 2
i3 = input 3
i4 = input 4
o1 = output 1
o2 = output 2
o3 = output 3
o4 = output 4ETC.
To reboot a card:
SEND_STRING dvPORTREBOOT,"'reboot -if BCPU1’,13,10"
BCPU1 = Card slot one
BCPU2 = Card slot twoETC.