- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Re: Noob SDN Programming Questions
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
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
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
09-09-2014 05:57 AM
09-09-2014 05:57 AM
Noob SDN Programming Questions
Hi Guys,
Hopefully someone can help me. I've just started out in the SDN space and I'm trying to get my head around using the API and programming the controller to do my bidding.
So what I want to do to start off with is have the ability to detect PACKET_IN and FLOW_REMOVED messages.
From my limited research into the field, I have found a few helpful hints, but Eclipse keeps telling me that various SDK packages cannot be found.
Has anyone successfully been able to sniff for these packets and somehow print them somewhere? (preferably in the web UI, but just to a file is ok for now).
Thanks in advance for any assisstance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 08:31 AM
09-16-2014 08:31 AM
Re: Noob SDN Programming Questions
Hello MatthewHart,
As per SDN programming guide 2.3 [page 212] Posting Alerts-you can make use of the post function available under AlertService.You can implement SequencedPacketListener and override the function
public boolean event(MessageContext context){ …}
In this function you can extract the packet information-
OfmPacketIn packetIn = (OfmPacketIn) context.getPacketIn();
//Then packetIn.toString() can be passed to the post function of AlertService
//post(Severity severity, AlertTopic topic, String origin, String data) please refer to page 212 of
SDN Programming guide 2.3
Please let us know if this helps or still your are facing some problem.
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 04:07 PM
09-16-2014 04:07 PM
Re: Noob SDN Programming Questions
Thanks for the reply!
Once i'm able to resolve the other issue i'm having (http://h30499.www3.hp.com/t5/SDN-Development/How-to-install-SDN/m-p/6618818/highlight/false#M437) I'll jump in and give this a go.
I'll reply with results soon (hopefully).
Thanks for the support thus far!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 04:09 AM
09-29-2014 04:09 AM
Re: Noob SDN Programming Questions
Hi Team,
When you say to override "public boolean event(MessageContext context){ …}", do you mean "public void event(MessageContext context){ …}"? I can find the latter, but not the former.
This is my event listener code and it doesn't generate any alerts in the VAN SDN Software under the Alert Tab.
Do I need to hook this listener into the event handler somehow?
@Override
public void event(MessageContext context) {
OfmPacketIn packetIn = (OfmPacketIn) context.getPacketIn();
alertService.post(Severity.WARNING, alertTopic, "SniffPacketIn: ", packetIn.toString());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2014 09:36 AM
10-01-2014 09:36 AM
Re: Noob SDN Programming Questions
Hello Matthew,
Interface SequencedPacketListener has the function boolean event(MessageContext context) in SDN JAVA API 2.0 and 2.2.5 versions.
However in version 2.3.5 the function is void event(MessageContext context)
The referred was for SDN JAVA API 2.0/2.2.5
As pet the SDN Programming guide 2.3 page 213
“When the optional AlertService is set, an alert topic is registered using the AlertService. This registration process will return the alert topic to use when the alert is posted. Alert topics are persistent, thus if the topic was already registered, registering it again will have no effect.
Since AlertService is optional in SwitchManager, the alert will be posted just if the service is available, thus a check for null is needed before posting the alert.”
So please modify code as per page 212
….
if (alertService != null) {
String source = "OpenFlow Switch: " +
id.getValue();
String data = "Switch Retrieved!!”;
alertService.post(Severity.WARNING, alertTopic,
source, data);
}
…..
You can have a look on the example provided in the guide to post alert (for e.g. SwitchManager.java has data member as alertService of type AlertService , also you may need to consider other files too ) You may need to look others pages as well e.g. 166 onwards.
You can also try for Auditing with logs from page 215 onwards.
Please let us know if this helps or you still face some issue.
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2014 03:52 PM
10-06-2014 03:52 PM
Re: Noob SDN Programming Questions
Hi All,
I've managed to get the PacketIn processing happening.
I've now turned my attention to the flowremoved events.
I've added my code below to start looking for them at the moment, but Nothing comes up in the alertService.
I've also added the event listeners in the same way as I have with PacketIn.
private class FlowListenerImpl implements FlowListener {
/**
* Listener for FlowRemoved Messages
*/
@Override
public void event(FlowEvent event) {
OfmFlowRemoved flowRemoved = event.flowRemoved();
if(flowRemoved != null) {
long numBytes = flowRemoved.getByteCount();
String bytes = "" + numBytes;
alertService.post(Severity.WARNING, alertTopic, "Traffic-Monitor(SwitchManager.FlowListenerImpl - toString):", flowRemoved.toString());
alertService.post(Severity.WARNING, alertTopic, "Traffic-Monitor(SwitchManager.FlowListenerImpl - numBytes):", bytes);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2014 08:55 AM
10-11-2014 08:55 AM
Re: Noob SDN Programming Questions
Hello Matthew,
Since you are done with PacketIn successfully and having problem with FlowRemoved ,it looks like code inside the if condition-block is not executing.
Please note that OfmFlowRemoved flowRemoved() returns the FlowRemoved message that was received from the datapath. If the event type is not FLOW_REMOVED, this method returns null.
Please make sure the value is not null.
Thanks,
HP SDN Team