Exemple #1
0
    def test_08_create_policy_router_stopped(self):
        """Test verify create stickiness policy when router is stopped state"""

        # Validate the following
        # 1. stop the router
        # 2. create stikiness policy from UI
        # 3. start the router. listLBStickinessPolicies Api should show created
        #    stikiness policy

        self.debug("Creating LB rule for account: %s" % self.account.name)
        lb_rule = self.create_LB_Rule(
            self.public_ip,
            network=self.get_Network(self.account),
            vmarray=[self.virtual_machine, self.virtual_machine_2],
        )

        self.debug("Fetching routers for the account: %s" % self.account.name)
        router = self.get_router(self.account)

        self.debug("Stopping the router: %s" % router.name)
        Router.stop(self.apiclient, id=router.id)

        policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie")
        policy = policies.stickinesspolicy[0]

        self.debug("Starting the router: %s" % router.name)
        Router.start(self.apiclient, id=router.id)

        self.debug("Policy: %s" % str(policy))
        self.debug("Validating the stickiness policy")
        self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress)
        return
Exemple #2
0
    def test_08_create_policy_router_stopped(self):
        """Test verify create stickiness policy when router is stopped state"""

        # Validate the following
        # 1. stop the router
        # 2. create stikiness policy from UI
        # 3. start the router. listLBStickinessPolicies Api should show created
        #    stikiness policy

        self.debug("Creating LB rule for account: %s" % self.account.name)
        lb_rule = self.create_LB_Rule(self.public_ip,
                                      network=self.get_Network(self.account),
                                      vmarray=[self.virtual_machine, self.virtual_machine_2])

        self.debug("Fetching routers for the account: %s" %
                                                    self.account.name)
        router = self.get_router(self.account)

        self.debug("Stopping the router: %s" % router.name)
        Router.stop(self.apiclient, id=router.id)

        policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie")
        policy = policies.stickinesspolicy[0]

        self.debug("Starting the router: %s" % router.name)
        Router.start(self.apiclient, id=router.id)

        self.debug("Policy: %s" % str(policy))
        self.debug("Validating the stickiness policy")
        self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress)
        return
    def test_07_stop_start_VR_verify_ip_alias(self):
        """Reboot VR and verify ip alias
            1.Deploy guest vm in new cidr
            2.Verify ip alias creation
            3.Stop and Start VR
            4.Verify ip alias on VR
        """
        list_router_response = list_routers(self.apiclient,
                                            zoneid=self.zone.id,
                                            listall=True)
        self.assertEqual(isinstance(list_router_response, list), True,
                         "Check list response returns a valid list")
        router = list_router_response[0]
        hosts = list_hosts(self.apiclient,
                           zoneid=router.zoneid,
                           type='Routing',
                           state='Up',
                           id=router.hostid)
        self.assertEqual(isinstance(hosts, list), True,
                         "Check list host returns a valid list")
        host = hosts[0]
        self.debug("Router ID: %s, state: %s" % (router.id, router.state))
        self.assertEqual(router.state, 'Running',
                         "Check list router response for router state")

        port = self.testdata['configurableData']['host']["publicport"]
        username = self.testdata['configurableData']['host']["username"]
        password = self.testdata['configurableData']['host']["password"]

        # SSH to host so that host key is saved in first
        # attempt
        SshClient(host.ipaddress, port, username, password)

        proc = "ip addr show eth0"
        result = get_process_status(host.ipaddress, port, username, password,
                                    router.linklocalip, proc)
        res = str(result)
        self.debug("ip alias configuration on VR: %s" % res)
        self.assertNotEqual(
            res.find(self.alias_ip) - 1, "ip alias is not created on VR eth0")
        self.debug("Stopping VR")
        Router.stop(
            self.apiclient,
            router.id,
        )
        self.debug("Starting VR")
        Router.start(self.apiclient, router.id)
        list_router_response = list_routers(self.apiclient,
                                            zoneid=self.zone.id,
                                            listall=True)
        self.assertEqual(isinstance(list_router_response, list), True,
                         "Check list response returns a valid list")
        router = list_router_response[0]
        self.assertEqual(router.state, 'Running',
                         "Router is not in running state after reboot")
        self.debug("VR is up and Running")
        result = get_process_status(host.ipaddress, port, username, password,
                                    router.linklocalip, proc)
        res = str(result)
        self.assertNotEqual(
            res.find(self.alias_ip), -1,
            "IP alias not present on VR after VR stop and start")
        return
    def test_07_stop_start_VR_verify_ip_alias(self):
        """Reboot VR and verify ip alias
            1.Deploy guest vm in new cidr
            2.Verify ip alias creation
            3.Stop and Start VR
            4.Verify ip alias on VR
        """
        list_router_response = list_routers(
            self.apiclient,
            zoneid=self.zone.id,
            listall=True
        )
        self.assertEqual(
            isinstance(list_router_response, list),
            True,
            "Check list response returns a valid list"
        )
        router = list_router_response[0]
        hosts = list_hosts(
            self.apiclient,
            zoneid=router.zoneid,
            type='Routing',
            state='Up',
            id=router.hostid
        )
        self.assertEqual(
            isinstance(hosts, list),
            True,
            "Check list host returns a valid list"
        )
        host = hosts[0]
        self.debug("Router ID: %s, state: %s" % (router.id, router.state))
        self.assertEqual(
            router.state,
            'Running',
            "Check list router response for router state"
        )

        port = self.testdata['configurableData']['host']["publicport"]
        username = self.testdata['configurableData']['host']["username"]
        password = self.testdata['configurableData']['host']["password"]

        # SSH to host so that host key is saved in first
        # attempt
        SshClient(host.ipaddress, port, username, password)

        proc = "ip addr show eth0"
        result = get_process_status(
            host.ipaddress,
            port,
            username,
            password,
            router.linklocalip,
            proc
        )
        res = str(result)
        self.debug("ip alias configuration on VR: %s" % res)
        self.assertNotEqual(
            res.find(self.alias_ip)
            - 1,
            "ip alias is not created on VR eth0"
        )
        self.debug("Stopping VR")
        Router.stop(
            self.apiclient,
            router.id,
        )
        self.debug("Starting VR")
        Router.start(
            self.apiclient,
            router.id
        )
        list_router_response = list_routers(
            self.apiclient,
            zoneid=self.zone.id,
            listall=True
        )
        self.assertEqual(
            isinstance(list_router_response, list),
            True,
            "Check list response returns a valid list"
        )
        router = list_router_response[0]
        self.assertEqual(
            router.state,
            'Running',
            "Router is not in running state after reboot"
        )
        self.debug("VR is up and Running")
        result = get_process_status(
            host.ipaddress,
            port,
            username,
            password,
            router.linklocalip,
            proc
        )
        res = str(result)
        self.assertNotEqual(
            res.find(self.alias_ip),
            - 1,
            "IP alias not present on VR after VR stop and start"
        )
        return