Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

Using Server Manager to Automate Provisioning

Overview of Server Manager

The Contrail Server Manager can be used to provision, configure, and reimage a Contrail virtual network system of servers, clusters, and nodes. Server Manager is an alternative to using Fabric commands to provision a Contrail system.

This section describes the functions and usage guidelines for the Contrail Server Manager.

The Server Manager provides a simple, centralized way for users to manage and configure components of a virtual network system running across multiple physical and virtual servers in a cloud infrastructure.

You can use Server Manager to configure, provision, and reimage servers with the correct software version and packages for the nodes that are running on each server in multiple virtual network system clusters.

The Server Manager:

  • Provides REST APIs to handle customer requests.
  • Manages its own database to store information about the servers.
  • Interacts with other open source products such as Cobbler and Puppet to configure servers based on user requests.

Server Manager Requirements and Assumptions

The following are requirements and assumptions for the Server Manager:

  • The Server Manager runs on a Linux server (bare metal or virtual machine) and assumes availability of several software products with which it interacts to provide the functionality of managing servers.
  • The Server Manager has network connectivity to the servers it is trying to manage.
  • The Server Manager has access to a remote power management tool to power cycle the servers that it manages.
  • The Server Manager uses Cobbler software for Linux provisioning to configure and download software to physical servers. Cobbler resides on the same server that is running the Server Manager daemon.
    • Server Manager assumes that DNS and DHCP servers embedded with Cobbler provide IP addresses and names to the servers being managed, although it is possible to use external DNS and DHCP servers.
  • The Server Manager uses Puppet software, an open source configuration management tool, to accomplish the configuration management of target servers, including the installation and configuration of different software packages and the launching of various services.
  • SQLite3 database management software is used to maintain and manage server configurations and it runs on the same machine where the Server Manager daemon is running.
  • Because the server-manager process listens on port 9001, and the server-manager webui listens on ports 9080 and 9143, the firewall must be enabled for those ports.
  • Server Manager needs a minimum of 4GB of RAM, 2 CPU cores, and 80GB of disks (to support multiple contrail installations).
  • Server Manager assumes that SSH is enabled on target nodes.

Server Manager Component Interactions

The Server Manager runs as a daemon and provides REST APIs for interaction with the client. The Server Manager accepts user input in the form of REST API requests, performs the requested function on the resources, and responds with a REST API response.

Configuration parameters required by the Server Manager are provided in the Server Manager configuration file. However, the parameters can be overridden by Server Manager command line parameters.

Figure 1 illustrates several high-level components with which the Server Manager interacts.

Figure 1: Server Manager Component Interactions

Server Manager Component Interactions

Internally, the Server Manager uses a SQLite3 database to hold server configuration information. The Server Manager coordinates the database configuration information and user requests to manage the servers defined in the database.

While managing the servers, the Server Manager also communicates with other software components. It uses Cobbler for reimaging target servers and it uses Puppet for provisioning, thereby ensuring necessary software packages are installed and configured, required services are running, and so on.

A Server Manager agent runs on each of the servers and communicates with the Server Manager, providing the information needed to monitor the operation of the servers. The Server Manager agent also uses REST APIs to communicate with the Server Manager, and it can use other software tools to fetch other information, such as Intelligent Platform Interface (IPMI). Monitoring functionality is not part of the Server Manager default installation.

Configuring Server Manager

When the installation of all Server Manager components and dependent packages is finished, configure the Server Manager with parameters that identify your environment and make it available for clients to serve REST API requests.

Upon installation, a sample Server Manager configuration file is created at:

/opt/contrail/server_manager/sm-config.ini

Modify the sm-config.ini configuration file to include parameter values specific to your environment.

The environment-specific configuration section of the sm-config.ini file is named SERVER-MANAGER.

The following example shows the format and parameters of the SERVER-MANAGER section. Typically, only the listen_ip_addr, cobbler_username, and cobbler_passwd values need to be modified.

[SERVER-MANAGER]

listen_ip_addr = <SM-IP-address>

listen_port    = <port-number>


cobbler_ip_address = <cobbler-ip-address>

cobbler_port   = <cobbler-port-number>

cobbler_username = <cobbler-username>

cobbler_password = <cobbler-password>


ipmi_username = <IPMI username>

ipmi_password = <IPMI password>

ipmi_type = <IPMI type>

Table 1 provides details for each of the parameters in the SERVER-MANAGER section.

Table 1: Server Manager Parameters

Parameter

Configuration

listen_ip_addr

Specify the IP address of the server on which the Server Manager is listening for REST API requests.

listen_port

The port number on which the Server Manager is listening for REST API requests. The default is 9001.

cobbler_ip_address

The IP address used to access Cobbler. This address MUST be the same address as the listen_ip_address. The Server Manager assumes that the Cobbler service is running on the same server as the Server Manager service.

cobbler_port

The port on which Cobbler listens for user requests. Leave this field blank.

cobbler_username

Specify the user name to access the Cobbler service. Specify testing unless your Cobbler settings have been modified to use a different user name.

cobbler_password

Specify the password to access the Cobbler service. Specify testing unless your Cobbler settings have been modified to use a different password.

ipmi_username

The IPMI username for power management.

ipmi_password

The IPMI password for power management.

ipmi_type

The IPMI type (ipmilan, lanplus, or other Cobbler-supported types).

