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


Java NeutronPort类代码示例

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


NeutronPort类属于org.opendaylight.controller.networkconfig.neutron包,在下文中一共展示了NeutronPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testCanCreatePortOk

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@PrepareForTest({ PortHandler.class, VirtualMachineInterface.class, InstanceIp.class })
@Test
public void testCanCreatePortOk() throws Exception {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    VirtualMachineInterface mockedVirtualMachineInterface = PowerMock.createNiceMock(VirtualMachineInterface.class);
    expectNew(VirtualMachineInterface.class).andReturn(mockedVirtualMachineInterface);
    InstanceIp mockedInstanceIp = PowerMock.createNiceMock(InstanceIp.class);
    expectNew(InstanceIp.class).andReturn(mockedInstanceIp);
    when(mockedApiConnector.findById(VirtualMachineInterface.class, neutronPort.getPortUUID())).thenReturn(null);
    when(mockedApiConnector.findById(VirtualMachine.class, neutronPort.getDeviceID())).thenReturn(mockedvirtualMachine);
    when(mockedApiConnector.findById(VirtualNetwork.class, neutronPort.getNetworkUUID())).thenReturn(mockedVirtualNetwork);
    when(mockedApiConnector.create(mockedVirtualMachineInterface)).thenReturn(true);
    PowerMock.replay(mockedVirtualMachineInterface, VirtualMachineInterface.class);
    when(neutronPort.getFixedIPs().get(0).getIpAddress()).thenReturn("10.0.0.1");
    when(mockedApiConnector.create(mockedInstanceIp)).thenReturn(true);
    PowerMock.replay(mockedInstanceIp, InstanceIp.class);
    assertEquals(HttpURLConnection.HTTP_OK, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:Juniper,项目名称:odl-opencontrail-plugin,代码行数:20,代码来源:PortHandlerTest.java

示例4: 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

示例5: 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

示例6: defaultNeutronPortObject

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
public NeutronPort defaultNeutronPortObject() {
    NeutronPort neutronPort = new NeutronPort();
    neutronPort.setPortUUID("64a271fe-0216-46bc-a3e6-1ff582fbd324");
    neutronPort.setNetworkUUID("54a271fe-0216-46bc-a3e6-1ff582fbd324");
    neutronPort.setMacAddress("02:70:72:93:4d:d6");
    neutronPort.setName("port12");
    neutronPort.setDeviceID("100071fe-0216-46bc-a3e6-1ff582fbd324");
    neutronPort.setTenantID("100071fe-0216-46bc-a3e6-1ff582fbd324");
    List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
    ips.add(mockNeutron_IPs);
    neutronPort.setFixedIPs(ips);
    return neutronPort;
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:14,代码来源:PortHandlerTest.java

示例7: detaNeutronPort

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
public NeutronPort detaNeutronPort() {
    NeutronPort dummyNeutronPort = new NeutronPort();
    dummyNeutronPort.setPortUUID("64a271fe-0216-46bc-a3e6-1ff582fbd324");
    dummyNeutronPort.setNetworkUUID("54a271fe-0216-46bc-a3e6-1ff582fbd324");
    dummyNeutronPort.setName("port01");
    dummyNeutronPort.setDeviceID("100071fe-0216-46bc-a3e6-1ff582fbd324");
    dummyNeutronPort.setTenantID("100071fe-0216-46bc-a3e6-1ff582fbd324");
    List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
    ips.add(mockNeutron_IPs);
    dummyNeutronPort.setFixedIPs(ips);
    return dummyNeutronPort;
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:13,代码来源:PortHandlerTest.java

示例8: testCanCreatePortIdEmtpy

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortIdEmtpy() {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    neutronPort.setPortUUID("");
    assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:8,代码来源:PortHandlerTest.java

示例9: testCanCreatePortTenantIdNull

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortTenantIdNull() {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    neutronPort.setTenantID(null);
    assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:8,代码来源:PortHandlerTest.java

示例10: testCanCreatePortNameNull

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortNameNull() {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    neutronPort.setName("");
    assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:8,代码来源:PortHandlerTest.java

示例11: testCanCreatePortSameTenant

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortSameTenant() throws IOException {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    when(mockedVirtualNetwork.getParentUuid()).thenReturn("f00071fe-0216-46bc-a3e6-1ff582fbd324");
    when(mockedApiConnector.findById(Project.class, neutronPort.getTenantID())).thenReturn(mockedProject);
    when(mockedApiConnector.findById(VirtualNetwork.class, neutronPort.getNetworkUUID())).thenReturn(mockedVirtualNetwork);
    assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:10,代码来源:PortHandlerTest.java

示例12: testCanCreatePortProjectNotFound

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortProjectNotFound() throws Exception {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    when(mockedApiConnector.findById(Project.class, neutronPort.getTenantID())).thenReturn(null);
    assertEquals(HttpURLConnection.HTTP_NOT_FOUND, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:8,代码来源:PortHandlerTest.java

示例13: testCanCreatePortExist

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortExist() throws IOException {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    when(mockedVirtualNetwork.getParentUuid()).thenReturn(neutronPort.getTenantID());
    when(mockedApiConnector.findById(Project.class, neutronPort.getTenantID())).thenReturn(mockedProject);
    when(mockedApiConnector.findById(VirtualNetwork.class, neutronPort.getNetworkUUID())).thenReturn(mockedVirtualNetwork);
    when(mockedApiConnector.findById(VirtualMachineInterface.class, neutronPort.getPortUUID())).thenReturn(mockedVirtualMachineInterface);
    assertEquals(HttpURLConnection.HTTP_FORBIDDEN, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:11,代码来源:PortHandlerTest.java

示例14: testCanCreatePortExistSameName

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortExistSameName() throws IOException {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    when(mockedVirtualNetwork.getParentUuid()).thenReturn(neutronPort.getTenantID());
    when(mockedApiConnector.findById(Project.class, neutronPort.getTenantID())).thenReturn(mockedProject);
    when(mockedApiConnector.findById(VirtualNetwork.class, neutronPort.getNetworkUUID())).thenReturn(mockedVirtualNetwork);
    when(mockedApiConnector.findById(VirtualMachineInterface.class, neutronPort.getPortUUID())).thenReturn(null);
    when(mockedApiConnector.findByName(VirtualMachineInterface.class, mockedProject, neutronPort.getName())).thenReturn("PORT-001");
    assertEquals(HttpURLConnection.HTTP_FORBIDDEN, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:12,代码来源:PortHandlerTest.java

示例15: testCanCreatePortOK

import org.opendaylight.controller.networkconfig.neutron.NeutronPort; //导入依赖的package包/类
@Test
public void testCanCreatePortOK() throws IOException {
    Activator.apiConnector = mockedApiConnector;
    NeutronPort neutronPort = defaultNeutronPortObject();
    when(mockedVirtualNetwork.getParentUuid()).thenReturn(neutronPort.getTenantID());
    when(mockedApiConnector.findById(Project.class, neutronPort.getTenantID())).thenReturn(mockedProject);
    when(mockedApiConnector.findById(VirtualNetwork.class, neutronPort.getNetworkUUID())).thenReturn(mockedVirtualNetwork);
    when(mockedApiConnector.findById(VirtualMachineInterface.class, neutronPort.getPortUUID())).thenReturn(null);
    when(mockedApiConnector.findByName(VirtualMachineInterface.class, mockedProject, neutronPort.getName())).thenReturn(null);
    assertEquals(HttpURLConnection.HTTP_OK, porthandler.canCreatePort(neutronPort));
}
 
开发者ID:opendaylight,项目名称:archived-plugin2oc,代码行数:12,代码来源:PortHandlerTest.java


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