def test_basic(self):
     sot = security_group_rule.SecurityGroupRule()
     self.assertEqual('security_group_rule', sot.resource_key)
     self.assertEqual('security_group_rules', sot.resources_key)
     self.assertEqual('/security-group-rules', sot.base_path)
     self.assertEqual('network', sot.service.service_type)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_retrieve)
     self.assertFalse(sot.allow_update)
     self.assertTrue(sot.allow_delete)
     self.assertTrue(sot.allow_list)
 def test_make_it(self):
     sot = security_group_rule.SecurityGroupRule(EXAMPLE)
     self.assertEqual(EXAMPLE['direction'], sot.direction)
     self.assertEqual(EXAMPLE['ethertype'], sot.ethertype)
     self.assertEqual(EXAMPLE['id'], sot.id)
     self.assertEqual(EXAMPLE['port_range_max'], sot.port_range_max)
     self.assertEqual(EXAMPLE['port_range_min'], sot.port_range_min)
     self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
     self.assertEqual(EXAMPLE['protocol'], sot.protocol)
     self.assertEqual(EXAMPLE['remote_group_id'], sot.remote_group_id)
     self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
     self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
Example #3
0
 def test_make_it(self):
     sot = security_group_rule.SecurityGroupRule(**EXAMPLE)
     self.assertEqual(EXAMPLE['created_at'], sot.created_at)
     self.assertEqual(EXAMPLE['description'], sot.description)
     self.assertEqual(EXAMPLE['direction'], sot.direction)
     self.assertEqual(EXAMPLE['ethertype'], sot.ether_type)
     self.assertEqual(EXAMPLE['id'], sot.id)
     self.assertEqual(EXAMPLE['port_range_max'], sot.port_range_max)
     self.assertEqual(EXAMPLE['port_range_min'], sot.port_range_min)
     self.assertEqual(EXAMPLE['protocol'], sot.protocol)
     self.assertEqual(EXAMPLE['remote_group_id'], sot.remote_group_id)
     self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
     self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
     self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
     self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
     self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
Example #4
0
def get_sgr_obj(sgr_id='7621d1e0-a2d2-4496-94eb-ffd375d20877',
                sg_id='cfb3dfc4-7a43-4ba1-b92d-b8b2650d7f88',
                protocol='tcp', direction='ingress'):

    sgr_data = {'description': '',
                'direction': direction,
                'ether_type': 'IPv4',
                'id': sgr_id,
                'port_range_max': 8080,
                'port_range_min': 8080,
                'project_id': '5ea46368c7fe436bb8732738c149fbce',
                'protocol': protocol,
                'remote_group_id': None,
                'remote_ip_prefix': None,
                'security_group_id': sg_id,
                'tenant_id': '5ea46368c7fe436bb8732738c149fbce'}

    return os_sgr.SecurityGroupRule(**sgr_data)
Example #5
0
    def test_basic(self):
        sot = security_group_rule.SecurityGroupRule()
        self.assertEqual('security_group_rule', sot.resource_key)
        self.assertEqual('security_group_rules', sot.resources_key)
        self.assertEqual('/security-group-rules', sot.base_path)
        self.assertTrue(sot.allow_create)
        self.assertTrue(sot.allow_fetch)
        self.assertFalse(sot.allow_commit)
        self.assertTrue(sot.allow_delete)
        self.assertTrue(sot.allow_list)

        self.assertDictEqual({'any_tags': 'tags-any',
                              'description': 'description',
                              'direction': 'direction',
                              'id': 'id',
                              'ether_type': 'ethertype',
                              'limit': 'limit',
                              'marker': 'marker',
                              'not_any_tags': 'not-tags-any',
                              'not_tags': 'not-tags',
                              'port_range_max': 'port_range_max',
                              'port_range_min': 'port_range_min',
                              'project_id': 'project_id',
                              'protocol': 'protocol',
                              'remote_group_id': 'remote_group_id',
                              'remote_address_group_id':
                                  'remote_address_group_id',
                              'remote_ip_prefix': 'remote_ip_prefix',
                              'revision_number': 'revision_number',
                              'security_group_id': 'security_group_id',
                              'sort_dir': 'sort_dir',
                              'sort_key': 'sort_key',
                              'tags': 'tags',
                              'tenant_id': 'tenant_id'
                              },
                             sot._query_mapping._mapping)
Example #6
0
 def get_security_group_rule(self, **data):
     obj = security_group_rule.SecurityGroupRule(**data)
     return obj.get(self.session)
Example #7
0
 def create_security_group_rule(self, **data):
     obj = security_group_rule.SecurityGroupRule(data)
     return obj.create(self.session)
Example #8
0
 def delete_security_group_rule(self, **data):
     obj = security_group_rule.SecurityGroupRule(**data)
     return obj.delete(self.session)