Skip to content
Snippets Groups Projects
Commit d80c5557 authored by Andreas Wundsam's avatar Andreas Wundsam
Browse files

openflow/j: Factor out Nicira Vendor Extensions initialization to util class

parent 86a23017
No related branches found
No related tags found
No related merge requests found
...@@ -1767,21 +1767,9 @@ public class Controller implements IFloodlightProviderService, ...@@ -1767,21 +1767,9 @@ public class Controller implements IFloodlightProviderService,
private void initVendorMessages() { private void initVendorMessages() {
// Configure openflowj to be able to parse the role request/reply // Configure openflowj to be able to parse the role request/reply
// vendor messages. // vendor messages.
OFBasicVendorId niciraVendorId = new OFBasicVendorId( OFNiciraVendorExtensions.initialize();
OFNiciraVendorData.NX_VENDOR_ID, 4);
OFVendorId.registerVendorId(niciraVendorId);
OFBasicVendorDataType roleRequestVendorData =
new OFBasicVendorDataType(
OFRoleRequestVendorData.NXT_ROLE_REQUEST,
OFRoleRequestVendorData.getInstantiable());
niciraVendorId.registerVendorDataType(roleRequestVendorData);
OFBasicVendorDataType roleReplyVendorData =
new OFBasicVendorDataType(
OFRoleReplyVendorData.NXT_ROLE_REPLY,
OFRoleReplyVendorData.getInstantiable());
niciraVendorId.registerVendorDataType(roleReplyVendorData);
} }
/** /**
* Initialize internal data structures * Initialize internal data structures
*/ */
......
package org.openflow.vendor.nicira;
import org.openflow.protocol.vendor.OFBasicVendorDataType;
import org.openflow.protocol.vendor.OFBasicVendorId;
import org.openflow.protocol.vendor.OFVendorId;
public class OFNiciraVendorExtensions {
private static boolean initialized = false;
public static synchronized void initialize() {
if (initialized)
return;
// Configure openflowj to be able to parse the role request/reply
// vendor messages.
OFBasicVendorId niciraVendorId =
new OFBasicVendorId(OFNiciraVendorData.NX_VENDOR_ID, 4);
OFVendorId.registerVendorId(niciraVendorId);
OFBasicVendorDataType roleRequestVendorData =
new OFBasicVendorDataType(OFRoleRequestVendorData.NXT_ROLE_REQUEST,
OFRoleRequestVendorData.getInstantiable());
niciraVendorId.registerVendorDataType(roleRequestVendorData);
OFBasicVendorDataType roleReplyVendorData =
new OFBasicVendorDataType(OFRoleReplyVendorData.NXT_ROLE_REPLY,
OFRoleReplyVendorData.getInstantiable());
niciraVendorId.registerVendorDataType(roleReplyVendorData);
initialized = true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment