Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Managing Custom Roles

 

These topics provide instructions to add custom roles, backup custom roles, and restore custom roles.

Adding Custom Roles

Follow these steps to add a custom overlay role to device(s) managed by Contrail Enterprise Multicloud (CEM).

  1. Run the following command from the server running the device manager container.
  2. Define the custom role object in predef_payloads.json.
  3. Define custom overlay roles.

    All roles are defined in the “data”->"object_type": "overlay-role", "objects": [ section. As an example, motd-test is defined as a custom overlay role.

  4. After the roles are defined, map the custom role to devices and underlay roles.

    All device profiles are listed in the “data”->"object_type": "node-profile" section. Custom roles are added in the node_profile_roles -> role_mappings section.

    As an example, add motd-test custom role to juniper-mx device that is already configured with leaf physical role.

  5. Edit the all.yml file.
  6. Create a directory, motd_test, and configure motd-test as leaf physical role in the feature_based_plugin_roles section of the all.yml file.

    The Jinja template for each custom role and underlay role is stored in this directory.

    Note

    The name of the directory is motd_test. The name of the custom role is motd-test.

  7. Add the motd_test directory to the configuration apply order in the feature_apply_order section.
  8. Add Jinja templates.

    The device configuration templates are located here:

    Create motd_test directory.

  9. Add custom role to a device.

    The configuration file name depends on the device type. In this example, the file name for the devices are as follows:

    • MX Series devices: juniper_junos_motd_test.j2

    • QFX Series devices: juniper_junos-qfx_motd_test.j2

    Create a configuration file, juniper_junos_motd_test.j2, to add a custom role for the MX series device.

  10. Configure the file using the set command.

    Using{{cfg_group}} allows you to separate custom group configuration from predefined CEM roles.

  11. Exit the container and then restart it.

    The new role is now seen in the Contrail Command user interface (UI). See Figure 1.

    Figure 1: motd-test Routing-Bridging Role
    motd-test Routing-Bridging Role
  12. (Optional) After applying the role, log in to the device and confirm that the configuration is applied.

Backup and Restore Custom Roles

These topics provide instructions to backup and restore custom roles.

Backup Custom Roles

Follow these steps to backup custom roles.

  1. Backup /opt/contrail/fabric_ansible_playbooks/conf/predef_payloads.json.
  2. Verify the overlay roles and node profiles.

    For example, when you back up custom roles during the upgrade process, the existing containers are removed and the custom roles are erased. You will not be able to restore these roles and configurations once it has been erased. Hence, ensure that you back up the correct file by verifying the roles and node profiles before the upgrade process.

  3. Backup all.yml.
  4. Verify the feature_based_plugin_roles and feature apply order sections.
  5. Backup custom roles.

    Ensure that you add --exclude before "overlay*" when you back up custom roles. If you do not add --exclude, both custom roles as well as predefined roles are backed up. This might cause any predefined roles that had bug fixes for the next release to be overwritten.

    For example, assume that there is a fix in the Jinja template for overlay_evpn predefined role for Contrail Networking Release 2005. When you upgrade Contrail Networking Release 2003 to Contrail Networking Release 2005, and subsequently use the backup file (that was backed up not using --exclude), all fixes related to predefined roles for Contrail Networking Release 2005 will be overwritten when you use the config template from the backup file.

Restore Custom Roles

Follow these steps to restore custom roles.

  1. Copy the new /opt/contrail/fabric_ansible_playbooks/conf/predef_payloads.json file.
  2. Verify overlay roles and node profiles.
    Note

    New roles might have been added when CEM was updated.

  3. Restore the predef_payloads.json changes.
    1. Open predef_payloads.json.
    2. Verify that all roles are defined in the “data”->"object_type": "overlay-role", "objects": [ section, and motd-test is defined as a custom overlay role.

      For more information, see the predef_payloads.json.bak file. For a file diff, refer to section two of the predef_payloads.json.bak file.

    3. Verify that the custom role is mapped to devices and underlay roles.

      All device profiles are listed in the “data”->"object_type": "node-profile" section. Custom roles are added in the node_profile_roles -> role_mappings section.

      As an example, add motd-test custom role to juniper-mx device that is already configured with leaf physical role.

  4. Backup all.yml.
  5. Verify changes in feature_based_plugin_roles and feature apply order.
    Note

    New roles might have been added when CEM was updated.

  6. Restore all.yml.

    For more information, see the all.yml.bak file. For a file diff, refer to section five of the all.yml.bak file.

    1. Open all.yml.
    2. Verity that feature_based_plugin_roles has all roles and role mappings. Ensure that motd-test role is also added.
    3. Verify that the feature_apply_order describes the order of templates that are applied on devices. Ensure that motd_test is also added.
  7. Restore custom roles Jinja templates.
  8. Restart the container and verify roles.