def test_fwp_on_vhost0(self):
     src_node = self.inputs.compute_names[0]
     dst_node = self.inputs.compute_names[1]
     encrypt_nodes = self.inputs.compute_names[:2]
     self.enable_encryption(encrypt_nodes)
     self.validate_tunnels(encrypt_nodes, encrypt_nodes)
     src_vhost0_fqname = ['default-global-system-config',
                          src_node, 'vhost0']
     src_vhost0_uuid = self.vnc_h.virtual_machine_interface_read(
                       fq_name=src_vhost0_fqname).uuid
     src_vhost0 = PortFixture(connections=self.connections,
                              uuid=src_vhost0_uuid)
     src_vhost0.setUp()
     src_vhost0.enable_policy()
     self.addCleanup(src_vhost0.disable_policy)
     dst_vhost0_fqname = ['default-global-system-config',
                          dst_node, 'vhost0']
     dst_vhost0_uuid = self.vnc_h.virtual_machine_interface_read(
                       fq_name=dst_vhost0_fqname).uuid
     dst_vhost0 = PortFixture(connections=self.connections,
                              uuid=dst_vhost0_uuid)
     dst_vhost0.setUp()
     dst_vhost0.enable_policy()
     self.addCleanup(dst_vhost0.disable_policy)
     vn_fqname = ["default-domain", "default-project", "ip-fabric"]
     fab_vn_uuid = self.vnc_h.virtual_network_read(fq_name=vn_fqname).uuid
     fab_vn = VNFixture(connections=self.connections, uuid=fab_vn_uuid)
     fab_vn.setUp()
     self.setup_firewall_policy(fab_vn, src_vhost0, dst_vhost0)
     self.fwr.update(protocol='tcp', dports=(7777, 7777))
     self.verify_encrypt_traffic_bw_hosts(src_node, dst_node, '7777')
     self.fwr.update(action='deny', match='None')
     self.verify_encrypt_traffic_bw_hosts(src_node, dst_node, '7777',
                                          expectation=False)
Ejemplo n.º 2
0
def main():
    import sys
    from vn_test import VNFixture
    from vm_test import VMFixture
#    sys.settrace(tracefunc)
#    obj = LBaasFixture(api_type='neutron', name='LB', connections=setup_test_infra(), network_id='4b39a2bd-4528-40e8-b848-28084e59c944', members={'vms': ['a72ad607-f1ca-44f2-b31e-e825a3f2d408'], 'address': ['192.168.1.10']}, vip_net_id='4b39a2bd-4528-40e8-b848-28084e59c944', protocol='TCP', port='22', healthmonitors=[{'delay':5, 'timeout':5, 'max_retries':5, 'probe_type':'PING'}])
    conn = setup_test_infra()
    vnfix = VNFixture(connections=conn, vn_name='admin-33688095')
    vnfix.setUp()
    fip_fix = VNFixture(connections=conn, router_external=True, vn_name='fip-vn')
    fip_fix.setUp()
    subnet = vnfix.get_cidrs()[0]
    vm_fix = VMFixture(connections=conn, vn_obj=vnfix.obj, vm_name='member-vm')
    vm_fix.setUp()
    obj = LBaasV2Fixture(lb_name='LB-Test', connections=conn, network_id=vnfix.uuid,
                         fip_net_id=fip_fix.uuid, listener_name='Listener-Test', vip_port='80',
                         vip_protocol='HTTP', pool_name='Pool-Test', pool_port='80', pool_protocol='HTTP',
                         pool_algorithm='ROUND_ROBIN', members={'vms': [vm_fix.vm_id]},
                         hm_delay=5, hm_timeout=5, hm_max_retries=5, hm_probe_type='PING',
                        )
    obj.setUp()
    import pdb; pdb.set_trace()
    obj.verify_on_setup()
    obj.cleanUp()
    exit()
    import pdb; pdb.set_trace()
