class IfTree

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

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

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 error.

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.

bool  update_if (const IfTreeInterface& other_iface)

update_if

Create a new interface or update its state if it already exists.

Parameters:

other_ifacethe interface with the state to copy from.

Returns: true on success, false if an error.

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

get_if

Get iterator of corresponding to named interface.

Parameters:

ifnameinterface name to find iterator for.

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

IfMap::iterator  get_if (uint32_t ifindex)

get_if

Get iterator corresponding to an interface with a given physical index.

Parameters:

ifindexinterface index to find iterator for.

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

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

get_if

[const]

Get iterator of corresponding to named interface.

Parameters:

ifnameinterface name to find iterator for.

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

IfMap::const_iterator  get_if (uint32_t ifindex)

get_if

[const]

Get iterator corresponding to an interface with a given physical index.

Parameters:

ifindexinterface index 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& other)

align_with

Align user supplied configuration with the device configuration.

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 the item in the local tree is "disabled", then the state is copied but the item is still marked as "disabled". Otherwise, the rules below are applied. - If an item from the local tree is not in the other tree, it is marked as deleted in the local tree. However, if an interface from the local tree is marked as "soft" or "discard_emulated", and is not in the other tree, the interface is not marked as 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. However, if an item from the local tree is marked as "flipped", it will be set in the local tree even if it is not set in the other tree. - If an item from the other tree is not in the local tree, we do NOT copy it to the local tree.

Parameters:

otherthe configuration tree to align state with.

Returns: modified configuration structure.

IfTree&  prepare_replacement_state (const IfTree& other)

prepare_replacement_state

Prepare configuration for pushing and replacing previous configuration.

If the previous configuration is to be replaced with new configuration, we need to prepare the state that will delete, update, and add the new state as appropriate. The preparation works as follows: - All items in the local tree are preserved and marked as created. - All items in the other tree that are not in the local tree are added to the local tree and are marked as deleted. Only if the interface is marked as "soft" or "discard_emulated", or if the item in the other state is marked as disabled, then it is not added.

Parameters:

otherthe configuration tree to be used to prepare the replacement state.

Returns: modified configuration structure.

IfTree&  prune_bogus_deleted_state (const IfTree& old_iftree)

prune_bogus_deleted_state

Prune bogus deleted state.

If an item from the local tree is marked as deleted, but is not in the other tree, then it is removed.

Parameters:

old_iftreethe old tree with the state that is used as reference.

Returns: the modified configuration tree.

IfTree&  track_live_config_state (const IfTree& other)

track_live_config_state

Track modifications from the live config state as read from the kernel.

All interface-related modifications as received by the observer mechanism are recorded in a local copy of the interface tree (the live configuration tree). Some of those modifications however should be propagated to the XORP local configuration tree. This method updates a local configuration tree with only the relevant modifications of the live configuration tree: - Only if an item is in the local configuration tree, its status may be modified. - If the "no_carrier" flag of an interface is changed in the live configuration tree, the corresponding flag in the local configuration tree is updated.

Parameters:

otherthe live configuration tree whose modifications are tracked.

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.

string  str ()

str

[const]

Returns: string representation of IfTree.

Reimplemented from IfTreeItem.

IfMap _ifs

_ifs

[protected]

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

get_if

[protected]

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

get_if

[protected const]


Generated by: pavlin on possum.icir.org on Wed Mar 21 11:23:22 2007, using kdoc $.