Index: /branches/amp_3_7/extensions/license_server/webui/client/device/device.controller.js
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/client/device/device.controller.js	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/client/device/device.controller.js	(working copy)
@@ -144,7 +144,11 @@
                         $rootScope.$broadcast('endLoading', true);
                         if (res&&res.status === 200) {
                             if (res.data[0]) {
-                                vmDeviceTableView.refresh();
+                                $rootScope.TipService.setMessage('The license settings has been updated successfully. Please allow a few seconds for the changes to take effect.');
+                                setTimeout(function(){
+                                    $rootScope.TipService.clear();
+                                    vmDeviceTableView.refresh();
+                                }, 15000);
                             } else {
                                 $rootScope.TipService.setMessage(res.data[1]);
                             }
@@ -164,7 +168,11 @@
                             $rootScope.$broadcast('endLoading', true);
                             if (res&&res.status === 200) {
                                 if (res.data[0]) {
-                                    vmDeviceTableView.refresh();
+                                    $rootScope.TipService.setMessage('The license settings has been updated successfully. Please allow a few seconds for the changes to take effect.');
+                                    setTimeout(function(){
+                                        $rootScope.TipService.clear();
+                                        vmDeviceTableView.refresh();
+                                    }, 15000);
                                 } else {
                                     $rootScope.TipService.setMessage(res.data[1]);
                                 }
Index: /branches/amp_3_7/extensions/license_server/webui/client/device/device_default.html
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/client/device/device_default.html	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/client/device/device_default.html	(working copy)
@@ -1,72 +1,107 @@
-<div class="container-fluid"> 
-        <div class="row">
-            <rd-widget>
-                <rd-widget-header title="{{'Devices'|T}}">
-                </rd-widget-header>
-                <div class="table-toolbar">
-                    <div class="">
-                        <div class="btn-group">
-                            <button title="{{'Refresh'|T}}" class="btn btn-link hive_enable_active" ng-click="table.refresh()"><i class="fa fa-refresh"></i></button>
-                            <button title="{{'Add a Device'|T}}" class="btn btn-link" ng-click="table.showDeviceImportModal()"><i class="fa fa-plus-circle"></i></button>
-                        </div>
+<div class="container-fluid">
+    <div class="row">
+        <rd-widget>
+            <rd-widget-header title="{{'Devices'|T}}">
+            </rd-widget-header>
+            <div class="table-toolbar">
+                <div class="">
+                    <div class="btn-group">
+                        <button title="{{'Refresh'|T}}" class="btn btn-link hive_enable_active"
+                                ng-click="table.refresh()"><i class="fa fa-refresh"></i></button>
+                        <button title="{{'Add a Device'|T}}" class="btn btn-link"
+                                ng-click="table.showDeviceImportModal()"><i class="fa fa-plus-circle"></i></button>
                     </div>
-                    <div class="btn-group pull-right"></div>
                 </div>
-                <div class="table-container" st-table="displayedCollection" st-safe-src="table.tableData">
-                    <div class="table-responsive table-content">
-                        <table class="table table-striped table-hover">
-                            <thead>
-                            <tr>
-                                <th>No.</th>
-                                <th st-sort="ip" style="cursor: pointer;">{{'ip'|T}}</th>
-                                <th st-sort="product_name" style="cursor: pointer;">{{'Product Name'|T}}</th>
-                                <th st-sort="serial_name" style="cursor: pointer;">{{'Serial Name'|T}}</th>
-                                <th st-sort="connection" style="cursor: pointer;">{{'Connection'|T}}</th>
-                                <th st-sort="license" style="cursor: pointer;">{{'License'|T}}</th>
-                                <th st-sort="status" style="cursor: pointer;">{{'Status'|T}}</th>
-                                <th st-sort="bandwidth_mode" style="cursor: pointer;">{{'Bandwidth Mode'|T}}</th>
-                                <th st-sort="assigned_bandwidth" style="cursor: pointer;">{{'Assigned Bandwidth'|T}}</th>
-                                <th st-sort="applied_bandwidth" style="cursor: pointer;">{{'Applied Bandwidth'|T}}</th>
-                                <th st-sort="realtime_bandwidth" style="cursor: pointer;">{{'Real-time Bandwidth'|T}}</th>
-                                <th>{{'Action'|T}}</th>
-                            </tr>
-                            </thead>
-                            <tbody>
-                            <tr ng-repeat="row in displayedCollection">
-                                <td>{{ ((currentPageIndex - 1) * pageSize) + $index + 1 }}</td>
-                                <!-- <td>{{row.ip}}</td> -->
-                                <td><a ui-sref="index.volume_license.device.detail({name:row.ip})" class="active">{{row.ip}}</a></td>
-                                <td>{{row.product_name}}</td>
-                                <td>{{row.serial_number}}</td>
-                                <td>
-                                    <span class="text-success" ng-if="row.connection == 'connected'"><i class="fa fa-check-circle"></i></span>
-                                    <span class="text-warning" ng-if="row.connection == 'unconnected'"><i class="fa fa-times-circle"></i></span>
-                                </td>
-                                <td>{{row.license_name.length ? row.license_name : 'N/A'}}</td>
-                                <td>
-                                    <span class="text-success" ng-if="row.status == 'enabled'"><i class="fa fa-check-circle"></i></span>
-                                    <span class="text-warning" ng-if="row.status == 'disbaled'"><i class="fa fa-times-circle"></i></span>
-                                </td>
-                                <td>{{row.auto_bw ? 'Auto' : 'Manually'}}</td>
-                                <td>{{row.bw_limit ? row.bw_limit : 'N/A'}}</td>
-                                <td>{{row.perbw}}</td>
-                                <td>Current: {{row.rel_bandwith.current}}<br>Dropped: {{row.rel_bandwith.dropped}}<br>Limitation: {{row.rel_bandwith.limitation}}</td>
-                                <td>
-                                    <a class="icon-box" style="cursor:pointer" title="{{'Enable'|T}}" ng-if="row.status == 'disbaled'" ng-click="table.selectLicenseModal(row)"><i class="fa fa-play"></i></a>
-                                    <a class="icon-box" style="cursor:pointer" title="{{'Disable'|T}}" ng-if="row.status == 'enabled'" ng-click="table.disable(row)"><i class="fa fa-stop"></i></a>
-                                    <a class="icon-box" style="cursor:pointer" title="{{'Edit Resource Mode'|T}}" ng-click="table.edit(row)"><i class="fa fa-pencil"></i></a>
-                                    <a class="icon-box" style="cursor:pointer" title="{{'Delete'|T}}" ng-click="table.delete(row)"><i class="array-delete"></i></a>
-                                </td>
-                            </tr>
-                            </tbody>
-                        </table>
-                    </div>
-                    <div style="margin-bottom: 15px;text-align: center" ng-hide="table.tableData"><img src="app/images/loading.gif"></div>
-                    <div class="table-pagination">
-                        <div class="pagination-detail"></div>
-                        <div class="pagination" st-pagination="" st-items-by-page="pageSize" st-displayed-pages="5" st-page-change="onPageChange(newPage)"></div>
-                    </div>
+                <div class="btn-group pull-right"></div>
+            </div>
+            <div class="table-container" st-table="displayedCollection" st-safe-src="table.tableData">
+                <div class="table-responsive table-content">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th>No.</th>
+                            <th st-sort="ip" style="cursor: pointer;">{{'IP Address'|T}}</th>
+                            <th st-sort="product_name" style="cursor: pointer;">{{'Product Name'|T}}</th>
+                            <th st-sort="connection" style="cursor: pointer;">{{'Connection'|T}}</th>
+                            <th st-sort="license" style="cursor: pointer;">{{'License'|T}}</th>
+                            <th st-sort="status" style="cursor: pointer;">{{'Status'|T}}</th>
+                            <th st-sort="auto_bw" style="cursor: pointer;">{{'Bandwidth Mode'|T}}</th>
+                            <th st-sort="assigned_bandwidth" style="cursor: pointer;">{{'Assigned Bandwidth'|T}}</th>
+                            <th st-sort="applied_bandwidth" style="cursor: pointer;">{{'Applied Bandwidth'|T}}</th>
+                            <th st-sort="realtime_bandwidth" style="cursor: pointer;">{{'Real-time Bandwidth'|T}}</th>
+                            <th>{{'Action'|T}}</th>
+                        </tr>
+                        <tr ng-if="table.tableData">
+                            <th></th>
+                            <th><input st-search="ip" placeholder="{{'Search by IP'|T}}" class="input-sm form-control"
+                                       type="text"/></th>
+                            <th><input st-search="product_name" placeholder="{{'Search by Product'|T}}"
+                                       class="input-sm form-control" type="text"/></th>
+                            <th></th>
+                            <th><input st-search="license_name" placeholder="{{'Search by License Name'|T}}"
+                                       class="input-sm form-control" type="text"/></th>
+                            <th></th>
+                            <th>
+                                <select class="input-sm form-control" st-input-event="change" st-search="auto_bw">
+                                    <option value="">{{'All'|T}}</option>
+                                    <option value="true">{{'Auto'|T}}</option>
+                                    <option value="false">{{'Manually'|T}}</option>
+                                </select>
+                            </th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr ng-repeat="row in displayedCollection">
+                            <td>{{ ((currentPageIndex - 1) * pageSize) + $index + 1 }}</td>
+                            <td><a ui-sref="index.volume_license.device.detail({name:row.ip})"
+                                   class="active">{{row.ip}}</a></td>
+                            <td>{{row.product_name}}</td>
+                            <td>
+                                <span class="text-success" ng-if="row.connection == 'connected'"><i
+                                        class="fa fa-check-circle"></i></span>
+                                <span class="text-warning" ng-if="row.connection == 'unconnected'"><i
+                                        class="fa fa-times-circle"></i></span>
+                            </td>
+                            <td>
+                                <span ng-if="row.license_name.length">Name: {{row.license_name}}<br>Total: {{row.total_bw}} Mbps<br>Allocated: {{row.used_bw}} Mbps</span>
+                                <span ng-if="!row.license_name.length">N/A</span>
+                            </td>
+                            <td>
+                                <span class="text-success" ng-if="row.status == 'enabled'"><i
+                                        class="fa fa-check-circle"></i></span>
+                                <span class="text-warning" ng-if="row.status == 'disbaled'"><i
+                                        class="fa fa-times-circle"></i></span>
+                            </td>
+                            <td>{{row.auto_bw ? 'Auto' : 'Manually'}}</td>
+                            <td>{{row.bw_limit ? row.bw_limit + ' Mbps' : 'N/A'}}</td>
+                            <td>{{row.perbw}}</td>
+                            <td>Current: {{row.rel_bandwith.current}}<br>Dropped: {{row.rel_bandwith.dropped}}<br>Limitation:
+                                {{row.rel_bandwith.limitation}}
+                            </td>
+                            <td>
+                                <a class="icon-box" style="cursor:pointer" title="{{'Enable'|T}}"
+                                   ng-if="row.status == 'disbaled'" ng-click="table.selectLicenseModal(row)"><i
+                                        class="fa fa-play"></i></a>
+                                <a class="icon-box" style="cursor:pointer" title="{{'Disable'|T}}"
+                                   ng-if="row.status == 'enabled'" ng-click="table.disable(row)"><i
+                                        class="fa fa-stop"></i></a>
+                                <a class="icon-box" style="cursor:pointer" title="{{'Edit Resource Mode'|T}}"
+                                   ng-click="table.edit(row)"><i class="fa fa-pencil"></i></a>
+                                <a class="icon-box" style="cursor:pointer" title="{{'Delete'|T}}"
+                                   ng-click="table.delete(row)"><i class="array-delete"></i></a>
+                            </td>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+                <div style="margin-bottom: 15px;text-align: center" ng-hide="table.tableData"><img
+                        src="app/images/loading.gif"></div>
+                <div class="table-pagination">
+                    <div class="pagination-detail"></div>
+                    <div class="pagination" st-pagination="" st-items-by-page="pageSize" st-displayed-pages="5"
+                         st-page-change="onPageChange(newPage)"></div>
                 </div>
-            </rd-widget>
-        </div>
-    </div>    
\ No newline at end of file
+            </div>
+        </rd-widget>
+    </div>
+</div>
Index: /branches/amp_3_7/extensions/license_server/webui/client/device/edit-device-resource.controller.js
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/client/device/edit-device-resource.controller.js	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/client/device/edit-device-resource.controller.js	(working copy)
@@ -42,12 +42,16 @@
                         $rootScope.$broadcast('endLoading', true);
                         if (res&&res.status === 200) {
                             if (res.data[0]) {
+                                $rootScope.TipService.setMessage('The license settings has been updated successfully. Please allow a few seconds for the changes to take effect.');
+                                setTimeout(function(){
+                                    $rootScope.TipService.clear();
+                                }, 15000);
                                 $uibModalInstance.close(true);
                             } else {
                                 $rootScope.TipService.setMessage(res.data[1]);
                             }
                         } else {
-                            $rootScope.TipService.setMessage($filter('T')('Failed to edit device reosurce mode!'));
+                            $rootScope.TipService.setMessage($filter('T')('Failed to edit device resource mode!'));
                         }
                     });
             }