#    obj = LBaasFixture(api_type='neutron', uuid='58e5fb2c-ec47-4eb8-b4bf-9c66b0473f78', connections=setup_test_infra())
    obj.verify_on_setup()
    obj.delete_custom_attr('max_sess_rate')
    obj.add_custom_attr('client_timeout', 20000)
    obj.delete_custom_attr('server_timeout')
    obj.add_custom_attr('max_sess_rate', 20000)
    obj.delete_custom_attr('rate_limit_sessions')
    obj.add_custom_attr('rate_limit_sessions', 20)
    obj.delete_custom_attr('max_conn')
    obj.add_custom_attr('max_conn', 20)
    obj.delete_custom_attr('http_server_close')
    obj.add_custom_attr('http_server_close', "False")
    obj.verify_on_setup()
    obj.create_fip_on_vip()
    obj.verify_on_setup()
    obj.delete_fip_on_vip()
    obj.verify_on_setup()
    obj.delete_vip()
    obj.verify_on_setup()
    obj.check_and_create_vip()
    obj.verify_on_setup()
    obj.delete_member(address=obj.member_ips[1])
    obj.verify_on_setup()
    obj.create_member(address=get_random_ip(subnet))
    obj.verify_on_setup()
    obj.delete_hmon(obj.hmons.keys()[0])
    obj.verify_on_setup()
    obj.create_hmon({'delay': 5, 'max_retries': 5, 'probe_type': 'PING', 'timeout': 10})
    obj.verify_on_setup()
    obj.cleanUp()
    vm_fix.cleanUp()
    vnfix.cleanUp()
    vip_fix.cleanUp()
    fip_fix.cleanUp()
Ejemplo n.º 3
0
 def test_service_custom_isolation(self):
     """
     Verify reachability of a Service in and out of custom isolated namespace
     Verify following reachability:
     1. Pod inside custom isolated namespace should not be able to reach service within same namespace
        or any service outside the namespace.
     2. After creating a  contrail network policy between Custom VN and service VN< pod inside custom 
         isolated namespace should be able to reach service within and outside this namespace
     3. Pods inside non islated namespace should be able to reach service inside custom isolated namespace.
     """
     client1, client2 = self.setup_common_namespaces_pods(prov_service=True)
     #check 1
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client2[2],
                                   expectation=False)
     assert self.validate_nginx_lb([client1[0], client1[1]],
                                   client1[3].cluster_ip,
                                   test_pod=client2[2],
                                   expectation=False)
     #check 2
     #Creating the policy between custom VN ans default service VN
     policy_name = 'allow-btw-custom-ns-and-service'
     if self.inputs.slave_orchestrator == 'kubernetes':
         k8s_default_service_vn_name = self.connections.project_name + '-default-service-network'
     else:
         k8s_default_service_vn_name = "k8s-default-service-network"
     k8s_default_service_vn_fq_name = [
         self.connections.domain_name, self.connections.project_name,
         k8s_default_service_vn_name
     ]
     k8s_default_service_vn_obj = self.vnc_lib.virtual_network_read(
         fq_name=k8s_default_service_vn_fq_name)
     k8s_service_vn_fixt = VNFixture(connections=self.connections,
                                     vn_name=k8s_default_service_vn_name,
                                     option="contrail",
                                     uuid=k8s_default_service_vn_obj.uuid)
     k8s_service_vn_fixt.setUp()
     vn_service_policy = self.setup_policy_between_vns(
         client2[7],
         k8s_service_vn_fixt,
         api="contrail",
         connections=self.connections)
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]],
                                   client1[3].cluster_ip,
                                   test_pod=client2[2])
     #check 3
     # Disable of service isolation required or not ? For now, its working without disabling service isolation
     #client2[4].disable_service_isolation()
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client1[2])
Ejemplo n.º 4
0
 def test_services_custom_isolation_post_kube_manager_restart(self):
     """
     Verify that after restart of contrail-kubemanager, service reachability to 
     and from custom isolated namespace/pod is not affected
     Verify following reachability:
     1. Verify reachability between pods and services
     2. restart contrail-kube-manager
     3. Verify reachability between pods and services
     """
     self.addCleanup(self.invalidate_kube_manager_inspect)
     client1, client2 = self.setup_common_namespaces_pods(prov_service=True)
     policy_name = 'allow-btw-custom-ns-and-service'
     if self.inputs.slave_orchestrator == 'kubernetes':
         k8s_default_service_vn_name = self.connections.project_name + '-default-service-network'
     else:
         k8s_default_service_vn_name = "k8s-default-service-network"
     k8s_default_service_vn_fq_name = self.connections.inputs.project_fq_name + \
                                         [k8s_default_service_vn_name]
     k8s_default_service_vn_obj = self.vnc_lib.virtual_network_read(
         fq_name=k8s_default_service_vn_fq_name)
     k8s_service_vn_fixt = VNFixture(connections=self.connections,
                                     vn_name=k8s_default_service_vn_name,
                                     option="contrail",
                                     uuid=k8s_default_service_vn_obj.uuid)
     k8s_service_vn_fixt.setUp()
     vn_service_policy = self.setup_policy_between_vns(
         client2[6],
         k8s_service_vn_fixt,
         api="contrail",
         connections=self.connections)
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]],
                                   client1[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client1[2])
     self.restart_kube_manager()
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]],
                                   client1[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client2[0], client2[1]],
                                   client2[3].cluster_ip,
                                   test_pod=client1[2])
