Debian Codegraph @

rally-jobs/plugins/test_vpn_connectivity.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 from rally.common import logging
16 from rally.task import scenario
17 from rally.task import types
18
19 import vpn_base
20 LOG = logging.getLogger(__name__)
21
22
23 class TestVpnBasicScenario(vpn_base.VpnBase):
24 """Rally scenarios for VPNaaS"""
25
26 @types.convert(image={"type": "glance_image"},
27 flavor={"type": "nova_flavor"})
28 @scenario.configure()
29 def create_and_delete_vpn_connection(self, **kwargs):
30 """Basic VPN connectivity scenario.
31
32 1. Create 2 private networks, subnets and routers
33 2. Create public network, subnets and GW IPs on routers, if not present
34 3. Execute ip netns command and get the snat and qrouter namespaces
35 (assuming we use DVR)
36 4. Verify that there is a route between the router gateways by pinging
37 each other from their snat namespaces
38 5. Add security group rules for SSH and ICMP
39 6. Start a nova instance in each of the private networks
40 7. Create IKE and IPSEC policies
41 8. Create VPN service at each of the routers
42 9. Create IPSEC site connections at both endpoints
43 10. Verify that the ipsec-site-connection is ACTIVE (takes upto 30secs)
44 11. To verify the vpn connectivity, get into the peer router's snat
45 namespace and start a tcpdump at the qg-xxxx interface
46 12. SSH into the nova instance from the local qrouter namespace
47 and try to ping the nova instance on the peer network.
48 14. Verify that the captured packets are encapsulated and encrypted.
49 15. Verify the connectivity in the reverse direction following the
50 steps 11 through 13
51 16. Submit a request to delete all the resources
52 """
53
54 try:
55 self.setup(**kwargs)
56 self.create_networks(**kwargs)
57 self.create_servers(**kwargs)
58 self.check_route()
59 self.ike_policy = self._create_ike_policy(**kwargs)
60 self.ipsec_policy = self._create_ipsec_policy(**kwargs)
61 self.create_vpn_services()
62 self.create_ipsec_site_connections(**kwargs)
63 self.assert_statuses(final_status='ACTIVE', **kwargs)
64 self.verify_vpn_connectivity(**kwargs)
65 LOG.info("VPN CONNECTIVITY TEST PASSED!")
66
67 finally:
68 self.cleanup()