Layer 1 Switch Shell Standard
In this guide, we will guide you on how to create your L1 switch shell, implement its automation commands, test and use it in CloudShell.
In this guide:
- Creating a new shell and installing the shell's environment
- Implementing the shell in CloudShell
- Testing the shell in CloudShell
- Building and installing the shell's package on CloudShell
Creating a new shell and installing the shell's environment
Start a new project with shellfoundry. We recommend to do that in CloudShell's Drivers folder (usually at C:\Program Files (x86)\QualiSystems\CloudShell\Server\Drivers on the Quali Server machine):
shellfoundry new ShellName --template layer-1-switch
To install the shell's environment and dependencies defined in the shell's requirements.txt file, in command-line, navigate to the shell's root folder and run the appropriate command:
If you're using Quali's default python interpreter, which resides at ~\QualiSystems\CloudShell\Server\python, run the following:
If you want to use a different python interpreter, do the following:
Install the virtualenv package by running:
<interpreter-path>\python.exe -m pip install virtualenvusing your python interpreter
And then run:
The shell is installed on CloudShell.
- To verify, return to the \Drivers folder at ~\QualiSystems\CloudShell\Server\Drivers, and run the new shell exe file.
A command-line output similar to this should be displayed:
Starting driver shellname ""C:\Program Files (x86)\QualiSystems\CloudShell\Server\Drivers\cloudshell-L1-sh ellname\Scripts\python.exe" "C:\Program Files (x86)\QualiSystems\CloudShell\Serv er\Drivers\cloudshell-L1-shellname\main.py" 4000 "C:\Program Files (x86)\QualiSy stems\CloudShell\Server\Drivers\..\Logs"" Listen address 0.0.0.0:4000
Implementing the shell in CloudShell
Now that you have a new shell, it is time to implement the shell's commands. Note that at this point, the L1 shell includes the command structure but no working commands.
Implement methods of the DriverCommands class in <project_slug>/driver_commands.py.
Testing the shell in CloudShell
Do the following in Resource Manager Client.
Import the new data model.
- In the Resource Families explorer, right-click Resource Families and selct Import.
- In the driver package's datamodel folder, select the ResourceConfiguration.xml file (for example shellname_ResourceConfiguration.xml) and click Open.
Create an L1 resource.
- In Resource Explorer, right click Root and create a new resource.
- Give it a Name, and the device's Address.
- Select the L1 Switch Family and make sure the correct Model and Driver are selected.
- Click OK.
Follow this guide to set the timeout period (for L1 shell drivers in CloudShell), autoload and configure your L1 resource's physical connections.
Autoload and any other commands executed on the L1 resource are logged at ~\QualiSystems\CloudShell\Server\Logs.
- After validating Autoload, you can validate the mapping functions either in Resource Manager Client (in the L1 resource's Settings>Mappings page, or in CloudShell Portal, by creating a blueprint with 2 resources and a route, then reserving this blueprint and connecting the route.
Building and installing the shell's package on CloudShell
Once you’ve finished implementing and testing the shell, it’s time to create the shell package and install it in your CloudShell production environment. Note that you can skip this stage altogether if you developed your shell in the production environment.
From the shell's root folder, run the following command:
The L1 shell package is created in the shell project's dist folder, bearing the shell's name and version.
For example: dist\cloudshell-L1-DriverName-1.0.1.zip
In the dist folder, extract the shell package.
Open the extracted folder and copy the shell folder to the \Drivers folder at C:\Program Files (x86)\QualiSystems\CloudShell\Server\Drivers.
Install the shell's environment and dependencies, as explained in step 2 in section Creating a new driver and installing the driver's environment.
Install the shell on CloudShell, as explained in steps 1-3 in section Testing the driver in CloudShell.