Autoformatting files

pull/7745/head
Olli-Pekka Puolitaival 2018-08-20 09:50:55 +03:00
parent 912c4f5c05
commit 54ff956461
5 changed files with 34 additions and 28 deletions

View File

@ -12,11 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from icetea_lib.bench import Bench
from interface import interfaceUp, interfaceDown
import threading import threading
import time import time
from icetea_lib.bench import Bench
from interface import interfaceUp, interfaceDown
class Testcase(Bench): class Testcase(Bench):
def __init__(self): def __init__(self):
@ -52,8 +54,8 @@ class Testcase(Bench):
self.logger.info("Starting") self.logger.info("Starting")
time.sleep(5) # wait accept from server time.sleep(5) # wait accept from server
self.command("dut2", "socket " + str(self.client_socket_id) + " open") self.command("dut2", "socket " + str(self.client_socket_id) + " open")
self.command("dut2", "socket " + str(self.client_socket_id) + " connect " + str(self.server_ip) + " " + str(self.used_port)) self.command("dut2", "socket " + str(self.client_socket_id) + " connect " + str(self.server_ip) + " " + str(
self.used_port))
def case(self): def case(self):
self.used_port = 2000 self.used_port = 2000
@ -95,7 +97,6 @@ class Testcase(Bench):
self.command("dut1", "socket " + str(server_base_socket_id) + " delete") self.command("dut1", "socket " + str(server_base_socket_id) + " delete")
self.command("dut2", "socket " + str(self.client_socket_id) + " delete") self.command("dut2", "socket " + str(self.client_socket_id) + " delete")
def teardown(self): def teardown(self):
interfaceDown(self, ["dut1"]) interfaceDown(self, ["dut1"])
interfaceDown(self, ["dut2"]) interfaceDown(self, ["dut2"])

View File

@ -12,10 +12,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from icetea_lib.bench import Bench, TestStepFail
import random import random
import string import string
from icetea_lib.bench import Bench, TestStepFail
class Testcase(Bench): class Testcase(Bench):
def __init__(self): def __init__(self):

View File

@ -19,6 +19,7 @@ This script is intended to be a common test data generator.
Currently it implements randomUppercaseAsciiString, randomLowercaseAsciiString methods. Currently it implements randomUppercaseAsciiString, randomLowercaseAsciiString methods.
''' '''
def randomUppercaseAsciiString(length): def randomUppercaseAsciiString(length):
return ''.join(random.choice(string.ascii_uppercase) for i in range(length)) return ''.join(random.choice(string.ascii_uppercase) for i in range(length))

View File

@ -13,11 +13,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from icetea_lib.TestStepError import TestStepFail from icetea_lib.TestStepError import TestStepFail
''' '''
This interface script is intended to be a common library to be used in testcase scripts by testers. This interface script is intended to be a common library to be used in testcase scripts by testers.
It delegates setUp and tearDown functions with different provided network interface types using setUp() and tearDown() methods. It delegates setUp and tearDown functions with different provided network interface types using setUp() and tearDown() methods.
''' '''
def interfaceUp(tc, duts): def interfaceUp(tc, duts):
interfaces = {} interfaces = {}
for dut in duts: for dut in duts:
@ -35,6 +37,7 @@ def interfaceUp(tc, duts):
interfaces.update(interface) interfaces.update(interface)
return interfaces return interfaces
def interfaceDown(tc, duts): def interfaceDown(tc, duts):
for dut in duts: for dut in duts:
tc.command(dut, "ifdown") tc.command(dut, "ifdown")