Index: /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/avx/models/system/ntp.py
===================================================================
--- /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/avx/models/system/ntp.py	(revision 8882)
+++ /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/avx/models/system/ntp.py	(working copy)
@@ -1,6 +1,8 @@
 from hive.imports.model import *
 from django.utils.translation import ugettext_lazy as _
 from hive.model.query import mark_expire_all
+from ast import literal_eval
+from hive.model.legacycli import cli_parse
 
 class NTPSettings(ANModel):
     enable_ntp = BooleanField(verbose_name=_('Enable NTP'))
@@ -44,10 +46,10 @@
             self.cli.set_enable()
             self.cli.set_enable()
             result = self.cli.cmd('show ntp',
-                                   RegexParser('ntp (?P<enable_ntp>on|off)', MATCHONE, reflags=re.S))
+                                   RegexParser('Chrony daemon (?P<enable_ntp>is running|is not running)', MATCHONE, reflags=re.S))
             if result:
                 rtn_dict = {
-                            'enable_ntp':True if result['enable_ntp'] == 'on' else False
+                            'enable_ntp':True if result['enable_ntp'] == 'is running' else False
                             }
             else:
                 rtn_dict = { 'enable_ntp':False }
@@ -66,7 +68,7 @@
             mark_expire_all(NTPSettings)
             return
 
-        def _perform_Clear_ntp(self, options):
+        def _perform_Clear_ntp(self):
             self.cli.set_config()
             result = self.cli.cmd('clear ntp')
             mark_expire_all(NTPServer)
@@ -78,12 +80,8 @@
             return result
 
 class NTPServer(ANModel):
-    ip = IPAddressField(verbose_name=_('NTP Server IP'), primary_key=True)
-    version = EnumField(verbose_name=_('NTP Server Version'), default=4, primary_key=True, optional=True, values=(
-                        (1, '1'),
-                        (2, '2'),
-                        (3, '3'),
-                        (4, '4')))
+    ip = CharField(verbose_name=_('NTP Server IP or Hostname'), primary_key=True)
+    options = CharField(verbose_name=_('NTP Server Options'), default='', optional=True)
     asso = AssoField2(tgt='system.NTPSettings.ntp_server', mul='*', pos='right', hidden=True, default=[{}])
 
     class Meta:
@@ -93,16 +91,31 @@
         def _get_query_set(self):
             self.cli.set_enable()
             result = self.cli.cmd('show ntp\n',
-                        EasyParser('ntp server ', ['?ip', '?version']))           
+                        EasyParser('server ', ['?ip', '?options']))
             return QuerySet(self._model, result)
 
         def _insert(self, instance):
-            data = {
-                'ip':instance.ip.values()[0],
-                'version':instance.version,
-            }
+            available_options = ['', 'nts']
+            data = instance.get_field_dict()
+            ip_str = ""
+            ip_dict = literal_eval(data["ip"])
+            if "hostname" in ip_dict:
+                ip_str = ip_dict["hostname"]
+            elif "ipv4" in ip_dict:
+                ip_str = ip_dict["ipv4"]
+            elif "ipv6" in ip_dict:
+                ip_str = ip_dict["ipv6"]
+            options_str = ""
+            if "options" in data and data["options"]:
+                options_list = literal_eval(data["options"])
+                for option in options_list:
+                    if option not in available_options:
+                        return cli_parse("Invalid options", BlankParser(nonblank_exception=CLICmdError, nonblank_msg="Invalid options"))
+                    options_str = str(option)
+            if not ip_str:
+                return cli_parse("Please check fields", BlankParser(nonblank_exception=CLICmdError, nonblank_msg="Please check fields"))
             self.cli.set_config()
