use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class DomainIntentInstallerTest method testInstallFailed.
/**
* Test if domain Intent installation operations failed.
*/
@Test
public void testInstallFailed() {
domainIntentService = new TestFailedDomainIntentService();
installer.domainIntentService = domainIntentService;
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = createDomainIntents();
IntentData toUninstall = null;
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentOperationContext<DomainIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
assertEquals(intentInstallCoordinator.failedContext, operationContext);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method testInstallIntent.
/**
* Installs flow objective Intents.
*/
@Test
public void testInstallIntent() {
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = createFlowObjectiveIntents();
IntentData toUninstall = null;
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentOperationContext<FlowObjectiveIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
IntentOperationContext successContext = intentInstallCoordinator.successContext;
assertEquals(successContext, operationContext);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method testUninstallIntent.
/**
* Uninstalls flow objective Intents.
*/
@Test
public void testUninstallIntent() {
List<Intent> intentsToUninstall = createFlowObjectiveIntents();
List<Intent> intentsToInstall = Lists.newArrayList();
IntentData toInstall = null;
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.WITHDRAWING, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
IntentOperationContext<FlowObjectiveIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
IntentOperationContext successContext = intentInstallCoordinator.successContext;
assertEquals(successContext, operationContext);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method createInstallContext.
/**
* Creates Intent operation context for install Intents.
*
* @return the context
*/
private IntentOperationContext createInstallContext() {
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = createFlowObjectiveIntents();
IntentData toUninstall = null;
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
return new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowRuleIntentInstallerTest method testRuleModify.
/**
* Test intents with same match rules, should do modify instead of add.
*/
@Test
public void testRuleModify() {
List<Intent> intentsToInstall = createFlowRuleIntents();
List<Intent> intentsToUninstall = createFlowRuleIntentsWithSameMatch();
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLED, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
IntentOperationContext<FlowRuleIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
flowRuleService.load(operationContext.intentsToUninstall());
installer.apply(operationContext);
IntentOperationContext successContext = intentInstallCoordinator.successContext;
assertEquals(successContext, operationContext);
assertEquals(0, flowRuleService.flowRulesRemove.size());
assertEquals(0, flowRuleService.flowRulesAdd.size());
assertEquals(1, flowRuleService.flowRulesModify.size());
FlowRuleIntent installedIntent = (FlowRuleIntent) intentsToInstall.get(0);
assertEquals(flowRuleService.flowRulesModify.size(), installedIntent.flowRules().size());
assertTrue(flowRuleService.flowRulesModify.containsAll(installedIntent.flowRules()));
}
Aggregations