Index: /branches/amp_3_7/extensions/license_server/webui/client/license/license.html
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/client/license/license.html	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/client/license/license.html	(working copy)
@@ -23,10 +23,11 @@
                             <!-- <th st-sort="company_name" style="cursor: pointer;">{{'Company Name'|T}}</th> -->
                             <th st-sort="generation_date" style="cursor: pointer;">{{'Generation Date'|T}}</th>
                             <th st-sort="expiration_date" style="cursor: pointer;">{{'Expiration Date'|T}}</th>
-                            <th st-sort="bandwidth" style="cursor: pointer;">{{'Bandwith Limitation'|T}}</th>
+                            <th st-sort="bandwidth" style="cursor: pointer;">{{'Bandwidth Limitation'|T}}</th>
+                            <th st-sort="available_bw">{{'Available bandwidth'|T}}</th>
+                            <th st-sort="used_bw">{{'Allocated bandwidth'|T}}</th>
                             <th st-sort="capacity" style="cursor: pointer;">{{'vAPV Capacity'|T}}</th>
                             <th st-sort="memory_control">{{'Memory Control'|T}}</th>
-                            <th st-sort="bwlimit">{{'Max available bandwidth'|T}}</th>
                             <th>{{'Action'|T}}</th>
                         </tr>
                         </thead>