Ejemplo n.º 5
0
 def create_only_vn(cls, vn_name=None, vn_subnets=None, **kwargs):
     '''Classmethod to do only VN creation
     '''
     if not vn_name:
         vn_name = get_random_name('vn')
     connections = kwargs.pop('connections', None) or cls.connections
     project_name = kwargs.pop('project_name', None) or connections.project_name
     vn_fixture = VNFixture(project_name=project_name,
                   connections=connections,
                   inputs=connections.inputs,
                   vn_name=vn_name,
                   subnets=vn_subnets,
                   **kwargs)
     vn_fixture.setUp()
     return vn_fixture
Ejemplo n.º 6
0
    def test_check_vxlan_id_reuse(self):
        '''
            Create a VN X
            Create another VN Y and check that the VNid is the next number
            Delete the two Vns
            On creating a VN again, verify that Vxlan id of X is used
             (i.e vxlan id gets reused)
        '''
        vn1_name = get_random_name('vn')
        vn1_subnets = [get_random_cidr()]
        vn2_name = get_random_name('vn')
        vn2_subnets = [get_random_cidr()]

        # First VN
        vn1_obj = VNFixture(project_name=self.inputs.project_name,
                            connections=self.connections,
                            inputs=self.inputs,
                            vn_name=vn1_name,
                            subnets=vn1_subnets)
        vn1_obj.setUp()
        vxlan_id1 = vn1_obj.get_vxlan_id()

        # Second VN
        vn2_obj = VNFixture(project_name=self.inputs.project_name,
                            connections=self.connections,
                            inputs=self.inputs,
                            vn_name=vn2_name,
                            subnets=vn2_subnets)
        vn2_obj.setUp()
        vxlan_id2 = vn2_obj.get_vxlan_id()

        assert vxlan_id2 == (
            vxlan_id1 + 1), ("Vxlan ID allocation is not incremental, "
                             "Two VNs were seen to have vxlan ids %s, %s" %
                             (vxlan_id1, vxlan_id2))
        # Delete the vns
        vn1_obj.cleanUp()
        vn2_obj.cleanUp()

        vn3_fixture = self.create_vn()
        assert vn3_fixture.verify_on_setup(), "VNFixture verify failed!"
        new_vxlan_id = vn3_fixture.get_vxlan_id()
        assert new_vxlan_id == vxlan_id1, (
            "Vxlan ID reuse does not seem to happen",
            "Expected : %s, Got : %s" % (vxlan_id1, new_vxlan_id))
        self.logger.info('Vxlan ids are reused..ok')
