Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release ThingsPro_V2.0 #46

Merged
merged 35 commits into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a4fc11e
Merge pull request #26 from lwindg/develop
imZack Jan 14, 2016
66d215d
Merge pull request #28 from lwindg/develop
imZack Jan 15, 2016
2bd43dc
Merge pull request #30 from lwindg/develop
imZack Feb 25, 2016
a232094
Update schema
lwindg Mar 2, 2016
e4f7e54
Remove `/network/default-route`
lwindg Mar 3, 2016
bb65c02
Add request body in OAPI schema
lwindg Mar 4, 2016
3d99a6f
Add readonly in OAPI description
lwindg Mar 4, 2016
3263c4e
Merge pull request #31 from lwindg/develop
zack9433 Mar 4, 2016
6a4c000
Remove DNS PUT
lwindg Mar 24, 2016
084f83e
Merge pull request #36 from lwindg/develop
imZack Mar 24, 2016
e9f62b0
Modify description
imZack Apr 28, 2016
d84a410
update pip deps
imZack Oct 20, 2016
cfcdd73
1.0.2
imZack Oct 20, 2016
d48ee00
Merge pull request #38 from imZack/develop
taotao Oct 20, 2016
7d6b292
docs: Add `status` and `wan` for more info.
lwindg Jan 14, 2017
b8d5306
feat: Support `status` and `wan`
lwindg Jan 14, 2017
cef6c28
fix: compare with interface and gateway only
lwindg Feb 3, 2017
6da3bb2
fix: unit test
lwindg Feb 3, 2017
4c01f66
1.1.0
lwindg Feb 3, 2017
54989ac
Merge pull request #39 from lwindg/develop
imZack Feb 6, 2017
29f6f88
Revert "feat: Support `status` and `wan`"
imZack Feb 9, 2017
a79f2f9
Merge pull request #40 from Sanji-IO/revert-39-develop
imZack Feb 9, 2017
715d494
fix: Add "-pf" for `dhclient`
lwindg Mar 9, 2017
c72ddff
fix: Add "-pf" for `dhclient` (#41)
lwindg Mar 9, 2017
bd36c01
fix: unittest
lwindg Mar 9, 2017
a8c0416
1.0.3
lwindg Mar 9, 2017
ea5d912
fix: Add "-pf" for `dhclient` (#42)
lwindg Mar 9, 2017
fb5d7dd
Merge remote-tracking branch 'upstream/develop' into develop
lwindg Mar 30, 2017
c4fa047
feat: Get interface via shell script command
lwindg Mar 30, 2017
d6794fa
1.1.0
lwindg Mar 30, 2017
f18d89b
Merge pull request #44 from lwindg/develop
taotao Mar 30, 2017
0b5c37a
feat: Support `status` and `wan`
lwindg Jan 14, 2017
7ee884d
test: fix unittest
lwindg Feb 3, 2017
e494c29
1.2.0
lwindg Apr 5, 2017
55aea6d
Merge pull request #45 from lwindg/develop
taotao Apr 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extract-upstream:
tar zxf $(UPSTREAM_ORIG_ARCHIVE)

changelog:
dch -v $(VERSION)-$(DEBVERSION) -D $(DIST) -M -u low \
dch -v $(VERSION) -D $(DIST) -M -u low \
--release-heuristic log

clean:
Expand Down
37 changes: 37 additions & 0 deletions build-deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
sanji-bundle-route (1.2.0) unstable; urgency=low

* feat: Support `status` and `wan`.

-- Aeluin Chen <[email protected]> Wed, 05 Apr 2017 16:00:35 +0800

sanji-bundle-route (1.1.0) unstable; urgency=low

* feat: Get interface via shell script command.

-- Aeluin Chen <[email protected]> Thu, 30 Mar 2017 19:18:05 +0800

sanji-bundle-route (1.0.3) unstable; urgency=low

* fix: Add "-pf" for `dhclient`.
* fix: Use "True/False" instead of "1/0".

-- Aeluin Chen <[email protected]> Thu, 09 Mar 2017 18:31:02 +0800

sanji-bundle-route (1.0.2) unstable; urgency=low

* Update pip deps.

-- Zack YL Shih <[email protected]> Thu, 20 Oct 2016 17:38:13 +0800

sanji-bundle-route (1.0.1) unstable; urgency=low

* Remove DNS PUT.

-- Aeluin Chen <[email protected]> Thu, 24 Mar 2016 17:44:02 +0800

sanji-bundle-route (1.0.0-1) unstable; urgency=low

* Update API schema.

-- Aeluin Chen <[email protected]> Wed, 02 Mar 2016 15:36:09 +0800

sanji-bundle-route (0.10.5-1) unstable; urgency=low

* Change dhcp client setting to non-blocking mode.
Expand Down
2 changes: 1 addition & 1 deletion build-deb/debian/source/format
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0 (quilt)
3.0 (native)
18 changes: 3 additions & 15 deletions bundle.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "route",
"version": "0.10.5",
"version": "1.2.0",
"author": "Aeluin Chen",
"email": "[email protected]",
"description": "Handle the routing table",
"description": "Handles the routing table",
"license": "MOXA",
"main": "route.py",
"argument": "",
Expand All @@ -17,19 +17,7 @@
"resources": [
{
"role": "view",
"resource": "/network/interface"
},
{
"role": "view",
"resource": "/network/dns"
},
{
"methods": ["get"],
"resource": "/network/routes/interfaces"
},
{
"methods": ["get","put"],
"resource": "/network/routes/db"
"resource": "/network/interfaces/:name"
},
{
"methods": ["get","put"],
Expand Down
4 changes: 1 addition & 3 deletions data/route.json.factory
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"default": "eth0"
}
["eth0"]
25 changes: 11 additions & 14 deletions ip/addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def ifaddresses(iface):
try:
info["link"] = open("/sys/class/net/%s/operstate" % iface).read()
if "down" == info["link"][:-1]:
info["link"] = 0
info["link"] = False
else:
info["link"] = open("/sys/class/net/%s/carrier" % iface).read()
info["link"] = int(info["link"][:-1]) # convert to int
info["link"] = True if int(info["link"][:-1]) == 1 else False
except:
info["link"] = 0
info["link"] = False

info["inet"] = []
if netifaces.AF_INET not in full:
Expand Down Expand Up @@ -118,25 +118,21 @@ def ifupdown(iface, up):


def dhclient(iface, enable, script=None):
# Disable the dhcp client and flush interface
# Enable/0Disable the dhcp client and flush interface
# dhclient -pf /var/run/dhclient-<iface>.pid <iface>
# dhclient -r -pf /var/run/dhclient-<iface>.pid <iface>
pid_file = "/var/run/dhclient-{}.pid".format(iface)
try:
dhclients = sh.awk(
sh.grep(
sh.grep(sh.ps("ax"), iface, _timeout=5),
"dhclient", _timeout=5),
"{print $1}")
dhclients = dhclients.split()
for dhclient in dhclients:
sh.kill(dhclient)
sh.dhclient("-r", "-pf", pid_file, iface)
except Exception as e:
_logger.info("Failed to stop dhclient: %s" % e)
pass

if enable:
if script:
sh.dhclient("-nw", "-sf", script, iface, _bg=True)
sh.dhclient("-pf", pid_file, "-nw", "-sf", script, iface)
else:
sh.dhclient("-nw", iface, _bg=True)
sh.dhclient("-pf", pid_file, "-nw", iface)


def ifconfig(iface, dhcpc, ip="", netmask="24", gateway="", script=None):
Expand Down Expand Up @@ -182,6 +178,7 @@ def ifconfig(iface, dhcpc, ip="", netmask="24", gateway="", script=None):
print interfaces()

# ifconfig("eth0", True)
# dhclient("eth0", False)
# time.sleep(10)
# ifconfig("eth1", False, "192.168.31.36")
eth0 = ifaddresses("eth0")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
paho-mqtt==1.1
paho-mqtt>=1.1
sh
ipcalc
netifaces
Expand Down
Loading