|
|
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:
ifname | interface 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:
ifname | name 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_iface | the 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:
ifname | interface name 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:
ifname | interface 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& 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 not modified. 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. - If an item from the other tree is not in the local tree, we do NOT copy it to the local tree.
Parameters:
other | the configuration tree to align state with. |
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_iftree | the old tree with the state that is used as reference. |
Returns: the modified configuration tree.
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]