Configuring the Cobbler DHCP Template

In addition to configuring the sm_config.ini file, you must manually change the settings in the/etc/cobbler/dhcp.template file to use the correct subnet address, mask, and DNS domain name for your environment. Optionally, you can also restrict the use of the current instance of Server Manager and Cobbler to a subset of servers in the network.

The following is a link to a sample dhcp.template file, which you can modify to match the subnets in your setup.

Note: The IP addresses and other values in the sample are for example purposes only. Be sure to use values that are correct for your environment.

Sample dhcp.template

https://github.com/Juniper/contrail-server-manager/blob/master/src/cobbler/dhcp.template.u

User-Defined Tags for Server Manager

Server Manager enables you to define tags that can be used to group servers for performing a particular operation, such as show information, reimage, provision, and so on. Server Manager supports up to seven different tags that can be configured and used for grouping servers.

The names of user-defined tags are kept in the tags.ini file, at /etc/contrail_smgr/tags.ini.

It is possible to modify tag names, and add or remove tags dynamically using the Server Manager REST API interface. However, if a tag is already being used to group servers, the tag must be removed from the servers before tag modification is allowed.

The following is a sample tags.ini file that is copied on installation. In the sample file, five tags are defined – datacenter, floor, hall, rack, and user_tag. Use the tags to group servers together.

 [TAGS]
  tag1 = datacenter
  tag2 = floor
  tag3 = hall
  tag4 = rack
  tag5 = user_tag

Server Manager Client Configuration File

The Server Manager client application installation copies the /opt/contrail/server_manager/client/sm-client-config.ini, sample configuration file. The sample file contains parameter values such as the IP address to reach the Server Manager, the port used by Server Manager, default values for cluster table entries, default values for server table entries, and so on. You must modify the values in the sm-client-config.ini file to match your environment.

Server Manager uses the values from the CLUSTER and SERVER subsections in the ini file during creation of new clusters and servers, unless you explicitly override the values at the time of creation.

The CLUSTER and SERVER subsections have fields that represent the password for a host or a service. If a value for the password field is not explicitly provided, the Server Manager selects a default password.

Starting with Contrail Release 3.0.2, if you don’t explicitly specify a password, a password is automatically generated by the system. This makes the clusters provisioned by Server Manager more secure. There are no default passwords. The system administrator can specify the passwords to configure, or you can use the passwords that are automatically generated by Server Manager.

The following fields get an autogenerated password whenever an explicit password is not provided.

  • Ceilometer Mongodb password
  • Ceilometer keystone auth password
  • Cinder keystone auth password
  • Glance keystone auth password
  • Heat encryption key
  • Heat keystone auth password
  • Keystone admin password
  • Keystone admin token
  • MYSQL root password
  • MYSQL service password
  • Neutron keystone auth password
  • Nova keystone auth password
  • Swift keystone auth password

Restart Services

When all user changes have been made to the configuration files, restart the Server Manager so that it runs with the modifications:

service contrail-server-manager​ restart

Accessing Server Manager

When the Server Manager configuration has been customized to your environment, and the required daemon services are running, clients can request and use services of the Server Manager by using REST APIs. Any standard REST API client can be used to construct and send REST API requests and process Server Manager responses.

The following steps are typically required to fully implement a new cluster of servers being managed by the Server Manager.

  1. Add a boot image (ISO) to server-manager, along with the kickstart and preseed files compatible with your datacenter server. Each Server Manager release has a default kickstart file. If your system administrator doesn’t provide the kickstart files, Server Manager default files will be used.
  2. Add the Contrail image you are using to Server Manager.
  3. Add the cluster(s) to Server Manager. You can add common provisioning parameters for servers to the cluster, and the parameters get passed to the server when provisioning starts.
  4. Add the servers that will be managed by Server Manager. Remember to add the cluster_id to link with the cluster.

    The following are the minimum parameters needed for reimaging or provisioning:

    • ID
    • cluster
    • domain
    • interface details
    • roles assigned to each server
    • password
  5. Specify the name and location of boot images, packages, and repositories used to bring up the servers with needed software of the supported versions.
  6. Provision or configure the servers by installing necessary packages, creating configuration files, and bringing up the correct services so that each server can perform the functions or role(s) configured for that server.

    A Contrail system of servers has several components or roles that work together to provide the functionality of the virtual network system, including: control, config, analytics, compute, web-ui, OpenStack, and database. Each of the roles has different requirements for the software and services needed. The provisioning REST API enables the client to configure the roles on servers using the Server Manager.

  7. Set up API calls for monitoring servers.

    Once the servers in the Contrail system are correctly reimaged and provisioned to run configured roles, the server monitoring REST API calls allow clients to monitor performance of the servers as they provide one or more role functions.

Communicating with the Server Manager Client

Server Manager provides a REST API interface for clients to talk to the Server Manager software. Any client that can send and receive REST API requests and responses can be used to communicate with Server Manager, for example, Curl or Postman. Additionally, the Server Manager software provides a client with a simplified CLI interface, in a separate package. The Server Manager client can be installed and run on the Server Manager machine itself or on another server with an IP connection to the Server Manager machine.

Prior to using the Server Manager client CLI commands, you need to modify the sm-client-config.ini file to specify the IP address and the port for the Server Manager, along with other parameters.