-            result = self.cli.cmd('ntp server %(ip)s %(version)u' % data,
+            result = self.cli.cmd('ntp server "%s" "%s"' % (ip_str, options_str),
                                   BlankParser(nonblank_exception=CLICmdError, supplement=True))
             mark_expire_all(NTPSettings)
             return result
@@ -110,8 +123,8 @@
         def _delete(self, pk_list):
             self.cli.set_config()
             for each_pk in pk_list:
-                each_pk['ip_str'] = each_pk['ip'].values()[0]
-                result = self.cli.cmd('no ntp server %(ip_str)s %(version)u' % each_pk,
+                each_pk['ip_str'] = each_pk['ip']
+                result = self.cli.cmd('no ntp server "%(ip_str)s"' % each_pk,
                                       BlankParser(nonblank_exception=CLICmdError, supplement=True))
             mark_expire_all(NTPSettings)
             return
Index: /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp-add.html
===================================================================
--- /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp-add.html	(revision 8882)
+++ /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp-add.html	(working copy)
@@ -25,12 +25,22 @@
                                 </div>
                             </div>
                         </uib-tab>
+                        <uib-tab heading="Hostname" ng-click="ntpAdd.clickHostname()">
+                            <div class="form-group">
+                                <label class="col-md-3 control-label">{{'Hostname'|T}}</label>
+                                <div class="col-md-9">
+                                    <input ng-verify="union_require:true" type="hostname" class="form-control" placeholder="" ng-model="ntpAdd.data.hostname" name="hostname" >
+                                </div>
+                            </div>
+                        </uib-tab>
                     </uib-tabset>
                 </div>
                 <div class="form-group">
-                    <label class="col-md-3 control-label">{{'NTP Server Version'|T}}</label>
+                    <label class="col-md-3 control-label">{{'NTP Server Options'|T}}</label>
                     <div class="col-md-9">
-                        <input ng-verify="required:true, min_length:1, max_length:4" type="number" class="form-control" placeholder="1-4" ng-model="ntpAdd.data.version" name="version" >
+                        <select bs-select class="form-control selectpicker" placeholder="" ng-model="ntpAdd.data.options" name="options" multiple>
+                            <option value="nts">NTS</option>
+                        </select>
                     </div>
                 </div>
             </form>
Index: /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.controller.js
===================================================================
--- /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.controller.js	(revision 8882)
+++ /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.controller.js	(working copy)
@@ -70,12 +70,7 @@
             };
             avxViewModel.delete = function(data) {
                 showProgressBar();
-                var post_data={"version":parseInt(data["version"])};
-                if (data["ip"].indexOf('.')!=-1) {
-                    post_data["ip"]={"ipv4":data["ip"]};
-                } else {
-                    post_data["ip"]={"ipv6":data["ip"]};
-                }
+                var post_data={"ip":data["ip"]};
                 sysResourceService
                     .delete_ntp_server(post_data)
                     .then(function(res) {
@@ -91,10 +86,32 @@
                         }
                 });
             };
+            avxViewModel.clean = function() {
+                var delete_reminder = confirm($filter('T')("Are you sure you want to clear all the NTP server?"));
+                if (delete_reminder) {
+                    sysResourceService
+                    .clean_all_ntp(avxViewModel.csrf_token)
+                    .then(function(res) {
+                        $rootScope.$broadcast('endLoading', true);
+                        if (res && res.status === 200) {
+                            avxViewModel.refresh();
+                        } else {
+                            alert($filter('T')("Failed to Clean the NTP Server."));
+                        }
+                    });
+                }
+            };
             avxViewModel.refresh = function() {
                 $scope.ntp_data.ntp_server = [];
                 get_info();
             };
