use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class RulePopulatorUtil method buildCtExtensionSelector.
/**
* Builds OVS ConnTrack matches.
*
* @param driverService driver service
* @param deviceId device ID
* @param ctState connection tracking sate masking value
* @param ctSateMask connection tracking sate masking value
* @return OVS ConnTrack extension match
*/
public static ExtensionSelector buildCtExtensionSelector(DriverService driverService, DeviceId deviceId, long ctState, long ctSateMask) {
DriverHandler handler = driverService.createHandler(deviceId);
ExtensionSelectorResolver esr = handler.behaviour(ExtensionSelectorResolver.class);
ExtensionSelector extensionSelector = esr.getExtensionSelector(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_CONNTRACK_STATE.type());
try {
extensionSelector.setPropertyValue(CT_STATE, ctState);
extensionSelector.setPropertyValue(CT_STATE_MASK, ctSateMask);
} catch (Exception e) {
log.error("Failed to set nicira match CT state because of {}", e);
return null;
}
return extensionSelector;
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class OFAgentVirtualGroupBucketEntryBuilder method buildTreatment.
private TrafficTreatment buildTreatment(List<OFAction> actions) {
DriverHandler driverHandler = getDriver(dpid);
TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
// If this is a drop rule
if (actions.isEmpty()) {
builder.drop();
return builder.build();
}
return FlowEntryBuilder.configureTreatmentBuilder(actions, builder, driverHandler, DeviceId.deviceId(Dpid.uri(dpid))).build();
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class SelectGroupHandler method buildNiciraExtenstion.
/**
* Builds Nicira extension for tagging remoteIp of vxlan.
*
* @param id device id of vxlan source device
* @param hostIp remote ip of vxlan destination device
* @return NiciraExtension Treatment
*/
private ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) {
Driver driver = driverService.getDriver(id);
DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id));
ExtensionTreatmentResolver resolver = driverHandler.behaviour(ExtensionTreatmentResolver.class);
ExtensionTreatment extensionInstruction = resolver.getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type());
try {
extensionInstruction.setPropertyValue(TUNNEL_DESTINATION, hostIp);
} catch (ExtensionPropertyException e) {
log.error("Error setting Nicira extension setting {}", e);
}
return extensionInstruction;
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class DeviceInterfaceRemoveCommand method doExecute.
@Override
protected void doExecute() {
DriverService service = get(DriverService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
InterfaceConfig interfaceConfig = h.behaviour(InterfaceConfig.class);
if (trunkMode && !accessMode && !rateLimit) {
// Trunk mode for VLAN to be removed.
removeTrunkModeFromIntf(interfaceConfig);
} else if (accessMode && !trunkMode && !rateLimit) {
// Access mode for VLAN to be removed.
removeAccessModeFromIntf(interfaceConfig);
} else if (rateLimit && !trunkMode && !accessMode) {
// Rate limit to be removed.
removeRateLimitFromIntf(interfaceConfig);
} else {
// Option has not been correctly set.
print(ONE_ACTION_ALLOWED);
}
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class DeviceInterfaceAddCommand method doExecute.
@Override
protected void doExecute() {
DriverService service = get(DriverService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
InterfaceConfig interfaceConfig = h.behaviour(InterfaceConfig.class);
if (accessVlanString != null && trunkVlanStrings == null && limitString == null) {
// Access mode to be enabled for VLAN.
addAccessModeToIntf(interfaceConfig);
} else if (trunkVlanStrings != null && accessVlanString == null && limitString == null) {
// Trunk mode to be enabled for VLANs.
addTrunkModeToIntf(interfaceConfig);
} else if (limitString != null && accessVlanString == null && trunkVlanStrings == null) {
// Rate limit to be set on interface.
addRateLimitToIntf(interfaceConfig);
} else {
// Option has not been correctly set.
print(ONE_ACTION_ALLOWED);
}
}
Aggregations