Search in sources :

Example 6 with ComponentConfigService

use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.

the class NullPortStatsControlCommand method doExecute.

@Override
protected void doExecute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    NullProviders npService = get(NullProviders.class);
    npService.enablePortStats(cmd.equals(START));
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService) NullProviders(org.onosproject.provider.nil.NullProviders)

Example 7 with ComponentConfigService

use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.

the class OpenstackConfigArpModeCommand method configArpMode.

private void configArpMode(String arpMode) {
    ComponentConfigService service = get(ComponentConfigService.class);
    String switchingComponent = OpenstackSwitchingArpHandler.class.getName();
    String routingComponent = OpenstackRoutingArpHandler.class.getName();
    if (!isNullOrEmpty(arpMode)) {
        service.setProperty(switchingComponent, ARP_MODE_NAME, arpMode);
        service.setProperty(routingComponent, ARP_MODE_NAME, arpMode);
    }
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService)

Example 8 with ComponentConfigService

use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.

the class OpenstackManagementWebResource method configArpMode.

/**
 * Configures the ARP mode (proxy | broadcast).
 *
 * @param arpmode ARP mode
 * @return 200 OK with config result, 404 not found
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("config/arpmode/{arpmode}")
public Response configArpMode(@PathParam("arpmode") String arpmode) {
    String arpModeStr = nullIsIllegal(arpmode, ARP_MODE_REQUIRED);
    if (checkArpMode(arpModeStr)) {
        configArpModeBase(arpModeStr);
        ComponentConfigService service = get(ComponentConfigService.class);
        String switchingComponent = OpenstackSwitchingArpHandler.class.getName();
        String routingComponent = OpenstackRoutingArpHandler.class.getName();
        // reinstall all rules only if the arpMode is changed to the configured one
        while (true) {
            String switchingValue = getPropertyValue(service.getProperties(switchingComponent), ARP_MODE_NAME);
            String routingValue = getPropertyValue(service.getProperties(routingComponent), ARP_MODE_NAME);
            if (arpModeStr.equals(switchingValue) && arpModeStr.equals(routingValue)) {
                break;
            }
        }
        purgeRulesBase();
        syncRulesBase();
    } else {
        throw new IllegalArgumentException("The ARP mode is not valid");
    }
    return ok(mapper().createObjectNode()).build();
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with ComponentConfigService

use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.

the class MastershipManagerTest method setUp.

@Before
public void setUp() throws Exception {
    mgr = new MastershipManager();
    service = mgr;
    injectEventDispatcher(mgr, new TestEventDispatcher());
    testClusterService = new TestClusterService();
    mgr.clusterService = testClusterService;
    mgr.upgradeService = new UpgradeServiceAdapter();
    mgr.store = new TestSimpleMastershipStore(mgr.clusterService);
    regionStore = new DistributedRegionStore();
    TestUtils.setField(regionStore, "storageService", new TestStorageService());
    TestUtils.callMethod(regionStore, "activate", new Class<?>[] {});
    regionManager = new TestRegionManager();
    TestUtils.setField(regionManager, "store", regionStore);
    regionManager.activate();
    mgr.regionService = regionManager;
    ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    mockConfigService.registerProperties(mgr.getClass());
    expectLastCall();
    mockConfigService.unregisterProperties(mgr.getClass(), false);
    expectLastCall();
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    mgr.cfgService = mockConfigService;
    replay(mockConfigService);
    mgr.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) UpgradeServiceAdapter(org.onosproject.upgrade.impl.UpgradeServiceAdapter) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) TestStorageService(org.onosproject.store.service.TestStorageService) DistributedRegionStore(org.onosproject.store.region.impl.DistributedRegionStore) Before(org.junit.Before)

Example 10 with ComponentConfigService

use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.

the class NullControlCommand method doExecute.

@Override
protected void doExecute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    // If there is an existing topology; make sure it's stopped before restarting
    if (cmd.equals(START)) {
        NullProviders npService = get(NullProviders.class);
        TopologySimulator simulator = npService.currentSimulator();
        if (simulator != null) {
            simulator.tearDownTopology();
        }
    }
    if (topoShape != null) {
        service.setProperty(NullProviders.class.getName(), "topoShape", topoShape);
    }
    service.setProperty(NullProviders.class.getName(), "enabled", cmd.equals(START) ? "true" : "false");
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService) TopologySimulator(org.onosproject.provider.nil.TopologySimulator) NullProviders(org.onosproject.provider.nil.NullProviders)

Aggregations

ComponentConfigService (org.onosproject.cfg.ComponentConfigService)27 Path (javax.ws.rs.Path)9 Produces (javax.ws.rs.Produces)8 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)7 GET (javax.ws.rs.GET)7 Before (org.junit.Before)5 CoreService (org.onosproject.core.CoreService)4 Hashtable (java.util.Hashtable)3 Consumes (javax.ws.rs.Consumes)3 ComponentContext (org.osgi.service.component.ComponentContext)3 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 POST (javax.ws.rs.POST)2 StringsCompleter (org.apache.karaf.shell.support.completers.StringsCompleter)2 EasyMock.anyObject (org.easymock.EasyMock.anyObject)2 ConfigProperty (org.onosproject.cfg.ConfigProperty)2 NullProviders (org.onosproject.provider.nil.NullProviders)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 DELETE (javax.ws.rs.DELETE)1