Each of the commands described in this section takes a set of parameters you specify, constructs a REST API request to the Server Manager, and provides the server’s response.

The following describes each Server Manager client CLI command in detail.

Server Manager Commands for Configuring Servers

This section describes commands that are used to configure servers and server parameters in the Server Manager database. These commands allow you to add, modify, delete, or view servers, clusters, images, and tags.

Server Manager Commands Common Options

The common options in Table 2 are available with every Server Manager command.

Table 2: Common Command Options

Option

Description

-h, --help

Show the options available for the current command and exit.

--config_file CONFIG_FILE, -c CONFIG_FILE

The name of the Server Manager client configuration file. The default file is: /opt/contrail/server_manager/client/sm-client-config.ini

Add New Servers or Update Existing Servers

Use the server-manager add command to create a new server or update a server in the Server Manager database.

server-manager [-h] [--config_file CONFIG_FILE] add server [-f FILE_NAME]

Table 3 lists the optional arguments.

Table 3: Server Manager Add Server Command Options

Option

Description

--file_name FILE_NAME, -f FILE_NAME

The JSON file that contains the server parameter values.

If no JSON file is specified, the client program accepts all the needed server parameter values interactively, then builds a JSON file and makes a REST API call to the Server Manager. The JSON file contains a number of server entries, in the format shown in the following example:

https://github.com/Juniper/contrail-server-manager/blob/R3.1/src/client/new-server.json

Most of the parameters in the JSON sample file are self-explanatory. Cluster_id defines the cluster to which the server belongs. The sample roles array in the example lists all valid role values. Tag defines the mapping of tag names and values for grouping and classifying the server.

The server-manager add command will add a new entry if the server with the given ID or mac_address does not exist in the Server Manager database. If an entry already exists, the add command modifies the fields in the existing entry with any new parameters specified.

Note: It is not possible to re-add an existing MAC address under a new server, even if the ID and IP address of that new server are unique.

Delete Servers

Use the server-manager delete command to delete one or more servers from the Server Manager database.

server-manager [-h] [--config_file CONFIG_FILE] delete server (--server_id SERVER_ID | --mac MAC | --ip IP | --cluster_id CLUSTER_ID | --tag <tag_name=tag_value>.. )

Table 4 lists the optional arguments.

Table 4: Server Manager Delete Server Command Options

Option

Description

--server_id SERVER_ID

The server ID for the server or servers to be deleted.

--mac MAC

The MAC address for the server or servers to be deleted.

--ip IP

The IP address for the server or servers to be deleted.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be deleted.

--tag TagName=TagValue

The TagName that is to be matched with the Tagvalue. Up to seven TagName and Tagvalue pairs separated by commas can be provided.

The criteria for identifying servers to be deleted can be specified by providing the server_id or the server: mac address, ip, cluster_id, or the TagName = TagValue.

Provide one of the server matching criteria to display a list of servers available to be deleted.

Show Server Configuration

Use the server-manager show command to display the configuration of servers from the Server Manager database​.

server-manager show  [--config_file CONFIG_FILE]
                      server (--server_id SERVER_ID | --mac MAC | --ip IP | --cluster_id CLUSTER_ID | --tag <tag_name=tag_value>.. ) [--detail]

Table 5 lists the optional arguments.

Table 5: Server Manager Show Server Command Options

Option

Description

--server_id SERVER_ID

The server ID for the server or servers to be deleted.

--mac MAC

The MAC address for the server or servers to be displayed.

--ip IP

The IP address for the server or servers to be displayed.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be displayed.

--tag TagName=TagValue

The TagName that is to be matched with the Tagvalue. Up to seven TagName and Tagvalue pairs separated by commas can be provided.

--detail, -d

Flag to indicate if details are requested.

The criteria for identifying servers to be displayed can be specified by providing the server_id or one of the following server parameters: mac address, ip, cluster_id, or TagName=TagValue.

Provide one or more of the server matching criteria to display a list of servers.

Server Manager Commands for Managing Clusters

A cluster is used to store parameter values that are common to all servers belonging to that cluster. The commands in this section facilitate managing clusters in the Server Manager database, enabling you to add, modify, delete, and view clusters.

Note: Whenever a server is created with a specific cluster_id, Server Manager checks to see if a cluster with that ID has already been created. If there is no matching cluster_id already in the database, an error is returned.

Create a New Cluster or Update an Existing Cluster

Use the server-manager add command to create a new cluster or update an existing cluster in the Server Manager database.

server-manager add cluster [--file_name FILE_NAME]

Table 6 lists the optional arguments.

Table 6: Server Manager Add Cluster Command Options

Option

Description

--file_name FILE_NAME, -f FILE_NAME

The JSON file that contains the cluster parameter values.

If no JSON file is specified, the client program accepts all the needed cluster parameter values interactively, then builds a JSON file and makes a REST API call to the Server Manager. The JSON file contains a number of cluster entries, in the format shown in the following example:

https://github.com/Juniper/contrail-server-manager/blob/R3.1/src/client/new-cluster.json

Server membership to a cluster is determined by specifying the ID corresponding to the cluster when defining the server. All of the cluster parameters are available to the server when provisioning roles on the server.

Delete a Cluster

Use the server-manager delete command to delete a cluster from the Server Manager database that are no longer needed. Use this command after all servers in the cluster have been deleted.

Note: A cluster can only be deleted if no servers are attached to it. If any servers are attached, deletion will fail.

