Find devices connected to a named device
This query identifies all main node devices connected to a single specified main node device.
Example
1] SELECT locm.entityid Local_Main_Node_Entity_ID,
2] locm.entityName Local_Main_Node_Entity_Name,
3] nbrm.entityid Neighbor_Main_Node_Entity_ID,
4] nbrm.entityName Neighbor_Main_Node_Entity_Name
5] FROM entityData loc
6] INNER JOIN connects c ON c.aEndEntityId = loc.entityId
7] INNER JOIN entityData nbr ON nbr.entityId = c.zEndEntityId
8] INNER JOIN entityData nbrm ON nbrm.entityid = nbr.mainnodeentityid
9] INNER JOIN entityData locm ON locm.entityid = loc.mainnodeentityid
10] WHERE loc.mainNodeEntityId = 5
11] UNION
12] SELECT locm.entityid as locMainNodeEntityId,
13] locm.entityName as locMainNodeEntityName,
14] nbrm.entityid as nbrMainNodeEntityId,
15] nbrm.entityName as nbrMainNodeEntityName
16] FROM entityData loc
17] INNER JOIN connects c ON c.zEndEntityId = loc.entityId
18] INNER JOIN entityData nbr ON nbr.entityId = c.aEndEntityId
19] INNER JOIN entityData nbrm ON nbrm.entityid = nbr.mainnodeentityid
20] INNER JOIN entityData locm ON locm.entityid = loc.mainnodeentityid
21] WHERE loc.mainNodeEntityId = 5
Description
The table below describes this query.
Line numbers |
Description |
---|---|
1-4 |
Specify the data to show in the results, as follows:
|
5 |
Use the |
6 |
Identify all the connections for the entities associated with the local device. Do this by joining the |
7 |
Extract the entity data for each neighboring entity. Do this by joining the |
8 |
Limit the results to neighboring main node devices only. Do this by joining the Use the alias |
9 |
Limit the results to local main node devices only. Do this by joining the Use the alias |
10 |
Specify the identity of the local device. |
11 |
Use the UNION statement to ensure that all connections are retrieved. |
12-21 |
This is the same code as line 1-10 with the difference that here the
specified device is considered to be the |
Results
The table below shows the results of this query. This data includes examples of devices connected to themselves. These are connections within the same device between local VLANs and VLAN trunk ports.
Local main node entity ID |
Local main node entity name |
Neighbor main node entity ID |
Neighbor main mode entity name |
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|