Search in sources :

Example 1 with IdGenerator

use of org.onosproject.core.IdGenerator in project onos by opennetworkinglab.

the class OpticalConnectivityTest method setUp.

@Before
public void setUp() {
    idGenerator = new IdGenerator() {

        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };
    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
Also used : IdGenerator(org.onosproject.core.IdGenerator) ConnectPoint(org.onosproject.net.ConnectPoint) Before(org.junit.Before)

Example 2 with IdGenerator

use of org.onosproject.core.IdGenerator in project onos by opennetworkinglab.

the class PacketLinkRealizedByOpticalTest method setUp.

@Before
public void setUp() {
    idGenerator = new IdGenerator() {

        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };
    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
Also used : IdGenerator(org.onosproject.core.IdGenerator) ConnectPoint(org.onosproject.net.ConnectPoint) Before(org.junit.Before)

Example 3 with IdGenerator

use of org.onosproject.core.IdGenerator in project onos by opennetworkinglab.

the class OpticalPathProvisionerTest method setUp.

@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);
}
Also used : ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) IdGenerator(org.onosproject.core.IdGenerator) ConnectPoint(org.onosproject.net.ConnectPoint) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)3 IdGenerator (org.onosproject.core.IdGenerator)3 ConnectPoint (org.onosproject.net.ConnectPoint)3 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)1