@@ -39,9 +40,10 @@
                             <td>{{row.generation_date}}</td>
                             <td>{{row.expiration_date}}</td>
                             <td>{{row.bandwidth}}</td>
+                            <td>{{row.available_bw}} Mbps</td>
+                            <td>{{row.used_bw}} Mbps</td>
                             <td>{{row.capacity}}</td>
                             <td>{{row.memory_control}}</td>
-                            <td>{{row.bwlimit}}</td>
                             <td>
                                 <a class="icon-box" style="cursor:pointer" title="{{'Delete'|T}}" ng-click="table.delete(row)"><i class="array-delete"></i></a>
                             </td>
Index: /branches/amp_3_7/extensions/license_server/webui/model/cm_device/__init__.py
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/model/cm_device/__init__.py	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/model/cm_device/__init__.py	(working copy)
@@ -22,6 +22,8 @@
 
     product_name = CharField(verbose_name="Product Name", editable=False, configurable=False, optional=True)
     perbw = CharField(verbose_name="Assigned Bandwidth", editable=False, configurable=False, optional=True)
+    used_bw = CharField(verbose_name="Used Bandwidth", editable=False, configurable=False, optional=True)
+    total_bw = CharField(verbose_name="Total Bandwidth", editable=False, configurable=False, optional=True)
     connection = CharField(verbose_name="Connection", editable=False, configurable=False, optional=True, custom_display=lambda val: '<span class="text-running"><i class="fa fa-check-circle"></i>&nbsp;</span>' if str(val) == 'connected' else '<span class="text-false"><i class="fa fa-times-circle"></i>&nbsp;</span>')
     status = CharField(verbose_name="Status", editable=False, configurable=False, optional=True, custom_display=lambda val: '<span class="text-running"><i class="fa fa-check-circle"></i>&nbsp;</span>' if str(val) == 'enabled' else '<span class="text-false"><i class="fa fa-times-circle"></i>&nbsp;</span>')
     license_name = AssoField2(verbose_name=_('License'), tgt='device_mgmt.license.VolumeLicense.device',
@@ -147,11 +149,16 @@
     class Manager(CLIManager):
         def _get_query_set(self):
             db = DB.get_connected_db()
-            fetchall_sql = '''SELECT * FROM device2'''
+            fetchall_sql = '''
+                select d1.*, l3.used_bw, l3.total_bw from device2 as d1 left join 
+	            (select l2.name, l1.used_bw, l2.bandwidth as total_bw from license as l2 left join 
+	            (select license_name, sum(perbw) as used_bw from device2 group by device2.license_name) l1 
+	            on l1.license_name = l2.name) l3 on d1.license_name = l3.name;                
+            '''
             data = db.fetchall(fetchall_sql)
             db.close()
             result = []
-            key = ['id', 'ip', 'restapi_port', 'restapi_username', 'restapi_password', 'connection', 'status', 'version', 'license_name', 'perbw', 'error_msg', 'rel_bandwith', 'bw_limit', 'auto_bw', 'restapi_protocol']
+            key = ['id', 'ip', 'restapi_port', 'restapi_username', 'restapi_password', 'connection', 'status', 'version', 'license_name', 'perbw', 'error_msg', 'rel_bandwith', 'bw_limit', 'auto_bw', 'restapi_protocol', 'used_bw', 'total_bw']
             result = [dict(zip(key, each)) for each in data]
             # result = [
             #     {
@@ -183,7 +190,7 @@
                         rtn = cli_parse(replace_result, [
                                     RegexParser('Limitation: (.+?) bits/sec Current: (.+?) bits/sec Last30s-dropped: (.+?) bits', MATCHONE),
                                 ])
-                        each['rel_bandwith'] = {'limitation': str(int(rtn[0][0])/1024/1024)+' Mbps', 'current': rtn[0][1]+ ' bits/sec', 'dropped': rtn[0][2] + ' bits'}
+                        each['rel_bandwith'] = {'limitation': str(int(rtn[0][0])/1024/1024)+' Mbps', 'current': str(round(float(rtn[0][1])/1024/1024, 2))+' Mbps', 'dropped': str(round(float(rtn[0][2])/1024/1024, 2)) + ' Mbps'}
                     else:
                         each['rel_bandwith'] = {'limitation': 'Restricted', 'current': 'Restricted', 'dropped': 'Restricted'}
                 if each['status'] in ['active', 'inactive']:
Index: /branches/amp_3_7/extensions/license_server/webui/model/license/__init__.py
===================================================================
--- /branches/amp_3_7/extensions/license_server/webui/model/license/__init__.py	(revision 2452)
+++ /branches/amp_3_7/extensions/license_server/webui/model/license/__init__.py	(working copy)
@@ -15,7 +15,10 @@
     bwlimit = IntegerField(verbose_name="Max available bandwidth", configurable=False, optional=True, editable=True, unit_name=__('Mbps'))
     capacity = IntegerField(verbose_name="vAPV Capacity", configurable=False, optional=True, editable=True)
     memory_control = CharField(verbose_name="vAPV Memory Type Number", configurable=False, optional=True, editable=True)
-    
+    available_bw = IntegerField(verbose_name="Available bandwidth", configurable=False, optional=True, editable=True,
+                                unit_name=__('Mbps'))
+    used_bw = IntegerField(verbose_name="Used bandwidth", configurable=False, optional=True, editable=True,
+                           unit_name=__('Mbps'))
     managed_devices_info = FieldGroup(writable=False, verbose_name='Managed Devices', level=BASIC, visible_edit=True, fields={
       'device': AssoField2(verbose_name='Managed Devices', tgt='device_mgmt.cm_device.CMDevice.license_name', mul='1', pos='left', optional=True),
     })
@@ -44,10 +47,10 @@
     class Manager(CLIManager):
         def _get_query_set(self):
             db = DB.get_connected_db()
-            fetchall_sql = '''SELECT * FROM license'''
+            fetchall_sql = '''select license.*, dl.used_bw from license left join (select license_name, sum(perbw) as used_bw from device2 group by device2.license_name) dl on license.name = dl.license_name;'''
             data = db.fetchall(fetchall_sql)
             db.close()
-            key = ['name', 'license', 'company_name', 'generation_date', 'expiration_date', 'bandwidth', 'bwlimit', 'capacity', 'memory_resource_control'] + memory_control_column
+            key = ['name', 'license', 'company_name', 'generation_date', 'expiration_date', 'bandwidth', 'bwlimit', 'capacity', 'memory_resource_control'] + memory_control_column + ['used_bw']
             result = [dict(zip(key, each)) for each in data]
             for each in result:
                 for key, value in each.items():
@@ -65,6 +68,7 @@
                 del each["memory_resource_control"]
                 for index in memory_control_column:
                     del each[index]
+                each['available_bw'] = (0 if each['bwlimit'] is None else each['bwlimit']) - (0 if each['used_bw'] is None else each['used_bw'])
             return QuerySet(self._model, result)
 
         def _get_stats(self):
