コード例 #1
0
 def get_connector_list(self, telnet):
     telnet.sendline('smppccm -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return []
     return split_cols(result[2:-2])
コード例 #2
0
 def _list(self, telnet):
     "List MT router as python dict"
     telnet.sendline('mtrouter -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return {'mtrouters': []}
     results = [
         l.replace(', ', ',').replace('(!)', '') for l in result[2:-2] if l
     ]
     routers = split_cols(results)
     return {
         'mtrouters': [{
             'order':
             r[0].strip().lstrip('#'),
             'type':
             r[1],
             'rate':
             r[2],
             'connectors': [c.strip() for c in r[3].split(',')],
             'filters':
             [c.strip()
              for c in ' '.join(r[4:]).split(',')] if len(r) > 3 else []
         } for r in routers]
     }
コード例 #3
0
ファイル: httpccm.py プロジェクト: muriloventuroso/jasmin-api
 def get_connector_list(self, telnet):
     telnet.sendline('httpccm -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return []
     return split_cols(result[2:-2])
コード例 #4
0
 def _list(self, telnet):
     "List Filters as python dict"
     telnet.sendline('filter -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return {'filters': []}
     results = [
         l.replace(', ', ',').replace('(!)', '') for l in result[2:-2] if l
     ]
     filters = split_cols(results)
     return {
         'filters': [{
             'fid': f[0].strip().lstrip('#'),
             'type': f[1],
             'routes': f[2] + ' ' + f[3],
             'description': ' '.join(f[4:])
         } for f in filters]
     }
コード例 #5
0
ファイル: filters.py プロジェクト: ibsindsrt/Jasmin-API
 def _list(self, telnet):
     "List Filters as python dict"
     telnet.sendline('filter -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return {'filters': []}
     results = [l.replace(', ', ',').replace('(!)', '')
         for l in result[2:-2] if l]
     filters = split_cols(results)
     return {
         'filters':
             [
                 {
                     'fid': f[0].strip().lstrip('#'),
                     'type': f[1],
                     'routes': f[2] + ' ' + f[3],
                     'description': ' '.join(f[4:])
                 } for f in filters
             ]
     }
コード例 #6
0
 def _list(self, telnet):
     "List MT router as python dict"
     telnet.sendline('mtrouter -l')
     telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = telnet.match.group(0).strip().replace("\r", '').split("\n")
     if len(result) < 3:
         return {'mtrouters': []}
     results = [l.replace(', ', ',').replace('(!)', '')
         for l in result[2:-2] if l]
     routers = split_cols(results)
     return {
         'mtrouters':
             [
                 {
                     'order': r[0].strip().lstrip('#'),
                     'type': r[1],
                     'rate': r[2],
                     'connectors': [c.strip() for c in r[3].split(',')],
                     'filters': [c.strip() for c in ' '.join(r[4:]).split(',')
                         ] if len(r) > 3 else []
                 } for r in routers
             ]
     }