Software Defined Networking
1753480 Members
4980 Online
108794 Solutions
New Discussion

Locating a node on a switch: API 2.3.5

 
sbotkine
Frequent Advisor

Locating a node on a switch: API 2.3.5

Hello, 

 

With the HP VAN Controller API 2.0.0 , I used to locate a node on my Network by using the following instructions: 

 

 

// Mac address of the target Node I want to locate

 MacAddress targetMacAddress= MacAddress.valueOf("74:8e:f8:24:1a:00");

 

// Switch and port I can locate the Node

switch = nodeService.getNetworkNode(targetMacAddress, VId.valueOf(20)).connectedSwitchDpid();

outPort = nodeService.getNetworkNode(targetMacAddress, VId.valueOf(20)).connectedPort();

 

 

In the HP VAN Controller API 2.3.5, I can't use same instructions because API changed a lot. For example, the Nodes methodes "connectedSwitchDpid()" and "connectedPort()" doesn't exist anymore. And the nodeService methode "getNetworkNode(MAC, Vid)" doesnt exist.

 

I tried to find an easy way to do the same, but without success. Could you help me ? Can you give me instructions that allow to locate a Node (knowing its mac address) on my Network (switch and port)  ?

 

Regards, 

 

Serge

 

7 REPLIES 7
VoIP-Buddy
HPE Pro

Re: Locating a node on a switch: API 2.3.5

Serge,

 

I am looking into this for you.  I have sent a question off to Engineering.

 

In the meantime, I also looked at the VAN SDN Controller Release Notes for v2.3.  In the network services section it states that the LinkService and NodeService API's were removed.  They also state that they have added support for the OpenFlow Node Discovery apps for link and node discovery operations.  My feeling is that the new OpenFlow routines have superseeded the 2.0.0 provided routines.

 

I am looking to see what API packages the routines you used are located in to confirm that those were the ones that were removed.  More shortly.

 

Regards,

 

David

 

 

I work for HPE in Aruba Technical Support
VoIP-Buddy
HPE Pro

Re: Locating a node on a switch: API 2.3.5

Serge,

 

I got the following response back from SDN Engineering this morning.  I hope this helps.

 

Regards,

 

David

 

======================================================

 

In 2.3.5, the nodes can be obtained using Mac Address by creating a Node filter and applying to the result of getNodes(NodeFilter) or use getNodesByMacVid(). Please find the sample code snippet given below:

 

>>given MAC and VlanId  :

 

Set<Node> getNodesByMacVid(NodeService ns, MacAddress mac, VlanId vid) {

   SegmentId seg = SegmentId.valueOf(vid);

   return ns.getNodes(mac, seg);

}

 

>>look up the set of nodes using a given MAC, VlanId, switch, and port:

 

Set<Node> getNodesByMacVidLocation(NodeService ns, MacAddress mac, VlanId vid, DataPathId dpid, BigPortNumber port) {

   SegmentId seg = SegmentId.valueOf(vid);

   DeviceId devId = DeviceId.valueOf(dpid);

   InterfaceId intfId = InterfaceId.valueOf(port);

   ConnectionPoint cp = new DefaultConnectionPoint(devId, intfId);

 

   DefaultNodeFilter filter = new DefaultNodeFilter();

   filter.mac(mac);

   filter.cp(cp);

   filter.segmentId(seg);

   return ns.getNodes(filter);

}

I work for HPE in Aruba Technical Support
sdnindia
Trusted Contributor

Re: Locating a node on a switch: API 2.3.5

Hello Serge,

 

Doing a follow up to check if you need any further assistance with respect to the query posted.

Please do let us know  if your problem is solved.

 

If you have more questions on the same topic please do reply on the same thread or open a new post if new topic.

 

Thanks

HP SDN Team

NewToSDNProgram
Occasional Advisor

Re: Locating a node on a switch: API 2.3.5

Hi SDN Team,

 

I am interested to know how to find the switch/port using the new 2.3.5 API, as the original poster said before this could be found using these methods in the old API.

 

// Switch and port I can locate the Node

switch = nodeService.getNetworkNode(targetMacAddress, VId.valueOf(20)).connectedSwitchDpid();

outPort = nodeService.getNetworkNode(targetMacAddress, VId.valueOf(20)).connectedPort();

 

Thank you!

 

-David

VoIP-Buddy
HPE Pro

Re: Locating a node on a switch: API 2.3.5

David,

 

Please see my previous code snipit 3 messages back from this one.

 

Regards,

 

David

I work for HPE in Aruba Technical Support
NewToSDNProgram
Occasional Advisor

Re: Locating a node on a switch: API 2.3.5

Hi Voip Buddy,

 

Your code wasn't exactly what I was looking for, my problem wasnt searching for Nodes, but rather finding out which switch (DataPathID) contained those nodes. The following code via another post resolves this problem in the new 2.3.5+ API. Thanks!

 

List<DataPathId> dataPathIdsToInstallRule = new ArrayList<DataPathId>();
for(Node curr : nodes)
{
        dataPathIdsToInstallRule.add(DataPathId.dpid(curr.location().elementId().toString()));
}

 

 

-David

VoIP-Buddy
HPE Pro

Re: Locating a node on a switch: API 2.3.5

David,

 

Glad I was able to help.  Thank you for posting your solution!

 

Regards,

 

David

I work for HPE in Aruba Technical Support