Search in sources :

Example 11 with ExtensionTreatmentResolver

use of org.onosproject.net.behaviour.ExtensionTreatmentResolver 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;
    }
}
Also used : Device(org.onosproject.net.Device) ExtensionTreatmentResolver(org.onosproject.net.behaviour.ExtensionTreatmentResolver) ExtensionTreatment(org.onosproject.net.flow.instructions.ExtensionTreatment) ExtensionPropertyException(org.onosproject.net.flow.instructions.ExtensionPropertyException)

Example 12 with ExtensionTreatmentResolver

use of org.onosproject.net.behaviour.ExtensionTreatmentResolver 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;
    }
}
Also used : ExtensionTreatmentResolver(org.onosproject.net.behaviour.ExtensionTreatmentResolver) ExtensionTreatment(org.onosproject.net.flow.instructions.ExtensionTreatment) ExtensionPropertyException(org.onosproject.net.flow.instructions.ExtensionPropertyException)

Aggregations

ExtensionTreatmentResolver (org.onosproject.net.behaviour.ExtensionTreatmentResolver)12 ExtensionTreatment (org.onosproject.net.flow.instructions.ExtensionTreatment)12 ExtensionPropertyException (org.onosproject.net.flow.instructions.ExtensionPropertyException)11 Device (org.onosproject.net.Device)6 DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)2 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)2 DriverHandler (org.onosproject.net.driver.DriverHandler)2 ItemNotFoundException (org.onlab.util.ItemNotFoundException)1 DeviceId (org.onosproject.net.DeviceId)1 Driver (org.onosproject.net.driver.Driver)1 DriverService (org.onosproject.net.driver.DriverService)1 ExtensionTreatmentType (org.onosproject.net.flow.instructions.ExtensionTreatmentType)1 UnresolvedExtensionTreatment (org.onosproject.net.flow.instructions.UnresolvedExtensionTreatment)1