Exemplo n.º 1
0
def p_route_line(p):
    '''route_line : ROUTE item IP_ADDR IP_ADDR IP_ADDR NUMBER'''
    #for i in p : print i
    iface = p_info['firewall'].get_interface_by_name(str(p[2]))
    route = Route(p_info['index_route'], iface, Ip(p[3]), Ip(p[4]), Ip(p[5]), int(p[6]))
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
    print route.to_string()
    print ('okk')
    print 'pb instanticiation de la route'
Exemplo n.º 2
0
def p_route_line(p):
    '''route_line : ROUTE item IP_ADDR IP_ADDR IP_ADDR NUMBER'''
    #for i in p : print i
    iface = p_info['firewall'].get_interface_by_name(str(p[2]))
    route = Route(p_info['index_route'], iface, Ip(p[3]), Ip(p[4]), Ip(p[5]),
                  int(p[6]))
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
    print route.to_string()
    print('okk')
    print 'pb instanticiation de la route'
Exemplo n.º 3
0
def p_route_line2(p):
    '''route_line : IP_ADDR SLASH NUMBER VIA IP_ADDR DEV WORD'''
    print[p[i] for i in range(len(p))]
    iface = p_info['firewall'].get_interface_by_name(str(p[5]))
    if not isinstance(iface, Interface):
        for i in p_info['firewall'].interfaces:
            iface = i.get_subif_by_name(str(p[5]))
            if isinstance(iface, Interface):
                break
    route = Route(p_info['index_route'], iface, Ip(p[1]),
                  Ip(fromDec2Dotted(int(p[3]))), Ip(p[5]))
    print route.to_string()
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
Exemplo n.º 4
0
def p_default_route_line(p):
    '''route_line : DEFAULT VIA IP_ADDR DEV WORD'''
    print[p[i] for i in range(len(p))]
    iface = p_info['firewall'].get_interface_by_name(str(p[5]))
    if not isinstance(iface, Interface):
        for i in p_info['firewall'].interfaces:
            iface = i.get_subif_by_name(str(p[5]))
            if isinstance(iface, Interface):
                break
    route = Route(p_info['index_route'], iface, Ip('0.0.0.0'), Ip('0.0.0.0'),
                  Ip(p[3]))
    print route.to_string()
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
def p_route_line(p) :
    '''route_line : SET ROUTE IP_ADDR SLASH NUMBER INTERFACE WORD GATEWAY IP_ADDR
                  | SET ROUTE IP_ADDR SLASH NUMBER INTERFACE WORD GATEWAY IP_ADDR PREFERENCE NUMBER'''

    iface = p_info['firewall'].get_interface_by_nameif(str(p[7]))
    if not isinstance(iface, Interface) :
        for i in p_info['firewall'].interfaces :
            iface = i.get_subif_by_nameif(str(p[7]))
            if isinstance(iface, Interface) : break

    print iface.name
    route = Route(p_info['index_route'], iface, Ip(p[3]), Ip(str(calcDottedMask(int(p[5])))), Ip(p[9]))
    print 'ok'
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
    print route.to_string()
    print ('okk')
    print 'pb instanticiation de la route'
def p_route_line(p):
    '''route_line : SET ROUTE IP_ADDR SLASH NUMBER INTERFACE WORD GATEWAY IP_ADDR
                  | SET ROUTE IP_ADDR SLASH NUMBER INTERFACE WORD GATEWAY IP_ADDR PREFERENCE NUMBER'''

    iface = p_info['firewall'].get_interface_by_nameif(str(p[7]))
    if not isinstance(iface, Interface):
        for i in p_info['firewall'].interfaces:
            iface = i.get_subif_by_nameif(str(p[7]))
            if isinstance(iface, Interface): break

    print iface.name
    route = Route(p_info['index_route'], iface, Ip(p[3]),
                  Ip(str(calcDottedMask(int(p[5])))), Ip(p[9]))
    print 'ok'
    p_info['route_list'].append(route)
    p_info['index_route'] += 1
    print route.to_string()
    print('okk')
    print 'pb instanticiation de la route'