server-manager delete cluster [--cluster_id CLUSTER_ID] 

Table 7 lists the optional arguments.

Table 7: Server Manager Delete Cluster Command Options

Option

Description

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be displayed.

Show Cluster Configuration

Use the server-manager show command to list the configuration of a cluster.

server-manager show     cluster [--cluster_id CLUSTER_ID] [--detail]

Table 8 lists the optional arguments.

Table 8: Server Manager Show Cluster Command Options

Option

Description

--detail, -d

Flag to indicate if details are requested.

--cluster_id CLUSTER_ID

The cluster ID for the cluster or clusters.

You can optionally specify a cluster ID to get server information about a particular cluster. If the optional parameter is not specified, server information about all clusters in the system is returned.

Server Manager Commands for Managing Tags

Tags are used for grouping servers together so that an operation such as show, reimage, provision, status, and so on can be easily performed on servers that have matching tags. The Server Manager provides a flexible way for you to define your own tags, then use those tags to assign values to servers. Servers with matching tag values can be easily grouped together. The Server Manager can store a maximum of seven tag values. At initialization, the Server Manager reads the tag names from the configuration file. The tag names can be retrieved or modified using CLI commands. When modifying tag names, the Server Manager ensures that the tag name being modified is not used by any of the server entries.

Create a New Tag or Update an Existing Tag

Use the server-manager add command to create a new tag or update an existing tag in the Server Manager database.

server-manager add  tag [--file_name FILE_NAME]

Table 9 lists the optional arguments.

Table 9: Server Manager Add New Tag

Option

Description

--file_name FILE_NAME, -f FILE_NAME

The JSON file that contains the tag names.

If no JSON file is specified, the client program prompts you for tag names, then builds a JSON file and makes a REST API call to the Server Manager. The JSON file contains a number of tag entries, in the format shown in the following example:

{

    "tag1" : "data-center",

    "tag2" : "floor",

    "tag3" : "",

    "tag4" : "pod",

    "tag5" : "rack",

}

In the example, you specify a JSON file to add or modify the tags, tag1 thru tag5. For tag3, the “” value specifies that if the tag is defined prior to the CLI command, it is removed on execution of the command. The tag name for tag1 is set to data-center. This is allowed if, and only if, none of the server entries are using tag1.

Show Tag Configuration

Use the server-manager show command to list the configuration of a tag.

server-manager show tag

The following is sample output for the show tag command.

{

    "tag1": "datacenter",

    "tag2": "floor",

    "tag3": "hall",

    "tag4": "rack",

    "tag5": "user_tag"

}

Server Manager Commands for Managing Images

In addition to servers and clusters, the Server Manager also manages information about images and packages that can be used to reimage and configure servers. Images and packages are both stored in the database as images. When new images are added to the database, or existing images are deleted, the Server Manager interfaces with Cobbler to make corresponding modifications in the Cobbler distribution profile for the specified image.

Table 10 lists the image types supported.

Table 10: Server Manager Image Types

Image Type

Description

centos

Manages the CentOS stock ISO, and does not include the Contrail packages repository packaged with the ISO.

contrail-centos-package

Maintains a repository of the package to be installed on the CentOS system image.

ubuntu

Manages the base Ubuntu ISO.

contrail-ubuntu-package

Maintains a repository of packages that contain Contrail and dependent packages to be installed on an Ubuntu base system.

ESXi5.1/ESXi5.5

Manages VMware ESXi 5.1 or 5.5 ISO.

Creating New Images or Updating Existing Images

The Server Manager maintains five types of images – CISO, Ubuntu ISO, ESXi hypervisor ISO, Contrail CentOS package, and Contrail Ubuntu package.

Use the server-manager add command or the server-manager upload command to add new images to the Server Manager database.

  • Use add when the new image is present locally on the Server Manager machine. The path provided is the image path on the Server Manager machine.
  • Use upload_image when the new image is present on the machine where the client program is being invoked. The path provided is the image path on the client machine.

Add an Image

server-manager add  image [--file_name FILE_NAME]

Table 11 lists the optional arguments.

Table 11: Server Manager Add Image

Option

Description

--file_name FILE_NAME, -f FILE_NAME

The name of the JSON file that contains the image parameter values.

If no JSON file is specified, the client program accepts parameter values interactively, then builds a JSON file and makes a REST API call to the Server Manager.

The JSON file contains an array of possible entries, in the following sample format. The sample shows three images: one CentOS ISO containing Contrail packages, one Ubuntu base ISO, and one Contrail Ubuntu package. When the images are added, corresponding distribution, profile, and repository entries are created in Cobbler by the Server Manager.

Note: Release numbers are represented in the sample with <x.xx>. Be sure to use the correct release numbers for your image versions.

{

    "image": [

        {  

            "id": "ubuntu-<x.xx.x>",

            "type": "ubuntu",

            "version": "ubuntu-<x.xx.x>",

            "path": "/iso/ubuntu-<x.xx.x>-server-amd64.iso"

        },

        {  

            "id": "centos-<x.xx>",

            "type": "centos",

            "version": "centos-<x.xx>",

            "path": "/iso/CentOS-<x.xx>-x86_64-minimal.iso"

        },

        {  

            "id": "contrail-ubuntu-<x.xx>",

            "type": "contrail-ubuntu-package",

            "version": "contrail-ubuntu-<x.xx>",

            "path": "/iso/contrail-install-packages_<x.xx-xx>_all.deb"

        }

    ]

}

