Пример #1
0
 def test_update_network_exception(self):
     # Update net: myid.
     resource = 'network'
     cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
     self.assertRaises(exceptions.CommandError, self._test_update_resource,
                       resource, cmd, 'myid', ['myid'], {})
Пример #2
0
 def test_update_router_exception(self):
     """Update router: myid."""
     resource = 'router'
     cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
     self.assertRaises(exceptions.CommandError, self._test_update_resource,
                       resource, cmd, 'myid', ['myid'], {})
Пример #3
0
 def test_add_interface_by_port(self):
     """Add interface to router: myid port=portid."""
     cmd = router.AddInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
     args = ['myid', 'port=portid']
     self._test_add_remove_interface('add', 'port', cmd, args)
Пример #4
0
 def test_list_router_ports_detail_tags(self):
     """List router ports: -D -- --tags a b."""
     resources = "ports"
     cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_router_port(resources, cmd, self.test_id,
                                 detail=True, tags=['a', 'b'])
Пример #5
0
 def test_list_routers_pagination(self):
     resources = "routers"
     cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources_with_pagination(resources, cmd)
Пример #6
0
 def test_list_ports_limit(self):
     """list ports: -P."""
     resources = "ports"
     cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, page_size=1000)
Пример #7
0
 def test_list_ports_fields(self):
     """List ports: --fields a --fields b -- --fields c d."""
     resources = "ports"
     cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd,
                               fields_1=['a', 'b'], fields_2=['c', 'd'])
Пример #8
0
 def test_list_subnets_detail(self):
     # List subnets: -D.
     resources = "subnets"
     cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, True)
Пример #9
0
 def test_list_subnets_detail_tags(self):
     # List subnets: -D -- --tags a b.
     resources = "subnets"
     cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, detail=True, tags=['a', 'b'])
 def test_update_firewall_with_bad_router_options(self):
     resource = 'firewall'
     cmd = firewall.UpdateFirewall(test_cli20.MyApp(sys.stdout), None)
     self.assertRaises(SystemExit, self._test_update_resource, resource,
                       cmd, 'myid',
                       ['myid', '--no-routers', '--router', 'fake-id'], {})
 def test_list_firewalls(self):
     # firewall-list.
     resources = "firewalls"
     cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, True)
 def test_update_firewall_with_no_routers(self):
     resource = 'firewall'
     cmd = firewall.UpdateFirewall(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(resource, cmd, 'myid',
                                ['myid', '--no-routers'],
                                {'router_ids': []})
 def test_list_firewalls_limit(self):
     # size (1000) limited list: firewall-list -P.
     resources = "firewalls"
     cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, page_size=1000)
 def test_list_firewalls_pagination(self):
     # firewall-list with pagination.
     resources = "firewalls"
     cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources_with_pagination(resources, cmd)
Пример #15
0
 def test_list_ports(self):
     """List ports: -D."""
     resources = "ports"
     cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, True)
Пример #16
0
 def test_list_subnets_pagination(self):
     resources = "subnets"
     cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources_with_pagination(resources, cmd)
Пример #17
0
 def test_list_ports_pagination(self):
     resources = "ports"
     cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources_with_pagination(resources, cmd)
Пример #18
0
 def test_list_subnets_limit(self):
     # List subnets: -P.
     resources = "subnets"
     cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, page_size=1000)
Пример #19
0
 def test_list_ports_tags(self):
     """List ports: -- --tags a b."""
     resources = "ports"
     cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, tags=['a', 'b'])
 def test_list_firewall_rules(self):
     # firewall-rule-list.
     resources = "firewall_rules"
     cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, True)
Пример #21
0
 def test_list_router_ports(self):
     """List router ports: -D."""
     resources = "ports"
     cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
     self._test_list_router_port(resources, cmd,
                                 self.test_id, True)
 def test_list_firewall_rules_pagination(self):
     # firewall-rule-list.
     resources = "firewall_rules"
     cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources_with_pagination(resources, cmd)
Пример #23
0
 def test_list_routers_detail(self):
     """list routers: -D."""
     resources = "routers"
     cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, True)
 def test_list_firewall_rules_limit(self):
     # firewall-rule-list -P."""
     resources = "firewall_rules"
     cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, page_size=1000)
Пример #25
0
 def test_list_routers_limit(self):
     """list routers: -P."""
     resources = "routers"
     cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
     self._test_list_resources(resources, cmd, page_size=1000)
 def test_show_firewall_rule_id(self):
     # firewall-rule-show test_id.
     resource = 'firewall_rule'
     cmd = firewallrule.ShowFirewallRule(test_cli20.MyApp(sys.stdout), None)
     args = ['--fields', 'id', self.test_id]
     self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
Пример #27
0
 def test_add_interface_compat(self):
     """Add interface to router: myid subnetid."""
     cmd = router.AddInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
     args = ['myid', 'subnetid']
     self._test_add_remove_interface('add', 'subnet', cmd, args)
 def _setup_create_firewall_rule_with_all_params(self,
                                                 protocol='tcp',
                                                 ip_version='4'):
     # 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,
         '--ip-version', ip_version, '--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
     if ip_version == '4' or ip_version == '6':
         self._test_create_resource(resource,
                                    cmd,
                                    name,
                                    my_id,
                                    args,
                                    position_names,
                                    position_values,
                                    description=description,
                                    shared=True,
                                    protocol=protocol,
                                    ip_version=int(ip_version),
                                    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)
     else:
         self.assertRaises(SystemExit,
                           self._test_create_resource,
                           resource,
                           cmd,
                           name,
                           my_id,
                           args,
                           position_names,
                           position_values,
                           ip_version=int(ip_version),
                           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)
Пример #29
0
 def test_del_interface_by_port(self):
     """Delete interface from router: myid port=portid."""
     cmd = router.RemoveInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
     args = ['myid', 'port=portid']
     self._test_add_remove_interface('remove', 'port', cmd, args)
Пример #30
0
 def test_list_shared_networks(self):
     # list nets : --shared False
     cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
     self._test_list_networks(cmd,
                              base_args='--shared False'.split(),
                              query='shared=False')