[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-8759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14728897#comment-14728897
 ] 

ASF GitHub Bot commented on CLOUDSTACK-8759:
--------------------------------------------

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

    https://github.com/apache/cloudstack/pull/773#discussion_r38636486
  
    --- Diff: test/integration/component/test_vpc_router_nics.py ---
    @@ -0,0 +1,449 @@
    +# Licensed to the Apache Software Foundation (ASF) under one
    +# or more contributor license agreements.  See the NOTICE file
    +# distributed with this work for additional information
    +# regarding copyright ownership.  The ASF licenses this file
    +# to you under the Apache License, Version 2.0 (the
    +# "License"); you may not use this file except in compliance
    +# with the License.  You may obtain a copy of the License at
    +#
    +#   http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing,
    +# software distributed under the License is distributed on an
    +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +# KIND, either express or implied.  See the License for the
    +# specific language governing permissions and limitations
    +# under the License.
    +
    +""" Test VPC nics after router is destroyed """
    +
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.base import (stopRouter,
    +                             startRouter,
    +                             destroyRouter,
    +                             Account,
    +                             VpcOffering,
    +                             VPC,
    +                             ServiceOffering,
    +                             NATRule,
    +                             NetworkACL,
    +                             PublicIPAddress,
    +                             NetworkOffering,
    +                             Network,
    +                             VirtualMachine,
    +                             LoadBalancerRule)
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               get_template,
    +                               list_routers)
    +from marvin.lib.utils import cleanup_resources
    +import socket
    +import time
    +import inspect
    +
    +
    +class Services:
    +    """Test VPC network services - Port Forwarding Rules Test Data Class.
    +    """
    +
    +    def __init__(self):
    +        self.services = {
    +            "account": {
    +                "email": "t...@test.com",
    +                "firstname": "Test",
    +                "lastname": "User",
    +                "username": "test",
    +                # Random characters are appended for unique
    +                # username
    +                "password": "password",
    +            },
    +            "service_offering": {
    +                "name": "Tiny Instance",
    +                "displaytext": "Tiny Instance",
    +                "cpunumber": 1,
    +                "cpuspeed": 100,
    +                "memory": 128,
    +            },
    +            "network_offering": {
    +                "name": 'VPC Network offering',
    +                "displaytext": 'VPC Network off',
    +                "guestiptype": 'Isolated',
    +                "supportedservices": 
'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
    +                "traffictype": 'GUEST',
    +                "availability": 'Optional',
    +                "useVpc": 'on',
    +                "serviceProviderList": {
    +                    "Vpn": 'VpcVirtualRouter',
    +                    "Dhcp": 'VpcVirtualRouter',
    +                    "Dns": 'VpcVirtualRouter',
    +                    "SourceNat": 'VpcVirtualRouter',
    +                    "PortForwarding": 'VpcVirtualRouter',
    +                    "Lb": 'VpcVirtualRouter',
    +                    "UserData": 'VpcVirtualRouter',
    +                    "StaticNat": 'VpcVirtualRouter',
    +                    "NetworkACL": 'VpcVirtualRouter'
    +                },
    +            },
    +            "network_offering_no_lb": {
    +                "name": 'VPC Network offering',
    +                "displaytext": 'VPC Network off',
    +                "guestiptype": 'Isolated',
    +                "supportedservices": 
'Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL',
    +                "traffictype": 'GUEST',
    +                "availability": 'Optional',
    +                "useVpc": 'on',
    +                "serviceProviderList": {
    +                    "Dhcp": 'VpcVirtualRouter',
    +                    "Dns": 'VpcVirtualRouter',
    +                    "SourceNat": 'VpcVirtualRouter',
    +                    "PortForwarding": 'VpcVirtualRouter',
    +                    "UserData": 'VpcVirtualRouter',
    +                    "StaticNat": 'VpcVirtualRouter',
    +                    "NetworkACL": 'VpcVirtualRouter'
    +                },
    +            },
    +            "vpc_offering": {
    +                "name": 'VPC off',
    +                "displaytext": 'VPC off',
    +                "supportedservices": 
'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
    +            },
    +            "vpc": {
    +                "name": "TestVPC",
    +                "displaytext": "TestVPC",
    +                "cidr": '10.0.0.1/24'
    +            },
    +            "network": {
    +                "name": "Test Network",
    +                "displaytext": "Test Network",
    +                "netmask": '255.255.255.0'
    +            },
    +            "lbrule": {
    +                "name": "SSH",
    +                "alg": "leastconn",
    +                # Algorithm used for load balancing
    +                "privateport": 22,
    +                "publicport": 2222,
    +                "openfirewall": False,
    +                "startport": 22,
    +                "endport": 2222,
    +                "protocol": "TCP",
    +                "cidrlist": '0.0.0.0/0',
    +            },
    +            "lbrule_http": {
    +                "name": "HTTP",
    +                "alg": "leastconn",
    +                # Algorithm used for load balancing
    +                "privateport": 80,
    +                "publicport": 8888,
    +                "openfirewall": False,
    +                "startport": 80,
    +                "endport": 8888,
    +                "protocol": "TCP",
    +                "cidrlist": '0.0.0.0/0',
    +            },
    +            "natrule": {
    +                "privateport": 22,
    +                "publicport": 22,
    +                "startport": 22,
    +                "endport": 22,
    +                "protocol": "TCP",
    +                "cidrlist": '0.0.0.0/0',
    +            },
    +            "http_rule": {
    +                "privateport": 80,
    +                "publicport": 80,
    +                "startport": 80,
    +                "endport": 80,
    +                "cidrlist": '0.0.0.0/0',
    +                "protocol": "TCP"
    +            },
    +            "virtual_machine": {
    +                "displayname": "Test VM",
    +                "username": "root",
    +                "password": "password",
    +                "ssh_port": 22,
    +                "privateport": 22,
    +                "publicport": 22,
    +                "protocol": 'TCP',
    +            },
    +            "ostype": 'CentOS 5.3 (64-bit)',
    +            "timeout": 10,
    +        }
    +
    +
    +class TestVPCNics(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        # We want to fail quicker if it's failure
    +        socket.setdefaulttimeout(60)
    +
    +        cls.testClient = super(TestVPCNics, cls).getClsTestClient()
    +        cls.api_client = cls.testClient.getApiClient()
    +
    +        cls.services = Services().services
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.api_client)
    +        cls.zone = get_zone(cls.api_client, 
cls.testClient.getZoneForTests())
    +        cls.template = get_template(
    +            cls.api_client,
    +            cls.zone.id,
    +            cls.services["ostype"])
    +        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
    +        cls.services["virtual_machine"]["template"] = cls.template.id
    +
    +        cls.service_offering = ServiceOffering.create(
    +            cls.api_client,
    +            cls.services["service_offering"])
    +        cls._cleanup = [cls.service_offering]
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.api_client, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    def setUp(self):
    +        self.routers = []
    +        self.networks = []
    +        self.ips = []
    +        self.apiclient = self.testClient.getApiClient()
    +        self.account = Account.create(
    +            self.apiclient,
    +            self.services["account"],
    +            admin=True,
    +            domainid=self.domain.id)
    +
    +        self.cleanup = [self.account]
    +        self.debug("Creating a VPC offering..")
    +        self.vpc_off = VpcOffering.create(
    +            self.apiclient,
    +            self.services["vpc_offering"])
    +
    +        self.debug("Enabling the VPC offering created")
    +        self.vpc_off.update(self.apiclient, state='Enabled')
    +
    +        self.debug("Creating a VPC network in the account: %s" % 
self.account.name)
    +        self.services["vpc"]["cidr"] = '10.1.1.1/16'
    +        self.vpc = VPC.create(
    +            self.apiclient,
    +            self.services["vpc"],
    +            vpcofferingid=self.vpc_off.id,
    +            zoneid=self.zone.id,
    +            account=self.account.name,
    +            domainid=self.account.domainid)
    +        return
    +
    +    def tearDown(self):
    +        try:
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            self.debug("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    def query_routers(self):
    +        self.routers = list_routers(self.apiclient,
    +                                    account=self.account.name,
    +                                    domainid=self.account.domainid,
    +                                    )
    --- End diff --
    
    The test was partially copied form another test, which was copied from 
test_routers.py. The extra ',' is not needed, indeed. Although it causes no 
harm. Concerning the parentheses, brackets and curly-brackets alone in the 
line, that's the style the Marvin tests were written with. For example:
    
    ```
            cls._cleanup = [
                cls.account,
                cls.service_offering
            ]
    ```
    The snippet above can be found at test_routers.py.
    
    I could write Python in a different way, but I don't really mind adapting 
to their style since all the other tests are written in the same way.


> Destroying VPC router results in a new unusable VPC router
> ----------------------------------------------------------
>
>                 Key: CLOUDSTACK-8759
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8759
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.6.0
>         Environment: ACS master/4.6 with XenServer and KVM tested
>            Reporter: Remi Bergsma
>            Assignee: Wilder Rodrigues
>            Priority: Critical
>             Fix For: 4.6.0
>
>
> Deploy VPC
> Deploy VM
> This all works fine
> Shutdown, then destroy VPC
> Expected result:
> A new VPC router is deployed that has the same functionality than before, but 
> with a new router instance ID.
> Experienced result:
> VPC router is unaccessible for CloudStack due to missing link-local interface:
> root@r-7-VM:~# ifconfig -a
> lo        Link encap:Local Loopback  
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>           RX packets:1 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0 
>           RX bytes:93 (93.0 B)  TX bytes:93 (93.0 B)
> From a first look, the command line info seems OK.
> root@r-7-VM:/etc/cloudstack# cat cmdline.json 
> {
>     "config": {
>         "baremetalnotificationapikey": 
> "pPgegDQwez17eCbRj4Wx8IwFs543rcPpF7Gavvtys_D7w1jnAoyJ4A-21H9Bf58s1ZjC4DTVrD0BHxNA3y7agA",
>  
>         "baremetalnotificationsecuritykey": 
> "Sxv0QbIgRTH-PkeDWBsY-GYsKz2WIz9JIyWTK16mNnIPPZ-Ozo940_8d8bSEx5pHZ4rEdxG5HQMRRcchANHuHg",
>  
>         "disable_rp_filter": "true", 
>         "dns1": "8.8.8.8", 
>         "domain": "cs2cloud", 
>         "eth1ip": "169.254.0.249", 
>         "eth1mask": "255.255.0.0", 
>         "host": "192.168.22.61", 
>         "name": "r-7-VM", 
>         "port": "8080", 
>         "redundant_router": "false", 
>         "template": "domP", 
>         "type": "vpcrouter", 
>         "vpccidr": "10.0.1.0/24"
>     }, 
>     "id": "cmdline"
> [~wilder.rodrigues] Let's have a look when you're back!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to