Ejemplo n.º 7
0
    def test_check_vxlan_id_reuse(self):
        ''' 
            Create a VN X 
            Create another VN Y and check that the VNid is the next number 
            Delete the two Vns
            On creating a VN again, verify that Vxlan id of X is used
             (i.e vxlan id gets reused)
        '''
        vn1_name = get_random_name('vn')
        vn1_subnets = [get_random_cidr()]
        vn2_name = get_random_name('vn')
        vn2_subnets = [get_random_cidr()]

        # First VN
        vn1_obj = VNFixture(project_name=self.inputs.project_name,
            connections=self.connections,
            inputs=self.inputs,
            vn_name=vn1_name,
            subnets=vn1_subnets)
        vn1_obj.setUp()
        vxlan_id1 = vn1_obj.get_vxlan_id()

        # Second VN
        vn2_obj = VNFixture(project_name=self.inputs.project_name,
            connections=self.connections,
            inputs=self.inputs,
            vn_name=vn2_name,
            subnets=vn2_subnets)
        vn2_obj.setUp()
        vxlan_id2 = vn2_obj.get_vxlan_id()

        assert vxlan_id2 == (vxlan_id1+1), (
            "Vxlan ID allocation is not incremental, "
            "Two VNs were seen to have vxlan ids %s, %s" % (
                vxlan_id1, vxlan_id2))
        # Delete the vns
        vn1_obj.cleanUp()
        vn2_obj.cleanUp()

        vn3_fixture = self.create_vn()
        assert vn3_fixture.verify_on_setup(), "VNFixture verify failed!"
        new_vxlan_id = vn3_fixture.get_vxlan_id()
        assert new_vxlan_id == vxlan_id1, (
            "Vxlan ID reuse does not seem to happen",
            "Expected : %s, Got : %s" % (vxlan_id1, new_vxlan_id))
        self.logger.info('Vxlan ids are reused..ok')
Ejemplo n.º 8
0
 def test_service_custom_isolation(self):
     """
     Verify reachability of a Service in and out of custom isolated namespace
     Verify following reachability:
     1. Pod inside custom isolated namespace should not be able to reach service within same namespace
        or any service outside the namespace.
     2. After creating a  contrail network policy between Custom VN and service VN< pod inside custom 
         isolated namespace should be able to reach service within and outside this namespace
     3. Pods inside non islated namespace should be able to reach service inside custom isolated namespace.
     """
     client1, client2 = self.setup_common_namespaces_pods(prov_service = True)
     #check 1
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client2[2], expectation = False)
     assert self.validate_nginx_lb([client1[0], client1[1]], client1[3].cluster_ip,
                                   test_pod=client2[2],  expectation = False)
     #check 2
     #Creating the policy between custom VN ans default service VN
     policy_name='allow-btw-custom-ns-and-service'
     if self.inputs.slave_orchestrator == 'kubernetes':
         k8s_default_service_vn_name = self.connections.project_name + '-default-service-network'
     else:
         k8s_default_service_vn_name = "k8s-default-service-network"
     k8s_default_service_vn_fq_name = [self.connections.domain_name,
                                     self.connections.project_name,
                                     k8s_default_service_vn_name]
     k8s_default_service_vn_obj = self.vnc_lib.virtual_network_read(
                                 fq_name = k8s_default_service_vn_fq_name)
     k8s_service_vn_fixt = VNFixture(connections = self.connections,
                                    vn_name = k8s_default_service_vn_name,
                                    option="contrail",
                                    uuid = k8s_default_service_vn_obj.uuid)
     k8s_service_vn_fixt.setUp()
     vn_service_policy = self.setup_policy_between_vns(client2[7],
                                                       k8s_service_vn_fixt,
                                                       api="contrail",
                                                       connections=self.connections)
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]], client1[3].cluster_ip,
                                   test_pod=client2[2])
     #check 3
     # Disable of service isolation required or not ? For now, its working without disabling service isolation
     #client2[4].disable_service_isolation()
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client1[2])
Ejemplo n.º 9
0
    def create_vn(self, vn_name=None, vn_subnets=None, vxlan_id=None,
        enable_dhcp=True, cleanup=True):
        if not vn_name:
            vn_name = get_random_name('vn')
        if not vn_subnets:
            vn_subnets = [get_random_cidr()]
        vn_fixture = VNFixture(project_name=self.inputs.project_name,
                      connections=self.connections,
                      inputs=self.inputs,
                      vn_name=vn_name,
                      subnets=vn_subnets,
                      vxlan_id=vxlan_id,
                      enable_dhcp=enable_dhcp)
        vn_fixture.setUp()
        if cleanup:
            self.addCleanup(vn_fixture.cleanUp)

        return vn_fixture
