package org.zstack.test.eip.flatnetwork; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import org.zstack.core.cloudbus.CloudBus; import org.zstack.core.componentloader.ComponentLoader; import org.zstack.core.db.DatabaseFacade; import org.zstack.header.identity.SessionInventory; import org.zstack.header.vm.VmInstanceInventory; import org.zstack.network.service.flat.FlatNetworkServiceSimulatorConfig; import org.zstack.simulator.kvm.KVMSimulatorConfig; import org.zstack.simulator.virtualrouter.VirtualRouterSimulatorConfig; import org.zstack.test.Api; import org.zstack.test.ApiSenderException; import org.zstack.test.DBUtil; import org.zstack.test.WebBeanConstructor; import org.zstack.test.deployer.Deployer; /** * @author frank * <p> * 1. create a vm with an EIP using virtual router provider * 2. reconnect host * <p> * confirm flat network eip provider not sync the EIP to vm's host */ public class TestFlatNetworkEip16 { Deployer deployer; Api api; ComponentLoader loader; CloudBus bus; DatabaseFacade dbf; SessionInventory session; VirtualRouterSimulatorConfig vconfig; KVMSimulatorConfig kconfig; FlatNetworkServiceSimulatorConfig fconfig; @Before public void setUp() throws Exception { DBUtil.reDeployDB(); WebBeanConstructor con = new WebBeanConstructor(); deployer = new Deployer("deployerXml/eip/TestVirtualRouterEip.xml", con); deployer.addSpringConfig("VirtualRouter.xml"); deployer.addSpringConfig("VirtualRouterSimulator.xml"); deployer.addSpringConfig("flatNetworkServiceSimulator.xml"); deployer.addSpringConfig("flatNetworkProvider.xml"); deployer.addSpringConfig("KVMRelated.xml"); deployer.addSpringConfig("vip.xml"); deployer.addSpringConfig("eip.xml"); deployer.build(); api = deployer.getApi(); loader = deployer.getComponentLoader(); vconfig = loader.getComponent(VirtualRouterSimulatorConfig.class); kconfig = loader.getComponent(KVMSimulatorConfig.class); bus = loader.getComponent(CloudBus.class); dbf = loader.getComponent(DatabaseFacade.class); fconfig = loader.getComponent(FlatNetworkServiceSimulatorConfig.class); session = api.loginAsAdmin(); } @Test public void test() throws ApiSenderException { VmInstanceInventory vm = deployer.vms.get("TestVm"); api.reconnectHost(vm.getHostUuid()); Assert.assertTrue(fconfig.batchApplyEipCmds.isEmpty()); } }