本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}