Browse Source

Fix the smoke test error

1. What is the problem?

the smoke test can not pass, because the

new version of openstack-sdk change.

2. What is the solution to the problem?

use the new method for the new version openstack-sdk.

3. What the features to be implemented in the Tricircle to realize the solution?

No new features.

Change-Id: I642086dac5d1320c7a04adf756b9bfe74a08a68c
Signed-off-by: song baisen <songbaisen@szzt.com.cn>
Co-Authored-By: zhiyuan_cai <luckyvega.g@gmail.com>
changes/94/541094/9
songbaisen 3 years ago
committed by zhiyuan_cai
parent
commit
5f76fdae96
14 changed files with 118 additions and 103 deletions
  1. +2
    -0
      devstack/plugin.sh
  2. +4
    -2
      tricircle/tempestplugin/run_yaml_test.py
  3. +4
    -4
      tricircle/tempestplugin/smoke_test.sh
  4. +33
    -13
      tricircle/tempestplugin/task_runner.py
  5. +6
    -3
      tricircle/tests/network_sdk/network_service.py
  6. +7
    -7
      tricircle/tests/network_sdk/v2/_proxy.py
  7. +16
    -19
      tricircle/tests/network_sdk/v2/flow_classifier.py
  8. +9
    -12
      tricircle/tests/network_sdk/v2/port_chain.py
  9. +9
    -12
      tricircle/tests/network_sdk/v2/port_pair.py
  10. +8
    -11
      tricircle/tests/network_sdk/v2/port_pair_group.py
  11. +10
    -11
      tricircle/tests/network_sdk/v2/trunk.py
  12. +6
    -2
      tricircle/tests/tricircle_sdk/multiregion_network_service.py
  13. +3
    -3
      tricircle/tests/tricircle_sdk/v1/_proxy.py
  14. +1
    -4
      tricircle/tests/tricircle_sdk/v1/job.py

+ 2
- 0
devstack/plugin.sh View File

@ -413,6 +413,8 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
if [[ "$TRICIRCLE_DEPLOY_WITH_CELL" == "True" ]]; then
# update the local nova.conf
init_local_nova_conf
else
iniset $NOVA_CONF glance region_name $REGION_NAME
fi
# add default bridges br-vlan, br-ext if needed, ovs-vsctl


+ 4
- 2
tricircle/tempestplugin/run_yaml_test.py View File

@ -18,8 +18,10 @@ import task_runner
if __name__ == '__main__':
yaml_path, auth_url, project, user, password = sys.argv[1:]
runner = task_runner.SDKRunner(auth_url, project, user, password)
(yaml_path, auth_url, project, user, password,
project_domain_id, user_domain_id) = sys.argv[1:]
runner = task_runner.SDKRunner(auth_url, project, user,
password, project_domain_id, user_domain_id)
engine = task_runner.RunnerEngine(yaml_path, runner)
error_msg = engine.run_task_sets()


+ 4
- 4
tricircle/tempestplugin/smoke_test.sh View File

@ -6,17 +6,17 @@ source $DEVSTACK_DIR/openrc admin admin
unset OS_REGION_NAME
echo "Start to run single gateway topology test"
python run_yaml_test.py single_gw_topology_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD"
python run_yaml_test.py single_gw_topology_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD" "$OS_PROJECT_DOMAIN_ID" "$OS_USER_DOMAIN_ID"
if [ $? != 0 ]; then
die $LINENO "Smoke test fails, error in single gateway topology test"
fi
echo "Start to run multi gateway topology test"
python run_yaml_test.py multi_gw_topology_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD"
python run_yaml_test.py multi_gw_topology_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD" "$OS_PROJECT_DOMAIN_ID" "$OS_USER_DOMAIN_ID"
if [ $? != 0 ]; then
die $LINENO "Smoke test fails, error in multi gateway topology test"
fi
echo "Start to run trunk test"
python run_yaml_test.py trunk_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD"
python run_yaml_test.py trunk_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD" "$OS_PROJECT_DOMAIN_ID" "$OS_USER_DOMAIN_ID"
if [ $? != 0 ]; then
die $LINENO "Smoke test fails, error in trunk test"
fi
@ -26,7 +26,7 @@ fi
# die $LINENO "Smoke test fails, error in service function chain test"
#fi
echo "Start to run qos policy function test"
python run_yaml_test.py qos_policy_rule_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD"
python run_yaml_test.py qos_policy_rule_test.yaml "$OS_AUTH_URL" "$OS_TENANT_NAME" "$OS_USERNAME" "$OS_PASSWORD" "$OS_PROJECT_DOMAIN_ID" "$OS_USER_DOMAIN_ID"
if [ $? != 0 ]; then
die $LINENO "Smoke test fails, error in service function chain test"
fi

