Beispiel #1
0
 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])
Beispiel #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]
     }
Beispiel #3
0
 def _list(self):
     "List Filters as python dict"
     self.telnet.sendline('filter -l')
     self.telnet.expect([r'(.+)\n' + STANDARD_PROMPT])
     result = self.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]
     }