def show_cx1_settings(self): del self.return_str[:] if 0 < self.cmd_mode: self.return_str.append(self.stt_str) cx1 = EpgNodeInfo(self.xml_path).get_node_info()['cx1'] self.return_str.append('[ cx1 settings* ]') ava_cmds = [ 'local-port', 'max-targets-per-list', 'nomsg-timer', 'pgw-remote-address', 'pgw-ki', 'pgw-password', 'pgw-sqn-groups', 'sgw-remote-address', 'sgw-ki', 'sgw-password', 'sgw-sqn-groups' ] for key in ava_cmds: if not cx1.has_key(key): del self.return_str[:] self.return_str.append('%s not found, check the format of node xml file: %s' % (key, self.xml_path)) return else: self.return_str.append((key + ' = ').rjust(34) + cx1[key]) self.return_str.append('') if 0 < self.cmd_mode: self.return_str.append(self.end_str)
def show_cx3_settings(self): del self.return_str[:] if 0 < self.cmd_mode: self.return_str.append(self.stt_str) cx3 = EpgNodeInfo(self.xml_path).get_node_info()['cx3'] self.return_str.append('[ cx2 settings* ]') ava_cmds = [ 'max-tunnels-per-connection', 'min-local-port', 'max-local-port', 'normal-timer', 'checkstate-timer', 'retry-timer' ] for key in ava_cmds: if not cx3.has_key(key): del self.return_str[:] self.return_str.append('%s not found, check the format of node xml file: %s' % (key, self.xml_path)) return else: self.return_str.append((key + ' = ').rjust(34) + cx3[key]) self.return_str.append('') self.return_str.append('[ cx3 pgw-lic settings* ]') pgw_lic = cx3['pgw_lics'] sgw_lic = cx3['sgw_lics'] lic_cmds = ['id', 'address', 'port'] if 0 == len('pgw_lic'): self.return_str.append('There are no cx3 pgw-lic entries') else: for lic in pgw_lic: for key in lic_cmds: if not lic.has_key(key): del self.return_str[:] self.return_str.append( '%s not found, check the format of node xml file: %s' % (key, self.xml_path)) return else: if 'id' == key: self.return_str.append((key + ' [ ').rjust(34) + lic[key] + ' ]') else: self.return_str.append((key + ' = ').rjust(34) + lic[key]) self.return_str.append('') self.return_str.append('[ cx3 sgw-lic settings* ]') if 0 == len(sgw_lic): self.return_str.append('There are no cx3 sgw-lic entries') else: for lic in sgw_lic: for key in lic_cmds: if not lic.has_key(key): del self.return_str[:] self.return_str.append( '%s not found, check the format of node xml file: %s' % (key, self.xml_path)) return else: if 'id' == key: self.return_str.append((key + ' [ ').rjust(34) + lic[key] + ' ]') else: self.return_str.append((key + ' = ').rjust(34) + lic[key]) self.return_str.append('') if '' != self.return_str[-1]: self.return_str.append('') if 0 < self.cmd_mode: self.return_str.append(self.end_str)