+ 33
- 13
tricircle/tempestplugin/task_runner.py View File

@ -20,7 +20,6 @@ import traceback
import yaml
from openstack import connection
from openstack import profile
from tricircle.tests.network_sdk import network_service
from tricircle.tests.tricircle_sdk import multiregion_network_service
@ -87,46 +86,63 @@ class SDKRunner(object):
type_plural_map = {
'qos_policy': 'qos_policie'}
def __init__(self, auth_url, project, username, password):
def __init__(self, auth_url, project, username, password,
project_domain_id, user_domain_id):
self.res_serv_map = {}
for serv in self.serv_reslist_map:
for res in self.serv_reslist_map[serv]:
self.res_serv_map[res] = serv
self.connection_map = {}
param = {
auth = {
'auth_url': auth_url,
'project_name': project,
'user_domain_name': 'default',
'project_domain_name': 'default',
'username': username,
'password': password}
'password': password,
'project_domain_id': project_domain_id,
'user_domain_id': user_domain_id}
for region in ('CentralRegion', 'RegionOne', 'RegionTwo'):
prof = profile.Profile()
extra_services = []
if region == 'CentralRegion':
serv = multiregion_network_service.MultiregionNetworkService(
version='v1')
prof._add_service(serv)
extra_services.append(serv)
net_serv = network_service.NetworkService(version='v2')
prof._add_service(net_serv)
prof.set_region(profile.Profile.ALL, region)
param['profile'] = prof
conn = connection.Connection(**param)
extra_services.append(net_serv)
conn = connection.Connection(region_name=region,
auth=auth,
extra_services=extra_services)
conn.config.config['network_sdk_service_type'] = 'network'
conn.config.config['tricircle_sdk_service_type'] = 'tricircle'
conn.config.config['network_sdk_api_version'] = 'v2'
conn.config.config['tricircle_sdk_api_version'] = 'v1'
for service in extra_services:
conn.add_service(service)
self.connection_map[region] = conn
def create(self, region, _type, params):
conn = self.connection_map[self.region_map[region]]
serv = self.res_serv_map[_type]
_type = self.res_alias_map.get(_type, _type)
proxy = getattr(conn, serv)
desc = getattr(conn, serv)
try:
proxy = desc.__get__(conn, '')
except Exception:
proxy = desc
return getattr(proxy, 'create_%s' % _type)(**params)
def action(self, region, _type, target, method, params):
conn = self.connection_map[self.region_map[region]]
serv = self.res_serv_map[_type]
_type = self.res_alias_map.get(_type, _type)
proxy = getattr(conn, serv)
desc = getattr(conn, serv)
try:
proxy = desc.__get__(conn, '')
except Exception:
proxy = desc
if method in ('update', 'delete'):
method = '%s_%s' % (method, _type)
getattr(proxy, method)(target, **params)
@ -135,7 +151,11 @@ class SDKRunner(object):
conn = self.connection_map[self.region_map[region]]
serv = self.res_serv_map[_type]
_type = self.res_alias_map.get(_type, _type)
proxy = getattr(conn, serv)
desc = getattr(conn, serv)
try:
proxy = desc.__get__(conn, '')
except Exception:
proxy = desc
_type = self.type_plural_map.get(_type, _type)
_list = list(getattr(proxy, '%ss' % _type)(**params))
if get_one:


+ 6
- 3
tricircle/tests/network_sdk/network_service.py View File

@ -10,15 +10,18 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import service_description
from openstack import service_filter
from tricircle.tests.network_sdk.v2 import _proxy
class NetworkService(service_filter.ServiceFilter):
class NetworkService(service_description.ServiceDescription):
"""The network service."""
valid_versions = [service_filter.ValidVersion('v2', 'v2.0')]
proxy_class = _proxy.Proxy
def __init__(self, version=None):
"""Create a network service."""
super(NetworkService, self).__init__(service_type='network',
version=version)
super(NetworkService, self).__init__(service_type='network_sdk')

+ 7
- 7
tricircle/tests/network_sdk/v2/_proxy.py View File

