Beispiel #1
0
 def get_default_sg(self, **kwargs):
     connections = kwargs.get('connections') or self.connections
     option = kwargs.get('option') or 'neutron'
     sg = SecurityGroupFixture(connections,
              secgrp_name='default', option=option)
     sg.read()
     return sg
Beispiel #2
0
 def get_default_sg(self, **kwargs):
     connections = kwargs.get('connections') or self.connections
     option = kwargs.get('option') or 'neutron'
     sg = SecurityGroupFixture(connections,
              secgrp_name='default', option=option)
     sg.read()
     return sg
Beispiel #3
0
 def get_default_sg(self):
     return SecurityGroupFixture(self.inputs,
                                 self.connections,
                                 self.inputs.domain_name,
                                 self.inputs.project_name,
                                 secgrp_name='default',
                                 option='neutron')
Beispiel #4
0
 def create_sec_group(self, name, secgrpid=None, entries=None):
     secgrp_fixture = self.useFixture(SecurityGroupFixture(
         self.connections, self.inputs.domain_name,
         self.inputs.project_name, secgrp_name=name,
         uuid=secgrpid, secgrp_entries=entries,option='neutron'))
     result, msg = secgrp_fixture.verify_on_setup()
     assert result, msg
     return secgrp_fixture
Beispiel #5
0
 def create_security_group(self, name=None, rules=None, **kwargs):
     connections = kwargs.get('connections') or self.connections
     option = kwargs.get('option') or 'neutron'
     name = name or get_random_name('secgrp')
     secgrp_fixture = self.useFixture(SecurityGroupFixture(
         connections, secgrp_name=name,
         secgrp_entries=rules, option=option))
     return secgrp_fixture
Beispiel #6
0
 def create_sg(self):
     self.sg_allow_tcp = 'sec_group_allow_tcp' + '_' + get_random_name()
     rule = [{
         'direction':
         '<>',
         'protocol':
         'tcp',
         'dst_addresses': [{
             'subnet': {
                 'ip_prefix': '0.0.0.0',
                 'ip_prefix_len': 0
             }
         }],
         'dst_ports': [{
             'start_port': 0,
             'end_port': -1
         }],
         'src_ports': [{
             'start_port': 0,
             'end_port': -1
         }],
         'src_addresses': [{
             'security_group': 'local'
         }],
     }, {
         'direction':
         '<>',
         'protocol':
         'tcp',
         'src_addresses': [{
             'subnet': {
                 'ip_prefix': '0.0.0.0',
                 'ip_prefix_len': 0
             }
         }],
         'src_ports': [{
             'start_port': 0,
             'end_port': -1
         }],
         'dst_ports': [{
             'start_port': 0,
             'end_port': -1
         }],
         'dst_addresses': [{
             'security_group': 'local'
         }],
     }]
     secgrp_fixture = self.useFixture(
         SecurityGroupFixture(self.inputs,
                              self.connections,
                              self.inputs.domain_name,
                              self.inputs.project_name,
                              secgrp_name='vip_sg',
                              secgrp_entries=rule,
                              option='neutron'))
     result, msg = secgrp_fixture.verify_on_setup()
     assert result, msg
     return secgrp_fixture
Beispiel #7
0
    def create_sg(self, name=None, entries=None):
        sg_fixture = self.useFixture(
            SecurityGroupFixture(self.connections,
                                 self.inputs.domain_name,
                                 self.inputs.project_name,
                                 secgrp_name=name,
                                 secgrp_entries=entries))

        return sg_fixture
Beispiel #8
0
 def config_sec_group(self, name, secgrpid=None, entries=None):
     option = self.option
     if self.option == 'openstack':
         option = 'neutron'
     secgrp_fixture = self.useFixture(
         SecurityGroupFixture(self.inputs,
                              self.connections,
                              self.inputs.domain_name,
                              self.inputs.project_name,
                              secgrp_name=name,
                              uuid=secgrpid,
                              secgrp_entries=entries,
                              option=option))
     result, msg = secgrp_fixture.verify_on_setup()
     assert result, msg
     return secgrp_fixture
Beispiel #9
0
def create_sg_quantum(self):
    if hasattr(self.topo, 'sg_list'):
        self.sg_uuid = {}
        self.secgrp_fixture = {}
        for sg_name in self.topo.sg_list:
            result = True
            msg = []
            self.secgrp_fixture[sg_name] = self.useFixture(
                SecurityGroupFixture(
		    connections=self.project_connections,
                    domain_name=self.topo.domain,
                    project_name=self.topo.project,
                    secgrp_name=sg_name,
                    secgrp_entries=self.topo.sg_rules[sg_name],option='neutron'))
            self.sg_uuid[sg_name] = self.secgrp_fixture[sg_name].secgrp_id
            if self.skip_verify == 'no':
                ret, msg = self.secgrp_fixture[sg_name].verify_on_setup()
                assert ret, "Verifications for security group is :%s failed and its error message: %s" % (
                    sg_name, msg)
    return self