Java Code Examples for org.onosproject.cfg.ComponentConfigService#setProperty()

The following examples show how to use org.onosproject.cfg.ComponentConfigService#setProperty() . 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: LinksWebResource.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Set useStaleLinkAge status.
 *
 * @onos.rsModel VanishedLink
 * @param stream input JSON
 * @return 200 ok.
 * BAD_REQUEST if the JSON is invalid
 */
@POST
@Path("{usestalelinkage}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response setVanishStaleLink(InputStream stream) {
    try {
        // Parse the input stream
        ObjectNode root = (ObjectNode) mapper().readTree(stream);
        if (root.has("active")) {
            ComponentConfigService useStaleLink = get(ComponentConfigService.class);
            useStaleLink.setProperty("org.onosproject.provider.lldp.impl.LldpLinkProvider",
               "useStaleLinkAge", String.valueOf(root.get("active")));
        }
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }
    return Response
            .ok()
            .build();
}
 
Example 2
Source File: NullControlCommand.java    From onos with Apache License 2.0 6 votes vote down vote up
@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");
}
 
Example 3
Source File: OpenstackManagementWebResource.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Configures the security group (enable | disable).
 *
 * @param securityGroup security group activation flag
 * @return 200 OK with config result, 404 not found
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("config/securityGroup/{securityGroup}")
public Response configSecurityGroup(@PathParam("securityGroup") String securityGroup) {
    String securityGroupStr = nullIsIllegal(securityGroup, SECURITY_GROUP_FLAG_REQUIRED);

    boolean flag = checkActivationFlag(securityGroupStr);

    ComponentConfigService service = get(ComponentConfigService.class);
    String securityGroupComponent = OpenstackSecurityGroupHandler.class.getName();

    service.setProperty(securityGroupComponent, USE_SECURITY_GROUP_NAME, String.valueOf(flag));

    return ok(mapper().createObjectNode()).build();
}
 
Example 4
Source File: OpenstackManagementWebResource.java    From onos with Apache License 2.0 5 votes vote down vote up
private void configArpModeBase(String arpMode) {
    ComponentConfigService service = get(ComponentConfigService.class);
    String switchingComponent = OpenstackSwitchingArpHandler.class.getName();
    String routingComponent = OpenstackRoutingArpHandler.class.getName();

    service.setProperty(switchingComponent, ARP_MODE_NAME, arpMode);
    service.setProperty(routingComponent, ARP_MODE_NAME, arpMode);
}
 
Example 5
Source File: OpenstackConfigArpModeCommand.java    From onos with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 6
Source File: CreateRoutes.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
protected void doExecute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    service.setProperty("org.onosproject.routescale.ScaleTestManager",
                        "routeCount", String.valueOf(routeCount));

}
 
Example 7
Source File: OpenstackManagementWebResource.java    From onos with Apache License 2.0 4 votes vote down vote up
private void configStatefulSnatBase(boolean snatFlag) {
    ComponentConfigService service = get(ComponentConfigService.class);
    String snatComponent = OpenstackRoutingSnatHandler.class.getName();

    service.setProperty(snatComponent, USE_STATEFUL_SNAT_NAME, String.valueOf(snatFlag));
}
 
Example 8
Source File: OpenstackConfigStatefulSnatCommand.java    From onos with Apache License 2.0 4 votes vote down vote up
private void configSnatMode(boolean snatMode) {
    ComponentConfigService service = get(ComponentConfigService.class);
    String snatComponent = OpenstackRoutingSnatHandler.class.getName();

    service.setProperty(snatComponent, USE_STATEFUL_SNAT, String.valueOf(snatMode));
}
 
Example 9
Source File: CreateFlows.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
protected void doExecute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    service.setProperty("org.onosproject.routescale.ScaleTestManager",
                        "flowCount", String.valueOf(flowCount));
}