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 Virtual Port Group section in Contrail Command interface showing a table with columns Name VLAN IDs Physical Interfaces Port Profile. One entry vpg_1 with VLAN IDs Add option Physical Interfaces 5b11-qfx10:xe-0/0/47 Port Profile empty. Navigation options search bar and buttons for creating refreshing and deleting entries are present. User admin logged in with view set to Default.
  • 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 Screenshot of Virtual Port Group section in Contrail Command interface showing a table with columns Name vpg_1 VLAN IDs 11 Physical Interfaces 5b11-qfx10:xe-0/0/47 and Port Profile empty. Options for search refresh delete and create are visible. Admin user logged in.
  • 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 Virtual Port Group section in Contrail Command showing a table with details: Name vpg_1, VLAN ID 15, Physical Interface 5b11-qfx10:xe-0/0/47, Port Profile empty. Options include search, refresh, delete, and create new. User admin logged in.

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 Contrail Command interface showing Virtual Port Group section with name vpg_1, option to add VLAN IDs, physical interface 5b11-qfx10:xe-0/0/47, and unspecified port profile. Options to create, search, refresh, and delete entries are available.

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 Contrail Command interface showing Virtual Port Group section with a table listing Name, VLAN IDs, Physical Interfaces, and Port Profile columns.

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 Contrail Command interface showing Virtual Port Group section with name vpg_1, option to add VLAN IDs, physical interface 5b11-qfx10:xe-0/0/47, and unspecified port profile. Options to create, search, refresh, and delete entries are available.

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 Contrail Command interface showing Virtual Port Group section with table listing virtual port groups and action buttons like Create, search, refresh, and delete.