Search in sources :

Example 6 with IntentInstallationContext

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) FlowObjectiveIntent(org.onosproject.net.intent.FlowObjectiveIntent) Intent(org.onosproject.net.intent.Intent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext)

Example 7 with IntentInstallationContext

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) Intent(org.onosproject.net.intent.Intent) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) Test(org.junit.Test)

Example 8 with IntentInstallationContext

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) Intent(org.onosproject.net.intent.Intent) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) Test(org.junit.Test)

Example 9 with IntentInstallationContext

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) Intent(org.onosproject.net.intent.Intent) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) Test(org.junit.Test)

Example 10 with IntentInstallationContext

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) Intent(org.onosproject.net.intent.Intent) ProtectionEndpointIntent(org.onosproject.net.intent.ProtectionEndpointIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) Test(org.junit.Test)

Aggregations

IntentInstallationContext (org.onosproject.net.intent.IntentInstallationContext)36 IntentOperationContext (org.onosproject.net.intent.IntentOperationContext)32 IntentData (org.onosproject.net.intent.IntentData)30 Test (org.junit.Test)28 Intent (org.onosproject.net.intent.Intent)28 WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)26 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)14 PathIntent (org.onosproject.net.intent.PathIntent)13 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)5 FlowRule (org.onosproject.net.flow.FlowRule)5 ProtectionEndpointIntent (org.onosproject.net.intent.ProtectionEndpointIntent)5 Collection (java.util.Collection)4 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)4 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)4 TrafficSelector (org.onosproject.net.flow.TrafficSelector)4 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)4 ImmutableList (com.google.common.collect.ImmutableList)3 Lists (com.google.common.collect.Lists)3 Maps (com.google.common.collect.Maps)3 Sets (com.google.common.collect.Sets)3