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


Java NeutronPort.getPortUUID方法代码示例

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


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

示例1: neutronPortCreated

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入方法依赖的package包/类
/**
 * Invoked to create a port and take action after the port has been created.
 *
 * @param network
 *            An instance of new Neutron port object.
 */
@Override
public void neutronPortCreated(NeutronPort neutronPort) {
    try {
        createPort(neutronPort);
        String portUUID = neutronPort.getPortUUID();
        if (!(portUUID.contains("-"))) {
            portUUID = Utils.uuidFormater(portUUID);
        }
        portUUID = UUID.fromString(portUUID).toString();
        VirtualMachineInterface virtualMachineInterface = (VirtualMachineInterface) apiConnector
                .findById(VirtualMachineInterface.class, portUUID);
        if (virtualMachineInterface != null) {
            LOGGER.info("Port creation verified....");
        }
    } catch (Exception ex) {
        LOGGER.error("Exception :    " + ex);
    }
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:25,代码来源:PortHandler.java

示例2: neutronPortDeleted

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入方法依赖的package包/类
/**
 * Invoked to take action after a port has been deleted.
 *
 * @param neutronPort
 *            An instance of new Neutron port object.
 */
@Override
public void neutronPortDeleted(NeutronPort neutronPort) {
    try {
        deletePort(neutronPort);
        String portUUID = neutronPort.getPortUUID();
        if (!(portUUID.contains("-"))) {
            portUUID = Utils.uuidFormater(portUUID);
        }
        portUUID = UUID.fromString(portUUID).toString();
        VirtualMachineInterface virtualMachineInterface = (VirtualMachineInterface) apiConnector
                .findById(VirtualMachineInterface.class, portUUID);
        if (virtualMachineInterface == null) {
            LOGGER.info("Port deletion verified....");
        }
    } catch (IOException ioEx) {
        LOGGER.error("Exception :    " + ioEx);
    } catch (Exception e) {
        LOGGER.error("Exception :    " + e);
    }
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:27,代码来源:PortHandler.java

示例3: canDeletePort

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入方法依赖的package包/类
/**
 * Invoked when a port deletion is requested to check if the specified Port
 * can be deleted
 *
 * @param NeutronPort
 *            An instance of proposed Neutron Port object.
 * @return A HTTP status code to the deletion request.
 */
@Override
public int canDeletePort(NeutronPort neutronPort) {
    if (neutronPort == null) {
        LOGGER.info("Port object can't be null...");
        return HttpURLConnection.HTTP_BAD_REQUEST;
    }
    apiConnector = Activator.apiConnector;
    String portUUID = neutronPort.getPortUUID();
    if (!(portUUID.contains("-"))) {
        portUUID = Utils.uuidFormater(portUUID);
    }
    portUUID = UUID.fromString(portUUID).toString();
    try {
        VirtualMachineInterface virtualMachineInterface = (VirtualMachineInterface) apiConnector
                .findById(VirtualMachineInterface.class, portUUID);

        if (virtualMachineInterface == null) {
            LOGGER.error("No port exists for specified UUID...");
            return HttpURLConnection.HTTP_NOT_FOUND;
        } else {
            List<ObjectReference<ApiPropertyBase>> vmi = new ArrayList<ObjectReference<ApiPropertyBase>>();
            vmi = virtualMachineInterface.getFloatingIpBackRefs();
            if (vmi != null) {
                LOGGER.info("Port has floating Ip associated with it...");
                return HttpURLConnection.HTTP_BAD_REQUEST;
            }
            return HttpURLConnection.HTTP_OK;
        }
    } catch (Exception ioEx) {
        LOGGER.error("IOException :   ", ioEx);
        return HttpURLConnection.HTTP_INTERNAL_ERROR;
    }
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:42,代码来源:PortHandler.java

示例4: neutronPortUpdated

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入方法依赖的package包/类
/**
 * Invoked to take action after a port has been updated.
 *
 * @param updatedPort
 *            An instance of modified Neutron Port object.
 */
@Override
public void neutronPortUpdated(NeutronPort updatedPort) {
    String deviceUUID = updatedPort.getDeviceID();
    String portUUID = updatedPort.getPortUUID();
    try {
        updatePort(updatedPort);
        try {
            if (!(portUUID.contains("-"))) {
                portUUID = Utils.uuidFormater(portUUID);
            }
            portUUID = UUID.fromString(portUUID).toString();
            if (deviceUUID != null) {
                if (!(deviceUUID.contains("-"))) {
                    deviceUUID = Utils.uuidFormater(deviceUUID);
                }
                deviceUUID = UUID.fromString(deviceUUID).toString();
            }
            VirtualMachineInterface virtualMachineInterface = (VirtualMachineInterface) apiConnector.findById(VirtualMachineInterface.class,
                    portUUID);
            if (deviceUUID == null || ("").equals(deviceUUID)) {
                if (updatedPort.getName().matches(virtualMachineInterface.getDisplayName())
                        && virtualMachineInterface.getVirtualMachine() == null) {
                    LOGGER.info("Port updation verified....");
                }
            } else {
                if (updatedPort.getName().matches(virtualMachineInterface.getDisplayName())
                        && deviceUUID.matches(virtualMachineInterface.getVirtualMachine().get(0).getUuid())) {
                    LOGGER.info("Port updatation verified....");
                }
            }
        } catch (Exception e) {
            LOGGER.error("Exception :" + e);
        }
    } catch (IOException ioEx) {
        LOGGER.error("Exception :" + ioEx);
    } catch (Exception ex) {
        LOGGER.error("Exception :" + ex);
    }
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:46,代码来源:PortHandler.java


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