Debian Codegraph @

rally-jobs/plugins/test_vpn_tenant_scenario.py

raw
1 # Copyright 2015 Hewlett-Packard Development Company, L.P.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15
16 from rally.common import logging
17 from rally.task import scenario
18 from rally.task import types
19
20 import vpn_base
21
22 LOG = logging.getLogger(__name__)
23
24
25 class TestVpnTenantScenario(vpn_base.VpnBase):
26 """Rally scenarios for VPNaaS"""
27
28 @types.convert(image={"type": "glance_image"},
29 flavor={"type": "nova_flavor"})
30 @scenario.configure()
31 def multitenants_vpn_test(self, **kwargs):
32 """Test VPN connectivity under two different tenants.
33
34 1. Create 2 private networks with 2 different tenants, subnets, routers
35 2. Create public network, subnets and GW IPs on routers, if not present
36 3. Execute ip netns command and get the snat and qrouter namespaces
37 (assuming we use DVR)
38 4. Verify that there is a route between the router gateways by pinging
39 each other from their snat namespaces
40 5. Add security group rules for SSH and ICMP
41 6. Start a nova instance in each of the private networks
42 7. Create IKE and IPSEC policies
43 8. Create VPN service at each of the routers
44 9. Create IPSEC site connections at both endpoints
45 10. Verify that the vpn-service and ipsec-site-connection are ACTIVE
46 11. Cleanup the resources that are setup for this test
47 """
48
49 try:
50 self.setup(**kwargs)
51 self.create_tenants()
52 self.create_networks(**kwargs)
53 self.check_route()
54 self.ike_policy = self._create_ike_policy(**kwargs)
55 self.ipsec_policy = self._create_ipsec_policy(**kwargs)
56 self.create_vpn_services()
57 self.create_ipsec_site_connections(**kwargs)
58 self.assert_statuses(final_status='ACTIVE', **kwargs)
59 LOG.info("VPN TENANT TEST PASSED!")
60
61 finally:
62 self.cleanup()