In this section we’ll provide a few handy examples of common driver operations.
The intention is to grow this into a good source to copy paste common code from.
All of the examples will be available in the
DevGuide Examples repository
under the common_driver_recipes folder.
Decrypting a password attribute
The password for logging into the device/app will be passed as an encrypted value to the driver
as a part of the context object. In order to be able to use it to log in you’ll most likely
need to decrypt it. To do that, you can use the CloudShellAPI function DecryptPassword.
The resource live status can be used to indicate the current state of the resource on the diagram.
CloudShell comes with a pre-built collection of statuses you can use, and this collection of icons can also
be extended if needed.
The following code will update the resource live status from offline to online:
The full list of statuses can be found in the ServerUniversalSettings.xml file which you can find on the Quali Server
machine under the %programdata%\QualiSystems\Settings\Global directory:
Sending a message to the sandbox console
Another way to update the sandbox regarding an operation progress is to use the WriteMessageToReservationOutput
function to display a message in the Sandbox console pane.
We can easily modify the previous code to do that instead:
When adding a new command that requires communication with a networking device, such as a switch or router, you need to open a session to the device. An easy way to do that is by leveraging Quali’s shell framework (cloudshell-cli package). The framework can provide a session from a session pool via Telnet, SSH or TCP, based on the configuration saved in the CLI Connection Type attribute on the root resource.
CloudShell 8.3 allows developers to map connections between sub-resources residing on deployed Apps. This applies to scenarios where you want to map the port connections between virtual devices residing in App VMs. For example, to map the connection between port 1 residing on a virtual switch and port 2 residing on another virtual switch. For details, see Mapping Connections using App Sub-resources.