xorp

Nodes Class Reference

List of all members.

Public Member Functions

 Nodes (Simulator *r, EventLoop &ev)
bool create_node (const vector< IPv4 > &addrs)
 Simulation graph creation.
bool destroy_node (const IPv4 &main_addr)
 Destroy an OLSR node in the simulator.
size_t purge_links_by_node (const IPv4 &main_addr) throw (NoSuchAddress)
 Given the main address of an OLSR node, destroy all links referencing that node.
bool configure_address (const IPv4 &iface_addr)
 Mark an OLSR node address as administratively up.
bool unconfigure_address (const IPv4 &iface_addr)
 Mark an OLSR node address as administratively down.
void set_default_hello_interval (const int value)
void set_default_mid_interval (const int value)
void set_default_mpr_coverage (const int value)
void set_default_refresh_interval (const int value)
void set_default_tc_interval (const int value)
void set_default_hna_interval (const int value)
void set_default_dup_hold_time (const int value)
void set_default_willingness (const int value)
void set_default_tc_redundancy (const int value)
bool set_hello_interval (const IPv4 &main_addr, const int value)
 Set HELLO_INTERVAL variable for the node given by main_addr.
bool set_mid_interval (const IPv4 &main_addr, const int value)
 Set MID_INTERVAL variable for the node given by main_addr.
bool set_mpr_coverage (const IPv4 &main_addr, const int value)
 Set MPR_COVERAGE variable for the node given by main_addr.
bool set_refresh_interval (const IPv4 &main_addr, const int value)
 Set REFRESH_INTERVAL variable for the node given by main_addr.
bool set_tc_interval (const IPv4 &main_addr, const int value)
 Set TC_INTERVAL variable for the node given by main_addr.
bool set_tc_redundancy (const IPv4 &main_addr, const int value)
 Set TC_REDUNDANCY variable for the node given by main_addr.
bool set_willingness (const IPv4 &main_addr, const int value)
 Set WILLINGNESS variable for the node given by main_addr.
bool set_hna_interval (const IPv4 &main_addr, const int value)
 Set HNA_INTERVAL variable for the node given by main_addr.
bool set_dup_hold_time (const IPv4 &main_addr, const int value)
 Set DUP_HOLD_TIME variable for the node given by main_addr.
bool select_node (const IPv4 &main_addr)
 Select the OLSR node with the given main address for the verification commands which follow.
bool dump_routing_table (const IPv4 &main_addr)
 Dump a node's routing table to cout.
bool verify_all_link_state_empty ()
 Verify that the link state database at every node in the topology is empty (N1/N2/TC/MPR/MID).
bool verify_node_link_state_empty (NodeTuple &nat)
 Verify that the link state database in the given node is empty (N1/N2/TC/MPR/MID).
bool verify_n1 (const IPv4 &n1_addr, const bool expected_is_n1)
 Verify that the neighbor given by n1_addr is a one-hop neighbor of the currently selected node.
bool verify_n2 (const IPv4 &n2_addr, const bool expected_is_n2)
 Verify that n2_addr is the address of a two-hop neighbor of the currently selected node.
bool verify_is_mpr (const bool expected_is_mpr)
 Verify the MPR status of the selected node.
bool verify_mpr_set (const vector< IPv4 > &mpr_addrs)
 Verify the MPR set of the selected node.
bool verify_mpr_selector_set (const vector< IPv4 > &mprs_addrs)
 Verify the MPR selector set of the selected node.
