diff --git a/common/scripts/mesh-11s_nats.sh b/common/scripts/mesh-11s_nats.sh index 559b3aa9e..ebbdd5243 100755 --- a/common/scripts/mesh-11s_nats.sh +++ b/common/scripts/mesh-11s_nats.sh @@ -51,9 +51,16 @@ add_network_intf_to_bridge() { } fix_iface_mac_addresses() { + # handles the case when the mac address of the batman interface the same as the eth0. + # For batman interface, the mac address is set to 00:0Y:XX:XX:XX:XX by utilizing eth0 mac address. + # from 00:0Y:XX:XX:XX:XX Y is the batman interface index + + # batman interface is bat0, take the last char for the numbering + batman_iface_index="$(echo "$batman_iface" | cut -b 4)" + #Create static mac addr for Batman if eth0_mac="$(ip -brief link | grep eth0 | awk '{print $3; exit}')" - batif_mac="00:00:$(echo "$eth0_mac" | cut -b 7-17)" + batif_mac="00:0${batman_iface_index}:$(echo "$eth0_mac" | cut -b 7-17)" ifconfig "$batman_iface" down ifconfig "$batman_iface" hw ether "$batif_mac" ifconfig "$batman_iface" up @@ -165,10 +172,7 @@ network={ EOF if [ "$routing_algo" == "batman-adv" ]; then - mesh_kill "[a]lfred -i $batman_iface -m" - mesh_kill "[b]atadv-vis -i $batman_iface -s" - rm -f /var/run/alfred.sock - #Check if batman_adv is built-in module + echo "batman-adv" elif [ "$routing_algo" == "olsr" ]; then mesh_kill "[o]lsrd -i $wifidev -d 0" fi @@ -214,8 +218,6 @@ EOF if [ "$routing_algo" == "batman-adv" ]; then batctl if add "$wifidev" echo "$batman_iface up.." - # Create static mac addr for Batman if and br-lan - fix_iface_mac_addresses ifconfig "$batman_iface" up echo "$batman_iface ip address.." ifconfig "$batman_iface" "$ipaddr" netmask "$nmask" @@ -224,16 +226,6 @@ EOF echo ifconfig "$batman_iface" - # for visualisation - (alfred -i "$batman_iface" -m)& - echo "started alfred" - - if ps aux | grep -q "[b]atadv-vis -i $batman_iface -s"; then - echo "batadv-vis is already running." - else - (batadv-vis -i "$batman_iface" -s) & - echo "batadv-vis started." - fi elif [ "$routing_algo" == "olsr" ]; then ifconfig "$wifidev" "$ipaddr" netmask "$nmask" # Enable debug level as necessary @@ -245,6 +237,25 @@ EOF ifconfig "$bridge_name" up echo ifconfig "$bridge_name" + + if [ "$routing_algo" == "batman-adv" ]; then + sleep 3 + # for visualisation + if ps aux | grep -q "[a]lfred -i $bridge_name -m"; then + echo "alfred is already running." + else + (alfred -i "$bridge_name" -m)& + echo "started alfred" + fi + + if ps aux | grep -q "[b]atadv-vis -i $batman_iface -s"; then + echo "batadv-vis is already running." + else + (batadv-vis -i "$batman_iface" -s) & + echo "batadv-vis started." + fi + fi + # Add forwarding rules from AP to "$batman_iface" interface iptables -P FORWARD ACCEPT route del -net "$network" gw 0.0.0.0 netmask "$nmask" dev "$bridge_name" @@ -295,10 +306,7 @@ network={ EOF if [ "$routing_algo" == "batman-adv" ]; then - mesh_kill "[a]lfred -i $batman_iface -m" - mesh_kill "[b]atadv-vis -i $batman_iface -s" - rm -f /var/run/alfred.sock - #Check if batman_adv is built-in module + echo "batman-adv" if [[ -d "/sys/module/batman_adv" ]]; then modprobe batman-adv fi @@ -328,8 +336,6 @@ EOF if [ "$routing_algo" == "batman-adv" ]; then batctl if add "$wifidev" echo "$batman_iface up.." - # Create static mac addr for Batman if and br-lan - fix_iface_mac_addresses ifconfig "$batman_iface" up echo "$batman_iface ip address.." ifconfig "$batman_iface" "$ipaddr" netmask "$nmask" @@ -338,18 +344,6 @@ EOF echo ifconfig "$batman_iface" - sleep 3 - - # for visualisation - (alfred -i "$batman_iface" -m)& - echo "started alfred" - if ps aux | grep -q "[b]atadv-vis -i $batman_iface -s"; then - echo "batadv-vis is already running." - else - (batadv-vis -i "$batman_iface" -s) & - echo "batadv-vis started." - fi - elif [ "$routing_algo" == "olsr" ]; then ifconfig "$wifidev" "$ipaddr" netmask "$nmask" # Enable debug level as necessary @@ -364,6 +358,25 @@ EOF ifconfig "$bridge_name" up echo ifconfig "$bridge_name" + + if [ "$routing_algo" == "batman-adv" ]; then + sleep 3 + # for visualisation + if ps aux | grep -q "[a]lfred -i $bridge_name -m"; then + echo "alfred is already running." + else + (alfred -i "$bridge_name" -m)& + echo "started alfred" + fi + + if ps aux | grep -q "[b]atadv-vis -i $batman_iface -s"; then + echo "batadv-vis is already running." + else + (batadv-vis -i "$batman_iface" -s) & + echo "batadv-vis started." + fi + fi + # Add forwarding rules from AP to "$batman_iface" interface iptables -P FORWARD ACCEPT route del -net "$network" gw 0.0.0.0 netmask "$nmask" dev "$bridge_name" @@ -626,7 +639,6 @@ main () { fi calculate_network_address "$br_lan_ip" "$nmask" - mode_execute "$mode" } diff --git a/modules/sc-mesh-secure-deployment/src/nats/initd/S9011sNatsMesh b/modules/sc-mesh-secure-deployment/src/nats/initd/S9011sNatsMesh index 6d5dd6fd2..4bd03236a 100644 --- a/modules/sc-mesh-secure-deployment/src/nats/initd/S9011sNatsMesh +++ b/modules/sc-mesh-secure-deployment/src/nats/initd/S9011sNatsMesh @@ -28,6 +28,14 @@ LOG_FILE=/opt/mesh_11s_${RADIO_INDEX}.log [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" start() { + + while [ -f "/var/run/nats.pid" ]; do + random_number=$(( (RANDOM % 5) + 1 )) + sleep $random_number + done + + echo $$ > /var/run/nats.pid + printf 'Starting %s: ' "$DAEMON" if [ "${!_MODE}" == "ap+mesh_scc" ] || [ "${!_MODE}" == "ap+mesh_mcc" ]; then mode=mesh @@ -41,6 +49,9 @@ start() { else echo "FAIL" fi + + rm /var/run/nats.pid + return "$status" } stop() { diff --git a/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_apply.py b/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_apply.py index e02b91003..da33f72da 100644 --- a/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_apply.py +++ b/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_apply.py @@ -8,10 +8,10 @@ async def main(): # Connect to NATS! nc = await client.connect_nats() - cmd_dict = {"api_version": 1, "cmd": "APPLY", "radio_index": "1"} + cmd_dict = {"api_version": 1, "cmd": "APPLY", "radio_index": "0"} cmd = json.dumps(cmd_dict) rep = await nc.request( - f"comms.command.{config.MODULE_IDENTITY}", cmd.encode(), timeout=10 + f"comms.command.{config.MODULE_IDENTITY}", cmd.encode(), timeout=15 ) parameters = json.loads(rep.data) print(json.dumps(parameters, indent=2)) diff --git a/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_request.py b/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_request.py index c55502b08..c69522e04 100644 --- a/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_request.py +++ b/modules/sc-mesh-secure-deployment/src/nats/scripts/cli_settings_request.py @@ -8,62 +8,62 @@ async def main(): nc = await client.connect_nats() cmd_dict = { "api_version": 1, - "role": f"{config.MODULE_ROLE}", + "role": f"{config.MODULE_ROLE}", # sleeve, drone, gcs "radios": [ { "radio_index": "0", - "ssid": "test_mesh", + "ssid": "test_mesh2", "key": "1234567890", "ap_mac": "00:11:22:33:44:55", - "country": "US", - "frequency": "5220", - "frequency_mcc": "2412", + "country": "US", # all radios must have the same country + "frequency": "2412", + "frequency_mcc": "2412", # multiradio not supporting "routing": "batman-adv", "priority": "long_range", - "ip": "192.168.1.2", + "ip": "10.20.15.3", "subnet": "255.255.255.0", - "tx_power": "5", - "mode": "mesh", + "tx_power": "15", + "mode": "mesh", # ap+mesh_scc, mesh, halow "mesh_vif": "wlp2s0", - "phy": "phy0", + "phy": "phy2", # TODO: NOT_USED "batman_iface": "bat0", }, { "radio_index": "1", - "ssid": "test_mesh2", + "ssid": "test_mesh", "key": "1234567890", "ap_mac": "00:11:22:33:44:55", - "country": "US", - "frequency": "2412", - "frequency_mcc": "2412", + "country": "US", # all radios must have the same country + "frequency": "5220", + "frequency_mcc": "2412", # multiradio not supporting + "routing": "batman-adv", + "priority": "long_range", + "ip": "10.20.15.3", + "subnet": "255.255.255.0", + "tx_power": "15", + "mode": "mesh", # ap+mesh_scc, mesh, halow + "mesh_vif": "wlp3s0", # this needs to be correct + "phy": "phy0", # TODO: NOT_USED + "batman_iface": "bat0", + }, + { + "radio_index": "2", + "ssid": "test_mesh3", + "key": "1234567890", + "ap_mac": "00:11:22:33:44:55", + "country": "US", # all radios must have the same country + "frequency": "5190", + "frequency_mcc": "2412", # multiradio not supporting "routing": "batman-adv", "priority": "long_range", - "ip": "192.168.1.2", + "ip": "10.20.15.3", "subnet": "255.255.255.0", - "tx_power": "5", - "mode": "mesh", - "mesh_vif": "wlp3s0", - "phy": "phy2", + "tx_power": "30", + "mode": "halow", # ap+mesh_scc, mesh, halow + "mesh_vif": "halow1", + "phy": "phy2", # TODO: NOT_USED "batman_iface": "bat0", }, - # { - # "radio_index": "2", - # "ssid": "test_mesh3", - # "key": "1234567890", - # "ap_mac": "00:11:22:33:44:55", - # "country": "US", - # "frequency": "5190", - # "frequency_mcc": "2412", - # "routing": "batman-adv", - # "priority": "long_range", - # "ip": "192.168.1.2", - # "subnet": "255.255.255.0", - # "tx_power": "5", - # "mode": "halow", - # "mesh_vif": "halow1", - # "phy": "phy2", - # "batman_iface": "bat0", - # }, ], "bridge": "br-lan bat0 eth1 lan1" } diff --git a/modules/sc-mesh-secure-deployment/src/nats/src/batadvvis.py b/modules/sc-mesh-secure-deployment/src/nats/src/batadvvis.py index 0245b7ed7..66b7cfa5a 100644 --- a/modules/sc-mesh-secure-deployment/src/nats/src/batadvvis.py +++ b/modules/sc-mesh-secure-deployment/src/nats/src/batadvvis.py @@ -12,10 +12,14 @@ class BatAdvVis: """ command = 'batadv-vis' - def __init__(self, loop_interval:float = 1.0): + def __init__(self, loop_interval:float = 1.0, batman_interface:str = "bat0" ): + """ + init method + """ + self.__batman_interface = batman_interface self.latest_topology = "{}" self.thread_running = False - self.interval = loop_interval + self.__interval = loop_interval @staticmethod def remove_interfaces(visual_lines): @@ -77,7 +81,7 @@ def run(self): self.thread_running = True while self.thread_running: self.latest_topology = self.get() - time.sleep(self.interval) + time.sleep(self.__interval) # Real user is mesh_executor diff --git a/modules/sc-mesh-secure-deployment/src/nats/src/batstat.py b/modules/sc-mesh-secure-deployment/src/nats/src/batstat.py index e0227c2da..bdf3a8a05 100644 --- a/modules/sc-mesh-secure-deployment/src/nats/src/batstat.py +++ b/modules/sc-mesh-secure-deployment/src/nats/src/batstat.py @@ -5,8 +5,9 @@ import re import json from time import sleep -import netifaces from datetime import datetime +import netifaces + class STATUS: # pylint: disable=too-few-public-methods """ @@ -22,29 +23,31 @@ def __init__(self): self.accesspoint = "AP" # accesspoint configuration in use self.not_avail = "NA" # Not Available - +# pylint: disable=too-many-instance-attributes class Batman: """ Batman mesh class """ - def __init__(self, loop_interval: float = 1.0): - self.topology = {} - self.device_template = {} - self.device_rssi_list = [] - self.device_noise_dict = {} + def __init__(self, loop_interval: float = 1.0, batman_interface: str = "bat0"): + self.batman_interface = batman_interface + self.topology: {} = {} + self.device_template: {} = {} + self.device_rssi_list_per_radio: [dict, ...] = [] + self.device_noise_list_per_radio: [dict, ...] = [] self.mesh_status = STATUS() - self._status = self.mesh_status.no_config # "MESH/OFF/NO_CONFIG/ONGOING/AP/ERROR" - self.iw_type = self.mesh_status.not_avail # iw dev info - type - self.network_interface = self.mesh_status.not_avail - self.freq = self.mesh_status.not_avail - self.txpower = self.mesh_status.not_avail - self.iw_state = self.mesh_status.not_avail - self.country = self.mesh_status.not_avail - self.hw_name = self.mesh_status.not_avail - self.thread_running = False - self.latest_stat = "" - self.interval = loop_interval + self.status: [str, ...] = [self.mesh_status.no_config] # "MESH/OFF/NO_CONFIG/ + # ONGOING/AP/ERROR" + self.iw_type: [str, ...] = [self.mesh_status.not_avail] # iw dev info - type + self.network_interface: [str, ...] = [self.mesh_status.not_avail] + self.freq: [str, ...] = [self.mesh_status.not_avail] + self.txpower: [str, ...] = [self.mesh_status.not_avail] + self.iw_state: [str, ...] = [self.mesh_status.not_avail] + self.country: [str, ...] = [self.mesh_status.not_avail] + self.hw_name: [str, ...] = [self.mesh_status.not_avail] + self.thread_running: bool = False + self.latest_stat: str = "" + self.interval: float = loop_interval def _update_interface_name(self): """ @@ -52,42 +55,49 @@ def _update_interface_name(self): :return: None """ - out = subprocess.Popen(['batctl', 'if'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - try: - self.network_interface = out.stdout.readline().decode('utf-8').split(":")[0] - except (TypeError, IndexError): - self.network_interface = self.mesh_status.not_avail + with subprocess.Popen(['batctl', 'meshif', self.batman_interface, 'if'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) as out: + + try: + self.network_interface = [line.decode('utf-8').split(":")[0] for line in out.stdout] + except (TypeError, IndexError): + self.network_interface = [self.mesh_status.not_avail] def _update_survey_dump(self): """ - Update survey dump info, self.freq, self.noise + Update survey dump info, freq, noise :return: None """ - dump = subprocess.Popen(['iw', 'dev', self.network_interface, 'survey', 'dump'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - self.device_noise_dict = {} - freq = 0 - noise = 0 - try: - for line in dump.stdout: - line = line.decode("utf-8") - if "frequency:" in line: - freq = re.findall(r'\s*frequency:\s+(\d+) ', line)[0] - noise = 0 - elif "noise:" in line: - noise = re.findall(r'\s*noise:\s+(-*\d+) ', line)[0] - - if noise and freq: - self.device_noise_dict[freq] = noise - freq = 0 - noise = 0 - except (IndexError, TypeError): - self.device_noise_dict = [self.mesh_status.not_avail] - print("ERROR survey") + self.device_noise_list_per_radio = [] + + for interface in self.network_interface: + with subprocess.Popen(['iw', 'dev', interface, 'survey', 'dump'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as dump: + + radio_noise_dict = {} + freq = 0 + noise = 0 + + try: + for line in dump.stdout: + line = line.decode("utf-8") + if "frequency:" in line: + freq = re.findall(r'\s*frequency:\s+(\d+) ', line)[0] + noise = 0 + elif "noise:" in line: + noise = re.findall(r'\s*noise:\s+(-*\d+) ', line)[0] + + if noise and freq: + radio_noise_dict[freq] = noise + freq = 0 + noise = 0 + radio_noise_dict["status"] = self.mesh_status.mesh + self.device_noise_list_per_radio.append(radio_noise_dict) + except (IndexError, TypeError): + print("ERROR survey") def _update_station_dump_info(self): """ @@ -95,23 +105,28 @@ def _update_station_dump_info(self): :return: None """ - dump = subprocess.Popen(['iw', 'dev', self.network_interface, 'station', 'dump'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - self.device_rssi_list = [] - mac = "" - rssi = [] - for line in dump.stdout: - line = line.decode("utf-8") - if "Station" in line: - mac = line.split(" ")[1] - rssi = [] - elif "signal:" in line: - rssi = re.findall(r'-\d+', line) - if mac and rssi: - self.device_rssi_list.append((mac, rssi)) + self.device_rssi_list_per_radio = [] + + for interface in self.network_interface: + with subprocess.Popen(['iw', 'dev', interface, 'station', 'dump'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as dump: + + mac_and_rssi_dict = {} mac = "" + rssi = [] + for line in dump.stdout: + line = line.decode("utf-8") + if "Station" in line: + mac = line.split(" ")[1] + rssi = [] + elif "signal:" in line: + rssi = re.findall(r'-\d+', line) + if mac and rssi: + mac_and_rssi_dict[mac] = rssi + mac = "" + + self.device_rssi_list_per_radio.append(mac_and_rssi_dict) def _update_iw_info(self): """ @@ -120,22 +135,28 @@ def _update_iw_info(self): :return: None """ - dump = subprocess.Popen(['iw', 'dev', self.network_interface, 'info'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - try: - for line in dump.stdout: - line = line.decode("utf-8") - if "channel" in line: - self.freq = re.findall(r'\((\d+) MHz\)', line)[0] - elif "txpower" in line: - self.txpower = re.findall(r'\d+.\d+', line)[0] - elif "type" in line: - self.iw_state = re.findall(r'type (\w+)', line)[0] - except (IndexError, TypeError): - self.freq = self.mesh_status.not_avail - self.txpower = self.mesh_status.not_avail - self.iw_state = self.mesh_status.not_avail + self.freq = [] + self.txpower = [] + self.iw_state = [] + + for interface in self.network_interface: + + with subprocess.Popen(['iw', 'dev', interface, 'info'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as dump: + try: + for line in dump.stdout: + line = line.decode("utf-8") + if "channel" in line: + self.freq.append(str(re.findall(r'\((\d+) MHz\)', line)[0])) + elif "txpower" in line: + self.txpower.append(str(re.findall(r'\d+.\d+', line)[0])) + elif "type" in line: + self.iw_state.append(str(re.findall(r'type (\w+)', line)[0])) + except (IndexError, TypeError): + self.freq.append(self.mesh_status.not_avail) + self.txpower.append(self.mesh_status.not_avail) + self.iw_state.append(self.mesh_status.not_avail) def _update_iw_type(self): """ @@ -144,18 +165,22 @@ def _update_iw_type(self): :return: None """ - if self.iw_state == "managed": - self.status = self.mesh_status.no_config - elif self.iw_state == "AP": - self.status = self.mesh_status.accesspoint - elif self.iw_state == "mesh": - self.status = self.mesh_status.mesh - elif self.iw_state == "IBSS": - self.status = self.mesh_status.mesh - elif self.iw_state == self.mesh_status.not_avail: - self.status = self.mesh_status.not_avail - else: - self.status = self.mesh_status.error + self.status: [str, ...] = [] + + # for loop network_interfaces with index + for index in range(len(self.network_interface)): + if self.iw_state[index] == "managed": + self.status.append(self.mesh_status.no_config) + elif self.iw_state[index] == "AP": + self.status.append(self.mesh_status.accesspoint) + elif self.iw_state[index] == "mesh": + self.status.append(self.mesh_status.mesh) + elif self.iw_state[index] == "IBSS": + self.status.append(self.mesh_status.mesh) + elif self.iw_state[index] == self.mesh_status.not_avail: + self.status.append(self.mesh_status.not_avail) + else: + self.status.append(self.mesh_status.error) def _update_iw_reg(self): """ @@ -164,58 +189,46 @@ def _update_iw_reg(self): :return: None """ - dump = subprocess.Popen(['iw', 'reg', 'get'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - try: - for line in dump.stdout: - line = line.decode("utf-8") - if "country" in line: - self.country = re.findall(r'country (\w+)', line)[0] - except (IndexError, TypeError): - self.country = self.mesh_status.not_avail + with subprocess.Popen(['iw', 'reg', 'get'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as dump: + try: + for line in dump.stdout: + line = line.decode("utf-8") + if "country" in line: + self.country = re.findall(r'country (\w+)', line)[0] + break + except (IndexError, TypeError): + self.country = self.mesh_status.not_avail @property - def _get_my_mac(self): + def _get_my_mac(self) -> [str, ...]: """ Get device mac :return: mac or not_avail """ self._update_interface_name() - try: - return netifaces.ifaddresses(self.network_interface)[netifaces.AF_PACKET][0]['addr'] - except (ValueError, TypeError, IndexError): - return self.mesh_status.not_avail + macs = [] + for interface in self.network_interface: + try: + macs.append(netifaces.ifaddresses(interface)[netifaces.AF_PACKET][0]['addr']) + except (ValueError, TypeError, IndexError): + return [self.mesh_status.not_avail] + + return macs - def _get_my_rssi(self, mac): + def _get_my_rssi(self, mac: str) -> [str, ...]: """ Get device rssi values :return: rssi value or not_avail """ - result = [r for (m, r) in self.device_rssi_list if m == mac] - if result: - return result[0] + for index in range(len(self.network_interface)): + if mac in self.device_rssi_list_per_radio[index]: + return self.device_rssi_list_per_radio[index][mac] return [self.mesh_status.not_avail] - @property - def status(self): - """ - Status getter - - :return: status - """ - return self._status - - @status.setter - def status(self, new_status): - """ - Status setter - - :return: None - """ - self._status = new_status def _update_device_info(self): self._update_interface_name() # Wi-Fi interface name @@ -237,14 +250,23 @@ def _create_template(self): :return: None """ + noise_per_used_channel = [] + self._update_device_info() + for index in range(0, len(self.network_interface)): + if self.freq[index] in self.device_noise_list_per_radio[index]: + noise_per_used_channel.append( + self.device_noise_list_per_radio[index][self.freq[index]]) + else: + noise_per_used_channel.append(self.mesh_status.not_avail) + self.topology = {'ts': self._timestamp(), # timestamp + 'batman': self.batman_interface, # batman interface name + 'netifs': self.network_interface, # network interfaces 'status': self.status, # "MESH/OFF/NO_CONFIG/ONGOING/AP/" 'my_mac': self._get_my_mac, # e.g. 00:11:22:33:44:55 - 'noise': self.device_noise_dict[self.freq] - if self.freq in self.device_noise_dict - else self.mesh_status.not_avail, + 'noise': noise_per_used_channel, 'freq': self.freq, 'txpower': self.txpower, 'country': self.country, @@ -268,13 +290,13 @@ def update_stat_data(self): route = [] try: - proc = subprocess.Popen(['batctl', 'o'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + with subprocess.Popen(['batctl', 'meshif', self.batman_interface, 'o' , '-H'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: - for line in proc.stdout: - device = dict(self.device_template) - aux = line.split() + for line in proc.stdout: + device = dict(self.device_template) + aux = line.split() - if b"Originator" not in aux[0] and b"B.A.T" not in line: # active route check if b"*" in aux[0]: index = 1 @@ -290,7 +312,7 @@ def update_stat_data(self): device['nhr'] = self._get_my_rssi(device['nh']) route.append(device) - self.topology['devices'] = route + self.topology['devices'] = route except FileNotFoundError: self.topology['devices'] = self.device_template # if not succeed, return empty template print("update_stat_data: ERROR") diff --git a/modules/utils/docker/entrypoint_nats.sh b/modules/utils/docker/entrypoint_nats.sh index 12e5da501..fce15b13b 100755 --- a/modules/utils/docker/entrypoint_nats.sh +++ b/modules/utils/docker/entrypoint_nats.sh @@ -67,7 +67,7 @@ else /opt/S90nats_server start echo "starting radvd" - radvd -C /etc/radvd.conf # TODO: for some reason init.d is not working + #radvd -C /etc/radvd.conf # TODO: for some reason init.d is not working echo "starting comms services" /opt/S90comms_controller start