forked from zstackio/zstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when delete l3network, iprange, virtual router will not be deleted
if the l3 network is not guest network, or public network, managment network fix ZSTAC-10692
- Loading branch information
Showing
4 changed files
with
205 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...gration/networkservice/provider/virtualrouter/VirtualRouterDeletePublicNetworkCase.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package org.zstack.test.integration.networkservice.provider.virtualrouter | ||
|
||
import org.zstack.core.db.DatabaseFacade | ||
import org.zstack.core.db.Q | ||
import org.zstack.header.vm.VmNicVO | ||
import org.zstack.network.service.virtualrouter.VirtualRouterVmVO | ||
import org.zstack.sdk.IpRangeInventory | ||
import org.zstack.sdk.L2NetworkInventory | ||
import org.zstack.sdk.L3NetworkInventory | ||
import org.zstack.sdk.VmInstanceInventory | ||
import org.zstack.test.integration.networkservice.provider.NetworkServiceProviderTest | ||
import org.zstack.testlib.EnvSpec | ||
import org.zstack.testlib.SubCase | ||
|
||
/** | ||
* Created by shixin on 03/30/2018. | ||
*/ | ||
class VirtualRouterDeletePublicNetworkCase extends SubCase { | ||
|
||
EnvSpec env | ||
DatabaseFacade dbf | ||
|
||
@Override | ||
void setup() { | ||
useSpring(NetworkServiceProviderTest.springSpec) | ||
} | ||
|
||
@Override | ||
void environment() { | ||
env = VirtualRouterNetworkServiceEnv.oneVmOneHostVyosOnEipEnv() | ||
} | ||
|
||
@Override | ||
void test() { | ||
env.create { | ||
testDeleteAdditionalPublicNetwork() | ||
} | ||
} | ||
|
||
void testDeleteAdditionalPublicNetwork() { | ||
def l2 = env.inventoryByName("l2") as L2NetworkInventory | ||
def pub = env.inventoryByName("pubL3") as L3NetworkInventory | ||
|
||
L3NetworkInventory l3_1 = createL3Network { | ||
delegate.category = "Public" | ||
delegate.l2NetworkUuid = l2.uuid | ||
delegate.name = "pubL3-2" | ||
} | ||
|
||
addIpRange { | ||
delegate.name = "TestIpRange" | ||
delegate.l3NetworkUuid = l3_1.uuid | ||
delegate.startIp = "11.168.200.10" | ||
delegate.endIp = "11.168.200.253" | ||
delegate.gateway = "11.168.200.1" | ||
delegate.netmask = "255.255.255.0" | ||
} | ||
|
||
VirtualRouterVmVO vr = Q.New(VirtualRouterVmVO.class).find() | ||
|
||
VmInstanceInventory inv = attachL3NetworkToVm { | ||
delegate.l3NetworkUuid = l3_1.getUuid() | ||
delegate.vmInstanceUuid = vr.uuid | ||
} | ||
|
||
deleteL3Network { | ||
uuid = l3_1.uuid | ||
} | ||
|
||
vr = Q.New(VirtualRouterVmVO.class).find() | ||
assert vr != null | ||
assert vr.getPublicNetworkUuid() == pub.uuid | ||
assert vr.getManagementNetworkUuid() == pub.uuid | ||
for (VmNicVO nic : vr.getVmNics()) { | ||
assert nic.l3NetworkUuid != l3_1.uuid | ||
} | ||
} | ||
|
||
@Override | ||
void clean() { | ||
env.delete() | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
.../networkservice/provider/virtualrouter/VirtualRouterDeletePublicNetworkIpRangeCase.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package org.zstack.test.integration.networkservice.provider.virtualrouter | ||
|
||
import org.zstack.core.db.DatabaseFacade | ||
import org.zstack.core.db.Q | ||
import org.zstack.header.vm.VmNicVO | ||
import org.zstack.network.service.virtualrouter.VirtualRouterVmVO | ||
import org.zstack.sdk.IpRangeInventory | ||
import org.zstack.sdk.L2NetworkInventory | ||
import org.zstack.sdk.L3NetworkInventory | ||
import org.zstack.sdk.VmInstanceInventory | ||
import org.zstack.test.integration.networkservice.provider.NetworkServiceProviderTest | ||
import org.zstack.testlib.EnvSpec | ||
import org.zstack.testlib.SubCase | ||
|
||
/** | ||
* Created by shixin on 03/30/2018. | ||
*/ | ||
class VirtualRouterDeletePublicNetworkIpRangeCase extends SubCase { | ||
|
||
EnvSpec env | ||
DatabaseFacade dbf | ||
|
||
@Override | ||
void setup() { | ||
useSpring(NetworkServiceProviderTest.springSpec) | ||
} | ||
|
||
@Override | ||
void environment() { | ||
env = VirtualRouterNetworkServiceEnv.oneVmOneHostVyosOnEipEnv() | ||
} | ||
|
||
@Override | ||
void test() { | ||
env.create { | ||
testDeleteAdditionalPublicIpRange() | ||
} | ||
} | ||
|
||
void testDeleteAdditionalPublicIpRange() { | ||
def l2 = env.inventoryByName("l2") as L2NetworkInventory | ||
def pub = env.inventoryByName("pubL3") as L3NetworkInventory | ||
|
||
L3NetworkInventory l3_1 = createL3Network { | ||
delegate.category = "Public" | ||
delegate.l2NetworkUuid = l2.uuid | ||
delegate.name = "pubL3-2" | ||
} | ||
|
||
IpRangeInventory iprInv = addIpRange { | ||
delegate.name = "TestIpRange" | ||
delegate.l3NetworkUuid = l3_1.uuid | ||
delegate.startIp = "11.168.200.10" | ||
delegate.endIp = "11.168.200.253" | ||
delegate.gateway = "11.168.200.1" | ||
delegate.netmask = "255.255.255.0" | ||
} | ||
|
||
VirtualRouterVmVO vr = Q.New(VirtualRouterVmVO.class).find() | ||
assert vr != null | ||
assert vr.getPublicNetworkUuid() == pub.uuid | ||
assert vr.getManagementNetworkUuid() == pub.uuid | ||
|
||
VmInstanceInventory inv = attachL3NetworkToVm { | ||
delegate.l3NetworkUuid = l3_1.getUuid() | ||
delegate.vmInstanceUuid = vr.uuid | ||
} | ||
|
||
deleteIpRange { | ||
uuid = iprInv.uuid | ||
} | ||
|
||
vr = Q.New(VirtualRouterVmVO.class).find() | ||
assert vr != null | ||
assert vr.getPublicNetworkUuid() == pub.uuid | ||
assert vr.getManagementNetworkUuid() == pub.uuid | ||
} | ||
|
||
@Override | ||
void clean() { | ||
env.delete() | ||
} | ||
} |