use of org.onosproject.net.intent.IntentInstallationContext in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method createUninstallContext.
/**
* Creates Intent operation context for uninstall Intents.
*
* @return the context
*/
private IntentOperationContext createUninstallContext() {
List<Intent> intentsToUninstall = createFlowObjectiveIntents();
List<Intent> intentsToInstall = Lists.newArrayList();
IntentData toInstall = null;
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
return new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
}
use of org.onosproject.net.intent.IntentInstallationContext in project onos by opennetworkinglab.
the class ProtectionEndpointIntentInstallerTest method testInstallFailed.
/**
* Test if installation failed.
* framework.
*/
@Test
public void testInstallFailed() {
networkConfigService = new TestFailedNetworkConfigService();
installer.networkConfigService = networkConfigService;
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = createProtectionIntents(CP2);
IntentData toUninstall = null;
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentOperationContext<ProtectionEndpointIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
assertEquals(intentInstallCoordinator.failedContext, operationContext);
}
use of org.onosproject.net.intent.IntentInstallationContext in project onos by opennetworkinglab.
the class ProtectionEndpointIntentInstallerTest method testInstallIntents.
/**
* Installs protection endpoint Intents.
* framework.
*/
@Test
public void testInstallIntents() {
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = createProtectionIntents(CP2);
IntentData toUninstall = null;
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentOperationContext<ProtectionEndpointIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
assertEquals(intentInstallCoordinator.successContext, operationContext);
}
use of org.onosproject.net.intent.IntentInstallationContext in project onos by opennetworkinglab.
the class ProtectionEndpointIntentInstallerTest method testUninstallAndInstallIntents.
/**
* Test both uninstall and install protection endpoint Intents.
* framework.
*/
@Test
public void testUninstallAndInstallIntents() {
List<Intent> intentsToUninstall = createProtectionIntents(CP2);
List<Intent> intentsToInstall = createProtectionIntents(CP3);
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLED, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToInstall);
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentOperationContext<ProtectionEndpointIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
assertEquals(intentInstallCoordinator.successContext, operationContext);
}
use of org.onosproject.net.intent.IntentInstallationContext in project onos by opennetworkinglab.
the class ProtectionEndpointIntentInstallerTest method testUninstallIntents.
/**
* Uninstalls protection endpoint Intents.
* framework.
*/
@Test
public void testUninstallIntents() {
List<Intent> intentsToUninstall = createProtectionIntents(CP2);
List<Intent> intentsToInstall = Lists.newArrayList();
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
IntentData toInstall = null;
IntentOperationContext<ProtectionEndpointIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
assertEquals(intentInstallCoordinator.successContext, operationContext);
}
Aggregations