Upload an Image

The server-manager upload_image command is similar to the server-manager add command, except that the path provided for the image being added is the local path on the client machine. This command is useful if the client is being run remotely, not on the Server Manager machine, and the image being added is not physically present on the Server Manager machine.

server-manager upload_image image_id image_version image_type file_name

Table 12 lists the optional arguments.

Table 12: Server Manager Upload Image

Option

Description

image_id

Name of the new image.

image_version

Version number of the new image.

image_type

Type of image: fedora, centos, ubuntu, contrail- ubuntu-package, contrail-centos-package

file_name

Complete path for the file.

Delete an Image

Use the server-manager delete command to delete an image from the Server Manager database. When an image is deleted from the Server Manager database, the corresponding distribution, profile, or repository for the image is also deleted from the Cobbler database.

server-manager delete  image image_id

Table 13 lists the optional arguments.

Table 13: Server Manager Delete Image

Option

Description

image_id

The image ID for the image to be deleted.

Show Image Configuration

Use the server-manager show command to list the configuration of images from the Server Manager database. If the detail flag is specified, detailed information about the image is returned. If the optional image_id is not specified, information about all the images is returned.

server-manager show  image [--image_id IMAGE_ID] [--detail]

Table 14 lists the optional arguments.

Table 14: Server Manager Show Image Configuration

Option

Description

image_id

The image ID for the image or images.

--detail, -d

Flag to indicate if details are requested.

Server Manager Operational Commands for Managing Servers

The Server Manager commands in the following sections are operational commands for performing a specific operation on a server or a group of servers. These commands assume that the base configuration of entities required to execute the operational commands is already completed using configuration CLI commands.

Reimaging Server(s)

Use the server-manager reimage command to reimage a server or servers with a provided base ISO and package. Servers are specified by providing match conditions to select them from the database.

Before issuing the reimage command, the images must be added to the Server Manager, which also adds the images to Cobbler. The set of servers to be reimaged can be specified by providing match criteria for servers already added to the Server Manager database, using server_id.

You must identify the base image ID to be used to reimage, plus any optional Contrail package to be used. When a Contrail package is provided, a local repository is created that can be used for subsequent provisioning of reimaged servers.

The command prompts for a confirmation before making the REST API call to the Server Manager to start reimaging the servers. This confirmation message can be bypassed by specifying the optional --no_confirm or –F parameter on the command line.

server-manager reimage 
           [--package_image_id PACKAGE_IMAGE_ID]

           [--no_reboot]

           (--server_id SERVER_ID | --cluster_id CLUSTER_ID |--tag <tag_name=tag_value>)

           [--no_confirm]
base_image_id

Options include the following:

Table 15 lists the optional arguments.

Table 15: Server Manager Reimage

Option

Description

base_image_id

The image ID of the base image to be used.

--package_image_id PACKAGE_IMAGE_ID, -p PACKAGE_IMAGE_ID

The optional Contrail package to be used to reimage the server or servers.

--no_reboot, -n

Optional parameter to indicate that the server should not be rebooted following the reimage setup.

--server_id SERVER_ID

The server ID for the server or servers to be reimaged.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be reimaged.

--tag TagName=TagValue

TagName which is to be matched with Tagvalue

--no_confirm, -F

Flag to bypass confirmation message, default = do NOT bypass.

Provisioning and Configuring Roles on Servers

Use the server-manager provision command to provision identified server(s) with configured roles for the virtual network system. The servers can be selected from the database configuration (using standard server match criteria), identified in a JSON file, or provided interactively.

From the configuration of servers in the database, the Server Manager determines which roles to configure on which servers and uses this information along with other parameters from the database to achieve the task of configuring the servers with specific roles.

When the server-manager provision command is used, the Server Manager pushes the specified server configurations to the servers.

server-manager provision 
         (--server_id SERVER_ID | --cluster_id CLUSTER_ID | --tag <tag_name=tag_value> | --provision_params_file PROVISION_PARAMS_FILE | --interactive)
          [--no_confirm]
          package_image_id

Options include the following:

Table 16 lists the optional arguments.

Table 16: Server Manager Provision

Option

Description

package_image_id

The Contrail package image ID to be used for provisioning.

--server_id SERVER_ID

The server ID for the server or servers to be provisioned.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be provisioned.

--tag TagName=TagValue

TagName to be matched with Tagvalue.

--provision_params_file PROVISION_PARAMS_FILE, -f PROVISION_PARAMS_FILE

Optional JSON file containing the parameters for provisioning the server(s).

--interactive, -I

Flag indicating that you are manually entering the server parameters for provisioning.

--no_confirm, -F

Flag to bypass confirmation message, default = do NOT bypass.

You can specify roles different from what is configured in the database by using the JSON file option parameter. When using the file option, the rest of the server parameters, the cluster parameters, and the list of servers must be configured before using the provision command. The following is a sample format for the file option:

{

    "roles" : {

        "database" : ["demo2-server"],

        "openstack" : ["demo2-server"],

        "config" : ["demo2-server"],

        "control" : ["demo2-server"],

        "collector" : ["demo2-server"],

        "webui" : ["demo2-server"],

        "compute" :  ["demo2-server"]

    }

}

