Routing¶
RoutingDaemonBase¶
Base class for Routing daemons.
- class nest.routing.route_daemons.RoutingDaemonBase(router_ns_id, ipv6_routing, interfaces, daemon, conf_dir, **kwargs)¶
Bases:
ABC
Abstract class for Dynamic routing related processes. This class should be inherited for adding other daemons
Use add_to_config to sequentially add daemon related commands for the config file.
Finally call run to create the config file and run the daemon.
Note: (i): If you’re using RoutingHelper, config files are created at the /tmp directory. (ii): Daemons may not work as expected if a config file is not created
- conf¶
In memory stream to temporarily hold configuration
- Type:
file-like
- router_ns_id¶
Router namespace id
- Type:
str
- daemon¶
daemon to run(one of [‘zebra’, ‘ospf’, ‘isis’])
- Type:
str
- conf_file¶
config file path
- Type:
str
- pid_file¶
pid file path for the daemon process
- Type:
str
- interfaces¶
interfaces present in the router
- Type:
List[Interface]
- ipv6_routing¶
True for routing IPv6 interfaces, False otherwise. Default value is set to False.
- Type:
bool
- add_to_config(command)¶
Add a line to self.conf
- Parameters:
command (str) – command to add to config file
- abstract create_basic_config()¶
Created minimum configuration for daemon
- create_config()¶
Creates config file on disk from self.conf
- handle_dependecy_error()¶
Default error when routing daemon is not present
- abstract run(engine_func)¶
Run the daemon along with its config file
Zebra¶
Class to handle zebra
- class nest.routing.zebra.Zebra(router_ns_id, ipv6_routing, interfaces, conf_dir, **kwargs)¶
Bases:
RoutingDaemonBase
Handles zebra related functionalities. Refer to DaemonBase for usage
- add_interface(interface)¶
Add interface command to config file
- add_ip_address(ip_address)¶
Add IP address command to config file
- create_basic_config()¶
Creates a file with basic configuration for OSPF. Use base add_to_config directly for more complex configurations
- handle_dependecy_error()¶
Default error when routing daemon is not present
- run()¶
Runs the zebra daemon
Ospf¶
Class to handles OSPF related functionalities
- class nest.routing.ospf.Ospf(router_ns_id, ipv6_routing, interfaces, conf_dir, **kwargs)¶
Bases:
RoutingDaemonBase
Handles OSPF related functionalities.
- create_basic_config()¶
Creates a file with basic configuration for OSPF. Use base add_to_config directly for more complex configurations
- run()¶
Runs the ospfd command
Rip¶
Class to handles RIP related functionalities
- class nest.routing.rip.Rip(router_ns_id, ipv6_routing, interfaces, conf_dir, **kwargs)¶
Bases:
RoutingDaemonBase
Handles RIP related functionalities. Refer to DaemonBase for usage
- add_network(network)¶
Add command for subnet or interface to run RIP on to config file
- Parameters:
network (str) – subnet or interface to run RIP on
- add_rip()¶
Add command to enable RIP on router to config file
- create_basic_config()¶
Creates a file with basic configuration for RIP. Use base add_to_config directly for more complex configurations
- run()¶
Runs the ripd command
Isis¶
Class to handles IS-IS related functionalities
- class nest.routing.isis.Isis(router_ns_id, ipv6_routing, interfaces, conf_dir, **kwargs)¶
Bases:
RoutingDaemonBase
Handles IS-IS related functionalities.
- create_basic_config()¶
Creates a file with basic configuration for IS-IS. Use base add_to_config directly for more complex configurations
- run()¶
Runs the isisd command
Ldp¶
Class to handles Ldp related functionalities
- class nest.routing.ldp.Ldp(router_ns_id, ipv6_routing, interfaces, conf_dir, **kwargs)¶
Bases:
RoutingDaemonBase
Handles Ldp related functionalities for frr.
- create_basic_config()¶
Creates a file with basic configuration for ldp. Use base add_to_config directly for more complex configurations
- run()¶
Runs the ldpd command
RoutingHelper¶
Helper class for routing
- class nest.routing.routing_helper.RoutingHelper(protocol: str, ipv6_routing: bool = False, hosts: List[Node] = None, routers: List[Node] = None, ldp_routers: List[Node] = None)¶
Bases:
object
Handles basic routing requirements for the topology. Either inherit this class or use Zebra and other protocols for better customizations
- _module_map¶
map between protocol string and its module and class
- Type:
dict
- protocol¶
routing protocol(one of [‘rip’, ‘ospf’, ‘isis’])
- Type:
str
- conf_dir¶
path for config directory of daemons
- Type:
str
- protocol_class¶
Protocol class which will later be instantiated
- Type:
ABCMeta
- ipv6_routing¶
True for routing IPv6 interfaces, False otherwise. Default value is set to False.
- Type:
bool
- __init__(protocol: str, ipv6_routing: bool = False, hosts: List[Node] = None, routers: List[Node] = None, ldp_routers: List[Node] = None)¶
Constructor for RoutingHelper. The dynamic routing daemons will be run only on nodes with more than one interface. Specify hosts & routers parameters to override this.
- Parameters:
protocol (str) – routing protocol to be run. One of [ospf, rip, isis]
ipv6_routing (bool) – True for routing IPv6 interfaces, False otherwise. Default value is set to False.
hosts (List[Node]) – List of hosts in the network. If None, considers the entire topology. Use this if your topology has disjoint networks
routers (List[Node]) – List of routers in the network. If None, considers the entire topology. Use this if your topology has disjoint networks
ldp_routers (List[Node]) – List of Routers which are to be used with mpls. Only enables ldp discovery on interfaces with mpls enabled
- populate_routing_tables()¶
Populate routing table using self.protocol