use of org.onosproject.net.behaviour.ExtensionSelectorResolver 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.behaviour.ExtensionSelectorResolver 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", e);
return null;
}
return extensionSelector;
}
use of org.onosproject.net.behaviour.ExtensionSelectorResolver 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.behaviour.ExtensionSelectorResolver in project onos by opennetworkinglab.
the class ExtensionCriterionSerializer method read.
@Override
public ExtensionCriterion read(Kryo kryo, Input input, Class<ExtensionCriterion> type) {
ExtensionSelectorType exType = (ExtensionSelectorType) kryo.readClassAndObject(input);
DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
byte[] bytes = (byte[]) kryo.readClassAndObject(input);
ExtensionSelector selector;
try {
DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
selector = resolver.getExtensionSelector(exType);
selector.deserialize(bytes);
} catch (ItemNotFoundException | IllegalArgumentException e) {
selector = new UnresolvedExtensionSelector(bytes, exType);
}
return Criteria.extension(selector, deviceId);
}
Aggregations