The final option for specifying roles for provisioning servers is to specify the –interactive option flag. When the provision command is used, you are prompted to enter role definitions interactively.

Adding and Deleting Roles

You can add or delete roles through server manager to expand or shrink your cluster.

Adding and deleting roles is done by modifying the roles section in the server’s JSON and issuing the provision command.

The following example shows the JSON to remove all of the controller roles from a server cluster.

        {
            "cluster_id": "test-cluster",
            "id": "<ID>",
            "ip_address": "<ip address>",
            "roles": [
                "config",
                "control",
                "collector",
                "webui",
                "database",
                "openstack"
            ]
        },

The resulting role changes are shown in the following.

        {
            "cluster_id": "test-cluster",
            "id": "<ID>",
            "ip_address": <ip address>",
            "roles": [
            ]
        },

Use server-manager add and server-manager provision for the whole cluster. Provisioning the whole cluster enables the references to the server to be added or removed in the other controllers of the cluster.

The following example shows how to add roles to a server cluster, assuming the server initially has no roles, as shown.

        {
            "cluster_id": "test-cluster",
            "id": "<ID>",
            "ip_address": "<ip address>",
            "roles": [
            ]
        },

The following shows the addition of a controller and its roles.

        {
            "cluster_id": "test-cluster",
            "id": "<ID>",
            "ip_address": "<ip address>",
            "roles": [
                "config",
                "control",
                "collector",
                "webui",
                "database",
                "openstack"
            ]
        },

Use server-manager add and server-manager provision for the whole cluster. Provisioning the whole cluster enables the references to the server to be added or removed in the other controllers of the cluster.

A similar procedure can be followed to add a compute node.

Note: The following are caveats for adding and deleting roles:

  • You cannot add and delete in a single provision command. You can perform all adds in a single provision or all deletes in a single provision.
  • A node that is down or unreachable cannot be deleted, because the Puppet agent cannot run to perform the add or delete.

Restarting Server(s)

Use the server-manager restart command to reboot identified server(s). Servers can be specified from the database by providing standard match conditions. The restart command provides a way to reboot or power-cycle the servers, using the Server Manager REST API interface. If reimaging is intended, use the restart command with the net-boot flag enabled. When netbooted, the Puppet agent is also installed and configured on the servers. If there are Puppet manifest files created for the server prior to rebooting, the agent pulls those from the Server Manager and executes the configured Puppet manifests. The restart command uses an IPMI mechanism to power cycle the servers, if available and configured. Otherwise, the restart command uses SSH to the server and the existing reboot command mechanism is used.

server-manager restart 
             (--server_id SERVER_ID | --cluster_id CLUSTER_ID | --tag <tag_name=tag_value>)

             [--net_boot]

[--no_confirm]

Table 17 lists the optional arguments.

Table 17: Server Manager Restart

Option

Description

--server_id SERVER_ID

The server ID for the server or servers to be restarted.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be restarted.

--tag TagName=TagValue

TagName to be matched with Tagvalue.

--net_boot, -n

Optional parameter to indicate if the server should be netbooted.

--no_confirm, -F

Flag to bypass confirmation message, default = do NOT bypass.

Show Status of Server(s)

Use the server-manager status command to view the reimaging or provisioning status of server(s).

server-manager status server  (--server_id SERVER_ID | --cluster_id CLUSTER_ID | --tag <tag_name=tag_value>)

Table 18 lists the optional arguments.

Table 18: Server Manager Status Server

Option

Description

--server_id SERVER_ID

The server ID for the server whose status is to be fetched.

--cluster_id CLUSTER_ID

The cluster ID for the server or servers to be restarted.

--tag TagName=TagValue

TagName to be matched with Tagvalue.

The status command provides a way to fetch the current status of a server.

Status outputs include the following:

  • restart_issued

    reimage_started

    provision_started

    provision_completed

    database_started

    database_completed

    openstack_started

    openstack_completed

    config_started

    config_completed

    control_started

    control_completed

    collector_started

    collector_completed

    webui_started

    webui_completed

    compute_started

    compute_completed

Server Manager REST API Calls

This section describes all of the REST API calls to the Server Manager. Each description includes an example configuration.

REST APIs for Server Manager Configuration Database Entries

The REST API calls in this section help in configuring different elements in the Server Manager database.

Note: The IP addresses and other values in the following are shown for example purposes only. Be sure to use values that are correct for your environment.

API: Add a Server

To add a new server to the service manager configuration database:

URL: http://<SM-IP-Address>:<SM-Port>/server

Method: PUT

Payload: JSON payload containing an array of servers to be added. For each server in the array, all the parameters are specified as JSON fields. The mask, gateway, password, and domain fields are optional, and if not specified, the values of these fields are taken from the cluster to which the server belongs.

The following is a sample JSON file for adding a server.

https://github.com/Juniper/contrail-server-manager/blob/R3.1/src/client/new-server.json

API: Delete Servers

Use one of the following formats to delete a server.

URL: http://<SM-IP-Address>:<SM-Port>/server?server_id=SERVER_ID

http://<SM-IP-Address>:<SM-Port>/server?cluster_id=CLUSTER_ID

http://<SM-IP-Address>:<SM-Port>/server?mac=MAC

http://<SM-IP-Address>:<SM-Port>/server?ip=IP

