Software Defined Networking
1827294 Members
1916 Online
109960 Solutions
New Discussion

Re: How to get DataPathId of switch for a node that has a certain IP Address

 
SOLVED
Go to solution
NewToSDNProgram
Occasional Advisor

How to get DataPathId of switch for a node that has a certain IP Address

Hello,

I would like to kindly ask how via the 2.3.5 SDN Controller API I would be able to get the DataPathId(s) of the switch(es) that are passing packets with a specific source IP Address.

 

I know that I can get all the nodes with the IP Address by using the NodeService as follows:

 

Set<Node> nodes = nodeService.getNodes(IpAddress.ip(ipAddress));

 

Now with the node's NodeLocation I can even get the node's elementId/InterfaceId/DeviceId, but via this information how can i get the swtich(es) DatapathId(s) that are passing packets with this as a source IP Address? I need this information to target the specific switches with FlowMod messages to drop packets with the specified source IP Address. Thanks!

 

-David

3 REPLIES 3
sdnindia
Trusted Contributor
Solution

Re: How to get DataPathId of switch for a node that has a certain IP Address

Hello David,

 

Function call getNodes as below

Set<Node> getNodes(IpAddress ip) which returns all nodes in the domain with a given IP address.

 

Node has below function which returns the most recent node location(NodeLocation ).

NodeLocation    location()

 

Again NodeLocation can call a function elementId() which returns DeviceId    and then function toString() can be called .

Finally             static DataPathId    dpid(String spec) will give the dpid i.e. DataPathID

 

Please let us know if this helps or you still face the issue.

 

Thanks,

HP SDN Team

 

NewToSDNProgram
Occasional Advisor

Re: How to get DataPathId of switch for a node that has a certain IP Address

Thank you,

 

Out of curiosity is this documented anywhere in the SDK PDF manual? I would like to read more about how to use the different interfaces and what they mean. 

 

-David

sdnindia
Trusted Contributor

Re: How to get DataPathId of switch for a node that has a certain IP Address

Hello David,

 

You can find the information in Java API documentation.

Doing a follow up to see if you need any further assistance with respected to the query.

 

Thanks,

HP SDN Team