[Xorp-hackers] Patch to add method SlaveConfigTreeNode::set_segname(...)

Pavlin Radoslavov pavlin@icir.org
Fri, 10 Mar 2006 18:12:52 -0800


> Hi Pavlin,
> 
> This method is intended for setting or changing the name of a newly created 
> multi-node.  After creating them, I either set the value if it is a regular 
> node, or the name if it is a multi-node.  Multi-nodes being added  that have 
> not yet been committed can also have their name changed without having to 
> recreate their child nodes.

OK, this is the part I still don't understand.
In general, the "segname" of a node is like a permanent name for a
node that should not be modified after it is created. Otherwise,
there could be various surprises. For example, we can have the
multi-value nodes sorted (by their segname), and just changing the
segname on the fly can be a disaster.

It sounds like you create a multi-node and set its segname (say, IP
address "1.1.1.1"). Then, before committing the configuration change
the name of the multi-node is changed (say, "2.2.2.2"), and you want
to just use "set_segname()" to change that node.

To avoid the danger of segname renaming you should create a new
multi-node "2.2.2.2" and then clone the "1.1.1.1" node's subtree to
that node. For that purpose there is already method
ConfigTreeNode::clone_subtree()

Pavlin


> 
> -- Marat
> 
> ----- Original Message ----- 
> From: "Pavlin Radoslavov" <pavlin@icir.org>
> To: "Marat Nepomnyashy" <marat@vyatta.com>
> Cc: "Pavlin Radoslavov" <pavlin@icir.org>; <xorp-hackers@xorp.org>
> Sent: Thursday, March 09, 2006 6:02 PM
> Subject: Re: [Xorp-hackers] Patch to add method 
> SlaveConfigTreeNode::set_segname(...)
> 
> 
> >> Please consider the attached patch file for integration into XORP.  It
> >> adds a convenience method SlaveConfigTreeNode::set_segname(...) to
> >> /rtrmgr/slave_conf_tree_node.hh
> >>
> >> I'm using this method to set the name of a multi-node
> >> SlaveConfigTreeNode after I create it.
> >
> > Marat,
> >
> > Why is the segname of a child allowed to change?
> > It should be assigned when the node is created and shouldn't change
> > after that.
> > If the only time you need to set the segname is when you create the
> > node, then it should be added as an argument to the appropriate
> > constructor.