bool verify_mid_node_count (const size_t expected)
 Verify the MID database of the selected node contains the expected number of nodes (Note: this is NOT the same as entries; rather, it's the number of unique keys we have in the _mid_addr multimap.)
bool verify_mid_node_addrs (const IPv4 &origin, const vector< IPv4 > &addrs)
 Verify the MID database of the selected node contains the given entries for the given protocol address.
bool verify_mid_address_distance (const IPv4 &origin, const IPv4 &iface_addr, const uint16_t expected_distance)
 Verify the MID database of the selected node contains an entry for the given main address and interface address, at the given network distance measured in hops.
bool verify_tc_origin_count (const size_t expected_count)
 Verify the TC database of the selected node contains entries which have originated from the given number of unique OLSR nodes.
bool verify_tc_ans (const IPv4 &origin, const uint16_t expected_ansn, const vector< IPv4 > &expected_addrs)
 Verify that the Advertised Neighbor Set of 'origin', as seen at the currently selected node, has the expected ANSN and the expected neighbor set contents.
bool verify_tc_origin_seen (const IPv4 &origin, const bool expected_seen)
 Verify that the selected node has seen TC broadcasts from 'origin' at least once during the lifetime of the simulation.
bool verify_tc_distance (const IPv4 &origin, const IPv4 &neighbor_addr, const uint16_t expected_distance)
 Verify that the given TC entry has the expected hop count, as observed at the currently selected node's TC database.
bool verify_tc_destination (const IPv4 &dest_addr, const size_t expected_count)
 Verify that the currently selected node has a given number of TC entries pointing to the given destination.
bool verify_hna_entry (const IPv4Net &dest, const IPv4 &origin)
 Verify the HNA database of the selected node contains an entry for the given destination from the given origin.
bool verify_hna_distance (const IPv4Net &dest, const IPv4 &origin, const uint16_t distance)
 Verify the HNA database of the selected node contains an entry for the given destination from the given origin, at the given distance.
bool verify_hna_entry_count (const size_t expected_count)
 Verify the HNA database of the selected node contains exactly the given number of entries.
bool verify_hna_origin_count (const size_t expected_count)
 Verify the HNA database of the selected node contains entries which have originated from the given number of unique OLSR nodes.
bool verify_hna_dest_count (const size_t expected_count)
 Verify the HNA database of the selected node contains the given number of leanred network prefixes.
bool originate_hna (const IPv4Net &dest)
 Add a prefix to the HNA "routes out" database of the currently selected node, and start advertising it.
bool withdraw_hna (const IPv4Net &dest)
 Withdraw a prefix from the HNA "routes out" database of the currently selected node, and stop advertising it.
bool verify_routing_table_size (const size_t rtsize)
 Verify the routing table of the selected node contains exactly the given number of entries.
bool verify_routing_entry (IPv4Net dest, IPv4 nexthop, uint32_t metric)
 Verify the routing table of the selected node contains the given route entry.
NodeTupleget_node_tuple_by_addr (const IPv4 &addr) throw (NoSuchAddress)
 Given an OLSR protocol address, return the corresponding NodeTuple instance by value.

Protected Member Functions

bool node_is_selected ()

Private Attributes

Simulator_parent
EventLoop_eventloop
int _next_instance_id
 The next available instance ID for a pair of OLSR/DebugIO instances.
int _default_hello_interval
int _default_mid_interval
int _default_mpr_coverage
int _default_refresh_interval
int _default_tc_interval
int _default_hna_interval
int _default_dup_hold_time
int _default_willingness
int _default_tc_redundancy
map< IPv4, NodeTuple_nodes
 Database of current simulation instances, keyed by protocol address; one entry for each OLSR address.
NodeTuple _selected_node
 The currently selected node.

Member Function Documentation

bool Nodes::configure_address ( const IPv4 iface_addr)

Mark an OLSR node address as administratively up.

Parameters:
iface_addrthe interface address to configure up.
Returns:
true if ok, false if any error occurred.
bool Nodes::create_node ( const vector< IPv4 > &  addrs)

Simulation graph creation.

Create an OLSR node in the simulator.

Parameters:
addrsthe interface addresses to create the node with; the first address is always the main address.
Returns:
true if ok, false if any error occurred.
bool Nodes::destroy_node ( const IPv4 main_addr)

Destroy an OLSR node in the simulator.

Parameters:
main_addrthe main address of the node to destroy.
Returns:
true if ok, false if any error occurred.
bool Nodes::dump_routing_table ( const IPv4 main_addr)

Dump a node's routing table to cout.

Parameters:
main_addrthe address of the node to dump routes for.
Returns:
true if ok, false if any error occurred.
NodeTuple & Nodes::get_node_tuple_by_addr ( const IPv4 addr) throw (NoSuchAddress)

Given an OLSR protocol address, return the corresponding NodeTuple instance by value.

Parameters:
addrthe OLSR protocol address to look up in the simulator.
Returns:
the NodeTuple corresponding to addr.
Exceptions:
NoSuchAddrif the address does not exist.
bool Nodes::originate_hna ( const IPv4Net dest)

Add a prefix to the HNA "routes out" database of the currently selected node, and start advertising it.

Parameters:
destthe network prefix to originate.
Returns:
true if ok, false if any error occurred.
size_t Nodes::purge_links_by_node ( const IPv4 main_addr) throw (NoSuchAddress)

Given the main address of an OLSR node, destroy all links referencing that node.

Parameters:
main_addrThe OLSR interface address of the node.
Returns:
the number of links which were destroyed.
Exceptions:
NoSuchAddressif link_addr does not exist.
bool Nodes::select_node ( const IPv4 main_addr)

Select the OLSR node with the given main address for the verification commands which follow.

Parameters:
main_addrthe address of the node to select.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_dup_hold_time ( const IPv4 main_addr,
const int  value 
)

Set DUP_HOLD_TIME variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the DUP_HOLD_TIME protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_hello_interval ( const IPv4 main_addr,
const int  value 
)

Set HELLO_INTERVAL variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the HELLO_INTERVAL protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_hna_interval ( const IPv4 main_addr,
const int  value 
)

Set HNA_INTERVAL variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the HNA_INTERVAL protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_mid_interval ( const IPv4 main_addr,
const int  value 
)

Set MID_INTERVAL variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the MID_INTERVAL protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_mpr_coverage ( const IPv4 main_addr,
const int  value 
)

Set MPR_COVERAGE variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the MPR_COVERAGE protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_refresh_interval ( const IPv4 main_addr,
const int  value 
)

Set REFRESH_INTERVAL variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the REFRESH_INTERVAL protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_tc_interval ( const IPv4 main_addr,
const int  value 
)

Set TC_INTERVAL variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the TC_INTERVAL protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_tc_redundancy ( const IPv4 main_addr,
const int  value 
)

Set TC_REDUNDANCY variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the TC_REDUNDANCY protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::set_willingness ( const IPv4 main_addr,
const int  value 
)

Set WILLINGNESS variable for the node given by main_addr.

Parameters:
main_addrthe address of the node to set the variable for.
valuethe new value of the WILLINGNESS protocol variable.
Returns:
true if ok, false if any error occurred.
bool Nodes::unconfigure_address ( const IPv4 iface_addr)

Mark an OLSR node address as administratively down.

Parameters:
iface_addrthe interface address to configure down.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_all_link_state_empty ( )

Verify that the link state database at every node in the topology is empty (N1/N2/TC/MPR/MID).

HNA state is NOT checked.

Returns:
true if ok, false if any error occurred.
bool Nodes::verify_hna_dest_count ( const size_t  expected_count)

Verify the HNA database of the selected node contains the given number of leanred network prefixes.

Parameters:
expected_countthe expected number of HNA prefixes.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_hna_distance ( const IPv4Net dest,
const IPv4 origin,
const uint16_t  distance 
)

Verify the HNA database of the selected node contains an entry for the given destination from the given origin, at the given distance.

Parameters:
destthe IPv4 destination to look up in HNA.
originthe expected OLSR main address of the origin.
distancethe expected distance to the origin, as measured from the HNA messages themselves.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_hna_entry ( const IPv4Net dest,
const IPv4 origin 
)

Verify the HNA database of the selected node contains an entry for the given destination from the given origin.

Parameters:
destthe IPv4 destination to look up in HNA.
originthe expected OLSR main address of the origin.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_hna_entry_count ( const size_t  expected_count)

Verify the HNA database of the selected node contains exactly the given number of entries.

Parameters:
expected_countthe expected number of HNA entries.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_hna_origin_count ( const size_t  expected_count)

Verify the HNA database of the selected node contains entries which have originated from the given number of unique OLSR nodes.

Parameters:
expected_countthe expected number of HNA origins.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_is_mpr ( const bool  expected_is_mpr)

Verify the MPR status of the selected node.

Parameters:
expected_is_mprthe expected MPR status.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_mid_address_distance ( const IPv4 origin,
const IPv4 iface_addr,
const uint16_t  expected_distance 
)

Verify the MID database of the selected node contains an entry for the given main address and interface address, at the given network distance measured in hops.

Parameters:
main_addrthe main address to look up in the MID database.
iface_addrthe interface address for the MID entry.
expected_distancethe expected distance in hops.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_mid_node_addrs ( const IPv4 origin,
const vector< IPv4 > &  addrs 
)

Verify the MID database of the selected node contains the given entries for the given protocol address.

Parameters:
originthe main address to look up in the MID database.
addrsthe expected addresses for this node; may be empty.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_mid_node_count ( const size_t  expected)

Verify the MID database of the selected node contains the expected number of nodes (Note: this is NOT the same as entries; rather, it's the number of unique keys we have in the _mid_addr multimap.)

Parameters:
expected_sizethe expected dize of the MID table.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_mpr_selector_set ( const vector< IPv4 > &  mprs_addrs)

Verify the MPR selector set of the selected node.

Parameters:
mprs_addrsthe expected contents of the MPR selector set.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_mpr_set ( const vector< IPv4 > &  mpr_addrs)

Verify the MPR set of the selected node.

Parameters:
mpr_addrsthe expected contents of the MPR set.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_n1 ( const IPv4 n1_addr,
const bool  expected_is_n1 
)

Verify that the neighbor given by n1_addr is a one-hop neighbor of the currently selected node.

Parameters:
n1_addrthe address of the one-hop neighbor to verify.
expected_is_n1the expected status
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_n2 ( const IPv4 n2_addr,
const bool  expected_is_n2 
)

Verify that n2_addr is the address of a two-hop neighbor of the currently selected node.

Parameters:
n2_addrthe address of the two-hop neighbor to verify.
expected_is_n2the expected status
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_node_link_state_empty ( NodeTuple nat)

Verify that the link state database in the given node is empty (N1/N2/TC/MPR/MID).

HNA state is NOT checked.

Parameters:
natthe NodeTuple to verify.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_routing_entry ( IPv4Net  dest,
IPv4  nexthop,
uint32_t  metric 
)

Verify the routing table of the selected node contains the given route entry.

TODO deal with multiple matches.

Parameters:
destthe destination.
nexthopthe expected next-hop of the entry.
metricthe expected metric of the entry.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_routing_table_size ( const size_t  rtsize)

Verify the routing table of the selected node contains exactly the given number of entries.

Parameters:
rtsizethe expected number of routing table entries.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_tc_ans ( const IPv4 origin,
const uint16_t  expected_ansn,
const vector< IPv4 > &  expected_addrs 
)

Verify that the Advertised Neighbor Set of 'origin', as seen at the currently selected node, has the expected ANSN and the expected neighbor set contents.

Parameters:
originthe origin to look up in the TC database.
expected_ansnthe ANSN we expect to see.
expected_addrsthe expected neighbor set contents; may be empty to indicate set should be empty.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_tc_destination ( const IPv4 dest_addr,
const size_t  expected_count 
)

Verify that the currently selected node has a given number of TC entries pointing to the given destination.

Parameters:
addrthe destination to look up in the TC database.
expected_countthe number of TC entries we expect to see.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_tc_distance ( const IPv4 origin,
const IPv4 neighbor_addr,
const uint16_t  expected_distance 
)

Verify that the given TC entry has the expected hop count, as observed at the currently selected node's TC database.

NOTE: The distance thus observed can never be less than 2, this accounts for the hop used to reach us, and the hop from the TC's origin to the advertised neighbor. This is used for the local TC routing computation.

Parameters:
originthe origin to look up in the TC database.
neighbor_addrthe neighbor to look up for origin.
expected_distancethe distance we expect to see recorded for this TC entry.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_tc_origin_count ( const size_t  expected_count)

Verify the TC database of the selected node contains entries which have originated from the given number of unique OLSR nodes.

Parameters:
expected_countthe expected number of TC origins.
Returns:
true if ok, false if any error occurred.
bool Nodes::verify_tc_origin_seen ( const IPv4 origin,
const bool  expected_seen 
)

Verify that the selected node has seen TC broadcasts from 'origin' at least once during the lifetime of the simulation.

If it has never been seen then TopologyManager::get_tc_neighbor_set() will throw an exception -- there is a check which takes place to look for final recorded ANSN values.

Parameters:
originthe origin to look up in the TC database.
expected_seentrue if we expect to have seen the origin.
Returns:
true if ok, false if any error occurred.
bool Nodes::withdraw_hna ( const IPv4Net dest)

Withdraw a prefix from the HNA "routes out" database of the currently selected node, and stop advertising it.

Parameters:
destthe network prefix to withdraw.
Returns:
true if ok, false if any error occurred.

Member Data Documentation

map<IPv4, NodeTuple> Nodes::_nodes [private]

Database of current simulation instances, keyed by protocol address; one entry for each OLSR address.

Multiple addresses may map to the same OLSR instance (see MID).


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations