Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

How to Detach and Attach a VMI to VPG

<Optional>This topic describes how to detach and attach a tagged as well as untagged Virtual Machine Interface (VMI) to a Virtual Port Group (VPG).

Before performing this procedure, it is mandatory to:
  • Create a VPG in Contrail Command user interface. For more information about configuring VPG, see Virtual Port Groups.
    Figure 1: Creating a Virtual Port Group Creating a Virtual Port Group
  • Ensure a tagged VMI (VLAN) already exists in VPG. If a tagged VMI does not exists, then create one following step 10 and 11 from Configuring Virtual Port Groups.

    Figure 2: Creating a tagged VMI in VPG Creating a tagged VMI in VPG
  • Similarly, ensure an untagged (native) VMI (VLAN) exists in VPG. If it does not exists, then create an untagged VMI.

    Figure 3: Creating an Untagged VMI in VPG Creating an Untagged VMI in VPG

Detaching a Tagged VMI from a VPG

Before detaching a tagged VMI from a VPG, you need to know how VMI is stored in Cassandra Config database. Use Config Editor from Contrail UI, or Config API port, '8082' to view the VMI. The following code snippet shows how a VMI is stored.

To view how VPG is stored in the Cassandra Config database, use Config Editor from Contrail UI, or Config API port, '8082'. The following code snippet shows how VPG is stored in the Cassandra Config database.

To detach a tagged VMI from a VPG:

  1. Create a detach.json file and then run the curl command with 'detach.json' as parameter:

    In this command,

    • https or http is used depending on whether config-api has SSL enabled (https) or not (http).

    • -H "X-Auth-Token: $TOKEN" is used when RBAC is enabled.

    • $TOKEN is used as a placeholder for an Openstack token.

After detaching a VMI from the VPG, the following 3 changes are noticeable:

  • In the Config Editor, VMI does not contain any “virtual_machine_interface_bindings”, any “virtual_port_group_refs” or any “virtual_port_group_back_refs”.

  • In the Config Editor, VPG does not contain any “virtual_machine_interface_refs” or any “virtual_machine_interface_back_refs”.

  • In Contrail Command UI, VMI has disappeared from VPG.

    Figure 4: VMI disappeared from VPG VMI disappeared from VPG

Attaching a Tagged VMI to a VPG

To attach a tagged VMI to a VPG:

  1. Create an attach.json file and then run the curl command with 'attach.json' as parameter:
    Note:

    In order to add the value associated to the "profile" key in attach.json, you can retrieve it from Config Editor, VMI entry, "virtual_machine_interface_bindings" dictionary (when the VMI is created and it is attached to the VPG).

After attaching a VMI to the VPG, the following 3 changes are noticeable:

  • In the Config Editor, VMI contains “virtual_machine_interface_bindings”, “virtual_port_group_refs” and “virtual_port_group_back_refs”.

  • In the Config Editor, VPG contains “virtual_machine_interface_refs” and “virtual_machine_interface_back_refs”.

  • In the Contrail Command UI, VMI appears in VPG.

    Figure 5: VMI appears in VPG VMI appears in VPG

Detaching an Untagged VMI from a VPG

Before detaching an untagged VMI from a VPG, you need to know how VMI is stored in Cassandra Config database. Use Config Editor from Contrail UI, or Config API port, '8082' to view the VMI. The following code snippet shows how a VMI is stored.

In the above code snippet, an untagged (native) VLAN (VMI) has “tor_port_vlan_id” in addition to other fields present in a tagged VLAN (VMI).

To view how VPG is stored in the Cassandra Config database, use Config Editor from Contrail UI, or Config API port, '8082'. The following code snippet shows how VPG is stored.

To detach an untagged VMI from a VPG:

  1. Create a detach.json file and then run the curl command with 'detach.json' as parameter. The detach.json is identical to detach.json from previous section. The curl command is similar, except that the URL in the curl command now contains the UUID of the native (untagged) VMI.

    In this command,

    • https or http is used depending on whether config-api has SSL enabled (https) or not (http).

    • -H "X-Auth-Token: $TOKEN" is used when RBAC is enabled.

    • $TOKEN is used as a placeholder for an Openstack token.

After detaching a VMI from the VPG, following 3 changes are noticeable:

  • In the Config Editor, VMI does not contain any “virtual_machine_interface_bindings”, any “virtual_port_group_refs” or any “virtual_port_group_back_refs”.

  • In the Config Editor, VPG does not contain any “virtual_machine_interface_refs” or any “virtual_machine_interface_back_refs”.

  • In the Contrail Command UI, VMI has disappeared from VPG.

    Figure 6: VMI disappeared from VPG VMI disappeared from VPG

Attaching an Untagged VMI to a VPG

To attach an untagged VMI to a VPG:

  1. Create a attach.json file and then run the curl command with 'attach.json' as parameter.

    Note:

    In order to add the value associated to the "profile" key in attach.json, you can retrieve it from Config Editor, VMI entry, "virtual_machine_interface_bindings" dictionary (when the VMI is created and it is attached to the VPG).

After attaching a VMI to a VPG, the following 3 changes are noticeable:

  • In the Config Editor, VMI contains “virtual_machine_interface_bindings”, “virtual_port_group_refs” and “virtual_port_group_back_refs”.

  • In the Config Editor, VPG contains “virtual_machine_interface_refs” and “virtual_machine_interface_back_refs”.

  • In Contrail Command UI, VMI appears in VPG.

    Figure 7: VMI appears in VPG VMI appears in VPG