[Mac Learning API] : Making changes for nsxp

Introducing new backend variable nsxp for policy
Also adding delay due to policy-mp realisation

Change-Id: I1cabecf54d0bf629e05fa829064f73f6a57c8297
This commit is contained in:
Deepthi Kandavara Jayarama 2019-03-21 20:57:53 +00:00
parent e3f9cc7df7
commit 64daec3673
3 changed files with 30 additions and 0 deletions

View File

@ -44,6 +44,7 @@ MD_BASE_URL = "http://169.254.169.254/"
NSX_BACKEND_TIME_INTERVAL = 30
NSX_BACKEND_SMALL_TIME_INTERVAL = 10
NSX_BACKEND_VERY_SMALL_TIME_INTERVAL = 5
NSXP_BACKEND_SMALL_TIME_INTERVAL = 10
# DFW
NSX_FIREWALL_REALIZED_TIMEOUT = 120

View File

@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
from tempest.api.network import base
from tempest.common import custom_matchers
@ -264,10 +265,16 @@ class NSXv3MacLearningTest(base.BaseNetworkTest):
test_port = self.create_port(self.network, name=test_port_name)
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self._delete_port, test_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self._check_mac_learning(test_port, mac_learn_state=False)
updated_os_port = self._update_port_enable_mac_learning(test_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self._check_mac_learning(updated_os_port, mac_learn_state=True)
self._delete_port(updated_os_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self.assertIsNone(self.nsx.get_logical_port(updated_os_port['name']),
"Port %s is not None" % updated_os_port['name'])
@ -285,12 +292,20 @@ class NSXv3MacLearningTest(base.BaseNetworkTest):
test_port = self._create_mac_learn_enabled_port(self.network)
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self._delete_port, test_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self._check_mac_learning(test_port, mac_learn_state=True)
ml_off_port = self._update_port_disable_mac_learning(test_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self._check_mac_learning(ml_off_port, mac_learn_state=False)
ml_on_port = self._update_port_enable_mac_learning(ml_off_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self._check_mac_learning(ml_on_port, mac_learn_state=True)
self._delete_port(ml_on_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self.assertIsNone(self.nsx.get_logical_port(ml_on_port['name']),
"Port %s is not None" % ml_on_port['name'])
@ -308,11 +323,15 @@ class NSXv3MacLearningTest(base.BaseNetworkTest):
new_port_name = data_utils.rand_name('updated_port-')
updated_port = self.update_port(test_port,
name=new_port_name)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
updated_nsx_port = self.nsx.get_logical_port(updated_port['name'])
self.assertEqual(updated_nsx_port['display_name'],
updated_port['name'],
"Updated port names do not match OS and NSX")
self._delete_port(updated_port)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
self.assertIsNone(self.nsx.get_logical_port(updated_port['name']),
"Logical port %s is not None" % updated_port['name'])

View File

@ -11,6 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
from tempest.api.network import base
from tempest import config
@ -18,6 +19,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
from vmware_nsx_tempest_plugin.common import constants
from vmware_nsx_tempest_plugin.services import nsxv3_client
CONF = config.CONF
@ -55,6 +57,8 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
router_name = data_utils.rand_name('router-')
router = self.create_router(router_name, admin_state_up=True)
self.addCleanup(self._delete_router, router['id'])
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(router['name'],
router['id'])
self.assertEqual(router['name'], router_name)
@ -66,6 +70,8 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
update_body = self.routers_client.update_router(router['id'],
name=updated_name)
updated_router = update_body['router']
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(updated_router['name'],
updated_router['id'])
self.assertEqual(updated_router['name'], updated_name)
@ -77,12 +83,16 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
# Create a router
router_name = data_utils.rand_name('router-')
router = self.create_router(router_name, admin_state_up=True)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(router['name'],
router['id'])
self.assertEqual(router['name'], router_name)
self.assertIsNotNone(nsx_router)
# Delete the router and verify it is deleted on nsx backend
self.routers_client.delete_router(router['id'])
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(router['name'],
router['id'])
self.assertIsNone(nsx_router)