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());
}
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);
}
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);
}
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);
}
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);
}
Aggregations