- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Re: ControllerService and authentication in java
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2014 04:04 AM
03-07-2014 04:04 AM
ControllerService and authentication in java
Hello,
My name is Alfonso, I'm newbie in developing SDN. I have several problems on SDN programming in Java.
Problem Description:
I have a network created with MiniNet, managed by the HP VAN SDN controller with 4 switches, each connected to 2 or 3 host
I want to get information DataPath, as I have seen in the HP VAN SDN Controller programming guide on page 31.
How I can implement?:
private ControllerService cs = ...;
Could you send me an example of implementation of ControllerService?
My code is:
import com.hp.api.NotFoundException;
import com.hp.of.ctl.ControllerService;
import com.hp.of.ctl.impl.ControllerManager;
import com.hp.of.lib.dt.DataPathId;
import com.hp.of.lib.dt.DataPathInfo;
import com.hp.of.lib.msg.Port;
public class infoDataPath {
public static void main(String[] args) {
//ControllerManager cm;
ControllerService cs = ...;
DataPathId dpid = DataPathId.valueOf("00:00:00:00:00:00:00:01");
DataPathInfo dpi;
try {
dpi = cs.getDataPathInfo(dpid);
System.out.println("Datapath with ID"+ dpid + "is connected");
System.out.println("Negotiated protocol version is"+ dpi.negotiated());
for (Port p: dpi.ports()) {
}
} catch (NotFoundException e) {
System.out.println("Datapath with ID"+dpid+" is not connected");
}
}
}
Do you need to be authenticated ? with /auth , to run this code.
How you can authenticate through java code accesing to Rest Service with Jersey Rest?
Is better accesing to Rest Service with Maven?
thank you very much
Greetings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2014 03:02 PM
03-10-2014 03:02 PM
Re: ControllerService and authentication in java
Hello Alfonso,
I can answer one of your questions.
Using the ControllerService API via java does not require authentication since this is considered an Internal Application. Only applications that are external to the controller will need to authenticate themselves and they do that through the REST API. This is explained further in the "Internal Applications vs. External Applications" section of the SDN Controller Programming Guide (http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-c04003169-2.pdf).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2014 11:09 AM
04-25-2014 11:09 AM
Re: ControllerService and authentication in java
Hello Alfonso,
I don't have an example that shows how to implement ControllerService but you will create the cs reference variable just like any other object reference:
private ControllerService cs = new ControllerService();
If you have installed the SDN SDK, which comes with the controller software, you can find details about the methods provided by ControllerService by pointing your browser to
file:///<PATH TO CONTROLLER PACKAGE DOWNLOADED FROM HP>/2.2.5.0016_hp-van-sdn-ctlr-2.2.5-x64/hp-sdn-apidoc-2.2.5/index.html.
Once there, select 'ControllerService' from the lower frame on the left-hand side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 01:27 AM
05-07-2014 01:27 AM
Re: ControllerService and authentication in java
Hello AlfonsoZendos,
Below is the sequence of steps by which the controller service can be invoked in an application.
//handler for controller service
@Reference(cardinality = OPTIONAL_UNARY, policy = DYNAMIC,
name="ControllerService")
//Declare the controller service
private volatile ControllerService cs;
/**
* Hook for notification of available {@link ControllerService} via
* declarative services.
*
* @param cs the service being made available
*/
protected void bindControllerService(ControllerService cs) {
if (this.cs != null)
return;
this.cs = cs;
log.debug("{}-bindControllerService() method invoked", NAME);
}
/**
* Announces the unavailability of the controller service.
*
* @param cs the service that is being revoked
*/
protected void unbindControllerService(ControllerService cs) {
if (this.cs == cs)
this.cs = null;
log.debug("{}-unbindControllerService() method invoked", NAME);
}
//calculate the DPID to start the Flow Mirror Service
Set<DataPathInfo> dpId = cs.getAllDataPathInfo();
Hope this helps.
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2014 03:54 AM
05-19-2014 03:54 AM
Re: ControllerService and authentication in java
Hello AlfonsoZendos,
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