Commit 5e94c9d1 authored by cedgar's avatar cedgar
Browse files

added a new task, and some modifications

parent 35cab2dc
......@@ -334,11 +334,15 @@ A few hints which will help you to solve this task:
`bw` and the `path` can be used to restore links capacities. The table
`handle` to update the the current entry in the switch.
Your task is now to implement the function `add_reservation` (and its helper functions)
such that it does the following:
Your task is now to implement the function `add_reservation` (and its helper functions).
This function should try to allocate bandwidth reservations whenever there is
capacity in the network, otherwise should discard them. Furthermore, it should be
to receive updated reservations for existing allocations, update its attributes,
move them to a new path if required, or even delete them if the updated request
can not be fullfilled anymore. We suggest you to implement `add_reservation` with
the following steps:
1. Compute a path from `src` to `dst` which has enough capacity left. We suggest
you to do this in the following steps:
1. Compute a path from `src` to `dst` which has enough capacity left.
- Implement `self.get_available_path(src, dst, bandwidth)` to compute an
available path and then call this function in `self.add_reservation(...)`.
......@@ -438,6 +442,13 @@ reservations(`del_reservation` and `del_all_reservations`).
2. Implement `del_all_reservations()`. Use `self.current_reservations` to delete
all reservations. For each reservation call `del_reservation`.
3. Add an extension to `add_reservation`. If you can not find a path were to allocate
the reservation print an error message. Furthermore, if the reservation was trying
to modify an existing one, you have to delete it. Note that `del_reservation` will
call `add_link_capacity`, and for this entry you already added the capacity back at
the beginning of `add_reservation`. An easy solution would be to call `sub_link_capacity`
before you delete the reservation.
Again a few hints:
- Remember that `self.current_reservations[(src,dst)]['handle']` contains the
......
......@@ -244,6 +244,8 @@ class RSVPController(object):
# PART 1, TASK 3.2 otherwise we print no path available
else:
# PART 1, task 4.3 if we dont find a path but the reservation existed
# you have to erase it while making sure you update links_capacity accordingly
print("\033[91mRESERVATION FAILURE: no bandwidth available!\033[0m")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment