Commit d0320404 authored by Simon Redman's avatar Simon Redman

Replace mutable default value

parent 58546975
......@@ -18,9 +18,7 @@
import ssh_helper
import argparse
import datetime
import getpass
import ipaddress
from netdiff import NetJsonParser
from typing import List
......@@ -47,7 +45,7 @@ def build_seg6_sysctl_command(interfaces: List[str]):
return SYSCTL_COMMAND_TEMPLATE.format(lines=str.join(" ", lines))
def build_seg6_sysctl_commands_for_network(netgraph, ignore_nodes: List[str]=[]):
def build_seg6_sysctl_commands_for_network(netgraph, ignore_nodes: List[str]=None):
"""
Build the command string to enable SRv6 for all nodes in the network
......@@ -55,6 +53,8 @@ def build_seg6_sysctl_commands_for_network(netgraph, ignore_nodes: List[str]=[])
:param ignore_nodes: List of nodes to not configure
:return: mapping of hosts to configurations
"""
if ignore_nodes is None: ignore_nodes = []
commands = []
for host in netgraph.nodes:
......@@ -66,7 +66,7 @@ def build_seg6_sysctl_commands_for_network(netgraph, ignore_nodes: List[str]=[])
return commands
def configure_nodes(netgraph, ignore_nodes: List[str]=[]):
def configure_nodes(netgraph, ignore_nodes: List[str]=None):
"""
Configure every node in the network to allow segment routing
......@@ -74,6 +74,8 @@ def configure_nodes(netgraph, ignore_nodes: List[str]=[]):
:param ignore_nodes: List of nodes to not configure
:return: Output from the SSH commands
"""
if ignore_nodes is None: ignore_nodes = []
hosts = [host for host in netgraph.nodes if host not in ignore_nodes]
sessions = list(map(lambda host : netgraph._node[host]['session'], hosts))
......
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