def _test_create_firewall_rule_with_mandatory_params(self, enabled): # firewall-rule-create with mandatory (none) params only. resource = 'firewall_rule' cmd = firewallrule.CreateFirewallRule(test_cli20.MyApp(sys.stdout), None) tenant_id = 'my-tenant' name = '' my_id = 'myid' protocol = 'tcp' action = 'allow' ip_version = 4 args = [ '--tenant-id', tenant_id, '--admin-state-up', '--protocol', protocol, '--action', action, '--enabled', enabled ] position_names = [] position_values = [] self._test_create_resource(resource, cmd, name, my_id, args, position_names, position_values, protocol=protocol, action=action, enabled=enabled, tenant_id=tenant_id, ip_version=ip_version)
def _setup_create_firewall_rule_with_all_params(self, protocol='tcp'): """firewall-rule-create with all params set.""" resource = 'firewall_rule' cmd = firewallrule.CreateFirewallRule(test_cli20.MyApp(sys.stdout), None) name = 'my-name' description = 'my-desc' source_ip = '192.168.1.0/24' destination_ip = '192.168.2.0/24' source_port = '0:65535' destination_port = '0:65535' action = 'allow' tenant_id = 'my-tenant' my_id = 'myid' enabled = 'True' args = [ '--description', description, '--shared', '--protocol', protocol, '--source-ip-address', source_ip, '--destination-ip-address', destination_ip, '--source-port', source_port, '--destination-port', destination_port, '--action', action, '--enabled', enabled, '--admin-state-up', '--tenant-id', tenant_id ] position_names = [] position_values = [] if protocol == 'any': protocol = None self._test_create_resource(resource, cmd, name, my_id, args, position_names, position_values, description=description, shared=True, protocol=protocol, source_ip_address=source_ip, destination_ip_address=destination_ip, source_port=source_port, destination_port=destination_port, action=action, enabled='True', tenant_id=tenant_id)