facebookarchive / augmented-traffic-control

Augmented Traffic Control: A tool to simulate network conditions
https://facebook.github.io/augmented-traffic-control
Other
4.33k stars 600 forks source link

Click on the button "turn on" django Get 404 #97

Closed JasonLZJ closed 9 years ago

JasonLZJ commented 9 years ago

When I click on the button 'turn on' on the web, django return 404 like api/v1/shape/ 404 This is my url.py

from django.conf.urls import include, url from django.views.generic.base import RedirectView from django.conf.urls import patterns urlpatterns = patterns( url(r'^api/v1/', include('atc_api.urls')), url(r'^atc_demo_ui/', include('atc_demo_ui.urls')), url(r'^api/v1/profiles/', include('atc_profile_storage.urls')), url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)), ) who can help me?thx lol

chantra commented 9 years ago

Hi @JasonLZJ

This is my url.py

I assume you mean urls.py

Is the atc_api module enabled in settings.py? Could you pastebin the whole stacktrace if this still happen so we have more data to troubleshoot. Tks

JasonLZJ commented 9 years ago

@chantra thank you very much. I have fix it but I have a new problem. I run atcd in my ubuntu server (sudo acted --atcd-wan eth0 --atcd-lan wlan0) But I see a warning in my web : ATC is not running what happened? thx

chantra commented 9 years ago

@JasonLZJ are both atcd and the web server running on the same host? Can you check that atcd is indeed running? can you run:

sudo netstat -lpnt | grep atc

and paste the output.

JasonLZJ commented 9 years ago

@chantra In the same server.

netstat -lpnt | grep act print nothing. I see atcd listen 9090, so netstat -npl | grep 9090 print tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 4859/python

When I run atcd It shows:

INFO:AtcdVService.AtcdNBServerTask:AtcdNBServerTask Server Started on 127.0.0.1:9090 INFO:AtcdVService.AtcdLinuxShaper:Calling initialize_shaping_system INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -F FORWARD INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on wlan0 INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on wlan0 INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on eth0 INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on eth0 INFO:AtcdVService.AtcdLinuxShaper:Restoring shaped connection from DB INFO:AtcdVService.AtcdLinuxShaper:Request startShaping TrafficControl(device=TrafficControlledDevice(controllingIP='192.168.1.102', controlledIP='192.168.1.102'), timeout=17633.855776309967, settings=TrafficControlSetting(down=Shaping(loss=Loss(percentage=20.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=10, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)), up=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=10, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)))) INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.1.102 on interface eth0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID eth0, classid 1:2,parent 1:0, rate 10kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID eth0, parent 1:2, loss 0.0%, delay 0 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID eth0, classid 1:2, handle 2, rate: 10kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -d 192.168.1.102 -i eth0 -j MARK --set-mark 2 INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.1.102 on interface wlan0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID wlan0, classid 1:2,parent 1:0, rate 10kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID wlan0, parent 1:2, loss 20.0%, delay 0 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID wlan0, classid 1:2, handle 2, rate: 10kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -s 192.168.1.102 -i wlan0 -j MARK --set-mark 2 INFO:AtcdVService.AtcdLinuxShaper:Request startShaping TrafficControl(device=TrafficControlledDevice(controllingIP='127.0.0.1', controlledIP='127.0.0.1'), timeout=24050.903750658035, settings=TrafficControlSetting(down=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=100, jitter=0, correlation=0.0), rate=10, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)), up=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=100, jitter=0, correlation=0.0), rate=10, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)))) INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 127.0.0.1 on interface eth0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID eth0, classid 1:3,parent 1:0, rate 10kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID eth0, parent 1:3, loss 0.0%, delay 100000 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID eth0, classid 1:3, handle 3, rate: 10kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -d 127.0.0.1 -i eth0 -j MARK --set-mark 3 INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 127.0.0.1 on interface wlan0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID wlan0, classid 1:3,parent 1:0, rate 10kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID wlan0, parent 1:3, loss 0.0%, delay 100000 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID wlan0, classid 1:3, handle 3, rate: 10kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -s 127.0.0.1 -i wlan0 -j MARK --set-mark 3 DEBUG:AtcdVService:All tasks started DEBUG:AtcdVService:VService Active. Awaiting graceful shutdown.

chantra commented 9 years ago

Hi @JasonLZJ

so somehow, you have managed to set some shaping for 127.0.0.1 and 192.168.1.102 .

I am not exactly sure what you mean by you click on "turn on" and get a 404. Does the button stays on "turn on"? Or does it change to "Turn off"? If you were going to navigate to /api/v1/shape/ do you get a webpage that is similar to the screenshot in http://www.django-rest-framework.org/ ?

JasonLZJ commented 9 years ago

@chantra The button stays on "ATC is not running" When atcd run in my server.

chantra commented 9 years ago

@JasonLZJ what about:

If you were going to navigate to /api/v1/shape/ do you get a webpage that is similar to the screenshot in http://www.django-rest-framework.org/ ?

chantra commented 9 years ago

@JasonLZJ Did you get a chance to load page http://youratcuiserver:atcuiport/api/v1/shape/ ?

JasonLZJ commented 9 years ago

@chantra It is ok, Thank you very much.

chantra commented 9 years ago

@JasonLZJ I understand that things are working now, correct?

Could you share what you had to change to get to a working state? This may be useful for others in the future. Tks

JasonLZJ commented 9 years ago

@chantra yep ...things are working now, correct. thank a lot. lol

chantra commented 9 years ago

@JasonLZJ Any chances you share why it was not working originally?

JasonLZJ commented 9 years ago

@chantra When I navigate to /api/v1/shape/ I find the django-rest-framework app not install. so I install it.

chantra commented 9 years ago

Thanks for sharing @JasonLZJ !