Hello,
I'm developing an aplication on Java as well for the HP VAN SDN Controller v2.4.5 and I'm interested in using it's internal services as you did. (NodeService, TopologyService, and so on). But I haven't been able to do that, the program runs normally until it reaches an instruction like Set<Node> nodes = nodeService.getNodes(IpAddress.ip(ipAddress)); and it stops running.
I don't know what's missing so I can use such services. I'm going to leave a sample of code that I'm working on so you can see where it stops:
public class trffcmngrManager implements trffcmngrService {
//@SuppressWarnings("unused")
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY_UNARY)
private volatile ControllerService controllerService; // This Service works perfectly
private volatile TopologyService topoService; //This is the Service that I want to use and I can't
private static final Logger LOG = LoggerFactory.getLogger( trffcmngrService.class );
private SwitchListener switchListener;
private PacketListener packetListener; // This is the class where I want to use Topology Service
@Activate
protected void activate()
{
LOG.info( "MySdnLab: Activated" );
LOG.info( "MySdnLab: I'm Alive!!!!!" );
switchListener = new SwitchListener();
switchListener.init(controllerService);
switchListener.startup();
packetListener = new PacketListener();
packetListener.init(controllerService, topoService);
packetListener.startup();
}
@Deactivate
protected void deactivate()
{
LOG.info( "MySdnLab: Deactivated" );
LOG.info( "MySdnLab: Ok.. I'm dead" );
switchListener.shutdown();
packetListener.shutdown();
}
}
///-------------------------------//-------------------------------------------------//
public class IpPacketHandler {
ControllerService mControllerService;
TopologyService mTopoService;
private static final Logger LOG = LoggerFactory.getLogger(IpPacketHandler.class);
private static final ProtocolVersion PV = ProtocolVersion.V_1_3;
public IpPacketHandler(ControllerService controllerservice, TopologyService topoService) {
mControllerService = controllerservice;
mTopoService = topoService;
}
/*
*There is some code here that will call the next function
*/
private DataPathId FindDestination (MessageContext messageContext, MacAddress destAdd){
LOG.info("MySdnLab: IpPacketHandler: FindDestination Activated");
Topology topology = mTopoService.getTopology(); //This is where the program stops
LOG.info("MySdnLab: IpPacketHandler: topogia {}", topology.toString());
return null;
}
}
I really appreciate your help in advance.
PM