Ejemplo n.º 10
0
 def create_only_vn(cls, vn_name=None, vn_subnets=None, vxlan_id=None,
                enable_dhcp=True, **kwargs):
     '''Classmethod to do only VN creation
     '''
     if not vn_name:
         vn_name = get_random_name('vn')
     if not vn_subnets:
         vn_subnets = [get_random_cidr()]
     vn_fixture = VNFixture(project_name=cls.inputs.project_name,
                   connections=cls.connections,
                   inputs=cls.inputs,
                   vn_name=vn_name,
                   subnets=vn_subnets,
                   vxlan_id=vxlan_id,
                   enable_dhcp=enable_dhcp,
                   **kwargs)
     vn_fixture.setUp()
     return vn_fixture
Ejemplo n.º 11
0
 def create_only_vn(cls, vn_name=None, vn_subnets=None, vxlan_id=None,
                enable_dhcp=True, **kwargs):
     '''Classmethod to do only VN creation
     '''
     if not vn_name:
         vn_name = get_random_name('vn')
     connections = kwargs.pop('connections', None) or cls.connections
     project_name = kwargs.pop('project_name', None) or connections.project_name
     vn_fixture = VNFixture(project_name=project_name,
                   connections=connections,
                   inputs=connections.inputs,
                   vn_name=vn_name,
                   subnets=vn_subnets,
                   vxlan_id=vxlan_id,
                   enable_dhcp=enable_dhcp,
                   **kwargs)
     vn_fixture.setUp()
     return vn_fixture
Ejemplo n.º 12
0
 def create_only_vn(cls, vn_name=None, vn_subnets=None, vxlan_id=None, enable_dhcp=True, **kwargs):
     """Classmethod to do only VN creation
     """
     if not vn_name:
         vn_name = get_random_name("vn")
     if not vn_subnets:
         vn_subnets = [get_random_cidr()]
     vn_fixture = VNFixture(
         project_name=cls.inputs.project_name,
         connections=cls.connections,
         inputs=cls.inputs,
         vn_name=vn_name,
         subnets=vn_subnets,
         vxlan_id=vxlan_id,
         enable_dhcp=enable_dhcp,
         **kwargs
     )
     vn_fixture.setUp()
     return vn_fixture