@ -33,17 +33,17 @@ class Proxy(_proxy.Proxy):
return self._update(_trunk.Trunk, trunk, **attrs)
def trunks(self, **query):
return self._list(_trunk.Trunk, pagination=False, **query)
return self._list(_trunk.Trunk, **query)
def add_subports(self, trunk, subports=[]):
trunk = self._get_resource(_trunk.Trunk, trunk)
body = {'sub_ports': subports}
return trunk.add_subports(self._session, **body)
return trunk.add_subports(self, **body)
def remove_subports(self, trunk, subports=[]):
trunk = self._get_resource(_trunk.Trunk, trunk)
body = {'sub_ports': subports}
return trunk.remove_subports(self._session, **body)
return trunk.remove_subports(self, **body)
# port pair
def create_port_pair(self, **attrs):
@ -56,7 +56,7 @@ class Proxy(_proxy.Proxy):
return self._update(_pp.PortPair, pp, **attrs)
def port_pairs(self, **query):
return self._list(_pp.PortPair, pagination=False, **query)
return self._list(_pp.PortPair, **query)
# port pair group
def create_port_pair_group(self, **attrs):
@ -69,7 +69,7 @@ class Proxy(_proxy.Proxy):
return self._update(_ppg.PortPairGroup, ppg, **attrs)
def port_pair_groups(self, **query):
return self._list(_ppg.PortPairGroup, pagination=False, **query)
return self._list(_ppg.PortPairGroup, **query)
# port chain
def create_port_chain(self, **attrs):
@ -82,7 +82,7 @@ class Proxy(_proxy.Proxy):
return self._update(_pc.PortChain, pc, **attrs)
def port_chains(self, **query):
return self._list(_pc.PortChain, pagination=False, **query)
return self._list(_pc.PortChain, **query)
# flow classifier
def create_flow_classifier(self, **attrs):
@ -95,4 +95,4 @@ class Proxy(_proxy.Proxy):
return self._update(_fc.FlowClassifier, fc, **attrs)
def flow_classifiers(self, **query):
return self._list(_fc.FlowClassifier, pagination=False, **query)
return self._list(_fc.FlowClassifier, **query)

+ 16
- 19
tricircle/tests/network_sdk/v2/flow_classifier.py View File

