Search in sources :

Example 86 with Intent

use of org.onosproject.net.intent.Intent in project onos by opennetworkinglab.

the class FlowRuleIntentInstallerTest method testUninstallAndInstallUnchanged.

/**
 * Do both install and uninstall Intents with same flow rules.
 */
@Test
public void testUninstallAndInstallUnchanged() {
    List<Intent> intentsToInstall = createFlowRuleIntents();
    List<Intent> intentsToUninstall = createFlowRuleIntents();
    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(0, flowRuleService.flowRulesModify.size());
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) Intent(org.onosproject.net.intent.Intent) PathIntent(org.onosproject.net.intent.PathIntent) FlowRuleIntent(org.onosproject.net.intent.FlowRuleIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) FlowRuleIntent(org.onosproject.net.intent.FlowRuleIntent) Test(org.junit.Test)

Example 87 with Intent

use of org.onosproject.net.intent.Intent 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 88 with Intent

use of org.onosproject.net.intent.Intent 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 89 with Intent

use of org.onosproject.net.intent.Intent 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 90 with Intent

use of org.onosproject.net.intent.Intent 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

Intent (org.onosproject.net.intent.Intent)282 Test (org.junit.Test)176 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)133 LinkCollectionIntent (org.onosproject.net.intent.LinkCollectionIntent)110 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)108 FlowRule (org.onosproject.net.flow.FlowRule)90 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)87 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)84 ConnectPoint (org.onosproject.net.ConnectPoint)78 DeviceId (org.onosproject.net.DeviceId)77 List (java.util.List)75 Collectors (java.util.stream.Collectors)71 AbstractIntentTest (org.onosproject.net.intent.AbstractIntentTest)70 PathIntent (org.onosproject.net.intent.PathIntent)70 Collection (java.util.Collection)60 VlanId (org.onlab.packet.VlanId)60 TrafficSelector (org.onosproject.net.flow.TrafficSelector)60 CoreService (org.onosproject.core.CoreService)59 Collections (java.util.Collections)57 ImmutableSet (com.google.common.collect.ImmutableSet)54