• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java InstanceIp类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中net.juniper.contrail.api.types.InstanceIp的典型用法代码示例。如果您正苦于以下问题:Java InstanceIp类的具体用法?Java InstanceIp怎么用?Java InstanceIp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

InstanceIp类属于net.juniper.contrail.api.types包,在下文中一共展示了InstanceIp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deleteInstanceIps

点赞 3

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void deleteInstanceIps()
        throws IOException {

    List<InstanceIp> apiObjs = null;
    try {
        apiObjs = (List<InstanceIp>)
                apiConnector.list(InstanceIp.class, null);
    } catch (Exception e) {
        s_logger.error("Exception in api.list: " + e);
        s_logger.error(Throwables.getStackTraceAsString(e));
        return ;
    }

    for (InstanceIp vn : apiObjs) {
        apiConnector.delete(vn);
    }
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:19,
代码来源:VncDB.java

示例2: deleteInstanceIp

点赞 3

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
public void deleteInstanceIp(VirtualMachineInterface apiVmi) throws IOException {
    // delete instance Ip
    List<ObjectReference<ApiPropertyBase>> instanceIpRefs =
            apiVmi.getInstanceIpBackRefs();
    if (instanceIpRefs == null) {
        return;
    }
    for (ObjectReference<ApiPropertyBase> instanceIpRef :
        Utils.safe(instanceIpRefs)) {
        s_logger.info("Delete instance IP: " +
                instanceIpRef.getReferredName());
        apiConnector.delete(InstanceIp.class,
                instanceIpRef.getUuid());
        s_logger.info("Deleted Ip Instance " + instanceIpRef.getUuid());
    }
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:17,
代码来源:VncDB.java

示例3: testCanCreatePortOk

点赞 3

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的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: readInstanceIp

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
private void readInstanceIp(VirtualMachineInterfaceInfo vmiInfo)
        throws IOException {
    VirtualMachineInterface apiVmi =
            (VirtualMachineInterface) apiConnector.findById(
                VirtualMachineInterface.class, vmiInfo.getUuid());
    if (apiVmi == null) {
        return;
    }
    vmiInfo.apiVmi = apiVmi;

    List<ObjectReference<ApiPropertyBase>> instanceIpRefs =
            apiVmi.getInstanceIpBackRefs();

    for (ObjectReference<ApiPropertyBase> instanceIpRef :
        Utils.safe(instanceIpRefs)) {
        InstanceIp inst = (InstanceIp)
                apiConnector.findById(InstanceIp.class,
                        instanceIpRef.getUuid());
        if (inst != null) {
            List<ObjectReference<ApiPropertyBase>> vnRefs = inst.getVirtualNetwork();
            for (ObjectReference<ApiPropertyBase> vnRef :
                Utils.safe(vnRefs)) {
                if (vnRef.getUuid().equals(vmiInfo.vnInfo.getUuid())) {
                    String ipAddress = inst.getAddress();
                    InetAddress ipAddr = InetAddress.getByName(ipAddress);
                    if (ipAddr instanceof Inet4Address) {
                        vmiInfo.setIpAddress(inst.getAddress());
                        vmiInfo.apiInstanceIp = inst;
                        // the VMI can have multiple IPv4 and IPv6 addresses,
                        // but we pick only the first IPv4 address
                        return;
                    }
                }
            }
        }
    }
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:38,
代码来源:VncDB.java

示例5: verifyInstanceIpPresent

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
public static InstanceIp verifyInstanceIpPresent(VirtualMachineInterfaceInfo vmiInfo)
        throws IOException {

    VirtualNetwork vn = VirtualNetworkInfoTest.verifyVirtualNetworkPresent(vmiInfo.vnInfo);
    VirtualMachineInterface vmInterface = verifyVirtualMachineInterfacePresent(vmiInfo);

    // find instance-ip corresponding to virtual-machine-interface
    List<ObjectReference<ApiPropertyBase>> instanceIpRefs =
            vmInterface.getInstanceIpBackRefs();
    assertNotNull(instanceIpRefs);
    assertEquals(1, instanceIpRefs.size());
    ObjectReference<ApiPropertyBase> instanceIpRef = instanceIpRefs.get(0);
    assertNotNull(instanceIpRef);

    InstanceIp instanceIp = (InstanceIp)
            api.findById(InstanceIp.class, instanceIpRef.getUuid());
    assertNotNull(instanceIp);
    String instanceIpName = "ip-" + vn.getName() + "-" + vmiInfo.vmInfo.getName();
    assertEquals(instanceIp.getDisplayName(), instanceIpName);
    assertEquals(instanceIp.getUuid(), instanceIpRef.getUuid());
    assertEquals(instanceIp.getName(), instanceIpRef.getUuid());
    assertEquals(instanceIp.getIdPerms(), vncDB.getVCenterIdPerms());

    List<ObjectReference<ApiPropertyBase>> instIpVnRefs = instanceIp.getVirtualNetwork();
    assertNotNull(instIpVnRefs);
    assertEquals(instIpVnRefs.size(), 1);
    assertEquals(instIpVnRefs.get(0).getUuid(), vn.getUuid());

    List<ObjectReference<ApiPropertyBase>> vmiRefs = instanceIp.getVirtualMachineInterface();
    assertNotNull(vmiRefs);
    assertEquals(1, vmiRefs.size());
    assertEquals(vmInterface.getUuid(), vmiRefs.get(0).getUuid());

    s_logger.info("Found instanceIP " + instanceIp.getAddress());
    return instanceIp;
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:37,
代码来源:VirtualMachineInterfaceInfoTest.java

示例6: delete

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@Override
public void delete(ModelController controller) throws IOException {
    ApiConnector api = controller.getApiAccessor();
    if (_uuid != null) {
        api.delete(InstanceIp.class, _uuid);
    }
    _uuid = null;
}
 

开发者ID:apache,
项目名称:cloudstack,
代码行数:9,
代码来源:InstanceIpModel.java

示例7: deleteInstanceIps

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
private void deleteInstanceIps(List<ObjectReference<ApiPropertyBase>> list, StringBuffer syncLogMesg) throws IOException {
    if (list == null) {
        return;
    }
    final ApiConnector api = _manager.getApiConnector();
    for (ObjectReference<ApiPropertyBase> instIp : list) {
        api.delete(InstanceIp.class, instIp.getUuid());
        syncLogMesg.append("VNC instance ip: " + instIp.getUuid() + " deleted\n");
    }

}
 

开发者ID:apache,
项目名称:cloudstack,
代码行数:12,
代码来源:ServerDBSyncImpl.java

示例8: createInstanceIp

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
public void createInstanceIp(VirtualMachineInterfaceInfo vmiInfo)
        throws IOException {
    if (vmiInfo == null) {
        s_logger.error("Cannot create API Instance IP: null arguments");
        throw new IllegalArgumentException("Null vmiInfo argument");
    }

    if (mode == Mode.VCENTER_AS_COMPUTE) {
        return;
    }

    VirtualNetwork network = vmiInfo.vnInfo.apiVn;

    if (vmiInfo.vnInfo.getSubnetAddress() == null
            || vmiInfo.vnInfo.getSubnetMask() == null) {
        return;
    }
    VirtualMachine vm = vmiInfo.vmInfo.apiVm;

    if (vm == null) {
        vm = vmiInfo.vmInfo.apiVm = (VirtualMachine) apiConnector.findById(
                VirtualMachine.class, vmiInfo.vmInfo.getUuid());

        if (vm == null) {
            s_logger.error("Cannot find " + vmiInfo);
            return;
        }
    }
    VirtualMachineInterface vmIntf = vmiInfo.apiVmi;
    String instanceIpName = "ip-" + network.getName() + "-" + vmiInfo.vmInfo.getName() ;
    String instIpUuid = UUID.randomUUID().toString();

    InstanceIp instanceIp = new InstanceIp();
    if (vmiInfo.getIpAddress() != null) {
        instanceIp.setAddress(vmiInfo.getIpAddress());

        if (vmiInfo.vnInfo.getExternalIpam() == false) {
            s_logger.error("Internal error address already set for DHCP");
        }
    }
    instanceIp.setDisplayName(instanceIpName);
    instanceIp.setUuid(instIpUuid);
    instanceIp.setName(instIpUuid);
    instanceIp.setVirtualNetwork(network);
    instanceIp.setVirtualMachineInterface(vmIntf);
    instanceIp.setIdPerms(vCenterIdPerms);
    apiConnector.create(instanceIp);
    apiConnector.read(instanceIp);

    vmiInfo.apiInstanceIp = instanceIp;
    vmiInfo.setIpAddress(instanceIp.getAddress());

    s_logger.debug("Created instanceIP: " + instanceIp.getName() + ": " +
            instanceIp.getAddress());
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:56,
代码来源:VncDB.java

示例9: testAddHierarchicalDelete

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@Test
public void testAddHierarchicalDelete() throws IOException {
    VirtualNetworkInfo vnInfo = new VirtualNetworkInfo(VirtualNetworkInfoTest.BLUE);

    // Create virtual-network on api-server
    vncDB.createVirtualNetwork(vnInfo);

    // Verify virtual-network creation
    VirtualNetworkInfoTest.verifyVirtualNetworkPresent(vnInfo);

    // Create Virtual Machine
    VirtualMachineInfo vmInfo = new VirtualMachineInfo(VirtualMachineInfoTest.VM1);

    vncDB.createVirtualMachine(vmInfo);

    // Verify virtual-machine is created on api-server
    VirtualMachineInfoTest.verifyVirtualMachinePresent(vmInfo);

    VirtualMachineInterfaceInfo vmiInfo = new VirtualMachineInterfaceInfo(VirtualMachineInterfaceInfoTest.VMI1);
    vmiInfo.setVnInfo(vnInfo);
    vmiInfo.setVmInfo(vmInfo);
    vncDB.createVirtualMachineInterface(vmiInfo);

    // Verify virtual-machine-interface is created on api-server
    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfacePresent(vmiInfo);

    vncDB.createInstanceIp(vmiInfo);

    InstanceIp instanceIp = VirtualMachineInterfaceInfoTest.verifyInstanceIpPresent(vmiInfo);

    // Delete virtual-network from api-server
    // This should in turn delete thr virtual-machine,
    // virtual-machine-interfce, instance-ip etc
    vncDB.deleteVirtualNetwork(vnInfo);

    // Verify instance-ip is deleted from  api-server
    VirtualMachineInterfaceInfoTest.verifyInstanceIpAbsent(instanceIp);

    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfaceAbsent(vmiInfo);

    // Verify virtual-network is deleted
    VirtualNetworkInfoTest.verifyVirtualNetworkAbsent(vnInfo);

    // verify VM is still there
    VirtualMachineInfoTest.verifyVirtualMachinePresent(vmInfo);
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:47,
代码来源:VncDBTest.java

示例10: testAddHierarchicalDeleteVM

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@Test
public void testAddHierarchicalDeleteVM() throws IOException {
    VirtualNetworkInfo vnInfo = new VirtualNetworkInfo(VirtualNetworkInfoTest.BLUE);

    // Create virtual-network on api-server
    vncDB.createVirtualNetwork(vnInfo);

    // Verify virtual-network creation
    VirtualNetworkInfoTest.verifyVirtualNetworkPresent(vnInfo);

    // Create Virtual Machine
    VirtualMachineInfo vmInfo = new VirtualMachineInfo(VirtualMachineInfoTest.VM1);

    vncDB.createVirtualMachine(vmInfo);

    // Verify virtual-machine is created on api-server
    VirtualMachineInfoTest.verifyVirtualMachinePresent(vmInfo);

    VirtualMachineInterfaceInfo vmiInfo = new VirtualMachineInterfaceInfo(VirtualMachineInterfaceInfoTest.VMI1);
    vmiInfo.setVnInfo(vnInfo);
    vmiInfo.setVmInfo(vmInfo);
    vncDB.createVirtualMachineInterface(vmiInfo);

    // Verify virtual-machine-interface is created on api-server
    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfacePresent(vmiInfo);

    vncDB.createInstanceIp(vmiInfo);

    InstanceIp instanceIp = VirtualMachineInterfaceInfoTest.verifyInstanceIpPresent(vmiInfo);

    // Delete virtual machine from api-server
    // This should in turn delete the virtual-machine,
    // virtual-machine-interface, instance-ip etc
    vncDB.deleteVirtualMachine(vmInfo);

    // Verify instance-ip is deleted from  api-server
    VirtualMachineInterfaceInfoTest.verifyInstanceIpAbsent(instanceIp);

    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfaceAbsent(vmiInfo);

    // Verify virtual-network is still there
    VirtualNetworkInfoTest.verifyVirtualNetworkPresent(vnInfo);

    // verify VM is still there
    VirtualMachineInfoTest.verifyVirtualMachineAbsent(vmInfo);    }
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:46,
代码来源:VncDBTest.java

示例11: verifyInstanceIpAbsent

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
public static void verifyInstanceIpAbsent(InstanceIp instanceIp) throws IOException {
    InstanceIp ip1 = (InstanceIp) api.findById(InstanceIp.class, instanceIp.getUuid());
    assertNull(ip1);
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:5,
代码来源:VirtualMachineInterfaceInfoTest.java

示例12: testSyncVirtualMachine

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@Test
public void testSyncVirtualMachine() throws IOException {

    SortedMap<String, VirtualMachineInfo> oldVMs =
            new ConcurrentSkipListMap<String, VirtualMachineInfo>();

    VirtualMachineInfo newVmInfo = new VirtualMachineInfo(VirtualMachineInfoTest.VM1);
    VirtualMachineInterfaceInfo newVmiInfo =
            new VirtualMachineInterfaceInfo(VirtualMachineInterfaceInfoTest.VMI2);
    newVmiInfo.setVnInfo(vnInfo);
    newVmiInfo.setVmInfo(newVmInfo);
    newVmInfo.created(newVmiInfo);
    assertTrue(newVmInfo.contains(newVmiInfo));

    SortedMap<String, VirtualMachineInfo> newVMs = new ConcurrentSkipListMap<String, VirtualMachineInfo>();
    newVMs.put(newVmInfo.getUuid(), newVmInfo);

    s_logger.info("Sync create VM");
    MainDB.sync(oldVMs, newVMs);

    verifyVirtualMachinePresent(newVmInfo);
    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfacePresent(newVmiInfo);
    InstanceIp instanceIp = VirtualMachineInterfaceInfoTest.verifyInstanceIpPresent(newVmiInfo);
    // verify VMI has been added in the VMI map of VN
    assertTrue(vnInfo.contains(newVmiInfo));
    verify(vrouterApi).addPort(anyString(), anyString(), anyString(), anyString(),
            anyString(), anyString(), anyShort(), anyShort(),
            anyString(), anyString());

    s_logger.info("Sync again should not produce any change");
    MainDB.sync(oldVMs, newVMs);

    verifyNoMoreInteractions(vrouterApi);

    oldVMs = vncDB.readVirtualMachines();
    newVMs = new ConcurrentSkipListMap<String, VirtualMachineInfo>();

    s_logger.info("Sync delete VM");
    MainDB.sync(oldVMs, newVMs);

    verifyVirtualMachineAbsent(newVmInfo);
    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfaceAbsent(newVmiInfo);
    VirtualMachineInterfaceInfoTest.verifyInstanceIpAbsent(instanceIp);
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:45,
代码来源:VirtualMachineInfoTest.java

示例13: createLoadBalancer

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
/**
     * Invoked to create the specified Neutron LoadBalancer.
     *
     * @param loadBalancer
     *            An instance of new Neutron LoadBalancer object.
     */
    private void createLoadBalancer(NeutronLoadBalancer loadBalancer) throws IOException {
//        LoadBalancer virtualLoadBalancer = new LoadBalancer();
//        virtualLoadBalancer = mapLoadBalancerProperties(loadBalancer, virtualLoadBalancer);
        Project project = (Project) apiConnector.findById(Project.class, loadBalancer.getLoadBalancerTenantID());
        INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this);
        NeutronSubnet subnet = subnetInterface.getSubnet(loadBalancer.getLoadBalancerVipSubnetID());
        String networkUUID = subnet.getNetworkUUID();
        VirtualNetwork virtualnetwork = (VirtualNetwork) apiConnector.findById(VirtualNetwork.class, networkUUID);
        VirtualMachineInterface vmi = new VirtualMachineInterface();
        vmi.setName(UUID.randomUUID().toString());
        vmi.setUuid(UUID.randomUUID().toString());
        vmi.setParent(project);
        vmi.setVirtualNetwork(virtualnetwork);
        boolean virtualMachineInterfaceCreated = apiConnector.create(vmi);
        if (!virtualMachineInterfaceCreated) {
            LOGGER.warn("actual virtualMachineInterface creation failed..");
        }
//        /* setting vmi in LoadBalancer in OpenContrail */
//        virtualLoadBalancer.setVirtualMachineInterface(vmi);
         String ips = loadBalancer.getLoadBalancerVipAddress();
         InstanceIp instanceIp = new InstanceIp();
         String instaneIpUuid = UUID.randomUUID().toString();
         instanceIp.setAddress(ips);
         instanceIp.setName(instaneIpUuid);
         instanceIp.setUuid(instaneIpUuid);
         instanceIp.setParent(vmi);
         instanceIp.setVirtualMachineInterface(vmi);
         instanceIp.setVirtualNetwork(virtualnetwork);
         boolean instanceIpCreated = apiConnector.create(instanceIp);
         if (!instanceIpCreated) {
         LOGGER.warn("instanceIp addition failed..");
         }
         LOGGER.info("Instance IP " + instanceIp.getAddress() +
         " added sucessfully...");
//        boolean loadBalancerCreated;
        try {
//            loadBalancerCreated = apiConnector.create(virtualLoadBalancer);
//            LOGGER.debug("loadBalancer:   " + loadBalancerCreated);
//            if (!loadBalancerCreated) {
//                LOGGER.info("loadBalancer creation failed..");
//            }
        } catch (Exception Ex) {
            LOGGER.error("Exception : " + Ex);
        }
    }
 

开发者ID:opendaylight,
项目名称:archived-plugin2oc,
代码行数:52,
代码来源:LoadBalancerHandler.java

示例14: initDefaultConfig

点赞 2

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
public void initDefaultConfig() throws Exception {
    int  port = ApiTestCommon.findFreePort();
    ApiTestCommon.launchContrailServer(port);
    s_logger.debug("initDefaultConfig: test api server launched <localhost" + ", " + port + ">");
    ApiConnector api = ApiConnectorFactory.build("localhost", port);

    Class<?extends ApiObjectBase>[] vncClasses =  new Class[] {
            Domain.class,
            VirtualNetwork.class,
            VirtualMachine.class,
            NetworkIpam.class,
            InstanceIp.class,
            ServiceInstance.class,
            FloatingIp.class,
            NetworkPolicy.class,
            Project.class,
            Port.class
    };

    HashMap<Class<?extends ApiObjectBase>, List<HashMap<String, ApiObjectBase>>> map = new HashMap<Class<?extends ApiObjectBase>, List<HashMap<String, ApiObjectBase>>>();
    for (Class<?extends ApiObjectBase> cls: vncClasses) {
        List<?extends ApiObjectBase> vncList = (List<?extends ApiObjectBase>)api.list(cls, null);
        List<HashMap<String, ApiObjectBase>> objList = new ArrayList<HashMap<String, ApiObjectBase>>();
        HashMap<String, ApiObjectBase> uuidMap = new HashMap<String, ApiObjectBase>();
        HashMap<String, ApiObjectBase> fqnMap = new HashMap<String, ApiObjectBase>();
        objList.add(uuidMap);
        objList.add(fqnMap);
        for (ApiObjectBase obj:vncList) {
           api.read(obj);
           uuidMap.put(obj.getUuid(), obj);
           fqnMap.put(StringUtils.join(obj.getQualifiedName(), ':'), obj);
        }
        map.put(cls, objList);
    }

    FileOutputStream fout = new FileOutputStream (defaultConfigFile);
    ObjectOutputStream objOut = new ObjectOutputStream(fout);
    objOut.writeObject(map);
    objOut.close();
    return;
}
 

开发者ID:Juniper,
项目名称:contrail-java-api,
代码行数:42,
代码来源:ContrailApiMockTest.java

示例15: testAddDeleteOneByOne

点赞 1

import net.juniper.contrail.api.types.InstanceIp; //导入依赖的package包/类
@Test
public void testAddDeleteOneByOne() throws IOException {
    VirtualNetworkInfo vnInfo = new VirtualNetworkInfo(VirtualNetworkInfoTest.BLUE);

    // Create virtual-network on api-server
    vncDB.createVirtualNetwork(vnInfo);

    // Verify virtual-network creation
    VirtualNetworkInfoTest.verifyVirtualNetworkPresent(vnInfo);

    // Create Virtual Machine
    VirtualMachineInfo vmInfo = new VirtualMachineInfo(VirtualMachineInfoTest.VM1);

    vncDB.createVirtualMachine(vmInfo);

    // Verify virtual-machine is created on api-server
    VirtualMachineInfoTest.verifyVirtualMachinePresent(vmInfo);

    VirtualMachineInterfaceInfo vmiInfo = new VirtualMachineInterfaceInfo(VirtualMachineInterfaceInfoTest.VMI1);
    vmiInfo.setVnInfo(vnInfo);
    vmiInfo.setVmInfo(vmInfo);
    vncDB.createVirtualMachineInterface(vmiInfo);

    // Verify virtual-machine-interface is created on api-server
    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfacePresent(vmiInfo);

    vncDB.createInstanceIp(vmiInfo);

    InstanceIp instanceIp = VirtualMachineInterfaceInfoTest.verifyInstanceIpPresent(vmiInfo);

    // Delete
    vncDB.deleteInstanceIp(vmiInfo);

    // Verify instance-ip is deleted from  api-server
    VirtualMachineInterfaceInfoTest.verifyInstanceIpAbsent(instanceIp);

    vncDB.deleteVirtualMachineInterface(vmiInfo);

    VirtualMachineInterfaceInfoTest.verifyVirtualMachineInterfaceAbsent(vmiInfo);

    vncDB.deleteVirtualMachine(vmInfo);

    // Verify virtual-machine is deleted from  api-server
    VirtualMachineInfoTest.verifyVirtualMachineAbsent(vmInfo);

    // Delete virtual-network from api-server
    vncDB.deleteVirtualNetwork(vnInfo);

    // Verify virtual-network is deleted
    VirtualNetworkInfoTest.verifyVirtualNetworkAbsent(vnInfo);
}
 

开发者ID:Juniper,
项目名称:contrail-vcenter-plugin,
代码行数:52,
代码来源:VncDBTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)