Search in sources :

Example 16 with ComponentConfigService

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

the class CreateFlows method doExecute.

@Override
protected void doExecute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    service.setProperty("org.onosproject.routescale.ScaleTestManager", "flowCount", String.valueOf(flowCount));
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService)

Example 17 with ComponentConfigService

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

the class OpenFlowControllerImplTest method setUp.

/**
 * Sets up switches to use as data, mocks and launches a controller instance.
 */
@Before
public void setUp() {
    try {
        switch1 = new OpenflowSwitchDriverAdapter();
        dpid1 = Dpid.dpid(new URI("of:0000000000000111"));
        switch2 = new OpenflowSwitchDriverAdapter();
        dpid2 = Dpid.dpid(new URI("of:0000000000000222"));
        switch3 = new OpenflowSwitchDriverAdapter();
        dpid3 = Dpid.dpid(new URI("of:0000000000000333"));
    } catch (URISyntaxException ex) {
        // Does not happen
        fail();
    }
    controller = new OpenFlowControllerImpl();
    agent = controller.agent;
    switchListener = new TestSwitchListener();
    controller.addListener(switchListener);
    CoreService mockCoreService = EasyMock.createMock(CoreService.class);
    controller.coreService = mockCoreService;
    OpenFlowService mockOpenFlowService = EasyMock.createMock(OpenFlowService.class);
    controller.openFlowManager = mockOpenFlowService;
    ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    mockConfigService.registerProperties(controller.getClass());
    expectLastCall();
    mockConfigService.unregisterProperties(controller.getClass(), false);
    expectLastCall();
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    controller.cfgService = mockConfigService;
    replay(mockConfigService);
    NetworkConfigRegistry netConfigService = EasyMock.createMock(NetworkConfigRegistry.class);
    controller.netCfgService = netConfigService;
    ComponentContext mockContext = EasyMock.createMock(ComponentContext.class);
    Dictionary<String, Object> properties = new Hashtable<>();
    properties.put("openflowPorts", Integer.toString(EPHEMERAL_PORT));
    expect(mockContext.getProperties()).andReturn(properties);
    replay(mockContext);
    controller.activate(mockContext);
}
Also used : OpenFlowService(org.onosproject.openflow.controller.OpenFlowService) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) ComponentContext(org.osgi.service.component.ComponentContext) Hashtable(java.util.Hashtable) CoreService(org.onosproject.core.CoreService) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) OpenflowSwitchDriverAdapter(org.onosproject.openflow.OpenflowSwitchDriverAdapter) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) EasyMock.anyObject(org.easymock.EasyMock.anyObject) Before(org.junit.Before)

Example 18 with ComponentConfigService

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

the class OpenstackConfigArpModeCommand method doExecute.

@Override
protected void doExecute() {
    if (checkArpMode(arpMode)) {
        configArpMode(arpMode);
        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 (arpMode.equals(switchingValue) && arpMode.equals(routingValue)) {
                break;
            }
        }
        purgeRules();
        syncRules();
    }
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService)

Example 19 with ComponentConfigService

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

the class OpenstackConfigStatefulSnatCommand method configSnatMode.

private void configSnatMode(boolean snatMode) {
    ComponentConfigService service = get(ComponentConfigService.class);
    String snatComponent = OpenstackRoutingSnatHandler.class.getName();
    service.setProperty(snatComponent, USE_STATEFUL_SNAT, String.valueOf(snatMode));
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService)

Example 20 with ComponentConfigService

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

the class OpenstackConfigStatefulSnatCommand method doExecute.

@Override
protected void doExecute() {
    configSnatMode(statefulSnat);
    ComponentConfigService service = get(ComponentConfigService.class);
    String snatComponent = OpenstackRoutingSnatHandler.class.getName();
    while (true) {
        boolean snatValue = getPropertyValueAsBoolean(service.getProperties(snatComponent), USE_STATEFUL_SNAT);
        if (statefulSnat == snatValue) {
            break;
        }
    }
    purgeRules();
    syncRules();
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService)

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