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