- play_arrow Overview
- play_arrow Zero-Touch-Provisioning
- play_arrow Fabric Configuration
- Image Management
- Onboard Brownfield Devices
- Onboard Greenfield Devices
- Device Import
- Create Virtual Network
- Create Logical Routers
- Create Network Policy
- Create Network IPAM
- Reconfigure Roles
- Managing Custom Roles
- View Node Profile Information
- Monitoring Fabric Jobs
- Terminating Ongoing Fabric Jobs
- Adding a Leaf or Spine Device to an Existing Fabric Using ZTP
- Grouping Fabric Devices and Roles Using Device Functional Groups
- Creating Layer 3 PNF Service Chains for Inter-LR Traffic
- Creating VNF Service Chains for Inter-LR Traffic
- Retaining the AS Path Attribute in a Service Chain
- Assisted Replication of Broadcast, Unknown Unicast, and Multicast Traffic
- Running Generic Device Operations Commands In Contrail Command
- Adding DHCP Server Information for Virtual Networks and Logical Routers
- Return Material Authorization
- Approaches to Enable External Connectivity for Overlay Networks
- Contrail Networking Supported Hardware Platforms and Associated Roles And Node Profiles
- play_arrow High Availability in Contrail Networking
- play_arrow Integrating VMware with Contrail Networking Fabric
- play_arrow Integrating OpenStack with Contrail Networking Fabric
- play_arrow Extending Contrail Networking to Bare Metal Servers
- Bare Metal Server Management
- How Bare Metal Server Management Works
- LAG and Multihoming Support
- Adding Bare Metal Server to Inventory
- Launching a Bare Metal Server
- Onboarding and Discovery of Bare Metal Servers
- Launching and Deleting a Greenfield Bare Metal Server
- Destination Network Address Translation for Bare Metal Servers
- Troubleshooting Bare Metal Servers
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).
- 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
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 VPGSimilarly, 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
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.
{ "virtual-machine-interface": { "virtual_machine_interface_bindings": { "key_value_pair": [ { "value": "vpg_1", "key": "vpg" }, { "value": "{\"local_link_information\": [{\"port_id\":\"xe-0/0/47\",\"switch_id\":\"xe-0/0/47\", \"switch_info\":\"5b11-qfx10\",\"fabric\":\"test-fabric\"}]}", "key": "profile" }, { "value": "baremetal", "key": "vnic_type" }, { "value": "vrouter", "key": "vif_type" } ] }, "virtual_port_group_back_refs": [ { "to": [ "default-global-system-config", "test-fabric", "vpg_1" ], "href": "http://10.87.69.8:8082/virtual-port-group/350196b7-1334-4c34-9f4f-b8796449a2a1", "attr": null, "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1" } ], "name": "vpg_1-11", "display_name": "vpg_1-11", "uuid": "c6298b0d-1907-43f0-81f3-e0d9f43774bf", "virtual_machine_interface_properties": { "sub_interface_vlan_tag": 11 }, "virtual_port_group_refs": [ { "to": [ "default-global-system-config", "test-fabric", "vpg_1" ], "href": "http://10.87.69.8:8082/virtual-port-group/350196b7-1334-4c34-9f4f-b8796449a2a1", "attr": { "vlan_tag": 11 }, "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1" } ] } }
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.
{ "virtual-port-group": { "virtual_machine_interface_back_refs": [ { "to": [ "default-domain", "admin", "vpg_1-11" ], "href": "http://10.87.69.8:8082/virtual-machine-interface/c6298b0d-1907-43f0-81f3-e0d9f43774bf", "attr": { "vlan_tag": 11 }, "uuid": "c6298b0d-1907-43f0-81f3-e0d9f43774bf" } ], "display_name": "vpg_1", "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1", "virtual_machine_interface_refs": [ { "to": [ "default-domain", "admin", "vpg_1-11" ], "href": "http://10.87.69.8:8082/virtual-machine-interface/c6298b0d-1907-43f0-81f3-e0d9f43774bf", "attr": null, "uuid": "c6298b0d-1907-43f0-81f3-e0d9f43774bf" } ], } }
To detach a tagged VMI from a VPG:
Create a detach.json file and then run the curl command with 'detach.json' as parameter:
content_copy zoom_out_map# cat detach.json { "virtual-machine-interface": { "virtual_machine_interface_bindings": { "key_value_pair": [ { "value": "true", "key": "detach_vpg" } ] } } } # cat detach_command.sh #!/bin/bash curl -X PUT -H "X-Auth-Token: $TOKEN" http://10.87.69.9:8082/virtual-machine-interface/c6298b0d-1907-43f0-81f3-e0d9f43774bf -H "Content-type: application/json" -d @detach.json
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
Attaching a Tagged VMI to a VPG
To attach a tagged VMI to a VPG:
- Create an attach.json file and then run the curl command with
'attach.json' as parameter:content_copy zoom_out_map
# cat attach.json { "virtual-machine-interface": { "virtual_machine_interface_bindings": { "key_value_pair": [ { "key": "attach_vpg", "value": "true" }, { "key": "vpg", "value": "vpg_1" }, { "key": "profile", "value": "{\"local_link_information\": [{\"port_id\":\"xe-0/0/47\",\"switch_id\":\"xe-0/0/47\", \"switch_info\":\"5b11-qfx10\",\"fabric\":\"test-fabric\"}]}" }, { "key": "vnic_type", "value": "baremetal" }, { "key": "vif_type", "value": "vrouter" } ] } } } # cat attach_command.sh #!/bin/bash curl -X PUT -H "X-Auth-Token: $TOKEN" http://10.87.69.9:8082/virtual-machine-interface/c6298b0d-1907-43f0-81f3-e0d9f43774bf -H "Content-type: application/json" -d @attach.json
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
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.
{ "virtual-machine-interface": { "virtual_machine_interface_bindings": { "key_value_pair": [ { "value": "vpg_1", "key": "vpg" }, { "value": "{\"local_link_information\":[{\"port_id\":\"xe-0/0/47\",\"switch_id\":\"xe-0/0/47\",\"switch_info\":\"5b11-qfx10\",\"fabric\":\"test-fabric\"}]}", "key": "profile" }, { "value": "baremetal", "key": "vnic_type" }, { "value": "vrouter", "key": "vif_type" }, { "value": "15", "key": "tor_port_vlan_id" } ] }, "virtual_port_group_back_refs": [ { "to": [ "default-global-system-config", "test-fabric", "vpg_1" ], "href": "http://10.87.69.8:8082/virtual-port-group/350196b7-1334-4c34-9f4f-b8796449a2a1", "attr": null, "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1" } ], "name": "vpg_1-15-untagged", "display_name": "vpg_1-15-untagged", "uuid": "48359942-31e3-4743-9a1a-f31600246aa3” "virtual_machine_interface_properties": { "sub_interface_vlan_tag": 0 }, "virtual_port_group_refs": [ { "to": [ "default-global-system-config", "test-fabric", "vpg_1" ], "href": "http://10.87.69.8:8082/virtual-port-group/350196b7-1334-4c34-9f4f-b8796449a2a1", "attr": { "native_vlan_tag": 15 }, "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1" } ] } }
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.
{ "virtual-port-group": { "virtual_machine_interface_back_refs": [ { "to": [ "default-domain", "admin", "vpg_1-15-untagged" ], "href": "http://10.87.69.8:8082/virtual-machine-interface/48359942-31e3-4743-9a1a-f31600246aa3", "attr": { "native_vlan_tag": 15 }, "uuid": "48359942-31e3-4743-9a1a-f31600246aa3" } ], "display_name": "vpg_1", "uuid": "350196b7-1334-4c34-9f4f-b8796449a2a1", "virtual_machine_interface_refs": [ { "to": [ "default-domain", "admin", "vpg_1-15-untagged" ], "href": "http://10.87.69.8:8082/virtual-machine-interface/48359942-31e3-4743-9a1a-f31600246aa3", "attr": null, "uuid": "48359942-31e3-4743-9a1a-f31600246aa3" } ], } }
To detach an untagged VMI from a VPG:
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.
content_copy zoom_out_map# cat detach_command.sh #!/bin/bash curl -X PUT -H "X-Auth-Token: $TOKEN" http://10.87.69.9:8082/virtual-machine-interface/48359942-31e3-4743-9a1a-f31600246aa3 -H "Content-type: application/json" -d @detach.json
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
Attaching an Untagged VMI to a VPG
To attach an untagged VMI to a VPG:
Create a attach.json file and then run the curl command with 'attach.json' as parameter.
content_copy zoom_out_map# cat attach.json { "virtual-machine-interface": { "virtual_machine_interface_bindings": { "key_value_pair": [ { "key": "attach_vpg", "value": "true" }, { "key": "vpg", "value": "vpg_1" }, { "key": "profile", "value": "{\"local_link_information\": [{\"port_id\":\"xe-0/0/47\",\"switch_id\":\"xe-0/0/47\",\"switch_info\":\"5b11-qfx10\", \"fabric\":\"test-fabric\"}]}" }, { "key": "vnic_type", "value": "baremetal" }, { "key": "vif_type", "value": "vrouter" }, { "key": "tor_port_vlan_id", "value": "15" } ] } } } # cat attach_command.sh #!/bin/bash curl -X PUT -H "X-Auth-Token: $TOKEN" http://10.87.69.9:8082/virtual-machine-interface/48359942-31e3-4743-9a1a-f31600246aa3 -H "Content-type: application/json" -d @attach.json
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