2f7850f3c0
- Added appliance manager to deploy, maintain, update and clean topology appliances for test modules - Added traffic manager to define network related traffic functions - Added feature manager to CRUD feature related tasks - Rewrote test_micro_segmentation_ops.py based on new design - Rewrote L2gaeway nsxv3 tests based on new design - Added L2gateway nsxv3 scenario tests based on new design Change-Id: I571a9dede56266204efd36ad2720340e7128fd79
101 lines
3.7 KiB
Python
101 lines
3.7 KiB
Python
# Copyright 2017 VMware, Inc.
|
|
# All Rights Reserved
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
from oslo_log import log
|
|
|
|
from tempest.lib.services.network import base
|
|
|
|
from vmware_nsx_tempest.common import constants
|
|
|
|
LOG = log.getLogger(__name__)
|
|
|
|
|
|
class L2GatewayClient(base.BaseNetworkClient):
|
|
"""
|
|
Request resources via API for L2GatewayClient
|
|
l2 gateway create request
|
|
l2 gateway update request
|
|
l2 gateway show request
|
|
l2 gateway delete request
|
|
l2 gateway list all request
|
|
"""
|
|
|
|
def create_l2_gateway(self, **kwargs):
|
|
uri = constants.L2_GWS_BASE_URI
|
|
post_data = {constants.L2GW: kwargs}
|
|
LOG.info("URI : %(uri)s, posting data : %(post_data)s",
|
|
{"uri": uri, "post_data": post_data})
|
|
return self.create_resource(uri, post_data)
|
|
|
|
def update_l2_gateway(self, l2_gateway_id, **kwargs):
|
|
uri = constants.L2_GWS_BASE_URI + "/" + l2_gateway_id
|
|
post_data = {constants.L2GW: kwargs}
|
|
constants.LOG.info(
|
|
"URI : %(uri)s, posting data : %(post_data)s",
|
|
{"uri": uri, "post_data": post_data})
|
|
return self.update_resource(uri, post_data)
|
|
|
|
def show_l2_gateway(self, l2_gateway_id, **fields):
|
|
uri = constants.L2_GWS_BASE_URI + "/" + l2_gateway_id
|
|
LOG.info("URI : %(uri)s", {"uri": uri})
|
|
return self.show_resource(uri, **fields)
|
|
|
|
def delete_l2_gateway(self, l2_gateway_id):
|
|
uri = constants.L2_GWS_BASE_URI + "/" + l2_gateway_id
|
|
LOG.info("URI : %(uri)s", {"uri": uri})
|
|
return self.delete_resource(uri)
|
|
|
|
def list_l2_gateways(self, **filters):
|
|
uri = constants.L2_GWS_BASE_URI
|
|
LOG.info("URI : %(uri)s", {"uri": uri})
|
|
return self.list_resources(uri, **filters)
|
|
|
|
|
|
class L2GatewayConnectionClient(base.BaseNetworkClient):
|
|
"""
|
|
Request resources via API for L2GatewayClient
|
|
l2 gateway connection create request
|
|
l2 gateway connection update request
|
|
l2 gateway connection show request
|
|
l2 gateway connection delete request
|
|
l2 gateway connection list all request
|
|
"""
|
|
resource = 'l2_gateway_connection'
|
|
resource_plural = 'l2_gateway_connections'
|
|
path = 'l2-gateway-connections'
|
|
resource_base_path = '/%s' % path
|
|
resource_object_path = '/%s/%%s' % path
|
|
|
|
def create_l2_gateway_connection(self, **kwargs):
|
|
uri = self.resource_base_path
|
|
post_data = {self.resource: kwargs}
|
|
return self.create_resource(uri, post_data)
|
|
|
|
def update_l2_gateway_connection(self, l2_gateway_id, **kwargs):
|
|
uri = self.resource_object_path % l2_gateway_id
|
|
post_data = {self.resource: kwargs}
|
|
return self.update_resource(uri, post_data)
|
|
|
|
def show_l2_gateway_connection(self, l2_gateway_id, **fields):
|
|
uri = self.resource_object_path % l2_gateway_id
|
|
return self.show_resource(uri, **fields)
|
|
|
|
def delete_l2_gateway_connection(self, l2_gateway_id):
|
|
uri = self.resource_object_path % l2_gateway_id
|
|
return self.delete_resource(uri)
|
|
|
|
def list_l2_gateway_connections(self, **filters):
|
|
uri = self.resource_base_path
|
|
return self.list_resources(uri, **filters)
|