Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1028#discussion_r43742770
  
    --- Diff: test/integration/smoke/test_vpc_vpn.py ---
    @@ -570,127 +584,139 @@ def test_vpc_site2site_vpn(self):
             finally:
                 self.assertIsNotNone(ntwk2, "Network failed to create")
     
    -        self.logger.debug("Network %s created in VPC %s" %(ntwk2.id, 
vpc2.id))
    +        self.logger.debug("Network %s created in VPC %s" % (ntwk2.id, 
vpc2.id))
     
             # Deploy a vm in network 2
             try:
                 vm1 = VirtualMachine.create(self.apiclient, 
services=self.services["virtual_machine"],
    -                templateid=self.template.id,
    -                zoneid=self.zone.id,
    -                accountid=self.account.name,
    -                domainid= self.account.domainid,
    -                serviceofferingid=self.service_offering.id,
    -                networkids=ntwk1.id,
    -                hypervisor=self.services["virtual_machine"]["hypervisor"]
    -            )
    +                                        templateid=self.template.id,
    +                                        zoneid=self.zone.id,
    +                                        accountid=self.account.name,
    +                                        domainid=self.account.domainid,
    +                                        
serviceofferingid=self.service_offering.id,
    +                                        networkids=ntwk1.id,
    +                                        hypervisor=self.services[
    +                                            
"virtual_machine"]["hypervisor"]
    +                                        )
             except Exception as e:
                 self.fail(e)
             finally:
                 self.assert_(vm1 is not None, "VM failed to deploy")
                 self.assert_(vm1.state == 'Running', "VM is not running")
     
    -        self.logger.debug("VM %s deployed in VPC %s" %(vm1.id, vpc1.id))
    +        self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
     
             # Deploy a vm in network 2
             try:
                 vm2 = VirtualMachine.create(self.apiclient, 
services=self.services["virtual_machine"],
    -                templateid=self.template.id,
    -                zoneid=self.zone.id,
    -                accountid=self.account.name,
    -                domainid= self.account.domainid,
    -                serviceofferingid=self.service_offering.id,
    -                networkids=ntwk2.id,
    -                hypervisor=self.services["virtual_machine"]["hypervisor"]
    -            )
    +                                        templateid=self.template.id,
    +                                        zoneid=self.zone.id,
    +                                        accountid=self.account.name,
    +                                        domainid=self.account.domainid,
    +                                        
