Understanding Pattern Script

rajesh44853
Tera Contributor

Hello 

Can someone help me understand below script in Network Pattern -- under Stacked Switches

 

 

parent_rel_pos=${StackAll[*].entPhysicalParentRelPos};
parent_rel_pos=parent_rel_pos.sort{ it.size()}
return parent_rel_pos[0]

Trying to understand point marked in Bold ... Its returning blank value. Hence trying to understand what is it bringing

 

 

 

rajesh44853_0-1696936952573.png

 

1 REPLY 1

Mateus Oliveira
Tera Guru

Hi @rajesh44853 ,

 

The extract of script you shared seems to be used to identify the parent relationship of network components or switches and determine which switch in the stack has the lowest "entPhysicalParentRelPos." This is a common approach to identify the master or primary switch in a stack of network switches.

 

Stacked switches often have a hierarchy, with one switch serving as the master and the others as members. The "entPhysicalParentRelPos" may represent the relative position or order of a switch within the stack. By sorting these values and returning the smallest (which may indicate the master switch), the Discovery Pattern is likely trying to determine the top-level or controlling switch in the stack.

 

I hope this helps you.

 

Please, mark my response as helpful 👍 in case it helped you. Also, please mark the question as answered in case your issue was solved. This really helps future readers.