mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
integration test: add private gateway in test
This commit is contained in:
parent
b2d8fffeea
commit
6a91b8ace7
@ -35,6 +35,7 @@ from marvin.lib.base import (Account,
|
|||||||
NetworkOffering,
|
NetworkOffering,
|
||||||
VPC,
|
VPC,
|
||||||
VpcOffering,
|
VpcOffering,
|
||||||
|
PrivateGateway,
|
||||||
StaticNATRule,
|
StaticNATRule,
|
||||||
NATRule,
|
NATRule,
|
||||||
PublicIPAddress,
|
PublicIPAddress,
|
||||||
@ -854,46 +855,74 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
|||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth5")
|
self.verify_router_publicnic_state(router, host, "eth1|eth5")
|
||||||
|
|
||||||
|
# Add private gateway
|
||||||
|
private_gateway_ip = "172.16." + str(random_subnet_number + 2) + ".1"
|
||||||
|
private_gateway = PrivateGateway.create(
|
||||||
|
self.apiclient,
|
||||||
|
gateway=private_gateway_ip,
|
||||||
|
ipaddress=private_gateway_ip,
|
||||||
|
netmask='255.255.255.0',
|
||||||
|
vlan=get_free_vlan(self.apiclient, self.zone.id)[1],
|
||||||
|
vpcid=self.vpc1.id
|
||||||
|
)
|
||||||
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
|
for router in routers:
|
||||||
|
host = self.get_router_host(router)
|
||||||
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth4,eth5,eth3,")
|
||||||
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth2", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth3", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, ipaddress_3.ipaddress.ipaddress, "eth3", False)
|
||||||
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth3|eth5")
|
||||||
|
|
||||||
# reboot router
|
# reboot router
|
||||||
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
cmd = rebootRouter.rebootRouterCmd()
|
cmd = rebootRouter.rebootRouterCmd()
|
||||||
cmd.id = router.id
|
cmd.id = router.id
|
||||||
self.apiclient.rebootRouter(cmd)
|
self.apiclient.rebootRouter(cmd)
|
||||||
router = self.get_router(router.id)
|
router = self.get_router(router.id)
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|
||||||
# 23. restart VPC with cleanup
|
# 23. restart VPC with cleanup
|
||||||
self.vpc1.restart(self.apiclient, cleanup=True)
|
self.vpc1.restart(self.apiclient, cleanup=True)
|
||||||
routers = self.get_vpc_routers(self.vpc1.id)
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|
||||||
# 24. restart VPC with cleanup, makeredundant=true
|
# 24. restart VPC with cleanup, makeredundant=true
|
||||||
self.vpc1.restart(self.apiclient, cleanup=True, makeredundant=True)
|
self.vpc1.restart(self.apiclient, cleanup=True, makeredundant=True)
|
||||||
routers = self.get_vpc_routers(self.vpc1.id)
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|||||||
@ -35,6 +35,7 @@ from marvin.lib.base import (Account,
|
|||||||
NetworkOffering,
|
NetworkOffering,
|
||||||
VPC,
|
VPC,
|
||||||
VpcOffering,
|
VpcOffering,
|
||||||
|
PrivateGateway,
|
||||||
StaticNATRule,
|
StaticNATRule,
|
||||||
NATRule,
|
NATRule,
|
||||||
PublicIPAddress,
|
PublicIPAddress,
|
||||||
@ -854,46 +855,74 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
|||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth5")
|
self.verify_router_publicnic_state(router, host, "eth1|eth5")
|
||||||
|
|
||||||
|
# Add private gateway
|
||||||
|
private_gateway_ip = "172.16." + str(random_subnet_number + 2) + ".1"
|
||||||
|
private_gateway = PrivateGateway.create(
|
||||||
|
self.apiclient,
|
||||||
|
gateway=private_gateway_ip,
|
||||||
|
ipaddress=private_gateway_ip,
|
||||||
|
netmask='255.255.255.0',
|
||||||
|
vlan=get_free_vlan(self.apiclient, self.zone.id)[1],
|
||||||
|
vpcid=self.vpc1.id
|
||||||
|
)
|
||||||
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
|
for router in routers:
|
||||||
|
host = self.get_router_host(router)
|
||||||
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth4,eth5,eth3,")
|
||||||
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth2", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth3", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, ipaddress_3.ipaddress.ipaddress, "eth3", False)
|
||||||
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
||||||
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth3|eth5")
|
||||||
|
|
||||||
# reboot router
|
# reboot router
|
||||||
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
cmd = rebootRouter.rebootRouterCmd()
|
cmd = rebootRouter.rebootRouterCmd()
|
||||||
cmd.id = router.id
|
cmd.id = router.id
|
||||||
self.apiclient.rebootRouter(cmd)
|
self.apiclient.rebootRouter(cmd)
|
||||||
router = self.get_router(router.id)
|
router = self.get_router(router.id)
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|
||||||
# 23. restart VPC with cleanup
|
# 23. restart VPC with cleanup
|
||||||
self.vpc1.restart(self.apiclient, cleanup=True)
|
self.vpc1.restart(self.apiclient, cleanup=True)
|
||||||
routers = self.get_vpc_routers(self.vpc1.id)
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|
||||||
# 24. restart VPC with cleanup, makeredundant=true
|
# 24. restart VPC with cleanup, makeredundant=true
|
||||||
self.vpc1.restart(self.apiclient, cleanup=True, makeredundant=True)
|
self.vpc1.restart(self.apiclient, cleanup=True, makeredundant=True)
|
||||||
routers = self.get_vpc_routers(self.vpc1.id)
|
routers = self.get_vpc_routers(self.vpc1.id)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
host = self.get_router_host(router)
|
host = self.get_router_host(router)
|
||||||
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,")
|
self.verify_network_interfaces_in_router(router, host, "eth0,eth1,eth2,eth3,eth4,eth5,")
|
||||||
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
controlIp, sourcenatIp, tier1_Ip, tier2_Ip = self.get_vpc_router_ips(router)
|
||||||
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
self.verify_ip_address_in_router(router, host, controlIp, "eth0", True)
|
||||||
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
self.verify_ip_address_in_router(router, host, sourcenatIp, "eth1", True)
|
||||||
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
self.verify_ip_address_in_router(router, host, ipaddress_6.ipaddress.ipaddress, "eth2", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
self.verify_ip_address_in_router(router, host, tier1_Ip, "eth3", True)
|
||||||
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth4", True)
|
self.verify_ip_address_in_router(router, host, private_gateway_ip, "eth4", True)
|
||||||
self.verify_router_publicnic_state(router, host, "eth1|eth2")
|
self.verify_ip_address_in_router(router, host, tier2_Ip, "eth5", True)
|
||||||
|
self.verify_router_publicnic_state(router, host, "eth1|eth2|eth4")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user