Test-Onboarding:
Adding multiple changes to specific test cases,
checking for cleaup also.
Change-Id: I112e61a9306d58d2f7fa6207ea8bb787cdc8cf22
diff --git a/src/test/onboarding/onboardingTest.py b/src/test/onboarding/onboardingTest.py
index c324320..6b0b4f6 100644
--- a/src/test/onboarding/onboardingTest.py
+++ b/src/test/onboarding/onboardingTest.py
@@ -25,13 +25,13 @@
from nose.tools import assert_equal, assert_not_equal
from twisted.internet import defer
from nose.twistedtools import reactor, deferred
-from CordTestUtils import get_mac, log_test
+from CordTestUtils import *
from onosclidriver import OnosCliDriver
from OnosCtrl import OnosCtrl
from OltConfig import OltConfig
from OnboardingServiceUtils import OnboardingServiceUtils
from SSHTestAgent import SSHTestAgent
-from CordTestUtils import running_on_pod, getstatusoutput
+from CordTestConfig import setup_module, running_on_ciab
from CordLogger import CordLogger
from CordTestUtils import *
from CordTestUtils import log_test as log
@@ -456,6 +456,8 @@
2. Do curl request to the example service running VM IP from test client
3. Verifying curl request success
"""
+ if self.on_pod is False:
+ return
df = defer.Deferred()
def test_exampleservice(df):
vm_public_ip = self.get_exampleservice_vm_public_ip()
@@ -591,12 +593,12 @@
self.add_static_route_via_vcpe_interface([vm_public_ip],vcpe=vcpe_intf)
#curl request from test container
cmd = 'curl -s http://{} --max-time 5'.format(vm_public_ip)
- st,_ = getstatusoutput(cmd)
+ st, out = getstatusoutput(cmd)
assert_not_equal(out,'')
- st,_ = getstatusoutput('ifconfig {} down'.format(vcpe_intf))
+ st, _ = getstatusoutput('ifconfig {} down'.format(vcpe_intf))
assert_equal(st, False)
time.sleep(1)
- st,_ = getstatusoutput('ifconfig {} up'.format(vcpe_intf))
+ st, _ = getstatusoutput('ifconfig {} up'.format(vcpe_intf))
assert_equal(st, False)
time.sleep(1)
self.add_static_route_via_vcpe_interface([vm_public_ip],vcpe=vcpe_intf)
@@ -607,6 +609,7 @@
raise
finally:
self.del_static_route_via_vcpe_interface([vm_public_ip],vcpe=vcpe_intf)
+ getstatusoutput('ifconfig {} up'.format(vcpe_intf))
df.callback(0)
reactor.callLater(0,test_exampleservice,df)
return df
@@ -691,11 +694,13 @@
assert_not_equal(out,'')
log.info('Suspending example service running vm')
service_vm.suspend()
- time.sleep(2)
+ time.sleep(5)
st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
assert_equal(out,'')
service_vm.resume()
time.sleep(5)
+ st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
+ assert_not_equal(out,'')
except Exception as error:
log.info('Got Unexpected error %s'%error)
service_vm.stop()
@@ -735,7 +740,7 @@
assert_not_equal(service_vm,None)
try:
self.add_static_route_via_vcpe_interface([vm_public_ip],vcpe=vcpe_intf)
- st,_ = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
+ st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
assert_not_equal(out,'')
log.info('Restarting example service running vm')
service_vm.reboot()
@@ -759,6 +764,7 @@
reactor.callLater(0,test_exampleservice,df)
return df
+ #not test. vSG VM goes down after restart
@deferred(70)
def test_exampleservice_access_after_vsg_vm_restart(self):
"""
@@ -781,7 +787,7 @@
vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
try:
self.add_static_route_via_vcpe_interface([vm_public_ip],vcpe=vcpe_intf)
- st,_ = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
+ st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
assert_not_equal(out,'')
log.info('Restarting vSG VM')
vsg.reboot()
@@ -805,7 +811,7 @@
reactor.callLater(0,test_exampleservice,df)
return df
- @deferred(60)
+ @deferred(80)
def test_exampleservice_access_after_service_stop(self):
"""
Algo:
@@ -841,10 +847,10 @@
st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
assert_equal(out,'')
service_vm.start()
- time.sleep(15)
+ time.sleep(5)
clock = 0
status = False
- while(clock <= 40):
+ while(clock <= 60):
time.sleep(5)
st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
if out != '':
@@ -862,7 +868,7 @@
reactor.callLater(0,test_exampleservice,df)
return df
- @deferred(60)
+ @deferred(80)
def test_exampleservice_for_service_message_after_service_stop_and_start(self, service_message="\"hello\""):
"""
Algo:
@@ -894,13 +900,13 @@
assert_not_equal(out,'')
log.info('Stopping example service running VM')
service_vm.stop()
- time.sleep(1)
+ time.sleep(5)
st, out = getstatusoutput('curl -s http://{} --max-time 5'.format(vm_public_ip))
assert_equal(out,'')
service.start()
time.sleep(5)
clock = 0
- while(clock <= 30):
+ while(clock <= 60):
time.sleep(5)
st,out = getstatusoutput('curl -s http://{} --max-time 10'.format(vm_public_ip))
if out != '':
@@ -910,7 +916,7 @@
line = line.split(':')
if line[0].strip() == 'Service Message':
srvs_msg = line[1].strip()
- clock = 30
+ clock = 60
break
clock += 5
assert_equal(service_message, srvs_msg)