Skip to content

Commit 9de6bf0

Browse files
author
Dmitrii Dugaev
committed
Moved table.txt and neighbors_file from source directory to /var/log/adhoc_routing
1 parent f6f72c7 commit 9de6bf0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

NeighborDiscovery.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
# Import the necessary modules of the program
2525
import routing_logging
2626

27-
## @var ABSOLUTE_PATH
28-
# This constant stores a string with an absolute path to the program's main directory.
29-
ABSOLUTE_PATH = routing_logging.ABSOLUTE_PATH
27+
## @var PATH_TO_LOGS
28+
# This constant stores a string with an absolute path to log files directory.
29+
PATH_TO_LOGS = routing_logging.PATH_TO_LOGS
3030
## @var NEIGHBOR_LOG
3131
# Global routing_logging.LogWrapper object for logging NeighborDiscovery activity.
3232
NEIGHBOR_LOG = routing_logging.create_routing_log("routing.neighbor_discovery.log", "neighbor_discovery")
@@ -59,7 +59,7 @@ class NeighborDiscovery:
5959
# @return None
6060
def __init__(self, raw_transport_obj, table_obj):
6161
# Create initial empty neighbors file
62-
f = open(ABSOLUTE_PATH + "/neighbors_file", "w")
62+
f = open(PATH_TO_LOGS + "neighbors_file", "w")
6363
f.close()
6464
# Create listening and advertising threads
6565
## @var listen_neighbors_handler
@@ -281,7 +281,7 @@ def process_neighbor(self, src_mac, dsr_hello_message):
281281
# @param self The object pointer.
282282
# @return None
283283
def update_neighbors_file(self):
284-
f = open(ABSOLUTE_PATH + "/neighbors_file", "w")
284+
f = open(PATH_TO_LOGS + "neighbors_file", "w")
285285
for mac in self.neighbors_list:
286286

287287
NEIGHBOR_LOG.debug("Neighbor's IPs: %s", str(self.neighbors_list[mac].l3_addresses))

RouteTable.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import rl_logic
1818
import routing_logging
1919

20-
## @var ABSOLUTE_PATH
21-
# This constant stores a string with an absolute path to the program's main directory.
22-
ABSOLUTE_PATH = routing_logging.ABSOLUTE_PATH
20+
## @var PATH_TO_LOGS
21+
# This constant stores a string with an absolute path to log files directory.
22+
PATH_TO_LOGS = routing_logging.PATH_TO_LOGS
2323

2424
## @var TABLE_LOG
2525
# Global routing_logging.LogWrapper object for logging RouteTable activity.
@@ -105,7 +105,7 @@ class Table:
105105
def __init__(self, node_mac):
106106
## @var table_filename
107107
# Define a filename to write the table entries to. Default filename is "table.txt".
108-
self.table_filename = "/table.txt"
108+
self.table_filename = "table.txt"
109109
## @var node_mac
110110
# MAC address of the node's network interface.
111111
self.node_mac = node_mac
@@ -239,7 +239,7 @@ def get_neighbors_l3_addresses(self):
239239
def print_table(self):
240240
current_entries_list = self.get_list_of_entries()
241241

242-
f = open(ABSOLUTE_PATH + self.table_filename, "w")
242+
f = open(PATH_TO_LOGS + self.table_filename, "w")
243243
f.write("-" * 90 + "\n")
244244

245245
for dst_ip in current_entries_list:

0 commit comments

Comments
 (0)