serviceofferingid=self.service_offering.id,
    +                                        networkids=ntwk2.id,
    +                                        hypervisor=self.services[
    +                                            
"virtual_machine"]["hypervisor"]
    +                                        )
             except Exception as e:
                 self.fail(e)
             finally:
                 self.assert_(vm2 is not None, "VM failed to deploy")
                 self.assert_(vm2.state == 'Running', "VM is not running")
     
    -        self.debug("VM %s deployed in VPC %s" %(vm2.id, vpc2.id))
    +        self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
     
             # 4) Enable Site-to-Site VPN for VPC
             vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
    -        self.assert_(vpn1_response is not None, "Failed to enable VPN 
Gateway 1")
    +        self.assert_(
    +            vpn1_response is not None, "Failed to enable VPN Gateway 1")
             self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
     
             vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
    -        self.assert_(vpn2_response is not None, "Failed to enable VPN 
Gateway 2")
    +        self.assert_(
    +            vpn2_response is not None, "Failed to enable VPN Gateway 2")
             self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
     
             # 5) Add VPN Customer gateway info
             src_nat_list = PublicIPAddress.list(
    -                                        self.apiclient,
    -                                        account=self.account.name,
    -                                        domainid=self.account.domainid,
    -                                        listall=True,
    -                                        issourcenat=True,
    -                                        vpcid=vpc1.id
    -                                        )
    +            self.apiclient,
    +            account=self.account.name,
    +            domainid=self.account.domainid,
    +            listall=True,
    +            issourcenat=True,
    +            vpcid=vpc1.id
    +        )
             ip1 = src_nat_list[0]
             src_nat_list = PublicIPAddress.list(
    -                                        self.apiclient,
    -                                        account=self.account.name,
    -                                        domainid=self.account.domainid,
    -                                        listall=True,
    -                                        issourcenat=True,
    -                                        vpcid=vpc2.id
    -                                        )
    +            self.apiclient,
    +            account=self.account.name,
    +            domainid=self.account.domainid,
    +            listall=True,
    +            issourcenat=True,
    +            vpcid=vpc2.id
    +        )
             ip2 = src_nat_list[0]
     
             services = self.services["vpncustomergateway"]
    -        customer1_response = VpnCustomerGateway.create(self.apiclient, 
services, "Peer VPC1", ip1.ipaddress, vpc1.cidr, self.account.name, 
self.domain.id )
    -        self.debug("VPN customer gateway added for VPC %s enabled" % 
vpc1.id )
    +        customer1_response = VpnCustomerGateway.create(
    +            self.apiclient, services, "Peer VPC1", ip1.ipaddress, 
vpc1.cidr, self.account.name, self.domain.id)
    +        self.debug("VPN customer gateway added for VPC %s enabled" % 
vpc1.id)
             self.logger.debug(vars(customer1_response))
     
    -        customer2_response = VpnCustomerGateway.create(self.apiclient, 
services, "Peer VPC2", ip2.ipaddress, vpc2.cidr, self.account.name, 
self.domain.id )
    -        self.debug("VPN customer gateway added for VPC %s enabled" % 
vpc2.id )
    +        customer2_response = VpnCustomerGateway.create(
    +            self.apiclient, services, "Peer VPC2", ip2.ipaddress, 
vpc2.cidr, self.account.name, self.domain.id)
    +        self.debug("VPN customer gateway added for VPC %s enabled" % 
vpc2.id)
             self.logger.debug(vars(customer2_response))
     
             # 6) Connect two VPCs
    -        vpnconn1_response = Vpn.createVpnConnection(self.apiclient, 
customer1_response.id, vpn2_response['id'], True)
    +        vpnconn1_response = Vpn.createVpnConnection(
    +            self.apiclient, customer1_response.id, vpn2_response['id'], 
True)
             self.debug("VPN passive connection created for VPC %s" % vpc2.id)
     
    -        vpnconn2_response = Vpn.createVpnConnection(self.apiclient, 
customer2_response.id, vpn1_response['id'])
    +        vpnconn2_response = Vpn.createVpnConnection(
    +            self.apiclient, customer2_response.id, vpn1_response['id'])
             self.debug("VPN connection created for VPC %s" % vpc1.id)
     
    -        self.assertEqual(vpnconn2_response['state'], "Connected", "Failed 
to connect between VPCs!")
    +        self.assertEqual(
    +            vpnconn2_response['state'], "Connected", "Failed to connect 
between VPCs!")
     
             # acquire an extra ip address to use to ssh into vm2
             try:
                 vm2.public_ip = PublicIPAddress.create(
    -                                    apiclient=self.apiclient,
    -                                    accountid=self.account.name,
    -                                    zoneid=self.zone.id,
    -                                    domainid=self.account.domainid,
    -                                    services=self.services,
    -                                    networkid=ntwk2.id,
    -                                    vpcid=vpc2.id)
    +                apiclient=self.apiclient,
    +                accountid=self.account.name,
    +                zoneid=self.zone.id,
    +                domainid=self.account.domainid,
    +                services=self.services,
    +                networkid=ntwk2.id,
    +                vpcid=vpc2.id)
             except Exception as e:
                 self.fail(e)
             finally:
    -            self.assert_(vm2.public_ip is not None, "Failed to aqcuire 
public ip for vm2")
    -
    +            self.assert_(
    +                vm2.public_ip is not None, "Failed to aqcuire public ip 
for vm2")
     
             # Create port forward to be able to ssh into vm2
             try:
    -            natrule = self.create_natrule(vpc2, vm2, 22, 22, 
vm2.public_ip, ntwk2)
    +            natrule = self.create_natrule(
    +                vpc2, vm2, 22, 22, vm2.public_ip, ntwk2)
             except Exception as e:
                 self.fail(e)
             finally:
    -            self.assert_(natrule is not None, "Failed to create 
portforward for vm2")
    -            time.sleep(10)
    +            self.assert_(
    +                natrule is not None, "Failed to create portforward for 
vm2")
    +            time.sleep(20)
    --- End diff --
    
    Is this the essence of this change , @michaelandersen ? seems like it is 
postponement of execution. Isn't there a condition to check for instead?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to