services: removed no longer relevant service arouted and associated logic, fixed nrlsmf to put the flood command before configured interfaces
This commit is contained in:
parent
0a0248d8b2
commit
fe0bc2b405
4 changed files with 2 additions and 98 deletions
|
@ -66,7 +66,6 @@ class NrlSmf(ConfigService):
|
||||||
modes: Dict[str, Dict[str, str]] = {}
|
modes: Dict[str, Dict[str, str]] = {}
|
||||||
|
|
||||||
def data(self) -> Dict[str, Any]:
|
def data(self) -> Dict[str, Any]:
|
||||||
has_arouted = "arouted" in self.node.config_services
|
|
||||||
has_nhdp = "NHDP" in self.node.config_services
|
has_nhdp = "NHDP" in self.node.config_services
|
||||||
has_olsr = "OLSR" in self.node.config_services
|
has_olsr = "OLSR" in self.node.config_services
|
||||||
ifnames = []
|
ifnames = []
|
||||||
|
@ -78,11 +77,7 @@ class NrlSmf(ConfigService):
|
||||||
ip4_prefix = f"{ip4.ip}/{24}"
|
ip4_prefix = f"{ip4.ip}/{24}"
|
||||||
break
|
break
|
||||||
return dict(
|
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
|
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
|
||||||
default_configs: List[Configuration] = []
|
default_configs: List[Configuration] = []
|
||||||
modes: Dict[str, Dict[str, str]] = {}
|
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)
|
|
||||||
|
|
|
@ -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 &
|
|
|
@ -1,8 +1,5 @@
|
||||||
<%
|
<%
|
||||||
ifaces = ",".join(ifnames)
|
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:
|
if has_nhdp:
|
||||||
flood = "ecds"
|
flood = "ecds"
|
||||||
elif has_olsr:
|
elif has_olsr:
|
||||||
|
@ -12,4 +9,4 @@
|
||||||
%>
|
%>
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# auto-generated by NrlSmf service
|
# 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 &
|
||||||
|
|
|
@ -118,12 +118,6 @@ class NrlSmf(NrlService):
|
||||||
ifaces = node.get_ifaces(control=False)
|
ifaces = node.get_ifaces(control=False)
|
||||||
if len(ifaces) == 0:
|
if len(ifaces) == 0:
|
||||||
return ""
|
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 len(ifaces) > 0:
|
||||||
if "NHDP" in servicenames:
|
if "NHDP" in servicenames:
|
||||||
comments += "# NHDP service is enabled\n"
|
comments += "# NHDP service is enabled\n"
|
||||||
|
@ -586,46 +580,3 @@ class MgenActor(NrlService):
|
||||||
return ""
|
return ""
|
||||||
cfg += comments + cmd + " < /dev/null > /dev/null 2>&1 &\n\n"
|
cfg += comments + cmd + " < /dev/null > /dev/null 2>&1 &\n\n"
|
||||||
return cfg
|
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
|
|
||||||
|
|
Loading…
Reference in a new issue