Skip to content

Commit

Permalink
Merge pull request #262 from zoufou/v0.6-beta
Browse files Browse the repository at this point in the history
0.6b37
  • Loading branch information
farirat committed Jul 18, 2015
2 parents b1606da + 87d7ef6 commit 8d050e6
Show file tree
Hide file tree
Showing 37 changed files with 2,177 additions and 417 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ python:
# Command to install dependencies
install:
- python setup.py sdist
- sudo pip install dist/jasmin-0.6b36.tar.gz
- sudo pip install dist/jasmin-0.6b37.tar.gz
- sudo cp misc/config/init-script/jasmind-ubuntu /etc/init.d/jasmind
- sudo update-rc.d jasmind defaults
# Commands to run tests:
Expand Down
2 changes: 1 addition & 1 deletion jasmin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAJOR = 0
MINOR = 6
PATCH = 36
PATCH = 37
META = 'b'

def get_version():
Expand Down
3 changes: 3 additions & 0 deletions jasmin/managers/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ def delConnector(self, cid):
self.log.debug('Deleting connector [%s] failed.', cid)
return False

def perspective_version_release(self):
return jasmin.get_release()

def perspective_persist(self, profile = 'jcli-prod'):
path = '%s/%s.smppccs' % (self.config.store_path, profile)
self.log.info('Persisting current configuration to [%s] profile in %s' % (profile, path))
Expand Down
4 changes: 4 additions & 0 deletions jasmin/managers/proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def pickle(self, obj):
def unpickle(self, obj):
return pickle.loads(obj)

@ConnectedPB
def version_release(self):
return self.pb.callRemote('version_release')

@ConnectedPB
def persist(self, profile = "jcli-prod"):
return self.pb.callRemote('persist', profile)
Expand Down
10 changes: 10 additions & 0 deletions jasmin/managers/test/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pickle
import glob
import os
import jasmin
from hashlib import md5
from testfixtures import LogCapture
from twisted.internet import reactor, defer
Expand Down Expand Up @@ -171,6 +172,15 @@ def test_connect_non_anonymous(self):

self.assertFalse(self.isConnected)

class BasicTestCases(SMPPClientPBProxyTestCase):
@defer.inlineCallbacks
def test_version_release(self):
yield self.connect('127.0.0.1', self.pbPort)

version_release = yield self.version_release()

self.assertEqual(version_release, jasmin.get_release())

class ConfigurationPersistenceTestCases(SMPPClientPBProxyTestCase):
@defer.inlineCallbacks
def tearDown(self):
Expand Down
11 changes: 7 additions & 4 deletions jasmin/protocols/cli/statsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,22 @@ def smppc(self, arg, opts):

def smppcs(self, arg, opts):
sc = SMPPClientStatsCollector()
headers = ["#Connector id", "Bound count", "Connected at", "Bound at", "Disconnected at", "Sent elink at", "Received elink at"]
headers = ["#Connector id", "Connected at", "Bound at", "Disconnected at", "Submits", "Delivers", "QoS errs", "Other errs"]

table = []
connectors = self.pb['smppcm'].perspective_connector_list()
for connector in connectors:
row = []
row.append('#%s' % connector['id'])
row.append(sc.get(connector['id']).get('bound_count'))
row.append(formatDateTime(sc.get(connector['id']).get('connected_at')))
row.append(formatDateTime(sc.get(connector['id']).get('bound_at')))
row.append(formatDateTime(sc.get(connector['id']).get('disconnected_at')))
row.append(formatDateTime(sc.get(connector['id']).get('last_sent_elink_at')))
row.append(formatDateTime(sc.get(connector['id']).get('last_received_elink_at')))
row.append('%s/%s' % (sc.get(connector['id']).get('submit_sm_request_count'),
sc.get(connector['id']).get('submit_sm_count')))
row.append('%s/%s' % (sc.get(connector['id']).get('deliver_sm_count'),
sc.get(connector['id']).get('data_sm_count')))
row.append(sc.get(connector['id']).get('throttling_error_count'))
row.append(sc.get(connector['id']).get('other_submit_error_count'))

table.append(row)

Expand Down
114 changes: 70 additions & 44 deletions jasmin/protocols/cli/test/test_statsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_smppc(self):
return self._test(r'jcli : ', commands)

