当前位置: 首页>>代码示例>>Java>>正文


Java StaticRouteConfig类代码示例

本文整理汇总了Java中org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig的典型用法代码示例。如果您正苦于以下问题:Java StaticRouteConfig类的具体用法?Java StaticRouteConfig怎么用?Java StaticRouteConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StaticRouteConfig类属于org.opendaylight.controller.forwarding.staticrouting包,在下文中一共展示了StaticRouteConfig类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieveCaches

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "deprecation" })
private void retrieveCaches() {
    if (this.clusterContainerService == null) {
        log
                .info("un-initialized clusterContainerService, can't retrieve cache");
        return;
    }

    staticRoutes = (ConcurrentMap<String, StaticRoute>) clusterContainerService
            .getCache("forwarding.staticrouting.routes");
    if (staticRoutes == null) {
        log.error("\nFailed to get rulesDB handle");
    }

    staticRouteConfigs = (ConcurrentMap<String, StaticRouteConfig>) clusterContainerService
            .getCache("forwarding.staticrouting.configs");
    if (staticRouteConfigs == null) {
        log.error("\nFailed to get rulesDB handle");
    }
    configSaveEvent = (ConcurrentMap<Long, String>) clusterContainerService
            .getCache("forwarding.staticrouting.configSaveEvent");
    if (configSaveEvent == null) {
        log.error("\nFailed to get cache for configSaveEvent");
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:26,代码来源:StaticRoutingImplementation.java

示例2: getStaticRoutesInternal

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
private List<StaticRoute> getStaticRoutesInternal(String containerName) {

        IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper
                .getInstance(IForwardingStaticRouting.class, containerName,
                        this);

        if (staticRouting == null) {
            throw new ResourceNotFoundException(RestMessages.NOCONTAINER
                    .toString());
        }

        List<StaticRoute> routes = new ArrayList<StaticRoute>();

        for (StaticRouteConfig conf : staticRouting.getStaticRouteConfigs()
                .values()) {
            StaticRoute route = new StaticRoute(conf.getName(), conf
                    .getStaticRoute(), conf.getNextHop());
            routes.add(route);
        }
        return routes;
    }
 
开发者ID:lbchen,项目名称:ODL,代码行数:22,代码来源:StaticRoutingNorthbound.java

示例3: loadConfiguration

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void loadConfiguration() {
    ObjectReader objReader = new ObjectReader();
    ConcurrentMap<String, StaticRouteConfig> confList = (ConcurrentMap<String, StaticRouteConfig>) objReader
            .read(this, staticRoutesFileName);

    if (confList == null) {
        return;
    }

    for (StaticRouteConfig conf : confList.values()) {
        addStaticRoute(conf);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:15,代码来源:StaticRoutingImplementation.java

示例4: saveConfigInternal

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
public Status saveConfigInternal() {
    Status status;
    ObjectWriter objWriter = new ObjectWriter();

    status = objWriter.write(
            new ConcurrentHashMap<String, StaticRouteConfig>(
                    staticRouteConfigs), staticRoutesFileName);

    if (status.isSuccess()) {
        return status;
    } else {
        return new Status(StatusCode.INTERNALERROR, "Save failed");
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:15,代码来源:StaticRoutingImplementation.java

示例5: addStaticRoute

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
public Status addStaticRoute(StaticRouteConfig config) {
    Status status;

    status = config.isValid();
    if (!status.isSuccess()) {
        return status;
    }
    if (staticRouteConfigs.get(config.getName()) != null) {
            return new Status(StatusCode.CONFLICT,
                            "A valid Static Route configuration with this name " +
                                            "already exists. Please use a different name");
    }
    for (StaticRouteConfig s : staticRouteConfigs.values()) {
        if (s.equals(config)) {
            return new Status(StatusCode.CONFLICT,
                            "This conflicts with an existing Static Route " +
                                    "Configuration. Please check the configuration " +
                                            "and try again");
        }
    }

    staticRouteConfigs.put(config.getName(), config);
    StaticRoute sRoute = new StaticRoute(config);
    staticRoutes.put(config.getName(), sRoute);
    checkAndUpdateListeners(sRoute, true);
    return status;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:28,代码来源:StaticRoutingImplementation.java

示例6: getStaticRoutes

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
@RequestMapping(value = "/staticRoutes", method = RequestMethod.GET)
@ResponseBody
public DevicesJsonBean getStaticRoutes(HttpServletRequest request,
        @RequestParam(required = false) String container) {
    Gson gson = new Gson();
    String containerName = (container == null) ? GlobalConstants.DEFAULT
            .toString() : container;

    // Derive the privilege this user has on the current container
    String userName = request.getUserPrincipal().getName();
    Privilege privilege = DaylightWebUtil.getContainerPrivilege(userName, containerName, this);

    IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper
            .getInstance(IForwardingStaticRouting.class, containerName,
                    this);
    if (staticRouting == null) {
        return null;
    }
    List<Map<String, String>> staticRoutes = new ArrayList<Map<String, String>>();
    ConcurrentMap<String, StaticRouteConfig> routeConfigs = staticRouting
            .getStaticRouteConfigs();
    if (routeConfigs == null) {
        return null;
    }
    if (privilege != Privilege.NONE) {
        for (StaticRouteConfig conf : routeConfigs.values()) {
            Map<String, String> staticRoute = new HashMap<String, String>();
            staticRoute.put("name", conf.getName());
            staticRoute.put("staticRoute", conf.getStaticRoute());
            staticRoute.put("nextHopType", conf.getNextHopType());
            staticRoute.put("nextHop", conf.getNextHop());
            staticRoute.put("json", gson.toJson(conf));
            staticRoutes.add(staticRoute);
        }
    }
    DevicesJsonBean result = new DevicesJsonBean();
    result.setPrivilege(privilege);
    result.setColumnNames(StaticRouteConfig.getGuiFieldsNames());
    result.setNodeData(staticRoutes);
    return result;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:42,代码来源:Devices.java

示例7: addStaticRoute

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
@RequestMapping(value = "/staticRoute/add", method = RequestMethod.GET)
@ResponseBody
public StatusJsonBean addStaticRoute(
        @RequestParam("routeName") String routeName,
        @RequestParam("staticRoute") String staticRoute,
        @RequestParam("nextHop") String nextHop,
        HttpServletRequest request,
        @RequestParam(required = false) String container) {
    String containerName = (container == null) ? GlobalConstants.DEFAULT
            .toString() : container;

    // Authorization check
    String userName = request.getUserPrincipal().getName();
    if (DaylightWebUtil
            .getContainerPrivilege(userName, containerName, this) != Privilege.WRITE) {
        return unauthorizedMessage();
    }

    StatusJsonBean result = new StatusJsonBean();
    try {
        IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper
                .getInstance(IForwardingStaticRouting.class, containerName,
                        this);
        StaticRouteConfig config = new StaticRouteConfig();
        config.setName(routeName);
        config.setStaticRoute(staticRoute);
        config.setNextHop(nextHop);
        Status addStaticRouteResult = staticRouting.addStaticRoute(config);
        if (addStaticRouteResult.isSuccess()) {
            result.setStatus(true);
            result.setMessage("Static Route saved successfully");
        } else {
            result.setStatus(false);
            result.setMessage(addStaticRouteResult.getDescription());
        }
    } catch (Exception e) {
        result.setStatus(false);
        result.setMessage("Error - " + e.getMessage());
    }
    return result;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:42,代码来源:Devices.java

示例8: getStaticRouteConfigs

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
public ConcurrentMap<String, StaticRouteConfig> getStaticRouteConfigs() {
    return staticRouteConfigs;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:4,代码来源:StaticRoutingImplementation.java

示例9: setStaticRouteConfigs

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
public void setStaticRouteConfigs(
        ConcurrentMap<String, StaticRouteConfig> staticRouteConfigs) {
    this.staticRouteConfigs = staticRouteConfigs;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:5,代码来源:StaticRoutingImplementation.java

示例10: addStaticRoute

import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; //导入依赖的package包/类
/**
 *
 * Add a new Static Route
 *
 * @param containerName Name of the Container. The Container name for the base controller is "default".
 * @param name Name of the Static Route configuration
 * @return Response as dictated by the HTTP Response code
 */
@Path("/{containerName}/{name}")
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes( {
        @ResponseCode(code = 201, condition = "Created Static Route successfully"),
        @ResponseCode(code = 404, condition = "The Container Name passed is not found"),
        @ResponseCode(code = 406, condition = "Cannot operate on Default Container when other Containers are active"),
        @ResponseCode(code = 409, condition = "Failed to create Static Route entry due to Conflicting Name or Prefix."), })
public Response addStaticRoute(
        @PathParam(value = "containerName") String containerName,
        @PathParam(value = "name") String name,
        @TypeHint(StaticRoute.class) JAXBElement<StaticRoute> staticRouteData) {


    if(!NorthboundUtils.isAuthorized(getUserName(), containerName,
            Privilege.WRITE, this)){
        throw new
            UnauthorizedException("User is not authorized to perform this operation on container "
                        + containerName);
    }
    handleDefaultDisabled(containerName);

    IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper
            .getInstance(IForwardingStaticRouting.class, containerName,
                    this);

    if (staticRouting == null) {
        throw new ResourceNotFoundException(RestMessages.NOCONTAINER
                .toString());
    }

    StaticRoute sRoute = staticRouteData.getValue();
    StaticRouteConfig cfgObject = new StaticRouteConfig(sRoute.getName(),
            sRoute.getPrefix(), sRoute.getNextHop());
    Status response = staticRouting.addStaticRoute(cfgObject);
    if (response.isSuccess()) {
        return Response.status(Response.Status.CREATED).build();
    }
    throw new ResourceConflictException(response.getDescription());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:49,代码来源:StaticRoutingNorthbound.java


注:本文中的org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。