Commit 23bb47e3 authored by Simon Redman's avatar Simon Redman

Document ospf_sniffer_configurator

parent 0fccb279
......@@ -31,7 +31,7 @@ The topology is parsed using the information in `/var/emulab/boot/topomap` to ge
For description of the non-standard fields used, see the NetworkGraph section of this document
#### 3. add_routable_ipv6_addrs.py
#### 2. add_routable_ipv6_addrs.py
This is an executable library which provides several methods for gathering the necessary information to construct IPv6 Unique Local Addresses, construct them, and push them to the hosts
The suggested usage is:
......@@ -45,7 +45,7 @@ The suggested usage is:
- This adds an `interfaces` property to the nodes in the graph which maps the (Linux) interface name to the ULA IPv6 address
- Use ssh_helper to log out of each host in the network
#### 4. frr_configurator.py
#### 3. frr_configurator.py
This is an executable library which supports configuring and managing FRR (Free Range Routing)
All methods in this library expect to be run on a NetGraph which has been annotated with the `interfaces` field by `add_routable_ipv6_addrs`
......@@ -55,6 +55,16 @@ The most useful methods are:
- start_frr_on_network: Start frr on all nodes in the network
- stop_frr_on_network: Stop frr on all nodes in the network
#### 4. osfp_sniffer_configurator.py
Support installing and controlling the OSPF sniffer
The most useful methods are:
- clone_repo_on_network: Download a repo, presumably the one which contains the OSPF sniffer code
- start_sniffer_on_network: Run the OSPF sniffer in the background
- Starting two sniffers is likely to cause problems, chief among which being the original PID file being overwritten
- stop_sniffer_on_network: Kill the OSPF sniffer running in the background
- If stop is run multiple times, the PID file will be invalid, so there is the unlikely event of another process being assigned the same PID and killed
#### 5. sysctl_configurator.py
This is an executable library which supports running sysctl commands
......
......@@ -33,20 +33,20 @@ DEFAULT_REPO_BRANCH='release'
DEFAULT_REPO_URL="https://gitlab.flux.utah.edu/safeedge/ospfv3_monitor.git"
def generate_repo_clone_command(repo: str, branch: str, path: str) -> str:
def _generate_repo_clone_command(repo: str, branch: str, path: str) -> str:
return "git clone -b {branch} --single-branch -- {repo} {path}".format(repo=repo, branch=branch, path=path)
def generate_repo_update_command(path: str) -> str:
def _generate_repo_update_command(path: str) -> str:
return "pushd {path}; git pull; popd".format(path=path)
def generate_start_command(path:str=DEFAULT_CLONE_PATH,
executable: str=DEFAULT_EXECUTABLE,
controller: str=DEFAULT_CONTROLLER,
logfile: str=DEFAULT_LOGFILE,
pidfile: str=DEFAULT_PIDFILE,
) -> str:
def _generate_start_command(path:str=DEFAULT_CLONE_PATH,
executable: str=DEFAULT_EXECUTABLE,
controller: str=DEFAULT_CONTROLLER,
logfile: str=DEFAULT_LOGFILE,
pidfile: str=DEFAULT_PIDFILE,
) -> str:
"""
Generate a command which launches the OSPF sniffer
......@@ -67,7 +67,7 @@ def generate_start_command(path:str=DEFAULT_CLONE_PATH,
pidfile=pidfile,
)
def generate_stop_command(pidfile: str=DEFAULT_PIDFILE) -> str:
def _generate_stop_command(pidfile: str=DEFAULT_PIDFILE) -> str:
return "kill $(cat {pidfile})".format(pidfile=pidfile)
......@@ -90,7 +90,7 @@ def clone_repo_on_network(graph: networkx.Graph,
:return:
"""
if ignore_nodes is None: ignore_nodes = []
command = generate_repo_clone_command(repo=repo, branch=branch, path=path)
command = _generate_repo_clone_command(repo=repo, branch=branch, path=path)
hosts = [host for host in graph.nodes if host not in ignore_nodes]
commands = [command for host in hosts]
......@@ -113,7 +113,7 @@ def clone_repo_on_network(graph: networkx.Graph,
raise
# Update anything which needed updating
commands = [generate_repo_update_command(path)] * len(sessions_needing_updating)
commands = [_generate_repo_update_command(path)] * len(sessions_needing_updating)
outputs = ssh_helper.run_commands_on_many_hosts(sessions_needing_updating, commands)
pass
......@@ -136,13 +136,13 @@ def start_sniffer_on_network(graph: networkx.Graph,
:return:
"""
if ignore_nodes is None: ignore_nodes = []
command = generate_start_command(path=path, executable=executable, controller=controller, pidfile=pidfile)
command = _generate_start_command(path=path, executable=executable, controller=controller, pidfile=pidfile)
hosts = [host for host in graph.nodes if host not in ignore_nodes]
commands = [command for host in hosts]
sessions = [graph._node[host]['session'] for host in hosts]
# Since this command puts the sniffer in the background, the naïve default error checking does not work
# Since this command puts the sniffer in the background, the naive default error checking does not work
# First the command is echoed
echos = ssh_helper.unchecked_run_commands_on_many_hosts(sessions, commands)
# Next we check for potential outputs
......@@ -170,7 +170,7 @@ def stop_sniffer_on_network(graph: networkx.Graph,
hosts = [host for host in graph.nodes if host not in ignore_nodes]
sessions = [graph._node[host]['session'] for host in hosts]
commands = [generate_stop_command(pidfile=pidfile)] * len(hosts)
commands = [_generate_stop_command(pidfile=pidfile)] * len(hosts)
output = ssh_helper.run_commands_on_many_hosts(sessions, commands)
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment