Ejemplo n.º 1
0
Archivo: S85.py Proyecto: sjava/weihu
def get_groups(ip):
    try:
        child = telnet(ip)
        rslt = do_some(child, 'disp cu config | in link-aggregation')
        close(child)
    except (pexpect.EOF, pexpect.TIMEOUT) as e:
        return ('fail', None, ip)
    temp = re_all(r'(group\s+\d+)\s+mode\s+(\w+)', rslt)
    temp1 = dict(re_all(r'(group\s+\d+)\s+description\s+(\S+ *\S*)', rslt))
    rslt1 = [dict(name=x[0],
                  mode=x[1],
                  desc=temp1.get(x[0], None)) for x in temp]
    rslt3 = [update_in(x, ['mode'], lambda y: 'yes' if y == 'static' else y)
             for x in rslt1]
    return ('success', rslt3, ip)
Ejemplo n.º 2
0
Archivo: S85.py Proyecto: sjava/weihu
def get_groups(ip):
    try:
        child = telnet(ip)
        rslt = do_some(child, 'disp cu config | in link-aggregation')
        close(child)
    except (pexpect.EOF, pexpect.TIMEOUT) as e:
        return ('fail', None, ip)
    temp = re_all(r'(group\s+\d+)\s+mode\s+(\w+)', rslt)
    temp1 = dict(re_all(r'(group\s+\d+)\s+description\s+(\S+ *\S*)', rslt))
    rslt1 = [
        dict(name=x[0], mode=x[1], desc=temp1.get(x[0], None)) for x in temp
    ]
    rslt3 = [
        update_in(x, ['mode'], lambda y: 'yes' if y == 'static' else y)
        for x in rslt1
    ]
    return ('success', rslt3, ip)
Ejemplo n.º 3
0
 def remap(x):
     f = lambda i: vol.get_container_mount(i)['biobox_target']
     return funcy.update_in(x, ['value'], f)
def _merge_in(collection, path, new_item):
    return update_in(collection, path, lambda x: merge(x, [new_item]))
Ejemplo n.º 5
0
 def remap(x):
     f = lambda i: vol.get_container_mount(i)['biobox_target']
     return funcy.update_in(x, ['value'], f)