http://<<SM-IP-Address>:<SM-Port>/server[?tag=<tag_name>=<tag_value>,.]

Method : DELETE

Payload : None

API: Retrieve Server Configuration

Use one of the following methods to retrieve a server configuration. The detail argument is optional, and specified as part of the URL if details of the server entry are requested.

URL: http://<SM-IP-Address>:<SM-Port>/server[?server_id=SERVER_ID&detail]

http://<SM-IP-Address>:<SM-Port>/server[?cluster_id=CLUSTER_ID&detail]

http://<SM-IP-Address>:<SM-Port>/server[?tag=<tag_name>=<tag_value>,.]

http://<SM-IP-Address>:<SM-Port>/server[?mac=MAC&detail]

http://<SM-IP-Address>:<SM-Port>/server[?ip=IP&detail]

http://<SM-IP-Address>:<SM-Port>/server[?tag=<tag_name>=<tag_value>,.]

Method : GET

Payload : None

API: Add an Image

Use the following to add a new image to the Server Manager configuration database from the Server Manager machine.

An image is either an ISO for a CentOS or Ubuntu distribution or an Ubuntu Contrail package repository. When adding an image, the image file is assumed to be available on the Server Manager machine.

URL : http://<SM-IP-Address>:<SM-Port>/image

Method: PUT

Payload: Specifies all the parameters that define the image being added.

See sample payload in the following:

https://github.com/Juniper/contrail-server-manager/blob/R3.1/src/client/new-package.json

API: Upload an Image

Use the following to upload a new image from a client to the Server Manager configuration database.

An image is an ISO for a CentOS or Ubuntu distribution or an Ubuntu Contrail package repository. Add image assumes the file is available on the Server Manager, whereas upload image transfers the image file from the client machine to the Server Manager machine.

URL : http://<SM-IP-Address>:<SM-Port>/image/upload

Method: PUT

Payload: Specifies all the parameters that define the image being added.

{      
    "image": [
        {
            " id": "Image-id",
            "type": "image_type",  <ubuntu or centos or esxi5.1 or esxi5.5 or contrail-ubuntu-package or contrail-centos-package>
            "version": "image_version",
            "path":"path-to-image-on-client-machine"
        }
    ]  
}        

API: Get Image Information

Use the following to get image information.

URL : http://<SM-IP-Address>:<SM-Port>/image[?image_id=IMAGE_ID&detail]

Method: GET

Payload: Specifies criteria for the image being sought. If no match criteria is specified, information about all the images is provided. The details field specifies if details of the image entry in the database are requested.

API: Delete an Image

Use the following to delete an image.

URL: http://<SM-IP-Address>:<SM-Port>/image?image_id=IMAGE_ID

Method: DELETE

Payload: Specifies criteria for the image being deleted.

API: Add or Modify a Cluster

Use the following to add a cluster to the Server Manager configuration database. A cluster maintains parameters for a set of servers that work together in different roles to provide complete functions for a Contrail cluster.

URL: http://<SM-IP-Address>:<SM-Port>/cluster

Method: PUT

Payload: Contains the definition of the cluster, including all the global parameters needed by all the servers in the cluster. The subnet_mask, gateway, password, and domain fields define parameters that apply to all servers in the VNS. These parameter values can be individually overridden for a server by specifying different values in the server entry.

A sample JSON is at the following:

https://github.com/Juniper/contrail-server-manager/blob/R3.1/src/client/new-cluster.json

API: Delete a Cluster

Use this API to delete a cluster from the Server Manager database.

URL: http://<SM-IP-Address>:<SM-Port>/cluster?cluster_id=CLUSTER_ID

Method: DELETE

Payload: None

API: Get Cluster Configuration

Use this API to get a cluster configuration.

URL: http://<SM-IP-Address>:<SM-Port>/cluster[?cluster_id=CLUSTER_ID&detail]

Method: GET

Payload: None

The optional detail argument is specified as part of the URL if details of the VNS entry are requested.

API: Get All Server Manager Configurations

Use this API to get all configurations of Server Manager objects, including servers, clusters, images, and tags.

URL: http://<SM-IP-Address>:<SM-Port>/all[?detail]

Method: GET

Payload: None

The optional detail argument is specified as part of the URL if details of the Server Manager configuration are requested.

API: Reimage Servers

Use one of the following API formats to reimage one or more servers.

URL: http://<SM-IP-Address>:<SM-Port>/server/reimage?server_id=SERVER_ID
http://<SM-IP-Address>:<SM-Port>/server/reimage?cluster_id=CLUSTER_ID
http://<SM-IP-Address>:<SM-Port>/server/reimage?mac=MAC
http://<SM-IP-Address>:<SM-Port>/server/reimage?ip=IP
http://<SM-IP-Address>:<SM-Port>/server/reimage [?tag=<tag_name>=<tag_value>,.]

Method: POST

Payload: None

API: Provision Servers

Use this API to provision or configure one or more servers for roles configured on them.

URL: http://<SM-IP-Address>:<SM-Port>/server/provision

Method: POST

Payload: Specifies the criteria to be used to identify servers which are being provisioned. The servers can be identified by server_id, mac, cluster_id or tags. See the following example.

