Java Code Examples for org.onosproject.net.intent.Intent#unbindIdGenerator()

The following examples show how to use org.onosproject.net.intent.Intent#unbindIdGenerator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntentManager.java    From onos with Apache License 2.0 6 votes vote down vote up
@Activate
public void activate() {
    configService.registerProperties(getClass());
    if (skipReleaseResourcesOnWithdrawal) {
        store.setDelegate(testOnlyDelegate);
    } else {
        store.setDelegate(delegate);
    }
    trackerService.setDelegate(topoDelegate);
    eventDispatcher.addSink(IntentEvent.class, listenerRegistry);
    batchExecutor = newSingleThreadExecutor(groupedThreads("onos/intent", "batch", log));
    workerExecutor = newFixedThreadPool(numThreads, groupedThreads("onos/intent", "worker-%d", log));
    idGenerator = coreService.getIdGenerator("intent-ids");
    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
    installCoordinator = new InstallCoordinator(installerRegistry, store);
    log.info("Started");
}
 
Example 2
Source File: PacketLinkRealizedByOpticalTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    idGenerator = new IdGenerator() {
        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };

    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
 
Example 3
Source File: OpticalConnectivityTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    idGenerator = new IdGenerator() {
        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };

    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
 
Example 4
Source File: IntentManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Deactivate
public void deactivate() {
    if (skipReleaseResourcesOnWithdrawal) {
        store.unsetDelegate(testOnlyDelegate);
    } else {
        store.unsetDelegate(delegate);
    }
    configService.unregisterProperties(getClass(), false);
    trackerService.unsetDelegate(topoDelegate);
    eventDispatcher.removeSink(IntentEvent.class);
    batchExecutor.shutdown();
    workerExecutor.shutdown();
    Intent.unbindIdGenerator(idGenerator);
    log.info("Stopped");
}
 
Example 5
Source File: NetworkManagerTest.java    From onos-byon with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    Intent.unbindIdGenerator(idGenerator);
}
 
Example 6
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.deviceService = new TestDeviceService();
    deviceService.devMap.put(deviceIdOf(1), DEVICE1);
    deviceService.devMap.put(deviceIdOf(2), DEVICE2);
    deviceService.devMap.put(deviceIdOf(3), DEVICE3);
    deviceService.devMap.put(deviceIdOf(4), DEVICE4);
    deviceService.devMap.put(deviceIdOf(5), DEVICE5);
    deviceService.devMap.put(deviceIdOf(6), DEVICE6);
    deviceService.devMap.put(deviceIdOf(7), DEVICE7);
    deviceService.portMap.put(CP11, PORT11);
    deviceService.portMap.put(CP12, PORT12);
    deviceService.portMap.put(CP21, PORT21);
    deviceService.portMap.put(CP22, PORT22);
    deviceService.portMap.put(CP31, PORT31);
    deviceService.portMap.put(CP32, PORT32);
    deviceService.portMap.put(CP41, PORT41);
    deviceService.portMap.put(CP42, PORT42);
    deviceService.portMap.put(CP51, PORT51);
    deviceService.portMap.put(CP52, PORT52);
    deviceService.portMap.put(CP61, PORT61);
    deviceService.portMap.put(CP62, PORT62);
    deviceService.portMap.put(CP71, PORT71);
    deviceService.portMap.put(CP72, PORT72);

    this.linkService = new TestLinkService();
    linkService.links.addAll(Stream.of(LINK1, LINK2, LINK3, LINK4, LINK5, LINK6)
        .collect(Collectors.toList()));

    this.topologyService = new TestTopologyService();
    this.intentService = new TestIntentService();
    this.mastershipService = new TestMastershipService();
    this.clusterService = new TestClusterService();

    mastershipService.setMastership(DEVICE1.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE2.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE3.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE4.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE5.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE6.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE7.id(), MastershipRole.MASTER);

    this.target = new OpticalPathProvisioner();
    target.coreService = new TestCoreService();
    target.intentService = this.intentService;
    target.topologyService = this.topologyService;
    target.linkService = this.linkService;
    target.mastershipService = this.mastershipService;
    target.clusterService = this.clusterService;
    target.storageService = new TestStorageService();
    target.deviceService = this.deviceService;
    target.networkConfigService = new TestNetworkConfigService();
    target.resourceService = new TestResourceService();
    injectEventDispatcher(target, new TestEventDispatcher());
    target.addListener(listener);

    target.activate(new ComponentContextAdapter());

    // To overwrite opticalView-ed deviceService
    target.deviceService = this.deviceService;

    idGenerator = new IdGenerator() {
        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };
    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
 
Example 7
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    Intent.unbindIdGenerator(idGenerator);
    target.removeListener(listener);
    target = null;
}
 
Example 8
Source File: PacketLinkRealizedByOpticalTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    Intent.unbindIdGenerator(idGenerator);
}
 
Example 9
Source File: OpticalConnectivityTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    Intent.unbindIdGenerator(idGenerator);
}