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


Java NodeConnector.fromStringNoNode方法代码示例

本文整理汇总了Java中org.opendaylight.controller.sal.core.NodeConnector.fromStringNoNode方法的典型用法代码示例。如果您正苦于以下问题:Java NodeConnector.fromStringNoNode方法的具体用法?Java NodeConnector.fromStringNoNode怎么用?Java NodeConnector.fromStringNoNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.controller.sal.core.NodeConnector的用法示例。


在下文中一共展示了NodeConnector.fromStringNoNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleNodeConnectorAvailability

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
private void handleNodeConnectorAvailability(String containerName,
        Node node, String nodeConnectorType, String nodeConnectorId) {

    NodeConnector nc = NodeConnector.fromStringNoNode(nodeConnectorType,
            nodeConnectorId, node);
    if (nc == null) {
        throw new ResourceNotFoundException(nc + " : "
                + RestMessages.NORESOURCE.toString());
    }

    ISwitchManager sm = (ISwitchManager) ServiceHelper.getInstance(
            ISwitchManager.class, containerName, this);

    if (sm == null) {
        throw new ServiceUnavailableException("Switch Manager "
                + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    if (!sm.getNodeConnectors(node).contains(nc)) {
        throw new ResourceNotFoundException(nc.toString() + " : "
                + RestMessages.NORESOURCE.toString());
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:24,代码来源:SwitchNorthbound.java

示例2: addNodeConnectorProperty

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Add a Name/Bandwidth property to a node connector
 *
 * @param containerName
 *            Name of the Container
 * @param nodeType
 *            Type of the node being programmed
 * @param nodeId
 *            Node Identifier as specified by
 *            {@link org.opendaylight.controller.sal.core.Node}
 * @param nodeConnectorType
 *            Type of the node connector being programmed
 * @param nodeConnectorId
 *            NodeConnector Identifier as specified by
 *            {@link org.opendaylight.controller.sal.core.NodeConnector}
 * @param propName
 *            Name of the Property specified by
 *            {@link org.opendaylight.controller.sal.core.Property} and its
 *            extended classes
 * @param propValue
 *            Value of the Property specified by
 *            {@link org.opendaylight.controller.sal.core.Property} and its
 *            extended classes
 * @return Response as dictated by the HTTP Response Status code
 */

@Path("/{containerName}/nodeconnector/{nodeType}/{nodeId}/{nodeConnectorType}/{nodeConnectorId}/property/{propName}/{propValue}")
@PUT
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes({
        @ResponseCode(code = 200, condition = "Operation successful"),
        @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
        @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
public Response addNodeConnectorProperty(
        @PathParam("containerName") String containerName,
        @PathParam("nodeType") String nodeType,
        @PathParam("nodeId") String nodeId,
        @PathParam("nodeConnectorType") String nodeConnectorType,
        @PathParam("nodeConnectorId") String nodeConnectorId,
        @PathParam("propName") String propName,
        @PathParam("propValue") String propValue) {

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

    handleDefaultDisabled(containerName);

    ISwitchManager switchManager = getIfSwitchManagerService(containerName);
    if (switchManager == null) {
        throw new ServiceUnavailableException("Switch Manager "
                + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    handleNodeAvailability(containerName, nodeType, nodeId);
    Node node = Node.fromString(nodeType, nodeId);

    handleNodeConnectorAvailability(containerName, node, nodeConnectorType,
            nodeConnectorId);
    NodeConnector nc = NodeConnector
            .fromStringNoNode(nodeConnectorType, nodeConnectorId, node);

    Property prop = switchManager.createProperty(propName, propValue);
    if (prop == null) {
        throw new ResourceNotFoundException(
                RestMessages.INVALIDDATA.toString());
    }

    Status ret = switchManager.addNodeConnectorProp(nc, prop);
    if (ret.isSuccess()) {
        return Response.status(Response.Status.CREATED).build();
    }
    throw new InternalServerErrorException(ret.getDescription());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:78,代码来源:SwitchNorthbound.java

示例3: deleteNodeConnectorProperty

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Delete a property of a node connector
 *
 * @param containerName
 *            Name of the Container
 * @param nodeType
 *            Type of the node being programmed
 * @param nodeId
 *            Node Identifier as specified by
 *            {@link org.opendaylight.controller.sal.core.Node}
 * @param nodeConnectorType
 *            Type of the node connector being programmed
 * @param nodeConnectorId
 *            NodeConnector Identifier as specified by
 *            {@link org.opendaylight.controller.sal.core.NodeConnector}
 * @param propertyName
 *            Name of the Property specified by
 *            {@link org.opendaylight.controller.sal.core.Property} and its
 *            extended classes
 * @return Response as dictated by the HTTP Response Status code
 */

@Path("/{containerName}/nodeconnector/{nodeType}/{nodeId}/{nodeConnectorType}/{nodeConnectorId}/property/{propertyName}")
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes({
        @ResponseCode(code = 200, condition = "Operation successful"),
        @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
        @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
public Response deleteNodeConnectorProperty(
        @PathParam("containerName") String containerName,
        @PathParam("nodeType") String nodeType,
        @PathParam("nodeId") String nodeId,
        @PathParam("nodeConnectorType") String nodeConnectorType,
        @PathParam("nodeConnectorId") String nodeConnectorId,
        @PathParam("propertyName") String propertyName) {

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

    handleDefaultDisabled(containerName);

    ISwitchManager switchManager = getIfSwitchManagerService(containerName);
    if (switchManager == null) {
        throw new ServiceUnavailableException("Switch Manager "
                + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    handleNodeAvailability(containerName, nodeType, nodeId);
    Node node = Node.fromString(nodeType, nodeId);

    handleNodeConnectorAvailability(containerName, node, nodeConnectorType,
            nodeConnectorId);
    NodeConnector nc = NodeConnector
            .fromStringNoNode(nodeConnectorType, nodeConnectorId, node);
    Status ret = switchManager.removeNodeConnectorProp(nc, propertyName);
    if (ret.isSuccess()) {
        return Response.ok().build();
    }
    throw new ResourceNotFoundException(ret.getDescription());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:66,代码来源:SwitchNorthbound.java


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