{
    server_id : <server_id> OR
    mac : <server_mac_address> OR
    cluster_id : <cluster_id> OR
    tag : {“data-center” : “dc1”} OR
    provision_parameters = {
    "roles" : {
        "database" : ["demo2-server"],
        "openstack" : ["demo2-server"],
        "config" : ["demo2-server"],
        "control" : ["demo2-server"],
        "collector" : ["demo2-server"],
        "webui" : ["demo2-server"],
        "compute" :  ["demo2-server"]
     }
   }
}

API: Restart Servers

This REST API is used to power cycle the servers and reboot either with net-booting enabled or disabled.

If the servers are to be reimaged and reprovisioned, the net-boot flag should be set.

If servers are only being reprovisioned, the net-boot flag ​is not needed, however, the Puppet agent must be running on the target systems with the correct puppet configuration to communicate to the puppet master running on the Server Manager.

URL: http://<SM-IP-Address>:<SM-Port>/server/restart?server_id=SERVER_ID
http://<SM-IP-Address>:<SM-Port>/server/restart?[netboot&]cluster_id=CLUSTER_ID
http://<SM-IP-Address>:<SM-Port>/server/restart? [netboot&]mac=MAC
http://<SM-IP-Address>:<SM-Port>/server/restart? [netboot&]ip=IP
http://<SM-IP-Address>:<SM-Port>/server/restart ? [netboot&]tag=<tag_name>=<tag_value>

Method: POST

Payload: Specifies the criteria to be used to identify servers which are being restarted. The servers can be identified by their server_id, mac, cluster_id, or tag. The netboot parameter specifies if the servers being power-cycled are to be booted from Cobbler or locally.

Example: Reimaging and Provisioning a Server

This example shows the steps used in Server Manager software to configure, reimage, and provision a server running all roles of the Contrail system in a single-node configuration.

Note: Component names and IP addresses in the following are used for example only. To use this example in your own environment, be sure to use addresses and names specific to your environment.

The Server Manager client configuration file used for the following CLI commands, is /opt/contrail/server_manager/client/sm-client-config.ini . It contains the values for the server IP address and port number as follows:

[SERVER-MANAGER]

listen_ip_addr = 192.168.1.10 (Server Manager IP address)

listen_port = 9001

Overview

The steps to be followed include:

  1. Configure cluster.
  2. Configure servers.
  3. Configure images.
  4. Reimage servers (either using servers configured above or using explicitly specified reimage parameters with the request).
  5. Provision servers (either using servers configured above or using explicitly specified provision parameters with the request).

Procedure

  1. Configure a cluster.

    server-manager add cluster -f cluster.json

    Where cluster.json contains :

    {
        "cluster" : [
            { 
                "id" : "demo-cluster",
                "parameters" : {
                    "router_asn": "<asn number>",
                    "database_dir": "/home/cassandra",
                    "database_token": "",
                    "use_certificates": "False",
                    "multi_tenancy": "False",
                    "encapsulation_priority": "MPLSoUDP,MPLSoGRE,VXLAN",
                    "service_token": "<password>",
                    "keystone_user": "admin",
                    "keystone_password": "<password>",
                    "keystone_tenant": "admin",
                    "analytics_data_ttl": "168",
                    "subnet_mask": "<subnet mask address>",
                    "gateway": "<ip address>",
                    "password": "<password>",
                    "haproxy": "disable",
                    "external_bgp": "",
                    "domain": "<domain name>"
                    }
            }
        ]
    }
    
    
  2. Configure the server.

    server-manager add server –f server.json

    Where server.json contains :

    {
    "server": [
    {
                   "id": "demo2-server",
                   "mac_address": "<mac address>",
                   "ip_address": "<ip-address>",
                   "parameters" : {
                   "interface_name": "eth1",
    },
                   "roles" : ["config","openstack","control","compute","collector","webui","database"],
                   "cluster_id": "demo-cluster",
                   "subnet_mask": "<subnet mask address>,
                   "gateway": "<ip-address>",
                   "password": "<password>",
                   "domain": "<domain name>t",
                   "ipmi_address": "<ip-address>"
    }
    ]
    }
    
    
  3. Configure images.

    In the example, the image files for ubuntu-xx.xx.x and contrail-ubuntu-164 are located at the corresponding image path specified on the Server Manager.

    server-manager add -c smgr_client_config.ini image –f image.json

    Where image.json contains:

    {
        "image": [
            {
                " id": "ubuntu-<x.xx.x>",
                "type": "ubuntu",
                "version": "ubuntu-<x.xx.x>",
                "path":"/iso/ubuntu-<x.xx.x>-server-amd64.iso"
            },
            {
                "id": "contrail-ubuntu-xxx",
                "type": "contrail-ubuntu-package",
                "version": "contrail-ubuntu-xxx",
                "path":"/iso/contrail-install-packages_x.xx-xxx~xxxxxxxx_all.deb"
            }
                      ]
    }
  4. Reimage servers.

    This step can be performed after the configuration from the previous steps is in the Server Manager database.

    server-manager reimage –server_id demo-server –r contrail-ubuntu-164 ubuntu-<x.xx.x>

  5. Provision servers.

    server-manager provision –server_id demo-server contrail-ubuntu-164

Note: Optionally, the Contrail package to be used can be specified with the reimage command, in which case the repository with the Contrail packages is created and made available to the target nodes as part of the reimage process. The repository is a mandatory parameter of the provision command.

Modified: 2016-11-08

Modified: 2016-11-08