class IfTree

Container class for Fea Interface objects in a system. More...

Definition#include <iftree.hh>
InheritsIfTreeItem [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Methods

Protected Members


Detailed Description

Container class for Fea Interface objects in a system.

typedef map<const string, IfTreeInterface> IfMap

IfMap

void  clear ()

clear

Remove all interface state from the interface tree.

bool  add_if (const string& ifname)

add_if

Create a new interface.

Parameters:
ifnameinterface name.

Returns: true on success, false if an interface with ifname already exists.

bool  remove_if (const string& ifname)

remove_if

Label interface as ready for deletion. Deletion does not occur until finalize_state() is called.

Parameters:
ifnamename of interface to be labelled.

Returns: true on success, false if ifname is invalid.

inline IfMap::iterator  get_if (const string& ifn)

get_if

Get iterator of corresponding to named interface.

Parameters:
ifninterface name to find iterator for.

Returns: iterator, will be equal to ifs().end() if invalid.

inline IfMap::const_iterator  get_if (const string& ifn)

get_if

[const]

Get iterator of corresponding to named interface.

Parameters:
ifninterface name to find iterator for.

Returns: iterator, will be equal to ifs().end() if invalid.

inline const IfMap&  ifs ()

ifs

[const]

inline IfMap&  ifs ()

ifs

IfTree&  align_with (const IfTree& user_config, bool do_finalize_state)

align_with

Align config such that only elements present in the config and a user supplied config are present. State information is taken from supplied user config.

Inside the FEA there may be multiple configuration representations, typically one the user modifies and one that mirrors the hardware. Errors may occur pushing the user config down onto the hardware and we need a method to update the user config from the h/w config that exists after the config push. We can't just copy the h/w config since the user config is restricted to configuration set by the user. The alignment works as follows: - if an item from the local tree is not in the other tree, it is deleted in the local tree - if an item from the local tree is in the other tree, its state is copied from the other tree to the local tree. - if an item from the other tree is not in the local tree, we do NOT copy it to the local tree.

Parameters:
user_configconfig to align state with.
do_finalize_stateif true, and if there are any items in the aligned config marked for deletion, then remove those items. More specifically, if true, then IfTree::finalize_state() will be called at the end.

Returns: modified configuration structure.

void  finalize_state ()

finalize_state

Delete interfaces labelled as ready for deletion, call finalize_state() on remaining interfaces, and set state to NO_CHANGE.

Reimplemented from IfTreeItem.

IfTree&  ignore_duplicates (const IfTree& o)

ignore_duplicates

Walk interfaces, vifs, and addresses and ignore state that is duplicated in the other tree: - if an item from the local tree is marked as CREATED or CHANGED, and exactly same item is on the other tree, it is marked as NO_CHANGE

Parameters:
othe other tree.

Returns: return the result local tree.

string  str ()

str

[const]

Returns: string representation of IfTree.

Reimplemented from IfTreeItem.

IfMap _ifs

_ifs

[protected]

inline IfTree::IfMap::iterator  get_if (const string& ifn)

get_if

[protected]

inline IfTree::IfMap::const_iterator  get_if (const string& ifn)

get_if

[protected const]


Generated by: pavlin on possum.icir.org on Thu Nov 6 23:46:57 2003, using kdoc 2.0a54+XORP.