From e5010468645aa602258dd9e1f144d9aa80edb8fc Mon Sep 17 00:00:00 2001 From: Alton MacDonald Date: Thu, 23 Jan 2014 11:00:42 +0100 Subject: added feature to rename BTS descriptions --- hlr_mgmt/__init__.py | 1 + hlr_mgmt/telnet_backend.py | 7 +++++++ hlr_mgmt/templates/bts.mako | 22 +++++++++++++++++++++- hlr_mgmt/templates/scripts.mako | 2 +- hlr_mgmt/views.py | 8 ++++++++ setup.py | 1 + 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/hlr_mgmt/__init__.py b/hlr_mgmt/__init__.py index 2b257f8..21acb99 100644 --- a/hlr_mgmt/__init__.py +++ b/hlr_mgmt/__init__.py @@ -108,6 +108,7 @@ def main(global_config, **settings): # configuration setup config = Configurator(settings=settings, session_factory=session_factory) + config.include('pyramid_mako') config.include('pyramid_debugtoolbar') config.include('pyramid_exclog') diff --git a/hlr_mgmt/telnet_backend.py b/hlr_mgmt/telnet_backend.py index c2c5dc0..cc5c5e6 100644 --- a/hlr_mgmt/telnet_backend.py +++ b/hlr_mgmt/telnet_backend.py @@ -114,6 +114,13 @@ class telnet_backend(object): def get_timeslot_info(self, bts, timeslot): return self.execute("show timeslot " + bts + " 0 " + timeslot) + + def set_bts_description(self, bts, description): + self.execute('configure terminal') + self.execute('network') + self.execute('bts ' + bts) + self.execute('description ' + description) + return self.save_config() ## OpenSGSN Commands ## diff --git a/hlr_mgmt/templates/bts.mako b/hlr_mgmt/templates/bts.mako index 04159b7..6e79960 100644 --- a/hlr_mgmt/templates/bts.mako +++ b/hlr_mgmt/templates/bts.mako @@ -40,7 +40,7 @@ % else: (OML disconnected) % endif -
${bts[i]['description']} +
${bts[i]['description']} ${table_iterator.iterate(bts[i]['stats'])}

Channel Details

@@ -137,4 +137,24 @@ $('select').tooltip({ placement: "left", title: "Select desired channel configuration" }); + +$('bts_description').tooltip({ + placement: "right", + title: "Click to Edit this Description" +}); + +$('bts_description').editable({ + type: 'text', + placement: 'bottom', + title: 'Edit the Description of this BTS', + emptytext: '____', + inputclass: 'span3', + url: function(params) + { + $.ajax({ + url: '${request.route_url('rename_component',field='bts',value='val',reference='ref')}'.replace('ref/val', params.pk+'/'+params.value) + }); + } +}); + diff --git a/hlr_mgmt/templates/scripts.mako b/hlr_mgmt/templates/scripts.mako index 6d76daf..abc38f3 100644 --- a/hlr_mgmt/templates/scripts.mako +++ b/hlr_mgmt/templates/scripts.mako @@ -58,7 +58,7 @@ - GGSN
(Data Gateway)
+ GGSN
(GPRS Data Gateway)
% if service_status['ggsn']: % if service_status['ggsn'].find("failed")<0: Running diff --git a/hlr_mgmt/views.py b/hlr_mgmt/views.py index 50f0ef0..078e309 100644 --- a/hlr_mgmt/views.py +++ b/hlr_mgmt/views.py @@ -394,6 +394,14 @@ def rename_component_view(request): update_imei_name(request.db, reference, value) if(field=="imsi"): update_imsi_name(request.db, reference, value) + elif(field=="bts"): + settings = request.registry.settings + bsc = connect_bsc(settings) + if bsc.connected==True: + bsc.set_bts_description(reference, value) + bsc.close() + else: + return {'success':1} else: return {'success':0} return {'success':1} diff --git a/setup.py b/setup.py index aca8cb6..702281a 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', + 'pyramid_mako', 'pyramid_debugtoolbar', 'pyramid_exclog', 'waitress', -- cgit v1.2.3