use of org.onosproject.store.service.WallClockTimestamp 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.store.service.WallClockTimestamp 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.store.service.WallClockTimestamp 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.store.service.WallClockTimestamp 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);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class GossipIntentStore method getPendingData.
@Override
public Iterable<IntentData> getPendingData(boolean localOnly, long olderThan) {
long now = System.currentTimeMillis();
final WallClockTimestamp time = new WallClockTimestamp(now - olderThan);
return pendingMap.values().stream().filter(data -> data.version().isOlderThan(time) && (!localOnly || isMaster(data.key()))).collect(Collectors.toList());
}
Aggregations