def test_smppcs(self):
expectedList = ['#Connector id\s+Bound count\s+Connected at\s+Bound at\s+Disconnected at\s+Sent elink at\s+Received elink at',
expectedList = ['#Connector id\s+Connected at\s+Bound at\s+Disconnected at\s+Submits\s+Delivers\s+QoS errs\s+Other errs',
'Total connectors: 0']
commands = [{'command': 'stats --smppcs', 'expect': expectedList}]
return self._test(r'jcli : ', commands)
Expand All @@ -46,21 +46,29 @@ def test_httpapi(self):
return self._test(r'jcli : ', commands)

def test_smppsapi(self):
expectedList = ['#Item Value',
'#disconnect_count 0',
'#bound_tx_count 0',
'#bind_rx_count 0',
'#last_received_pdu_at ND',
'#last_received_elink_at ND',
'#connected_count 0',
'#bound_trx_count 0',
'#unbind_count 0',
'#bind_tx_count 0',
'#bound_rx_count 0',
'#bind_trx_count 0',
'#created_at ND',
'#connect_count 0',
'#last_sent_pdu_at ND']
expectedList = ['#Item Value',
'#disconnect_count 0',
'#bound_rx_count 0',
'#bound_tx_count 0',
'#other_submit_error_count 0',
'#bind_rx_count 0',
'#bind_trx_count 0',
'#created_at ND',
'#last_received_elink_at ND',
'#elink_count 0',
'#throttling_error_count 0',
'#submit_sm_count 0',
'#connected_count 0',
'#connect_count 0',
'#bound_trx_count 0',
'#data_sm_count 0',
'#submit_sm_request_count 0',
'#deliver_sm_count 0',
'#last_sent_pdu_at ND',
'#unbind_count 0',
'#last_received_pdu_at ND',
'#bind_tx_count 0',
]
commands = [{'command': 'stats --smppsapi', 'expect': expectedList}]
return self._test(r'jcli : ', commands)

Expand All @@ -79,17 +87,27 @@ def test_user(self):
extraCommands = [{'command': 'uid test_user'}]
self.add_user('jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')

expectedList = ['#Item Type Value',
'#last_activity_at SMPP Server ND',
'#bind_count SMPP Server 0',
"#bound_connections_count SMPP Server {'bind_transmitter': 0, 'bind_receiver': 0, 'bind_transceiver': 0}",
'#submit_sm_request_count SMPP Server 0',
'#qos_last_submit_sm_at SMPP Server ND',
'#unbind_count SMPP Server 0',
'#qos_last_submit_sm_at HTTP Api ND',
'#connects_count HTTP Api 0',
'#last_activity_at HTTP Api ND',
'#submit_sm_request_count HTTP Api 0']
expectedList = [
'#Item Type Value',
'#bind_count SMPP Server 0',
'#submit_sm_count SMPP Server 0',
'#submit_sm_request_count SMPP Server 0',
'#unbind_count SMPP Server 0',
'#data_sm_count SMPP Server 0',
'#last_activity_at SMPP Server ND',
'#other_submit_error_count SMPP Server 0',
'#throttling_error_count SMPP Server 0',
"#bound_connections_count SMPP Server {'bind_transmitter': 0, 'bind_receiver': 0, 'bind_transceiver': 0}",
'#elink_count SMPP Server 0',
'#qos_last_submit_sm_at SMPP Server ND',
'#deliver_sm_count SMPP Server 0',
'#connects_count HTTP Api 0',
'#last_activity_at HTTP Api ND',
'#rate_request_count HTTP Api 0',
'#submit_sm_request_count HTTP Api 0',
'#qos_last_submit_sm_at HTTP Api ND',
'#balance_request_count HTTP Api 0',
]
commands = [{'command': 'stats --user=test_user', 'expect': expectedList}]
return self._test(r'jcli : ', commands)

Expand All @@ -99,8 +117,8 @@ def test_smppcs(self):
extraCommands = [{'command': 'cid test_smppcs'}]
yield self.add_connector(r'jcli : ', extraCommands)

expectedList = ['#Connector id\s+Bound count\s+Connected at\s+Bound at\s+Disconnected at\s+Sent elink at\s+Received elink at',
'#test_smppcs\s+0\s+ND\s+ND\s+ND\s+ND\s+ND',
expectedList = ['#Connector id\s+Connected at\s+Bound at\s+Disconnected at\s+Submits\s+Delivers\s+QoS errs\s+Other errs',
'#test_smppcs\s+ND\s+ND\s+ND\s+0/0\s+0/0\s+0\s+0',
'Total connectors: 1']
commands = [{'command': 'stats --smppcs', 'expect': expectedList}]
yield self._test(r'jcli : ', commands)
Expand All @@ -110,25 +128,33 @@ def test_smppc(self):
extraCommands = [{'command': 'cid test_smppc'}]
yield self.add_connector(r'jcli : ', extraCommands)

expectedList = ['#Connector id\s+Bound count\s+Connected at\s+Bound at\s+Disconnected at\s+Sent elink at\s+Received elink at',
'#test_smppc\s+0\s+ND\s+ND\s+ND\s+ND\s+ND',
expectedList = ['#Connector id\s+Connected at\s+Bound at\s+Disconnected at\s+Submits\s+Delivers\s+QoS errs\s+Other errs',
'#test_smppc\s+ND\s+ND\s+ND\s+0/0\s+0/0\s+0\s+0',
'Total connectors: 1']
commands = [{'command': 'stats --smppcs', 'expect': expectedList}]
yield self._test(r'jcli : ', commands)

expectedList = ['#Item Value',
'#disconnected_count 0',
'#last_received_pdu_at ND',
'#last_received_elink_at ND',
'#connected_count 0',
'#connected_at ND',
expectedList = ['#Item Value',
'#bound_at ND',
'#disconnected_count 0',
'#other_submit_error_count 0',
'#submit_sm_count 0',
'#created_at \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
'#bound_count 0',
'#last_received_elink_at ND',
'#elink_count 0',
'#throttling_error_count 0',
'#last_sent_elink_at ND',
'#connected_count 0',
'#connected_at ND',
'#deliver_sm_count 0',
'#data_sm_count 0',
'#submit_sm_request_count 0',
'#last_seqNum',
'#disconnected_at ND',
'#bound_at ND',
'#created_at \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
'#last_sent_elink_at ND',
'#bound_count 0',
'#last_seqNum_at ND',
'#last_sent_pdu_at ND']
'#last_seqNum_at ND',
'#last_sent_pdu_at ND',
'#disconnected_at ND',
'#last_received_pdu_at ND',
]
commands = [{'command': 'stats --smppc=test_smppc', 'expect': expectedList}]
yield self._test(r'jcli : ', commands)

0 comments on commit 8d050e6

Please sign in to comment.