Vyos Blueprint creation

Build Vyos image

It is necessary to build directly the Vyos image because the default one is missing some functionalities like DHCP and Cloud-init.To build a VyOS image you can use the following instructions. For additional functionalities, look at the GitHub official page.

  1. Create a folder in witch the image will be built and files will be downloaded, enter the folder.

  2. Enter the console of a linux machine with docker installed and download the docker file

    wget https://raw.githubusercontent.com/vyos/vyos-vm-images/current/Dockerfile
    
  3. Build local image with name vyos-vm-images (only if you do not have it)

    docker build --tag vyos-vm-images:latest -f ./Dockerfile .
    
  4. Run the docker and connect to the console

    docker run --rm -it --privileged -v $(pwd):/vm-build -v $(pwd)/images:/images -w /vm-build vyos-vm-images:latest bash
    
  5. Now you are using the console inside the container. Clone the repo and enter the folder

    git clone https://github.com/vyos/vyos-vm-images.git && cd vyos-vm-images
    
  6. (Optional) If the MTU is different from 1500 in the network where the image will be used (it happens in OpenStack) you will need to edit the configuration file that will be mounted.

    nano ./roles/install-config/config.boot.j2
    

    Edit this piece of configuration

    ...
    {% if enable_dhcp %}
        ethernet eth0 {
            address dhcp
        }
    {% endif %}
    ...
    

    Such that it becomes

    ...
    {% if enable_dhcp %}
        ethernet eth0 {
            address dhcp
            mtu 1450
        }
    {% endif %}
    ...
    
  7. Now you can build the image. Result will be located in /tmp

    sudo ansible-playbook qemu.yml -e enable_dhcp=true -e enable_ssh=true
    
  8. Move the image to the mounted folder

    mv /tmp/vyos-1.5-rolling-.....-10G-qemu.qcow2 /images/
    

You should now have the image in the host folder $(pwd)/images. The image can be uploaded and used on openstack.

Blueprint API usage

Step 0 - Vyos Creation

API (POST): {{ base_url }}/nfvcl/v1/api/blue/VyOSBlue

  • BODY:

{
  "type": "VyOSBlue",
  "areas": [
    {
      "id": 0,
      "config_list": [
        {
          "version": "1.00",
          "admin_password": "vyos",
          "network_endpoints": {
            "mgt": {
              "net_name": "control-os1"
            },
            "data_nets": [
              {
                "net_name": "radio"
              }
            ]
          }
        }
      ]
    }
  ]
}

The password can be omitted and by default it’s value is vyos.

VyOS status after creation

An example of VyOS’s status after creation should result like this:

"conf":{
    "type": "VyOSBlue",
    "callbackURL": null,
    "areas": [
      {
        "id": 0,
        "config_list": [
          {
            "version": "1.00",
            "name": "K2ZSWQ_vyos_router_area_0_0",
            "nsd_name": "K2ZSWQ_vyos_router_area_0_0",
            "nsd_id": "926454e0-4a79-438d-ae18-9eabd78bd517",
            "network_endpoints": {
              "mgt": {
                "net_name": "mngn-vnf-os",
                "interface_name": "eth0",
                "osm_interface_name": null,
                "ip_addr": "192.168.13.82",
                "network": "192.168.13.0/24"
              },
              "data_nets": [
                {
                  "net_name": "radio_0SJDRI",
                  "interface_name": "eth1",
                  "osm_interface_name": "ens4",
                  "ip_addr": "10.168.3.137",
                  "network": "10.168.0.0/16"
                },
                {
                  "net_name": "radio_test_paolo",
                  "interface_name": "eth2",
                  "osm_interface_name": "ens5",
                  "ip_addr": "10.170.3.74",
                  "network": "10.170.0.0/16"
                }
              ]
            },
            "vyos_router_flavors": null,
            "snat_rules": [],
            "dnat_rules": []
          }
        ]
      }
    ],
    "blueprint_instance_id": "K2ZSWQ",
    "blueprint_type": "VyOSBlue"
  }