Ejemplo n.º 13
0
 def test_services_custom_isolation_post_kube_manager_restart(self):
     """
     Verify that after restart of contrail-kubemanager, service reachability to 
     and from custom isolated namespace/pod is not affected
     Verify following reachability:
     1. Verify reachability between pods and services
     2. restart contrail-kube-manager
     3. Verify reachability between pods and services
     """
     client1, client2 = self.setup_common_namespaces_pods(prov_service = True)
     policy_name='allow-btw-custom-ns-and-service'
     if self.inputs.slave_orchestrator == 'kubernetes':
         k8s_default_service_vn_name = self.connections.project_name + '-default-service-network'
     else:
         k8s_default_service_vn_name = "k8s-default-service-network"
     k8s_default_service_vn_fq_name = self.connections.inputs.project_fq_name + \
                                         [k8s_default_service_vn_name]
     k8s_default_service_vn_obj = self.vnc_lib.virtual_network_read(
                                 fq_name = k8s_default_service_vn_fq_name)
     k8s_service_vn_fixt = VNFixture(connections = self.connections,
                                    vn_name = k8s_default_service_vn_name,
                                    option="contrail",
                                    uuid = k8s_default_service_vn_obj.uuid)
     k8s_service_vn_fixt.setUp()
     vn_service_policy = self.setup_policy_between_vns(client2[6],
                                                       k8s_service_vn_fixt,
                                                       api="contrail",
                                                       connections=self.connections)
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]], client1[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client1[2])
     self.restart_kube_manager()
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client1[0], client1[1]], client1[3].cluster_ip,
                                   test_pod=client2[2])
     assert self.validate_nginx_lb([client2[0], client2[1]], client2[3].cluster_ip,
                                   test_pod=client1[2])
Ejemplo n.º 14
0
    def create_vn(self,
                  vn_name=None,
                  vn_subnets=None,
                  vxlan_id=None,
                  enable_dhcp=True,
                  cleanup=True):
        if not vn_name:
            vn_name = get_random_name('vn')
        if not vn_subnets:
            vn_subnets = [get_random_cidr()]
        vn_fixture = VNFixture(project_name=self.inputs.project_name,
                               connections=self.connections,
                               inputs=self.inputs,
                               vn_name=vn_name,
                               subnets=vn_subnets,
                               vxlan_id=vxlan_id,
                               enable_dhcp=enable_dhcp)
        vn_fixture.setUp()
        if cleanup:
            self.addCleanup(vn_fixture.cleanUp)

        return vn_fixture
Ejemplo n.º 15
0
 def test_fwp_on_vhost0(self):
     src_node = self.inputs.compute_names[0]
     dst_node = self.inputs.compute_names[1]
     encrypt_nodes = self.inputs.compute_names[:2]
     self.enable_encryption(encrypt_nodes)
     self.validate_tunnels(encrypt_nodes, encrypt_nodes)
     src_vhost0_fqname = [
         'default-global-system-config', src_node, 'vhost0'
     ]
     src_vhost0_uuid = self.vnc_h.virtual_machine_interface_read(
         fq_name=src_vhost0_fqname).uuid
     src_vhost0 = PortFixture(connections=self.connections,
                              uuid=src_vhost0_uuid)
     src_vhost0.setUp()
     src_vhost0.enable_policy()
     self.addCleanup(src_vhost0.disable_policy)
     dst_vhost0_fqname = [
         'default-global-system-config', dst_node, 'vhost0'
     ]
     dst_vhost0_uuid = self.vnc_h.virtual_machine_interface_read(
         fq_name=dst_vhost0_fqname).uuid
     dst_vhost0 = PortFixture(connections=self.connections,
                              uuid=dst_vhost0_uuid)
     dst_vhost0.setUp()
     dst_vhost0.enable_policy()
     self.addCleanup(dst_vhost0.disable_policy)
     vn_fqname = ["default-domain", "default-project", "ip-fabric"]
     fab_vn_uuid = self.vnc_h.virtual_network_read(fq_name=vn_fqname).uuid
     fab_vn = VNFixture(connections=self.connections, uuid=fab_vn_uuid)
     fab_vn.setUp()
     self.setup_firewall_policy(fab_vn, src_vhost0, dst_vhost0)
     self.fwr.update(protocol='tcp', dports=(7777, 7777))
     self.verify_encrypt_traffic_bw_hosts(src_node, dst_node, '7777')
     self.fwr.update(action='deny', match='None')
     self.verify_encrypt_traffic_bw_hosts(src_node,
                                          dst_node,
                                          '7777',
                                          expectation=False)
