Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Update to python-ndn 0.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
zjkmxy committed Nov 21, 2021
1 parent 1acd3f2 commit e894e1d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ aiohttp = ">=3.8.1"
aiohttp-jinja2 = ">=1.5"
Jinja2 = ">=3.0.3"
Pillow = ">=8.4.0"
python-ndn = {git = "https://github.com/named-data/python-ndn"}
python-ndn = ">=0.3"

[requires]
python_version = "3.10"
Expand Down
14 changes: 9 additions & 5 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions ndncc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ async def issue_command_interest(self, cmd):
except (InterestCanceled, InterestTimeout, InterestNack, ValidationFailure, NetworkError):
logging.error(f'Command failed')
return None
ret = parse_response(data)
ret['status_text'] = ret['status_text'].decode()
return ret
return parse_response(data)

async def add_face(self, uri):
# It's not easy to distinguish udp4://127.0.0.1 and udp4://spurs.cs.ucla.edu
Expand Down
24 changes: 24 additions & 0 deletions templates/routing.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ <h2>{{ title }}</h2>
<div id="left-side" class="pure-u-1-2">
{{ route_table('Forwarding Table (FIB)', fib_list, 'next_hop_records') }}<br/>
{{ route_table('Routing Table (RIB)', rib_list, 'routes') }}<br/>
<form action="/routing/add" method="post">
<p>
<label for="name">Prefix</label>
<input type="text" name="name" id="name"/>
</p>
<p>
<label for="face_id">Face ID</label>
<input type="text" name="face_id" id="face_id"/>
</p>
<p>
<button type="submit">Add</button>
</p>
</form>
{% if st_code %}
<p>{{ st_code }} {{ st_text }}</p>
{% endif %}
</div>
<div id="right-side" class="pure-u-1-2">
{% if fib_routes|length > 0 %}
Expand Down Expand Up @@ -66,6 +82,7 @@ <h2>RIB Entry for {{ request_name }}</h2>
<th>Origin</th>
<th>Cost</th>
<th>Flags</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
Expand All @@ -77,6 +94,13 @@ <h2>RIB Entry for {{ request_name }}</h2>
<td>{{ route['origin']|e }}</td>
<td>{{ route['cost']|e }}</td>
<td>{{ route['flags']|e }}</td>
<td>
<form action="/routing/remove" method="post">
<input type="hidden" name="name" value={{ request_name }}>
<input type="hidden" name="face_id" value={{ route["face_id"] }}>
<button type="submit">Remove</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit e894e1d

Please sign in to comment.