use of org.onosproject.net.flow.instructions.ExtensionPropertyException in project onos by opennetworkinglab.
the class RulePopulatorUtil method buildLoadExtension.
/**
* Returns the nicira load extension treatment.
*
* @param device device instance
* @param field field code
* @param value value to load
* @return load extension treatment
*/
public static ExtensionTreatment buildLoadExtension(Device device, long field, long value) {
if (!checkTreatmentResolver(device)) {
return null;
}
ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_LOAD.type());
int ofsNbits = OFF_SET_BIT << 6 | (REMAINDER_BIT - 1);
try {
treatment.setPropertyValue(OFF_SET_N_BITS, ofsNbits);
treatment.setPropertyValue(DESTINATION, field);
treatment.setPropertyValue(VALUE, value);
return treatment;
} catch (ExtensionPropertyException e) {
log.error("Failed to set nicira load extension treatment for {}", device.id());
return null;
}
}
use of org.onosproject.net.flow.instructions.ExtensionPropertyException in project onos by opennetworkinglab.
the class OpenstackVtapManager method buildResubmitExtension.
private ExtensionTreatment buildResubmitExtension(DeviceId deviceId, int tableId) {
Device device = deviceService.getDevice(deviceId);
if (device == null || !device.is(ExtensionTreatmentResolver.class)) {
log.warn("Nicira extension treatment is not supported");
return null;
}
ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_RESUBMIT_TABLE.type());
try {
treatment.setPropertyValue(TABLE_EXTENSION, ((short) tableId));
return treatment;
} catch (ExtensionPropertyException e) {
log.error("Failed to set nicira resubmit extension treatment for {}", deviceId);
return null;
}
}
use of org.onosproject.net.flow.instructions.ExtensionPropertyException in project onos by opennetworkinglab.
the class RulePopulatorUtil method buildResubmitExtension.
/**
* Returns the nicira resubmit extension treatment with given table ID.
*
* @param device device instance
* @param tableId table identifier
* @return resubmit extension treatment
*/
public static ExtensionTreatment buildResubmitExtension(Device device, int tableId) {
if (!checkTreatmentResolver(device)) {
return null;
}
ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_RESUBMIT_TABLE.type());
try {
treatment.setPropertyValue(TABLE_EXTENSION, ((short) tableId));
return treatment;
} catch (ExtensionPropertyException e) {
log.error("Failed to set nicira resubmit extension treatment for {}", device.id());
return null;
}
}
Aggregations