-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_val.py
More file actions
executable file
·88 lines (63 loc) · 2.68 KB
/
test_val.py
File metadata and controls
executable file
·88 lines (63 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import unittest, os
from test import test_support
from commands import getoutput
from tempfile import mkstemp
class ValTestCase(unittest.TestCase):
def setUp(self):
fd, self.test_file = mkstemp()
os.write(fd, """
;; ------------- Replication and Master/Slave notification
; RmiLocalAddress=0.0.0.0
; RmiLocalPort=33099
No2xxAckReceivedTimeout=32
DEVICE=eth0:mng
IPADDR=192.168.0.1
NETMASK=192.168.0.255
ALLOW_SELF_PINGING=0 # < 0/1 > default=0
ETH_PORTS="eth0 eth1" # < non-empty list of ethXX > default="eth0 eth1"
LOCAL_SOURCE_ADDRESS=(LOCAL_ADDRESS) # < > default=""
NEIGHBOURS="192.168.0.1 192.168.0.2 10.0.0.251" # < List of IP addresses > default=""
log4j.rootLogger=ERROR
log4j.logger.com.comverse=ERROR, K
log4j.appender.K.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%-10t] %-24c{1}\t%-5p\t%m%n
;UnknownCall.ErrorCode = 404
; ProvNotifRequestLoad.1.max=11
[IP_Address]
remote_address=(LOCAL_ADDRESS)
path_tcap_ini=(NCXDIR)/ncxheartbeat ; < /usr/netcentrex/ncxheartbeat > default=/usr/netcentrex/ncxheartbeat
ringBackToneUrl=file://ringin.wav
# MEM_MIN=2048
MEM_MAX=4096
SYSLOGD_OPTIONS="-m 0"
"""
)
os.close(fd)
def compare_output(self, key, val):
self.assertEqual(
getoutput( "./val.py %s %s" % (self.test_file, key) ) , val )
def set_infile(self, keysvals):
os.system( "./val.py --set %s %s" % (self.test_file, keysvals))
def test_get_and_set(self):
"Reading"
self.compare_output(
"log4j.logger.com.comverse log4j.appender.K.layout.ConversionPattern",
"ERROR, K %d{dd/MM/yyyy HH:mm:ss,SSS} [%-10t] %-24c{1}\t%-5p\t%m%n")
self.compare_output("No2xxAckReceivedTimeout", '32' )
self.compare_output("DEVICE", 'eth0:mng' )
self.compare_output("ALLOW_SELF_PINGING", '0' )
self.compare_output("ETH_PORTS" , '"eth0 eth1"')
self.compare_output("NEIGHBOURS", '"192.168.0.1 192.168.0.2 10.0.0.251"')
def test_update(self):
"Updating"
self.set_infile('IPADDR=10.0.0.1 NETMASK=10.0.0.255')
self.set_infile('NEIGHBOURS="10.0.0.1"')
self.set_infile("local_address=10.0.0.1 remote_address=10.0.0.2")
self.set_infile('USER_MEM_ARGS="-Xms1024m -Xmx4096m"')
self.compare_output("IPADDR NETMASK", "10.0.0.1\t10.0.0.255")
self.compare_output("NEIGHBOURS", "10.0.0.1")
self.compare_output("local_address remote_address", "10.0.0.1\t10.0.0.2")
self.compare_output('USER_MEM_ARGS', "-Xms1024m -Xmx4096m")
def tearDown(self):
os.remove(self.test_file)
if __name__ == '__main__':
test_support.run_unittest( ValTestCase )