Skip to content

Commit 6b3c662

Browse files
author
Daniel Hirsch
committed
Add sanity check for specified startNode, endNode and route
1 parent 0a45bda commit 6b3c662

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ScenarioParser.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ def __convert_to_delivery_orders(self, root):
147147
if route.links[i].end_node.identifier == route.links[i+1].end_node.identifier:
148148
log.error('Error in route of delivery order ' + str(identifier) + '. Link ' + str(route.links[i].identifier) + ' is not connected to Link ' + str(route.links[i+1].identifier))
149149
exit()
150+
151+
# Verify that the specified route of the delivery order starts with the specified startNode
152+
if not start_node_identifier == route.links[0].start_node.identifier:
153+
log.error('Error in route of delivery order ' + str(identifier) + '. The first link ' + str(
154+
route.links[0].start_node.identifier) + ' is not connected to the startNode ' + str(start_node_identifier))
155+
exit()
156+
157+
# Verify that the specified route of the delivery order ends with the specified endNode
158+
if not end_node_identifier == route.links[0].start_node.identifier:
159+
log.error('Error in route of delivery order ' + str(identifier) + '. The last link ' + str(
160+
route.links[-1].end_node.identifier) + ' is not connected to the endNode ' + str(
161+
end_node_identifier))
162+
exit()
163+
150164
log.debug('Route of delivery order ' + str(identifier) + ' is valid')
151165

152166
else:

0 commit comments

Comments
 (0)