Staging a Switch for Automated Deployment in AmpCon


Staging a switch in AmpCon consists of seven steps. Steps 1 to 3 are executed only once, while Steps 4, 6 and 7 are repeated for every switch:

  1. Setup the PICOS image for a specific switch model
  2. Setup Global and Security configurations
  3. Upload switch model-specific template
  4. Generate the switch config
  5. Verify the switch config manually one time for each switch model
  6. Stage the switch in AmpCon for automated deployment
  7. Verify successful deployment of the PICOS switch

How to setup PICOS image for a specific switch model

Select the Settings > Add Switch Model menu, select your switch Model name from the drop down list, and enter the values of the port range specific to your switch model. Select the uploaded images for “Deployed image path” & “Installing ONIE *.bin file” in dropdowns. And MD5 file will automatically change according to the selected image if it has been uploaded in Settings > Image Management.

For details about how to use "Image Management" function to upload images and MD5 file, see the page Image Management

For the dropdown list of images:

1.        It supports to search in the list.

2.        It supports to filter the image dropdown list according to the model name.

The image dropdown list will be changed if user select a different model in form.

For example, if user change the model select value from “as4610_54pto “as5812_54x”, then the image dropdown list will only show images with platform “x86” and “other”.


After the image is selected, then click Save as shown below:

By default Deployed Image is same as Installing ONIE image. If you want to use a PICOS major release image for ONIE install and minor release image for an upgrade you can do so by uploading major release image in Installing ONIE *.bin file field and uploading the upgrade image in Deployed image path. It will use one image for ONIE installation and other image for upgrade.

Setting up Global and Security Configurations

In this step, we will setup PICOS configuration commands that are common among your entire population of switches. This does not interface-specific configuration commands. We will show how to generate the interface-specific configuration commands via Templates in the next section.
How to set Global and Security configurations:

  1. Select the Deployment>Global Configuration menu, enter the value for the Global Config Name, then select your Switch Model from the drop down list (shown below).
  2. Create a text file called GlobalConfig.txt and add PICOS configuration commands in the set command format that are common among all your PICOS switches. Click the Choose File button in the Generic Global File field and upload the newly created GlobalConfig.txt file.
  3. Create a text file called SecurityGlobalFile.txt and add PICOS Security-related configuration commands in the set command format that are common among all your PICOS switches. Click the Choose File button in Security Global File field and upload the newly created SecurityGlobalFile.txt file.
  4. Click Generate and then review the configuration. This includes both Global and Security PICOS configuration commands that are common among all the switches.
  5. Click Save.

How to Upload a Switch Model-Specific Template


Switch-specific templates are used for three primary purposes:

  1. To generate interface-specific configuration commands. PICOS does not have an interface range command, so the templates work well to generate any interface-related configuration programmatically.
  2. To customize switch-specific variables like hostname, management IP and VLANs. The GUI allows the AmpCon operator to enter these values that are specific to any particular switch.
  3. To generate switch-specific configurations.

To upload a switch model-specific template, Select Config/Templates>Template List menu, click Upload Template, enter the Name for the Template, click the Choose File button, upload the switch model-specific Template from your computer, and then click Upload as shown below.

Pre-built Internal Template

By default, it will not show the pre-built internal template in the Template List.

User can enable “Show Internal Template” to check the pre-built internal templates.

The pre-built templates will have a badge “Internal” after the template name.

For pre-build internal template, we support the operations: “View Template”, “Copy” and “Export”.

Users can update the latest pre-installed templates from Gitlab by clicking the button “Update Internal Template”. (Github URL: https://github.com/pica8/Jinja_Templates/tree/main/configuration_templates/default_prebuilt_template)

Generating a Switch Configuration

In this step, we will generate complete PICOS switch-configuration commands. These configuration commands include global, security and switch-specific configuration commands.
For this step you need to have switch Serial Number handy. You can get the serial number from any one of the following: the switch chassis itself, purchase records, your equipment sales partner, or from the output of the PICOS command: show system hwinfo.
To generate a switch-specific configuration, Select the Deployment>Switch Configuration menu, enter a value for Switch SN, enter Management IP, select Hardware Model, enter values for Deployment Location, and then select Global Config for your switch model from the pull-down menu. Select Site Template from the pull down menu for entering customized switch-specific input parameters, click Next, enter values for switch specific parameters shown below, then click Save.

Note:

If VPN is disabled, users need to specify the management IP address when generating a switch configuration. The setting of VPN enable/disable is configured in setup script. For details about setup script, please see AmpCon Installation Guide.

Perform a final review of the entire config generated for the switch, then click Save as shown below.

AmpCon supports to generate a switch configuration from multiple site templates.

As shown in the following figure, users can also customize each site template name displayed on the GUI, by edit the JSON file /template_form_format.json (/usr/share/automation/server/template_form_format.json).

The method is: uncomment the code in the JSON file and save it to make the customized name work. Then refresh the web page, the setting will be updated on the GUI.

Note:

You can change the name values in the JSON file to customize the site template names.

Verify the AmpCon-Generated Switch Config Manually One Time for Each Switch Model


The generated switch configuration in the above section may have a syntax error. If it does, AmpCon will fail to deploy the switch if there are any configuration related errors caused by configuration command syntax errors or a configuration command commit failure. Hence is it important to manually test the configuration generated by AmpCon one time for each switch model before deploying other switches of the same model using AmpCon. The following steps will verify the AmpCon-generated switch configuration commands manually on the switch.

  1. Select the Deployment > Switch List menu, select the switch that we generated the configuration for in the above section. Click Display > Init Deploy Config, copy the generated config.
  2. SSH into the switch that you want to verify and paste the config copied in the previous step to the configuration CLI prompt and then enter the command Commit.
  3. If there are no failures, then verification of the AmpCon generated switch config is complete. If you see failures, then failed config commands need to corrected in one of the following files: Generic Global file, Security Global file, and Site Template file.

Building Configuration Automatically for a Group of Switches

JSON File Introduction

JSON (JavaScript Object Notation) is a lightweight data-interchange format that can be edited as text. It can be used for generating configuration for a group of switches with the file suffix “.json”.

The template of JSON file is shown below:

{
    "sn": ["TEST-SN-1", "TEST-SN-2"],
    "hardware_model": "as4610_54p",
    "location": "Beijing",
    "global_config_name": "test_global_config_name",
    "site_template_name": ["test_template_name"],
    "agent_config":{
        "enable": true,
        "vpn_enable": true,
        "server_domain": "pica8.com",
        "inband_native_vlan": "4094",
        "server_vpn_host": "vpn.pica8.com",
        "inband_vlan": "4094",
        "server_hostname_prefix": "ac",
        "inband_lacp": true,
        "uplink_ports": "te-1/1/49,te-1/1/50",
        "uplink_speed": "1000"
    },
    "vpn": true,
    "retrieve_config": true,
    "default_config_param": {
       "test_template_name": {
         "vlan_id": 100
        }
    },
    "unique_config_param":{
        "TEST-SN-2":{
          "test_template_name": {
            "vlan_id": 200
            }
        }
    }
}

The configuration parameters in the template correspond to the configuration parameters in the “Switch Full Config Edit” interface,

  • “agent_config”, “vpn” and “retrieve_config” are optional.
  • "default_config_param" is used to specify configurations that are common to multiple devices of the same platform type, while "unique_config_param" is used to specify configurations that are unique to a particular device.

For example, the JSON file shown below defines the configuration of two AS4610_54P platform devices.

{
    "sn": ["TEST-SN-1", "TEST-SN-2"],
    "hardware_model": "as4610_54p",
    "location": "Beijing",
    "global_config_name": "2020-11-24-glob-as4610_54p-V1",
    "site_template_name": ["as4610_54p-Nov20"],
    "agent_config": {
    },
    "default_config_param": {
       "as4610_54p-Nov20": {         
            "VLAN_id": 100,
            "VLAN_name": "vlan_100"
        }
    },
    "unique_config_param": {
        "TEST-SN-2": {
          "as4610_54p-Nov20": {
            "VLAN_ID": 200
            }
        }        
    }
}

Pay attention to the following points when configuring the JSON file:

  • “global_ config_ name” and “site_ template_ "Name" already exist on AmpCon server.
  • When configuring “default_config_param” and “unique_config_param”, use the template parameters defined in the specified “site_template_name”.
  • The switch configuration will use the settings defined in “default_config_param” if its sn number is not in “unique_config_param”.
  • Parameters specific to a certain platform are placed under the “unique_config_param” and are used along with the “default_config_param” as long as it’s the same platform. (For example, in the above picture, the “TEST-SN-2” switch will use {“vlan_id”: 200, “vlan_name”: “vlan_100”} as the parameters to generate config.)

Upload a JSON File

Upload the JSON file by following the steps below after creating it locally and finishing all the settings for a group of switches in the JSON file:

Step 1       Select Deployment > Switch Configuration.

Step 2       In the pop-up "Upload by JSON" box, select the JSON file to be uploaded, then click the “Upload” button to complete JSON file import.

Step 3       You can find the corresponding switch and its configurations in path Lifecycle > Deployed Switch List, after successfully uploading the JSON file, as shown in the following figure:

To review the entire config generated for the switch, click “Config” button in “Operation” column.

Staging the Switch in AmpCon for Automated Deployment


Select the Deployment>Switch List menu, then click the Stage button to deploy the specific switch as shown below.

The switch's deployment status will then be shown as Staged.

NOTE:

Deploying PICOS on a bare-metal switch can take up to 15 minutes. Do not log into the switch CLI during this time as it will interfere with Automated deployment and lead to a switch deployment failure. When the switch is fully deployed you will see the following message on the switch console: This switch has been already deployed, agent will quit. You can log into switch CLI after 15 minutes.

Verify the Successful Deployment of PICOS Switch

After a successful automated deployment of a PICOS switch with a PICOS image, configuration and license, you can verify the deployment using the following steps:

  1. Check the switch console. You should see the following message: 020-07-09 10:53:09,463 Auto-deploy WARNING : This switch has been already deployed, agent will quit
  2. Check the switch deployment status in the AmpCon GUI:

Select the Deployment>Switch List menu and check the deployed switch deployment Status as shown below.

3. Check the deployed configuration of the switch as follows: Click Display, select Display Current Config, and select Show SET-format.

4. Click the Log icon to see the logs for automated switch deployment.





Copyright © 2024 Pica8 Inc. All Rights Reserved.