11
if [ $1 == 'noauth' ]; then
12
NOAUTH="--tenant_id $noauth_tenant_id"
18
# test the CRUD of network
20
quantum net-create $NOAUTH $network || die "fail to create network $network"
21
temp=`quantum net-list -- --name $network --fields id | wc -l`
23
if [ $temp -ne 5 ]; then
24
die "networks with name $network is not unique or found"
26
network_id=`quantum net-list -- --name $network --fields id | tail -n 2 | head -n 1 | cut -d' ' -f 2`
27
echo "ID of network with name $network is $network_id"
29
quantum net-show $network || die "fail to show network $network"
30
quantum net-show $network_id || die "fail to show network $network_id"
32
quantum net-update $network --admin_state_up False || die "fail to update network $network"
33
quantum net-update $network_id --admin_state_up True || die "fail to update network $network_id"
35
quantum net-list -c id -- --id fakeid || die "fail to list networks with column selection on empty list"
37
# test the CRUD of subnet
40
quantum subnet-create $NOAUTH $network $cidr --name $subnet || die "fail to create subnet $subnet"
41
tempsubnet=`quantum subnet-list -- --name $subnet --fields id | wc -l`
43
if [ $tempsubnet -ne 5 ]; then
44
die "subnets with name $subnet is not unique or found"
46
subnet_id=`quantum subnet-list -- --name $subnet --fields id | tail -n 2 | head -n 1 | cut -d' ' -f 2`
47
echo "ID of subnet with name $subnet is $subnet_id"
48
quantum subnet-show $subnet || die "fail to show subnet $subnet"
49
quantum subnet-show $subnet_id || die "fail to show subnet $subnet_id"
51
quantum subnet-update $subnet --dns_namesevers host1 || die "fail to update subnet $subnet"
52
quantum subnet-update $subnet_id --dns_namesevers host2 || die "fail to update subnet $subnet_id"
54
# test the crud of ports
56
quantum port-create $NOAUTH $network --name $port || die "fail to create port $port"
57
tempport=`quantum port-list -- --name $port --fields id | wc -l`
59
if [ $tempport -ne 5 ]; then
60
die "ports with name $port is not unique or found"
62
port_id=`quantum port-list -- --name $port --fields id | tail -n 2 | head -n 1 | cut -d' ' -f 2`
63
echo "ID of port with name $port is $port_id"
64
quantum port-show $port || die "fail to show port $port"
65
quantum port-show $port_id || die "fail to show port $port_id"
67
quantum port-update $port --device_id deviceid1 || die "fail to update port $port"
68
quantum port-update $port_id --device_id deviceid2 || die "fail to update port $port_id"
70
# test quota commands RUD
75
quantum quota-update --tenant_id $tenant_id --network 30 || die "fail to update quota for tenant $tenant_id"
76
quantum quota-update --tenant_id $tenant_id_b --network 20 || die "fail to update quota for tenant $tenant_id"
77
networks=`quantum quota-list | grep $tenant_id | awk '{print $2}'`
78
if [ $networks -ne 30 ]; then
79
die "networks quota should be 30"
81
networks=`quantum quota-list | grep $tenant_id_b | awk '{print $2}'`
82
if [ $networks -ne 20 ]; then
83
die "networks quota should be 20"
85
networks=`quantum quota-show --tenant_id $tenant_id | grep network | awk -F'|' '{print $3}'`
86
if [ $networks -ne 30 ]; then
87
die "networks quota should be 30"
89
quantum quota-delete --tenant_id $tenant_id || die "fail to delete quota for tenant $tenant_id"
90
networks=`quantum quota-show --tenant_id $tenant_id | grep network | awk -F'|' '{print $3}'`
91
if [ $networks -ne $DEFAULT_NETWORKS ]; then
92
die "networks quota should be $DEFAULT_NETWORKS"
95
if [ "t$NOAUTH" = "t" ]; then
97
quantum quota-update --port 99 || die "fail to update quota for self"
98
ports=`quantum quota-show | grep port | awk -F'|' '{print $3}'`
99
if [ $ports -ne 99 ]; then
100
die "ports quota should be 99"
103
ports=`quantum quota-list | grep 99 | awk '{print $4}'`
104
if [ $ports -ne 99 ]; then
105
die "ports quota should be 99"
107
quantum quota-delete || die "fail to delete quota for tenant self"
108
ports=`quantum quota-show | grep port | awk -F'|' '{print $3}'`
109
if [ $ports -ne $DEFAULT_PORTS ]; then
110
die "ports quota should be $DEFAULT_PORTS"
114
quantum quota-update --port 100
115
if [ $? -eq 0 ]; then
116
die "without valid context on server, quota update command should fail."
119
if [ $? -eq 0 ]; then
120
die "without valid context on server, quota show command should fail."
123
if [ $? -eq 0 ]; then
124
die "without valid context on server, quota delete command should fail."
126
quantum quota-list || die "fail to update quota for self"