Exemplo n.º 1
0
    def runTest(self):
        board.sendline('uci set network.lan.ifname="%s %s"' %
                       (board.wan_iface, board.lan_gmac_iface))
        board.expect(prompt)
        board.sendline('uci set firewall.@defaults[0]=defaults')
        board.expect(prompt)
        board.sendline('uci set firewall.@defaults[0].input=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@defaults[0].output=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@defaults[0].syn_flood=1')
        board.expect(prompt)
        board.sendline('uci set firewall.@defaults[0].forward=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0]=zone')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0].name=lan')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0].network=lan')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0].input=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0].output=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[0].forward=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1]=zone')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].name=wan')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].network=wan')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].output=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].mtu_fix=1')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].input=ACCEPT')
        board.expect(prompt)
        board.sendline('uci set firewall.@zone[1].forward=ACCEPT')
        board.expect(prompt)
        board.sendline('uci commit')
        board.expect(prompt)
        board.network_restart()
        board.firewall_restart()

        lan.sendline('ifconfig %s 192.168.0.2' % lan.iface_dut)
        lan.expect(prompt)
Exemplo n.º 2
0
 def runTest(self):
     board.sendline('\nuci delete network.lan.ip6addr')
     board.expect('uci ')
     board.expect(prompt)
     board.sendline('uci delete network.wan.ip6addr')
     board.expect(prompt)
     board.sendline('ip -6 addr delete 5aaa::1/64 dev eth0')
     board.expect(prompt)
     board.sendline('uci commit network')
     board.expect(prompt)
     board.network_restart()
     # Lan-side Device
     lan.sendline('\nip -6 addr del 4aaa::6/64 dev eth1')
     lan.expect('ip -6')
     lan.expect(prompt)
     lan.sendline('ip -6 route del default')
     lan.expect(prompt)
     # Wan-side Device
     wan.sendline('\nip -6 addr del 5aaa::6/64 dev eth1')
     wan.expect('ip -6')
     wan.expect(prompt)
     wan.sendline('ip -6 route del default')
     wan.expect(prompt)
     time.sleep(10)
Exemplo n.º 3
0
 def runTest(self):
     # Router
     board.sendline('uci set network.lan6=interface')
     board.expect(prompt)
     board.sendline('uci set network.lan6.proto=static')
     board.expect(prompt)
     board.sendline('uci set network.lan6.ip6addr=4aaa::1/64')
     board.expect(prompt)
     board.sendline('uci set network.lan6.ifname=@lan')
     board.expect(prompt)
     board.sendline('uci set network.wan6=interface')
     board.expect(prompt)
     board.sendline('uci set network.wan6.proto=static')
     board.expect(prompt)
     board.sendline('uci set network.wan6.ip6addr=5aaa::1/64')
     board.expect(prompt)
     board.sendline('uci set network.wan6.ifname=@wan')
     board.expect(prompt)
     board.sendline('uci commit network')
     board.expect(prompt)
     board.network_restart()
     # Lan-side Device
     lan.sendline('\nip -6 addr add 4aaa::6/64 dev %s' % lan.iface_dut)
     lan.expect('ip -6')
     lan.expect(prompt)
     lan.sendline('ip -6 route add 4aaa::1 dev %s' % lan.iface_dut)
     lan.expect(prompt)
     lan.sendline('ip -6 route add default via 4aaa::1 dev %s' %
                  lan.iface_dut)
     lan.expect(prompt)
     if 'No route to host' in lan.before:
         raise Exception('Error setting ivp6 routes')
     # Wan-side Device
     wan.sendline('\nip -6 addr add 5aaa::6/64 dev %s' % wan.iface_dut)
     wan.expect('ip -6')
     wan.expect(prompt)
     wan.sendline('ip -6 route add 5aaa::1 dev %s' % wan.iface_dut)
     wan.expect(prompt)
     wan.sendline('ip -6 route add default via 5aaa::1 dev %s' %
                  wan.iface_dut)
     wan.expect(prompt)
     if 'No route to host' in wan.before:
         raise Exception('Error setting ivp6 routes')
     # Wlan-side Device
     if wlan:
         wlan.sendline('\nip -6 addr add 4aaa::7/64 dev wlan0')
         wlan.expect('ip -6')
         wlan.expect(prompt)
         wlan.sendline('ip -6 route add 4aaa::1 dev eth1')
         wlan.expect(prompt)
         wlan.sendline('ip -6 route add default via 4aaa::1 dev wlan0')
         wlan.expect(prompt)
     # Give things time to get ready
     time.sleep(20)
     # Check addresses
     board.sendline('\nifconfig | grep -B2 addr:')
     board.expect('ifconfig ')
     board.expect(prompt)
     lan.sendline('\nifconfig | grep -B2 addr:')
     lan.expect('ifconfig ')
     lan.expect(prompt)
     wan.sendline('\nifconfig | grep -B2 addr:')
     wan.expect('ifconfig ')
     wan.expect(prompt)
Exemplo n.º 4
0
 def runTest(self):
     board.network_restart()
     print("\nWaiting 30s to give things time to fully start...\n")
     time.sleep(30)