예제 #1
0
 def test_create_firewall_policy_with_mandatory_params(self):
     # firewall-policy-create with mandatory (none) params only.
     resource = 'firewall_policy'
     cmd = firewallpolicy.CreateFirewallPolicy(test_cli20.MyApp(sys.stdout),
                                               None)
     tenant_id = 'my-tenant'
     name = 'my-name'
     my_id = 'myid'
     args = [
         '--tenant-id',
         tenant_id,
         '--admin-state_up',
         name,
     ]
     position_names = [
         'name',
     ]
     position_values = [
         name,
     ]
     self._test_create_resource(resource,
                                cmd,
                                name,
                                my_id,
                                args,
                                position_names,
                                position_values,
                                admin_state_up=True,
                                tenant_id=tenant_id)
예제 #2
0
 def test_create_firewall_policy_with_all_params(self):
     """firewall-policy-create with all params set."""
     resource = 'firewall_policy'
     cmd = firewallpolicy.CreateFirewallPolicy(test_cli20.MyApp(sys.stdout),
                                               None)
     name = 'my-name'
     description = 'my-desc'
     firewall_rules_arg = 'rule_id1 rule_id2'
     firewall_rules_res = ['rule_id1', 'rule_id2']
     tenant_id = 'my-tenant'
     my_id = 'myid'
     args = ['--description', description,
             '--shared',
             '--firewall-rules', firewall_rules_arg,
             '--audited',
             '--tenant-id', tenant_id,
             '--admin-state_up',
             name]
     position_names = ['name', ]
     position_values = [name, ]
     self._test_create_resource(resource, cmd, name, my_id, args,
                                position_names, position_values,
                                description=description, shared=True,
                                firewall_rules=firewall_rules_res,
                                audited=True, admin_state_up=True,
                                tenant_id=tenant_id)
예제 #3
0
    def test_create_firewall_policy_with_all_params(self):
        # firewall-policy-create with rule param of misc format.
        resource = 'firewall_policy'
        cmd = firewallpolicy.CreateFirewallPolicy(test_cli20.MyApp(sys.stdout),
                                                  None)
        name = 'my-name'
        description = 'my-desc'
        firewall_rules_res = ['rule_id1', 'rule_id2']
        tenant_id = 'my-tenant'
        my_id = 'myid'
        position_names = [
            'name',
        ]
        position_values = [
            name,
        ]

        # check for both str and unicode format firewall_rules_arg
        for firewall_rules_arg in ['rule_id1 rule_id2', u'rule_id1 rule_id2']:
            args = [
                '--description', description, '--shared', '--firewall-rules',
                firewall_rules_arg, '--audited', '--tenant-id', tenant_id,
                '--admin-state_up', name
            ]
            self._test_create_resource(resource,
                                       cmd,
                                       name,
                                       my_id,
                                       args,
                                       position_names,
                                       position_values,
                                       description=description,
                                       shared=True,
                                       firewall_rules=firewall_rules_res,
                                       audited=True,
                                       admin_state_up=True,
                                       tenant_id=tenant_id)