Exemple #1
0
    def setUp(self):
        super(SecurityGroupRuleFixture, self).setUp()
        self.neutron = get_neutron_client(
            project_name=self.project_fixture.name,
            user_name=self.project_fixture.admin_user.name,
            password=self.project_fixture.admin_user_fixture.password)
        self.load_security_group()

        self.security_group_rule = self.neutron.create_security_group_rule(
            {
                'security_group_rule': {
                    'direction': self.direction,
                    'security_group_id': self.security_group['id'],
                    'protocol': self.protocol,
                    'port_range_max': self.port_range_max,
                    'port_range_min': self.port_range_min,
                }
            })

        self.addDetail(
            'SecurityGroupRuleFixture-network',
            text_content(
                'Security group rule %s created' % (
                    self.security_group_rule
                    ['security_group_rule']
                    ['security_group_id'])))
        self.addCleanup(self.delete_security_group_rule)
Exemple #2
0
 def _setUp(self):
     super(NeutronNetworkFixture, self)._setUp()
     self.neutron = get_neutron_client(
         project_name=self.project_fixture.name,
         user_name=self.project_fixture.admin_user.name,
         password=self.project_fixture.admin_user_fixture.password)
     self.subnet_id = self.get_subnet_id()
     cidr = CONF.network['cidr'].format(subnet=self.subnet_id)
     # TODO: handle clashes and retry.
     self.net_name = factory.make_obj_name("network")
     self.sub_name = factory.make_obj_name("subnet")
     self.network = self.neutron.create_network(
         {"network": dict(name=self.net_name)})
     network_id = self.network["network"]["id"]
     self.subnet = self.neutron.create_subnet(
         {"subnet": dict(
             name=self.sub_name, network_id=network_id, cidr=cidr,
             ip_version=4)})
     self.addCleanup(self.delete_network)
     self.addDetail(
         'NeutronNetworkFixture-network',
         text_content('Network %s created' % self.net_name))
     self.addDetail(
         'NeutronNetworkFixture-subnet',
         text_content('Subnet %s created (cidr=%s)' % (
             self.sub_name, cidr)))
Exemple #3
0
 def setUp(self):
     super(RouterFixture, self).setUp()
     self.neutron = get_neutron_client(
         project_name=self.project_fixture.name,
         user_name=self.project_fixture.admin_user.name,
         password=self.project_fixture.admin_user_fixture.password)
     # TODO: handle clashes and retry.
     self.name = factory.make_obj_name("router")
     self.router = self.neutron.create_router(
         {'router': {'name': self.name, 'admin_state_up': True}})
     self.addCleanup(self.delete_router)
     self.addDetail(
         'RouterFixture-network',
         text_content('Router %s created' % self.name))
     self.wait_until_active()
Exemple #4
0
 def get_neutron_client(self, *args, **kwargs):
     return get_neutron_client(*args, **kwargs)
Exemple #5
0
 def get_neutron_client_admin(self):
     return get_neutron_client(
         user_name=CONF.username, project_name=CONF.admin_project,
         password=CONF.password)