Ejemplo n.º 16
0
              print "-" * indent[0] + "> call function", frame.f_code.co_name
      elif event == "return":
#          if frame.f_code.co_name.startswith('verify_'):
#              print "<" + "-" * indent[0], "exit function", frame.f_code.co_name, frame.f_code.co_names
          indent[0] -= 2
      return tracefunc

if __name__ == "__main__":
    import sys
    from vn_test import VNFixture
    from vm_test import VMFixture
#    sys.settrace(tracefunc)
#    obj = LBaasFixture(api_type='neutron', name='LB', connections=setup_test_infra(), network_id='4b39a2bd-4528-40e8-b848-28084e59c944', members={'vms': ['a72ad607-f1ca-44f2-b31e-e825a3f2d408'], 'address': ['192.168.1.10']}, vip_net_id='4b39a2bd-4528-40e8-b848-28084e59c944', protocol='TCP', port='22', healthmonitors=[{'delay':5, 'timeout':5, 'max_retries':5, 'probe_type':'PING'}])
    conn = setup_test_infra()
    vnfix = VNFixture(connections=conn)
    vnfix.setUp()
    vip_fix = VNFixture(connections=conn)
    vip_fix.setUp()
    fip_fix = VNFixture(connections=conn, router_external=True)
    fip_fix.setUp()
    subnet = vnfix.get_cidrs()[0]
    vm_fix = VMFixture(connections=conn, vn_obj=vnfix.obj)
    vm_fix.setUp()
    obj = LBaasFixture(api_type='neutron', name='LB', connections=conn, network_id=vnfix.uuid,
                       members={'address': [get_random_ip(subnet)], 'vms': [vm_fix.vm_id]},
                       vip_net_id=vip_fix.uuid, fip_net_id=fip_fix.uuid, protocol='TCP', port='22',
                       healthmonitors=[{'delay':5, 'timeout':5, 'max_retries':5, 'probe_type':'PING'}],
                       custom_attr={'max_conn': 100, 'max_sess_rate': 20, 'server_timeout': 50000, 'rate_limit_sessions': 10, 'http_server_close': "True"})
    obj.setUp()
#    obj = LBaasFixture(api_type='neutron', uuid='58e5fb2c-ec47-4eb8-b4bf-9c66b0473f78', connections=setup_test_infra())
    obj.verify_on_setup()
Ejemplo n.º 17
0
    elif event == "return":
        #          if frame.f_code.co_name.startswith('verify_'):
        #              print "<" + "-" * indent[0], "exit function", frame.f_code.co_name, frame.f_code.co_names
        indent[0] -= 2
    return tracefunc


