Use tricircle cli instead of curl command
1. What is the problem Tricircle cli has been implemented and can be used instead of curl, it's more user friendly and convenient. 2. What is the solution for the problem Update curl command with tricircle cli. 3. What the features need to be implemented to the tricircle to realize the solution None. Change-Id: Ib272c9cb53db06eb7185661953af1b46f54790d0
This commit is contained in:
parent
6cd177b73c
commit
ee34ea53e9
@ -47,14 +47,11 @@ token=$(openstack token issue | awk 'NR==5 {print $4}')
|
|||||||
|
|
||||||
echo $token
|
echo $token
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name RegionOne
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionOne"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name Pod1 --availability-zone az1
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "Pod1", "az_name": "az1"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name Pod2 --availability-zone az2
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "Pod2", "az_name": "az2"}}'
|
|
||||||
|
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "* Verify Nova *"
|
echo "* Verify Nova *"
|
||||||
@ -63,17 +60,12 @@ echo "******************************"
|
|||||||
echo "Show nova aggregate:"
|
echo "Show nova aggregate:"
|
||||||
nova aggregate-list
|
nova aggregate-list
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1:9696/v2.0/networks -H "Content-Type: application/json" \
|
neutron net-create --availability-zone-hint az1 net1
|
||||||
-H "X-Auth-Token: $token" \
|
|
||||||
-d '{"network": {"name": "net1", "admin_state_up": true, "availability_zone_hints": ["az1"]}}'
|
|
||||||
curl -X POST http://127.0.0.1:9696/v2.0/networks -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" \
|
|
||||||
-d '{"network": {"name": "net2", "admin_state_up": true, "availability_zone_hints": ["az2"]}}'
|
|
||||||
|
|
||||||
echo "Create external network ext-net by curl:"
|
neutron net-create --availability-zone-hint az2 net2
|
||||||
curl -X POST http://127.0.0.1:9696/v2.0/networks -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" \
|
echo "Create external network ext-net:"
|
||||||
-d '{"network": {"name": "ext-net", "admin_state_up": true, "router:external": true, "provider:network_type": "vlan", "provider:physical_network": "extern", "availability_zone_hints": ["Pod2"]}}'
|
neutron net-create --router:external --provider:network_type vlan --provider:physical_network extern --availability-zone-hint Pod2 ext-net
|
||||||
|
|
||||||
echo "Create test flavor:"
|
echo "Create test flavor:"
|
||||||
nova flavor-create test 1 1024 10 1
|
nova flavor-create test 1 1024 10 1
|
||||||
|
@ -43,11 +43,9 @@ token=$(openstack token issue | awk 'NR==5 {print $4}')
|
|||||||
|
|
||||||
echo $token
|
echo $token
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name RegionOne
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionOne"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name Pod1 --availability-zone az1
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "Pod1", "az_name": "az1"}}'
|
|
||||||
|
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "* Verify Nova *"
|
echo "* Verify Nova *"
|
||||||
|
@ -313,48 +313,41 @@ How to play
|
|||||||
normal OpenStack regions which includes Nova, Neutron and Glance. Shared
|
normal OpenStack regions which includes Nova, Neutron and Glance. Shared
|
||||||
Keystone service is registered in "RegionOne".
|
Keystone service is registered in "RegionOne".
|
||||||
|
|
||||||
- 4 Get token for the later commands. Run ::
|
- 4 Create pod instances for the Tricircle to manage the mapping between
|
||||||
|
availability zones and OpenStack instances ::
|
||||||
|
|
||||||
openstack --os-region-name=RegionOne token issue
|
openstack multiregion networking pod create --region-name CentralRegion
|
||||||
|
|
||||||
- 5 Create pod instances for the Tricircle to manage the mapping between
|
openstack multiregion networking pod create --region-name RegionOne --availability-zone az1
|
||||||
availability zones and OpenStack instances, "$token" is obtained in step 4 ::
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
openstack multiregion networking pod create --region-name RegionTwo --availability-zone az2
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "CentralRegion"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionOne", "az_name": "az1"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionTwo", "az_name": "az2"}}'
|
|
||||||
|
|
||||||
Pay attention to "region_name" parameter we specify when creating pod. Pod name
|
Pay attention to "region_name" parameter we specify when creating pod. Pod name
|
||||||
should exactly match the region name registered in Keystone. In the above
|
should exactly match the region name registered in Keystone. In the above
|
||||||
commands, we create pods named "CentralRegion", "RegionOne" and "RegionTwo".
|
commands, we create pods named "CentralRegion", "RegionOne" and "RegionTwo".
|
||||||
|
|
||||||
- 6 Create necessary resources in central Neutron server ::
|
- 5 Create necessary resources in central Neutron server ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion net-create net1
|
neutron --os-region-name=CentralRegion net-create --availability-zone-hint RegionOne net1
|
||||||
neutron --os-region-name=CentralRegion subnet-create net1 10.0.1.0/24
|
neutron --os-region-name=CentralRegion subnet-create net1 10.0.1.0/24
|
||||||
neutron --os-region-name=CentralRegion net-create net2
|
neutron --os-region-name=CentralRegion net-create --availability-zone-hint RegionTwo net2
|
||||||
neutron --os-region-name=CentralRegion subnet-create net2 10.0.2.0/24
|
neutron --os-region-name=CentralRegion subnet-create net2 10.0.2.0/24
|
||||||
|
|
||||||
Please note that the net1 and net2 ID will be used in later step to boot VM.
|
Please note that the net1 and net2 ID will be used in later step to boot VM.
|
||||||
|
|
||||||
- 7 Get image ID and flavor ID which will be used in VM booting ::
|
- 6 Get image ID and flavor ID which will be used in VM booting ::
|
||||||
|
|
||||||
glance --os-region-name=RegionOne image-list
|
glance --os-region-name=RegionOne image-list
|
||||||
nova --os-region-name=RegionOne flavor-list
|
nova --os-region-name=RegionOne flavor-list
|
||||||
glance --os-region-name=RegionTwo image-list
|
glance --os-region-name=RegionTwo image-list
|
||||||
nova --os-region-name=RegionTwo flavor-list
|
nova --os-region-name=RegionTwo flavor-list
|
||||||
|
|
||||||
- 8 Boot virtual machines ::
|
- 7 Boot virtual machines ::
|
||||||
|
|
||||||
nova --os-region-name=RegionOne boot --flavor 1 --image $image1_id --nic net-id=$net1_id vm1
|
nova --os-region-name=RegionOne boot --flavor 1 --image $image1_id --nic net-id=$net1_id vm1
|
||||||
nova --os-region-name=RegionTwo boot --flavor 1 --image $image2_id --nic net-id=$net2_id vm2
|
nova --os-region-name=RegionTwo boot --flavor 1 --image $image2_id --nic net-id=$net2_id vm2
|
||||||
|
|
||||||
- 9 Verify the VMs are connected to the networks ::
|
- 8 Verify the VMs are connected to the networks ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion port-list
|
neutron --os-region-name=CentralRegion port-list
|
||||||
neutron --os-region-name=RegionOne port-list
|
neutron --os-region-name=RegionOne port-list
|
||||||
@ -366,11 +359,9 @@ How to play
|
|||||||
Neutron server. The port has same uuid in local Neutron server and central
|
Neutron server. The port has same uuid in local Neutron server and central
|
||||||
Neutron Server.
|
Neutron Server.
|
||||||
|
|
||||||
- 10 Create external network and subnet ::
|
- 9 Create external network and subnet ::
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1:20001/v2.0/networks -H "Content-Type: application/json" \
|
neutron --os-region-name=CentralRegion net-create --router:external --provider:network_type vlan --provider:physical_network extern --availability-zone-hint RegionTwo ext-net
|
||||||
-H "X-Auth-Token: $token" \
|
|
||||||
-d '{"network": {"name": "ext-net", "admin_state_up": true, "router:external": true, "provider:network_type": "vlan", "provider:physical_network": "extern", "availability_zone_hints": ["RegionTwo"]}}'
|
|
||||||
neutron --os-region-name=CentralRegion subnet-create --name ext-subnet --disable-dhcp ext-net 163.3.124.0/24
|
neutron --os-region-name=CentralRegion subnet-create --name ext-subnet --disable-dhcp ext-net 163.3.124.0/24
|
||||||
|
|
||||||
Pay attention that when creating external network, we need to pass
|
Pay attention that when creating external network, we need to pass
|
||||||
@ -382,13 +373,13 @@ How to play
|
|||||||
bridge network when handling interface adding operation. This limitation will
|
bridge network when handling interface adding operation. This limitation will
|
||||||
be removed later.*
|
be removed later.*
|
||||||
|
|
||||||
- 11 Create router and attach subnets in central Neutron server ::
|
- 10 Create router and attach subnets in central Neutron server ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion router-create router
|
neutron --os-region-name=CentralRegion router-create router
|
||||||
neutron --os-region-name=CentralRegion router-interface-add router $subnet1_id
|
neutron --os-region-name=CentralRegion router-interface-add router $subnet1_id
|
||||||
neutron --os-region-name=CentralRegion router-interface-add router $subnet2_id
|
neutron --os-region-name=CentralRegion router-interface-add router $subnet2_id
|
||||||
|
|
||||||
- 12 Set router external gateway in central Neutron server ::
|
- 11 Set router external gateway in central Neutron server ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion router-gateway-set router ext-net
|
neutron --os-region-name=CentralRegion router-gateway-set router ext-net
|
||||||
|
|
||||||
@ -397,18 +388,18 @@ How to play
|
|||||||
to directly start a virtual machine in the external network to check the
|
to directly start a virtual machine in the external network to check the
|
||||||
network connectivity.
|
network connectivity.
|
||||||
|
|
||||||
- 13 Launch VNC console and test connection ::
|
- 12 Launch VNC console and test connection ::
|
||||||
|
|
||||||
nova --os-region-name=RegionOne get-vnc-console vm1 novnc
|
nova --os-region-name=RegionOne get-vnc-console vm1 novnc
|
||||||
nova --os-region-name=RegionTwo get-vnc-console vm2 novnc
|
nova --os-region-name=RegionTwo get-vnc-console vm2 novnc
|
||||||
|
|
||||||
You should be able to ping vm1 from vm2 and vice versa.
|
You should be able to ping vm1 from vm2 and vice versa.
|
||||||
|
|
||||||
- 14 Create floating ip in central Neutron server ::
|
- 13 Create floating ip in central Neutron server ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion floatingip-create ext-net
|
neutron --os-region-name=CentralRegion floatingip-create ext-net
|
||||||
|
|
||||||
- 15 Associate floating ip ::
|
- 14 Associate floating ip ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion floatingip-list
|
neutron --os-region-name=CentralRegion floatingip-list
|
||||||
neutron --os-region-name=CentralRegion port-list
|
neutron --os-region-name=CentralRegion port-list
|
||||||
|
@ -17,25 +17,25 @@ installing DevStack in virtual machine.
|
|||||||
https://github.com/openstack/tricircle/blob/master/devstack/local.conf.sample
|
https://github.com/openstack/tricircle/blob/master/devstack/local.conf.sample
|
||||||
to local.conf, change password in the file if needed.
|
to local.conf, change password in the file if needed.
|
||||||
|
|
||||||
- 3 Run DevStack. In DevStack folder, run::
|
- 3 Run DevStack. In DevStack folder, run ::
|
||||||
|
|
||||||
./stack.sh
|
./stack.sh
|
||||||
|
|
||||||
- 4 After DevStack successfully starts, we need to create environment variables for
|
- 4 After DevStack successfully starts, we need to create environment variables for
|
||||||
the user (admin user as example in this document). In DevStack folder::
|
the user (admin user as example in this document). In DevStack folder ::
|
||||||
|
|
||||||
source openrc admin demo
|
source openrc admin demo
|
||||||
|
|
||||||
- 5 Unset the region name environment variable, so that the command can be issued to
|
- 5 Unset the region name environment variable, so that the command can be issued to
|
||||||
specified region in following commands as needed::
|
specified region in following commands as needed ::
|
||||||
|
|
||||||
unset OS_REGION_NAME
|
unset OS_REGION_NAME
|
||||||
|
|
||||||
- 6 Check if services have been correctly registered. Run::
|
- 6 Check if services have been correctly registered. Run ::
|
||||||
|
|
||||||
openstack --os-region-name=RegionOne endpoint list
|
openstack --os-region-name=RegionOne endpoint list
|
||||||
|
|
||||||
you should get output looks like as following::
|
you should get output looks like as following ::
|
||||||
|
|
||||||
+----------------------------------+---------------+--------------+----------------+
|
+----------------------------------+---------------+--------------+----------------+
|
||||||
| ID | Region | Service Name | Service Type |
|
| ID | Region | Service Name | Service Type |
|
||||||
@ -59,41 +59,34 @@ installing DevStack in virtual machine.
|
|||||||
"RegionOne" is the normal OpenStack region which includes Nova, Cinder,
|
"RegionOne" is the normal OpenStack region which includes Nova, Cinder,
|
||||||
Neutron.
|
Neutron.
|
||||||
|
|
||||||
- 7 Get token for the later commands. Run::
|
- 7 Create pod instances for the Tricircle to manage the mapping between
|
||||||
|
availability zone and OpenStack instances ::
|
||||||
|
|
||||||
openstack --os-region-name=RegionOne token issue
|
openstack multiregion networking pod create --region-name CentralRegion
|
||||||
|
|
||||||
- 8 Create pod instances for the Tricircle to manage the mapping between
|
openstack multiregion networking pod create --region-name RegionOne --availability-zone az1
|
||||||
availability zone and OpenStack instances, the "$token" is obtained in the
|
|
||||||
step 7::
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "CentralRegion"}}'
|
|
||||||
|
|
||||||
curl -X POST http://127.0.0.1/tricircle/v1.0/pods -H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionOne", "az_name": "az1"}}'
|
|
||||||
|
|
||||||
Pay attention to "region_name" parameter we specify when creating pod. Pod name
|
Pay attention to "region_name" parameter we specify when creating pod. Pod name
|
||||||
should exactly match the region name registered in Keystone. In the above
|
should exactly match the region name registered in Keystone. In the above
|
||||||
commands, we create pods named "CentralRegion" and "RegionOne".
|
commands, we create pods named "CentralRegion" and "RegionOne".
|
||||||
|
|
||||||
- 9 Create necessary resources in central Neutron server::
|
- 8 Create necessary resources in central Neutron server ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion net-create net1
|
neutron --os-region-name=CentralRegion net-create --availability-zone-hint RegionOne net1
|
||||||
neutron --os-region-name=CentralRegion subnet-create net1 10.0.0.0/24
|
neutron --os-region-name=CentralRegion subnet-create net1 10.0.0.0/24
|
||||||
|
|
||||||
Please note that the net1 ID will be used in later step to boot VM.
|
Please note that the net1 ID will be used in later step to boot VM.
|
||||||
|
|
||||||
- 10 Get image ID and flavor ID which will be used in VM booting::
|
- 9 Get image ID and flavor ID which will be used in VM booting ::
|
||||||
|
|
||||||
glance --os-region-name=RegionOne image-list
|
glance --os-region-name=RegionOne image-list
|
||||||
nova --os-region-name=RegionOne flavor-list
|
nova --os-region-name=RegionOne flavor-list
|
||||||
|
|
||||||
- 11 Boot a virtual machine::
|
- 10 Boot a virtual machine ::
|
||||||
|
|
||||||
nova --os-region-name=RegionOne boot --flavor 1 --image $image_id --nic net-id=$net_id vm1
|
nova --os-region-name=RegionOne boot --flavor 1 --image $image_id --nic net-id=$net_id vm1
|
||||||
|
|
||||||
- 12 Verify the VM is connected to the net1::
|
- 11 Verify the VM is connected to the net1 ::
|
||||||
|
|
||||||
neutron --os-region-name=CentralRegion port-list
|
neutron --os-region-name=CentralRegion port-list
|
||||||
neutron --os-region-name=RegionOne port-list
|
neutron --os-region-name=RegionOne port-list
|
||||||
|
@ -36,20 +36,12 @@ unset OS_REGION_NAME
|
|||||||
mytoken=$(openstack --os-region-name=RegionOne token issue | awk 'NR==5 {print $4}')
|
mytoken=$(openstack --os-region-name=RegionOne token issue | awk 'NR==5 {print $4}')
|
||||||
echo $mytoken
|
echo $mytoken
|
||||||
|
|
||||||
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
|
openstack multiregion networking pod create --region-name CentralRegion
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $mytoken" -d '{"pod": {"region_name": "CentralRegion"}}'
|
|
||||||
|
|
||||||
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
|
openstack multiregion networking pod create --region-name RegionOne --availability-zone az1
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $mytoken" \
|
|
||||||
-d '{"pod": {"region_name": "RegionOne", "az_name": "az1"}}'
|
|
||||||
|
|
||||||
if [ "$DEVSTACK_GATE_TOPOLOGY" == "multinode" ]; then
|
if [ "$DEVSTACK_GATE_TOPOLOGY" == "multinode" ]; then
|
||||||
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
|
openstack multiregion networking pod create --region-name RegionTwo --availability-zone az2
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Auth-Token: $mytoken" \
|
|
||||||
-d '{"pod": {"region_name": "RegionTwo", "az_name": "az2"}}'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# the usage of "nova flavor-create":
|
# the usage of "nova flavor-create":
|
||||||
|
Loading…
Reference in New Issue
Block a user