Build

The build tool can be used to clone out pods from a manifest. The manifest is a toml file, that will be further explained below. Simply create a toml file and run netlab build my_manifest_file.toml to run it.

The build tool can be used to:

  • Clone out pods.

  • Delete pods.

  • Rebuild pods.

  • Bring pods online or take them offline.

Builder files can have any number of [[range]] blocks. This is the minimal example.

[[range]]
source_pod_id = 1000  # The pod to clone from. This can refer to pods in
                      # earlier ranges.

start = 24000         # The first pod id to clone.
number = 30           # The number of pods to create.

[range.pc_clone_specs] can take keys found in netlab.datatypes.PCCloneSpec

[[range]]
source_pod_id = 1200
start = 23000
number = 5

[range.pc_clone_specs]
clone_type = "FULL"      # Perform a 'FULL' clone type.
clone_vh_id = 9          # Clone to this virtual host.
clone_role = "TEMPLATE"  # The cloned pod will be a 'TEMPLATE'.

This is an advanced example.

[system]                 #>  A system block can be used to select a system to
                         #   run the manifest against.
name = "default"         #>  Select the 'default' system, the same as the
                         #   `--system` flag.

[[range]]
delete = true            #>  The pods from this range will be deleted. In this
                         #   example, the 'delete' range is unneeded. The build
                         #   tool will replace old pods if it detects a change.
pod_online = true        #>  Many of these options are allowed, but unneeded.

source_pod_id = 1000
start = 1400
number = 20
clone_prefix = "pod-A"
clone_suffix = "v1"

[[range]]
pod_online = true       #>  Bring these pods online after creating them.

source_pod_id = 1000
start = 1400
number = 10
step = 2                #>  Clone every 2 pod ids. 1400, 1402, 1404, ...
clone_prefix = "pod-A"  #>  Add this prefix to every pod name.
clone_suffix = "v2"     #>  Add this suffix to every pod name.

clone_name_template = "{default}"  # See 'Using clone_name_template'

[[range]]               #>  This range will create a second range, interspersed
                        #   with the one above.
pod_online = true

source_pod_id = 1000
start = 1401
number = 10
step = 2
clone_prefix = "pod-B"
clone_suffix = "v2"

Running this manifest will result in this output:

$ netlab build var/baz.toml
Fetching pods ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
var/baz.toml#0
   SUPERSEDED pod-A.H85.P1400.v2
   SUPERSEDED pod-B.H85.P1401.v2
   SUPERSEDED pod-A.H85.P1402.v2
   SUPERSEDED pod-B.H85.P1403.v2
   SUPERSEDED pod-A.H85.P1404.v2
   SUPERSEDED pod-B.H85.P1405.v2
   SUPERSEDED pod-A.H85.P1406.v2
   SUPERSEDED pod-B.H85.P1407.v2
   SUPERSEDED pod-A.H85.P1408.v2
   SUPERSEDED pod-B.H85.P1409.v2
   SUPERSEDED pod-A.H85.P1410.v2
   SUPERSEDED pod-B.H85.P1411.v2
   SUPERSEDED pod-A.H85.P1412.v2
   SUPERSEDED pod-B.H85.P1413.v2
   SUPERSEDED pod-A.H85.P1414.v2
   SUPERSEDED pod-B.H85.P1415.v2
   SUPERSEDED pod-A.H85.P1416.v2
   SUPERSEDED pod-B.H85.P1417.v2
   SUPERSEDED pod-A.H85.P1418.v2
   SUPERSEDED pod-B.H85.P1419.v2
var/baz.toml#1
   CREATE pod-A.H85.P1400.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1402.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1404.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1406.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1408.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1410.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1412.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1414.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1416.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-A.H85.P1418.v2
           [state]    ABSENT -> EXISTS
var/baz.toml#2
   CREATE pod-B.H85.P1401.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1403.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1405.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1407.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1409.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1411.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1413.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1415.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1417.v2
           [state]    ABSENT -> EXISTS
   CREATE pod-B.H85.P1419.v2
           [state]    ABSENT -> EXISTS
Continue? [y/N]:

Using clone_name_template

clone_name_template allows for more customization of the names of cloned pods. Variables inside curly braces will be replaced. These variables are allowed:

pod_id

The id of the created pod.

pod_role

The abbreviated role of the created pod.

vh_name

The abbreviated name of the virtual host of the created pod.

pt_org

The org name of the pod type.

pt_apdid

The author pod designer id of the pod type.

default

The default generated name of the created pod.