@ -10,16 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from openstack import resource
from tricircle.tests.network_sdk import network_service
class FlowClassifier(resource2.Resource):
class FlowClassifier(resource.Resource):
resource_key = 'flow_classifier'
resources_key = 'flow_classifiers'
base_path = '/sfc/flow_classifiers'
service = network_service.NetworkService()
allow_create = True
allow_get = True
@ -27,18 +24,18 @@ class FlowClassifier(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters('name')
_query_mapping = resource.QueryParameters('name')
name = resource2.Body('name')
description = resource2.Body('description')
ethertype = resource2.Body('ingress')
protocol = resource2.Body('protocol')
source_port_range_min = resource2.Body('source_port_range_min')
source_port_range_max = resource2.Body('source_port_range_max')
destination_port_range_min = resource2.Body('destination_port_range_min')
destination_port_range_max = resource2.Body('destination_port_range_max')
source_ip_prefix = resource2.Body('source_ip_prefix')
destination_ip_prefix = resource2.Body('destination_ip_prefix')
logical_source_port = resource2.Body('logical_source_port')
logical_destination_port = resource2.Body('logical_destination_port')
l7_parameters = resource2.Body('l7_parameters', type=dict)
name = resource.Body('name')
description = resource.Body('description')
ethertype = resource.Body('ingress')
protocol = resource.Body('protocol')
source_port_range_min = resource.Body('source_port_range_min')
source_port_range_max = resource.Body('source_port_range_max')
destination_port_range_min = resource.Body('destination_port_range_min')
destination_port_range_max = resource.Body('destination_port_range_max')
source_ip_prefix = resource.Body('source_ip_prefix')
destination_ip_prefix = resource.Body('destination_ip_prefix')
logical_source_port = resource.Body('logical_source_port')
logical_destination_port = resource.Body('logical_destination_port')
l7_parameters = resource.Body('l7_parameters', type=dict)

+ 9
- 12
tricircle/tests/network_sdk/v2/port_chain.py View File

@ -10,16 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from openstack import resource
from tricircle.tests.network_sdk import network_service
class PortChain(resource2.Resource):
class PortChain(resource.Resource):
resource_key = 'port_chain'
resources_key = 'port_chains'
base_path = '/sfc/port_chains'
service = network_service.NetworkService()
allow_create = True
allow_get = True
@ -27,11 +24,11 @@ class PortChain(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters('name')
_query_mapping = resource.QueryParameters('name')
name = resource2.Body('name')
description = resource2.Body('description')
port_pair_groups = resource2.Body('port_pair_groups', type=list)
flow_classifiers = resource2.Body('flow_classifiers', type=list)
chain_parameters = resource2.Body('chain_parameters', type=dict)
chain_id = resource2.Body('chain_id')
name = resource.Body('name')
description = resource.Body('description')
port_pair_groups = resource.Body('port_pair_groups', type=list)
flow_classifiers = resource.Body('flow_classifiers', type=list)
chain_parameters = resource.Body('chain_parameters', type=dict)
chain_id = resource.Body('chain_id')

+ 9
- 12
tricircle/tests/network_sdk/v2/port_pair.py View File

@ -10,16 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from openstack import resource
from tricircle.tests.network_sdk import network_service
class PortPair(resource2.Resource):
class PortPair(resource.Resource):
resource_key = 'port_pair'
resources_key = 'port_pairs'
base_path = '/sfc/port_pairs'
service = network_service.NetworkService()
allow_create = True
allow_get = True
@ -27,11 +24,11 @@ class PortPair(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters('name')
_query_mapping = resource.QueryParameters('name')
name = resource2.Body('name')
description = resource2.Body('description')
ingress = resource2.Body('ingress')
egress = resource2.Body('egress')
service_function_parameters = resource2.Body('service_function_parameters',
type=dict)
name = resource.Body('name')
description = resource.Body('description')
ingress = resource.Body('ingress')
egress = resource.Body('egress')
service_function_parameters = resource.Body('service_function_parameters',
type=dict)

+ 8
- 11
tricircle/tests/network_sdk/v2/port_pair_group.py View File

@ -10,16 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from openstack import resource
from tricircle.tests.network_sdk import network_service
class PortPairGroup(resource2.Resource):
class PortPairGroup(resource.Resource):
resource_key = 'port_pair_group'
resources_key = 'port_pair_groups'
base_path = '/sfc/port_pair_groups'
service = network_service.NetworkService()
allow_create = True
allow_get = True
@ -27,10 +24,10 @@ class PortPairGroup(resource2.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource2.QueryParameters('name')
_query_mapping = resource.QueryParameters('name')
name = resource2.Body('name')
description = resource2.Body('description')
port_pairs = resource2.Body('port_pairs', type=list)
port_pair_group_parameters = resource2.Body('port_pair_group_parameters',
type=dict)
name = resource.Body('name')
description = resource.Body('description')
port_pairs = resource.Body('port_pairs', type=list)
port_pair_group_parameters = resource.Body('port_pair_group_parameters',
type=dict)

+ 10
- 11
tricircle/tests/network_sdk/v2/trunk.py View File

@ -10,17 +10,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from openstack import resource
from openstack import utils
from tricircle.tests.network_sdk import network_service
class Trunk(resource2.Resource):
class Trunk(resource.Resource):
resource_key = 'trunk'
resources_key = 'trunks'
base_path = '/trunks'
service = network_service.NetworkService()
allow_create = True
allow_get = True
@ -28,17 +25,19 @@ class Trunk(resource2.Resource):
allow_delete = True
allow_list = True
status = resource2.Body('status')
name = resource2.Body('name')
port_id = resource2.Body('port_id')
sub_ports = resource2.Body('sub_ports', type=list)
status = resource.Body('status')
name = resource.Body('name')
port_id = resource.Body('port_id')
sub_ports = resource.Body('sub_ports', type=list)
def add_subports(self, session, **body):
url = utils.urljoin(self.base_path, self.id, 'add_subports')
resp = session.put(url, endpoint_filter=self.service, json=body)
resp = session.put(url, endpoint_filter={'service_type': 'network'},
json=body)
return resp.json()
def remove_subports(self, session, **body):
url = utils.urljoin(self.base_path, self.id, 'remove_subports')
resp = session.put(url, endpoint_filter=self.service, json=body)
resp = session.put(url, endpoint_filter={'service_type': 'network'},
json=body)
return resp.json()

+ 6
- 2
tricircle/tests/tricircle_sdk/multiregion_network_service.py View File

@ -12,13 +12,17 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import service_description
from openstack import service_filter
from tricircle.tests.tricircle_sdk.v1 import _proxy
class MultiregionNetworkService(service_filter.ServiceFilter):
class MultiregionNetworkService(service_description.ServiceDescription):
valid_versions = [service_filter.ValidVersion('v1')]
proxy_class = _proxy.Proxy
def __init__(self, version=None):
# TODO(zhiyuan) register a proper service type in keystone
super(MultiregionNetworkService, self).__init__(
service_type='tricircle', version=version)
service_type='tricircle_sdk')

+ 3
- 3
tricircle/tests/tricircle_sdk/v1/_proxy.py View File

@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import proxy2
from openstack import proxy
from tricircle.tests.tricircle_sdk.v1 import job
class Proxy(proxy2.BaseProxy):
class Proxy(proxy.BaseProxy):
def jobs(self, **query):
return self._list(job.Job, pagination=False, **query)
return self._list(job.Job, **query)

+ 1
- 4
tricircle/tests/tricircle_sdk/v1/job.py View File

@ -12,16 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack import resource2
from tricircle.tests.tricircle_sdk import multiregion_network_service
from openstack import resource as resource2
class Job(resource2.Resource):
resource_key = 'job'
resources_key = 'jobs'
base_path = '/jobs'
service = multiregion_network_service.MultiregionNetworkService()
allow_list = True
allow_get = True


Loading…
Cancel
Save