if __name__ == "__main__":
    import sys
    from vn_test import VNFixture
    from vm_test import VMFixture
    #    sys.settrace(tracefunc)
    #    obj = LBaasFixture(api_type='neutron', name='LB', connections=setup_test_infra(), network_id='4b39a2bd-4528-40e8-b848-28084e59c944', members={'vms': ['a72ad607-f1ca-44f2-b31e-e825a3f2d408'], 'address': ['192.168.1.10']}, vip_net_id='4b39a2bd-4528-40e8-b848-28084e59c944', protocol='TCP', port='22', healthmonitors=[{'delay':5, 'timeout':5, 'max_retries':5, 'probe_type':'PING'}])
    conn = setup_test_infra()
    vnfix = VNFixture(connections=conn)
    vnfix.setUp()
    vip_fix = VNFixture(connections=conn)
    vip_fix.setUp()
    fip_fix = VNFixture(connections=conn, router_external=True)
    fip_fix.setUp()
    subnet = vnfix.get_cidrs()[0]
    vm_fix = VMFixture(connections=conn, vn_obj=vnfix.obj)
    vm_fix.setUp()
    obj = LBaasFixture(api_type='neutron',
                       name='LB',
                       connections=conn,
                       network_id=vnfix.uuid,
                       members={
                           'address': [get_random_ip(subnet)],
                           'vms': [vm_fix.vm_id]
                       },
Ejemplo n.º 18
0
def main():
    import sys
    from vn_test import VNFixture
    from vm_test import VMFixture
    #    sys.settrace(tracefunc)
    #    obj = LBaasFixture(api_type='neutron', name='LB', connections=setup_test_infra(), network_id='4b39a2bd-4528-40e8-b848-28084e59c944', members={'vms': ['a72ad607-f1ca-44f2-b31e-e825a3f2d408'], 'address': ['192.168.1.10']}, vip_net_id='4b39a2bd-4528-40e8-b848-28084e59c944', protocol='TCP', port='22', healthmonitors=[{'delay':5, 'timeout':5, 'max_retries':5, 'probe_type':'PING'}])
    conn = setup_test_infra()
    vnfix = VNFixture(connections=conn, vn_name='admin-33688095')
    vnfix.setUp()
    fip_fix = VNFixture(connections=conn,
                        router_external=True,
                        vn_name='fip-vn')
    fip_fix.setUp()
    subnet = vnfix.get_cidrs()[0]
    vm_fix = VMFixture(connections=conn, vn_obj=vnfix.obj, vm_name='member-vm')
    vm_fix.setUp()
    obj = LBaasV2Fixture(
        lb_name='LB-Test',
        connections=conn,
        network_id=vnfix.uuid,
        fip_net_id=fip_fix.uuid,
        listener_name='Listener-Test',
        vip_port='80',
        vip_protocol='HTTP',
        pool_name='Pool-Test',
        pool_port='80',
        pool_protocol='HTTP',
        pool_algorithm='ROUND_ROBIN',
        members={'vms': [vm_fix.vm_id]},
        hm_delay=5,
        hm_timeout=5,
        hm_max_retries=5,
        hm_probe_type='PING',
    )
    obj.setUp()
    import pdb
    pdb.set_trace()
    obj.verify_on_setup()
    obj.cleanUp()
    exit()
    import pdb
    pdb.set_trace()
    #    obj = LBaasFixture(api_type='neutron', uuid='58e5fb2c-ec47-4eb8-b4bf-9c66b0473f78', connections=setup_test_infra())
    obj.verify_on_setup()
    obj.delete_custom_attr('max_sess_rate')
    obj.add_custom_attr('client_timeout', 20000)
    obj.delete_custom_attr('server_timeout')
    obj.add_custom_attr('max_sess_rate', 20000)
    obj.delete_custom_attr('rate_limit_sessions')
    obj.add_custom_attr('rate_limit_sessions', 20)
    obj.delete_custom_attr('max_conn')
    obj.add_custom_attr('max_conn', 20)
    obj.delete_custom_attr('http_server_close')
    obj.add_custom_attr('http_server_close', "False")
    obj.verify_on_setup()
    obj.create_fip_on_vip()
    obj.verify_on_setup()
    obj.delete_fip_on_vip()
    obj.verify_on_setup()
    obj.delete_vip()
    obj.verify_on_setup()
    obj.check_and_create_vip()
    obj.verify_on_setup()
    obj.delete_member(address=obj.member_ips[1])
    obj.verify_on_setup()
    obj.create_member(address=get_random_ip(subnet))
    obj.verify_on_setup()
    obj.delete_hmon(obj.hmons.keys()[0])
    obj.verify_on_setup()
    obj.create_hmon({
        'delay': 5,
        'max_retries': 5,
        'probe_type': 'PING',
        'timeout': 10
    })
    obj.verify_on_setup()
    obj.cleanUp()
    vm_fix.cleanUp()
    vnfix.cleanUp()
    vip_fix.cleanUp()
    fip_fix.cleanUp()