+            avxViewModel.optionsConvert = function(options) {
+                switch (options) {
+                    case "nts":
+                        return "NTS";
+                }
+                return options;
+            };
         }
     ])
     .controller('ntpAddCtrl', [
@@ -112,13 +129,21 @@
             };
             modalViewModel.chooseIpv4 = true;
             modalViewModel.chooseIpv6 = false;
+            modalViewModel.chooseHostname = false;
             modalViewModel.clickIpv4 = function() {
                 modalViewModel.chooseIpv4 = true;
                 modalViewModel.chooseIpv6 = false;
+                modalViewModel.chooseHostname = false;
             };
             modalViewModel.clickIpv6 = function() {
                 modalViewModel.chooseIpv4 = false;
                 modalViewModel.chooseIpv6 = true;
+                modalViewModel.chooseHostname = false;
+            };
+            modalViewModel.clickHostname = function() {
+                modalViewModel.chooseIpv4 = false;
+                modalViewModel.chooseIpv6 = false;
+                modalViewModel.chooseHostname = true;
             };
             var showProgressBar = function() {
                 var modalInstance = $uibModal.open({
@@ -130,11 +155,13 @@
             };
             modalViewModel.add = function(data) {
                 showProgressBar();
-                var post_data={"version":data["version"]};
+                var post_data={"options":data["options"]};
                 if (modalViewModel.chooseIpv4) {
                     post_data['ip'] = {'ipv4':data['ipv4']};
-                } else {
+                } else if (modalViewModel.chooseIpv6) {
                     post_data['ip'] = {'ipv6':data['ipv6']};
+                } else {
+                    post_data['ip'] = {'hostname':data['hostname']};
                 }
                 sysResourceService
                     .add_ntp_server(post_data)
Index: /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.html
===================================================================
--- /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.html	(revision 8882)
+++ /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/submenu/general/ntp/ntp.html	(working copy)
@@ -36,6 +36,7 @@
                     <div class="btn-group">
                         <button title="{{'Refresh'|T}}" class="btn btn-link hive_enable_active" ng-click="generalNTP.refresh()"><i class="fa fa-refresh"></i></button>
                         <button title="{{'Add'|T}}" class="btn btn-link" ng-click="generalNTP.showAddModal()"><i class="fa fa-plus-circle"></i></button>
+                        <button title="Clean All NTP Server" class="btn btn-link" ng-click="generalNTP.clean()"><i class="fa fa-trash"></i></button>
                     </div>
                 </div>
                 <div class="btn-group pull-right"></div>
@@ -47,7 +48,7 @@
                         <tr>
                             <th>#</th>
                             <th st-sort="ip">{{'NTP Server IP'|T}}</th>
-                            <th st-sort="version">{{'NTP Server Version'|T}}</th>
+                            <th st-sort="options">{{'NTP Server Options'|T}}</th>
                             <th>{{'Action'|T}}</th>
                         </tr>
                         </thead>
@@ -55,7 +56,7 @@
                         <tr ng-repeat="row in displayedCollection">
                             <td>{{$index + 1}}</td>
                             <td>{{row.ip}}</td>
-                            <td>{{row.version}}</td>
+                            <td>{{generalNTP.optionsConvert(row.options)}}</td>
                             <td>
                                 <div class="btn-group">
                                     <button  ng-show="allow_config" title="{{'Delete'|T}}" class="btn btn-link" ng-click="generalNTP.delete(row)"><i class="fa fa-times-circle"></i></button>
Index: /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/system.service.js
===================================================================
--- /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/system.service.js	(revision 8882)
+++ /branches/rel_avx_2_7_3/src/webui/webui/htdocs/new/src/client/app/modules/system/system.service.js	(working copy)
@@ -112,6 +112,7 @@
                 update_aaa_data: update_aaa_data,
                 clear_aaa_data: clear_aaa_data,
                 delete_aaa_data: delete_aaa_data,
+                clean_all_ntp: clean_all_ntp,
             };
             function get_udisk_files() {
                 return apiService.get('/api/avx/system/config_mgmt/UdiskFileConfig/_get_list_data');
@@ -153,12 +154,12 @@
             }
             function add_ntp_server(data) {
                 var url = '/api/avx/system/NTPServer/_add';
-                var post_data = {"post_data": JSON.stringify({"ip":data["ip"], "version":data["version"]})};
+                var post_data = {"post_data": JSON.stringify({"ip":data["ip"], "options":data["options"]})};
                 return apiService.post(url, post_data);
             }
             function delete_ntp_server(data) {
                 var url = '/api/avx/system/NTPServer/_delete';
-                var post_data = {"pk": JSON.stringify({"ip":data["ip"], "version":data["version"]})};
+                var post_data = {"pk": JSON.stringify({"ip":data["ip"]})};
                 return apiService.post(url, post_data);
             }
             function get_user() {
@@ -723,6 +724,15 @@
                     "csrfmiddlewaretoken": csrf_token
                 };
                 return apiService.post(url, post_data);
+            }
+            function clean_all_ntp(csrf_token) {
+                var url = '/api/avx/system/NTPSettings/_perform?action=Clear_ntp';
+                var post_data = {
+                    "action": "Clear_ntp",
+                    "options": JSON.stringify([]),
+                    "csrfmiddlewaretoken": csrf_token
+                };
+                return apiService.post(url, post_data);
             }
         }
 ]);
\ No newline at end of file
