From fe0bc2b4050ce1eaeb535406ef7f3e038048fc3a Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 26 Apr 2022 14:11:48 -0700 Subject: [PATCH] services: removed no longer relevant service arouted and associated logic, fixed nrlsmf to put the flood command before configured interfaces --- .../configservices/nrlservices/services.py | 31 +----------- .../nrlservices/templates/startarouted.sh | 15 ------ .../nrlservices/templates/startsmf.sh | 5 +- daemon/core/services/nrl.py | 49 ------------------- 4 files changed, 2 insertions(+), 98 deletions(-) delete mode 100644 daemon/core/configservices/nrlservices/templates/startarouted.sh diff --git a/daemon/core/configservices/nrlservices/services.py b/daemon/core/configservices/nrlservices/services.py index 3f911aef..ba9ef29c 100644 --- a/daemon/core/configservices/nrlservices/services.py +++ b/daemon/core/configservices/nrlservices/services.py @@ -66,7 +66,6 @@ class NrlSmf(ConfigService): modes: Dict[str, Dict[str, str]] = {} def data(self) -> Dict[str, Any]: - has_arouted = "arouted" in self.node.config_services has_nhdp = "NHDP" in self.node.config_services has_olsr = "OLSR" in self.node.config_services ifnames = [] @@ -78,11 +77,7 @@ class NrlSmf(ConfigService): ip4_prefix = f"{ip4.ip}/{24}" break return dict( - has_arouted=has_arouted, - has_nhdp=has_nhdp, - has_olsr=has_olsr, - ifnames=ifnames, - ip4_prefix=ip4_prefix, + has_nhdp=has_nhdp, has_olsr=has_olsr, ifnames=ifnames, ip4_prefix=ip4_prefix ) @@ -167,27 +162,3 @@ class MgenActor(ConfigService): validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING default_configs: List[Configuration] = [] modes: Dict[str, Dict[str, str]] = {} - - -class Arouted(ConfigService): - name: str = "arouted" - group: str = GROUP - directories: List[str] = [] - files: List[str] = ["startarouted.sh"] - executables: List[str] = ["arouted"] - dependencies: List[str] = [] - startup: List[str] = ["bash startarouted.sh"] - validate: List[str] = ["pidof arouted"] - shutdown: List[str] = ["pkill arouted"] - validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} - - def data(self) -> Dict[str, Any]: - ip4_prefix = None - for iface in self.node.get_ifaces(control=False): - ip4 = iface.get_ip4() - if ip4: - ip4_prefix = f"{ip4.ip}/{24}" - break - return dict(ip4_prefix=ip4_prefix) diff --git a/daemon/core/configservices/nrlservices/templates/startarouted.sh b/daemon/core/configservices/nrlservices/templates/startarouted.sh deleted file mode 100644 index 20bcc45e..00000000 --- a/daemon/core/configservices/nrlservices/templates/startarouted.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -for f in "/tmp/${node.name}_smf"; do - count=1 - until [ -e "$f" ]; do - if [ $count -eq 10 ]; then - echo "ERROR: nrlmsf pipe not found: $f" >&2 - exit 1 - fi - sleep 0.1 - count=$(($count + 1)) - done -done - -ip route add ${ip4_prefix} dev lo -arouted instance ${node.name}_smf tap ${node.name}_tap stability 10 2>&1 > /var/log/arouted.log & diff --git a/daemon/core/configservices/nrlservices/templates/startsmf.sh b/daemon/core/configservices/nrlservices/templates/startsmf.sh index 921568de..458b3ee9 100644 --- a/daemon/core/configservices/nrlservices/templates/startsmf.sh +++ b/daemon/core/configservices/nrlservices/templates/startsmf.sh @@ -1,8 +1,5 @@ <% ifaces = ",".join(ifnames) - arouted = "" - if has_arouted: - arouted = "tap %s_tap unicast %s push lo,%s resequence on" % (node.name, ip4_prefix, ifnames[0]) if has_nhdp: flood = "ecds" elif has_olsr: @@ -12,4 +9,4 @@ %> #!/bin/sh # auto-generated by NrlSmf service -nrlsmf instance ${node.name}_smf ${ifaces} ${arouted} ${flood} hash MD5 log /var/log/nrlsmf.log < /dev/null > /dev/null 2>&1 & +nrlsmf instance ${node.name}_smf ${flood} ${ifaces} hash MD5 log /var/log/nrlsmf.log < /dev/null > /dev/null 2>&1 & diff --git a/daemon/core/services/nrl.py b/daemon/core/services/nrl.py index 91e053b2..9ef4e1d8 100644 --- a/daemon/core/services/nrl.py +++ b/daemon/core/services/nrl.py @@ -118,12 +118,6 @@ class NrlSmf(NrlService): ifaces = node.get_ifaces(control=False) if len(ifaces) == 0: return "" - - if "arouted" in servicenames: - comments += "# arouted service is enabled\n" - cmd += " tap %s_tap" % (node.name,) - cmd += " unicast %s" % cls.firstipv4prefix(node, 24) - cmd += " push lo,%s resequence on" % ifaces[0].name if len(ifaces) > 0: if "NHDP" in servicenames: comments += "# NHDP service is enabled\n" @@ -586,46 +580,3 @@ class MgenActor(NrlService): return "" cfg += comments + cmd + " < /dev/null > /dev/null 2>&1 &\n\n" return cfg - - -class Arouted(NrlService): - """ - Adaptive Routing - """ - - name: str = "arouted" - executables: Tuple[str, ...] = ("arouted",) - configs: Tuple[str, ...] = ("startarouted.sh",) - startup: Tuple[str, ...] = ("bash startarouted.sh",) - shutdown: Tuple[str, ...] = ("pkill arouted",) - validate: Tuple[str, ...] = ("pidof arouted",) - - @classmethod - def generate_config(cls, node: CoreNode, filename: str) -> str: - """ - Return the Quagga.conf or quaggaboot.sh file contents. - """ - cfg = ( - """ -#!/bin/sh -for f in "/tmp/%s_smf"; do - count=1 - until [ -e "$f" ]; do - if [ $count -eq 10 ]; then - echo "ERROR: nrlmsf pipe not found: $f" >&2 - exit 1 - fi - sleep 0.1 - count=$(($count + 1)) - done -done - -""" - % node.name - ) - cfg += "ip route add %s dev lo\n" % cls.firstipv4prefix(node, 24) - cfg += "arouted instance %s_smf tap %s_tap" % (node.name, node.name) - # seconds to consider a new route valid - cfg += " stability 10" - cfg += " 2>&1 > /var/log/arouted.log &\n\n" - return cfg