/
usr
/
lib
/
python2.6
/
site-packages
/
neutronclient
/
tests
/
unit
/
/usr/lib/python2.6/site-packages/neutronclient/tests/unit
mkdir
upload
Name
Size
Mode
Actions
fw/
-
0755
rm
lb/
-
0755
rm
qos/
-
0755
rm
vpn/
-
0755
rm
test_auth.py
15714
0644
edit
dl
rm
test_auth.pyc
14626
0644
edit
dl
rm
test_casual_args.py
4993
0644
edit
dl
rm
test_casual_args.pyc
6781
0644
edit
dl
rm
test_cli20.py
31706
0644
edit
dl
rm
test_cli20.pyc
29553
0644
edit
dl
rm
test_cli20_address_scope.py
6024
0644
edit
dl
rm
test_cli20_address_scope.pyc
6576
0644
edit
dl
rm
test_cli20_agents.py
3052
0644
edit
dl
rm
test_cli20_agents.pyc
3543
0644
edit
dl
rm
test_cli20_agentschedulers.py
8631
0644
edit
dl
rm
test_cli20_agentschedulers.pyc
10044
0644
edit
dl
rm
test_cli20_credential.py
3301
0644
edit
dl
rm
test_cli20_credential.pyc
3684
0644
edit
dl
rm
test_cli20_extensions.py
1945
0644
edit
dl
rm
test_cli20_extensions.pyc
1834
0644
edit
dl
rm
test_cli20_floatingips.py
6258
0755
edit
dl
rm
test_cli20_floatingips.pyc
6875
0644
edit
dl
rm
test_cli20_metering.py
3974
0644
edit
dl
rm
test_cli20_metering.pyc
4670
0644
edit
dl
rm
test_cli20_network.py
26443
0644
edit
dl
rm
test_cli20_network.pyc
27226
0644
edit
dl
rm
test_cli20_networkprofile.py
6186
0644
edit
dl
rm
test_cli20_networkprofile.pyc
6011
0644
edit
dl
rm
test_cli20_nsx_networkgateway.py
11974
0644
edit
dl
rm
test_cli20_nsx_networkgateway.pyc
12566
0644
edit
dl
rm
test_cli20_nsx_queue.py
3124
0755
edit
dl
rm
test_cli20_nsx_queue.pyc
3714
0644
edit
dl
rm
test_cli20_nuage_netpartition.py
2252
0644
edit
dl
rm
test_cli20_nuage_netpartition.pyc
2732
0644
edit
dl
rm
test_cli20_policyprofile.py
3299
0644
edit
dl
rm
test_cli20_policyprofile.pyc
3305
0644
edit
dl
rm
test_cli20_port.py
26748
0644
edit
dl
rm
test_cli20_port.pyc
25239
0644
edit
dl
rm
test_cli20_rbac.py
5239
0644
edit
dl
rm
test_cli20_rbac.pyc
5633
0644
edit
dl
rm
test_cli20_router.py
14364
0644
edit
dl
rm
test_cli20_router.pyc
15580
0644
edit
dl
rm
test_cli20_securitygroup.py
27847
0755
edit
dl
rm
test_cli20_securitygroup.pyc
27420
0644
edit
dl
rm
test_cli20_servicetype.py
2268
0644
edit
dl
rm
test_cli20_servicetype.pyc
2768
0644
edit
dl
rm
test_cli20_subnet.py
30402
0644
edit
dl
rm
test_cli20_subnet.pyc
28179
0644
edit
dl
rm
test_cli20_subnetpool.py
7603
0644
edit
dl
rm
test_cli20_subnetpool.pyc
8094
0644
edit
dl
rm
test_client_extension.py
9253
0644
edit
dl
rm
test_client_extension.pyc
12179
0644
edit
dl
rm
test_command_meta.py
1496
0644
edit
dl
rm
test_command_meta.pyc
1848
0644
edit
dl
rm
test_http.py
4261
0644
edit
dl
rm
test_http.pyc
6393
0644
edit
dl
rm
test_name_or_id.py
8241
0644
edit
dl
rm
test_name_or_id.pyc
7399
0644
edit
dl
rm
test_quota.py
1680
0755
edit
dl
rm
test_quota.pyc
1951
0644
edit
dl
rm
test_shell.py
20714
0644
edit
dl
rm
test_shell.pyc
18083
0644
edit
dl
rm
test_ssl.py
6303
0644
edit
dl
rm
test_ssl.pyc
5229
0644
edit
dl
rm
test_utils.py
4368
0644
edit
dl
rm
test_utils.pyc
7650
0644
edit
dl
rm
test_validators.py
4101
0644
edit
dl
rm
test_validators.pyc
4238
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
__init__.pyc
166
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/neutronclient/tests/unit/test_cli20_agentschedulers.py
(8631B)
# Copyright 2013 Mirantis Inc. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # import sys from mox3 import mox from neutronclient.neutron.v2_0 import agentscheduler from neutronclient.neutron.v2_0 import network from neutronclient.tests.unit import test_cli20 AGENT_ID = 'agent_id1' NETWORK_ID = 'net_id1' ROUTER_ID = 'router_id1' class CLITestV20AgentScheduler(test_cli20.CLITestV20Base): def _test_add_to_agent(self, resource, cmd, cmd_args, destination, body, result): path = ((self.client.agent_path + destination) % cmd_args[0]) self.mox.StubOutWithMock(cmd, "get_client") self.mox.StubOutWithMock(self.client.httpclient, "request") cmd.get_client().MultipleTimes().AndReturn(self.client) result_str = self.client.serialize(result) return_tup = (test_cli20.MyResp(200), result_str) self.client.httpclient.request( test_cli20.end_url(path), 'POST', body=test_cli20.MyComparator(body, self.client), headers=mox.ContainsKeyValue( 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(cmd_args) cmd.run(parsed_args) self.mox.VerifyAll() self.mox.UnsetStubs() def _test_remove_from_agent(self, resource, cmd, cmd_args, destination): path = ((self.client.agent_path + destination + '/%s') % cmd_args) self.mox.StubOutWithMock(cmd, "get_client") self.mox.StubOutWithMock(self.client.httpclient, "request") cmd.get_client().MultipleTimes().AndReturn(self.client) return_tup = (test_cli20.MyResp(204), None) self.client.httpclient.request( test_cli20.end_url(path), 'DELETE', body=None, headers=mox.ContainsKeyValue( 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(cmd_args) cmd.run(parsed_args) self.mox.VerifyAll() self.mox.UnsetStubs() class CLITestV20DHCPAgentScheduler(CLITestV20AgentScheduler): def test_add_network_to_agent(self): resource = 'agent' cmd = agentscheduler.AddNetworkToDhcpAgent( test_cli20.MyApp(sys.stdout), None) args = (AGENT_ID, NETWORK_ID) body = {'network_id': NETWORK_ID} result = {'network_id': 'net_id', } self._test_add_to_agent(resource, cmd, args, self.client.DHCP_NETS, body, result) def test_remove_network_from_agent(self): resource = 'agent' cmd = agentscheduler.RemoveNetworkFromDhcpAgent( test_cli20.MyApp(sys.stdout), None) args = (AGENT_ID, NETWORK_ID) self._test_remove_from_agent(resource, cmd, args, self.client.DHCP_NETS) def test_list_networks_on_agent(self): resources = 'networks' cmd = agentscheduler.ListNetworksOnDhcpAgent( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.agent_path + self.client.DHCP_NETS) % agent_id) self.mox.StubOutWithMock(network.ListNetwork, "extend_list") network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) self._test_list_resources(resources, cmd, base_args=[agent_id], path=path) def test_list_agents_hosting_network(self): resources = 'agent' cmd = agentscheduler.ListDhcpAgentsHostingNetwork( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.network_path + self.client.DHCP_AGENTS) % agent_id) contents = {self.id_field: 'myid1', 'alive': True} self._test_list_resources(resources, cmd, base_args=[agent_id], path=path, response_contents=contents) class CLITestV20L3AgentScheduler(CLITestV20AgentScheduler): def test_add_router_to_agent(self): resource = 'agent' cmd = agentscheduler.AddRouterToL3Agent( test_cli20.MyApp(sys.stdout), None) args = (AGENT_ID, ROUTER_ID) body = {'router_id': ROUTER_ID} result = {'network_id': 'net_id', } self._test_add_to_agent(resource, cmd, args, self.client.L3_ROUTERS, body, result) def test_remove_router_from_agent(self): resource = 'agent' cmd = agentscheduler.RemoveRouterFromL3Agent( test_cli20.MyApp(sys.stdout), None) args = (AGENT_ID, ROUTER_ID) self._test_remove_from_agent(resource, cmd, args, self.client.L3_ROUTERS) def test_list_routers_on_agent(self): resources = 'router' cmd = agentscheduler.ListRoutersOnL3Agent( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.agent_path + self.client.L3_ROUTERS) % agent_id) contents = {self.id_field: 'myid1', 'name': 'my_name'} self._test_list_resources(resources, cmd, base_args=[agent_id], path=path, response_contents=contents) def test_list_agents_hosting_router(self): resources = 'agent' cmd = agentscheduler.ListL3AgentsHostingRouter( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.router_path + self.client.L3_AGENTS) % agent_id) contents = {self.id_field: 'myid1', 'alive': True} self._test_list_resources(resources, cmd, base_args=[agent_id], path=path, response_contents=contents) class CLITestV20LBaaSAgentScheduler(test_cli20.CLITestV20Base): def test_list_pools_on_agent(self): resources = 'pools' cmd = agentscheduler.ListPoolsOnLbaasAgent( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.agent_path + self.client.LOADBALANCER_POOLS) % agent_id) self._test_list_resources(resources, cmd, base_args=[agent_id], path=path) def test_get_lbaas_agent_hosting_pool(self): resources = 'agent' cmd = agentscheduler.GetLbaasAgentHostingPool( test_cli20.MyApp(sys.stdout), None) pool_id = 'pool_id1' path = ((self.client.pool_path + self.client.LOADBALANCER_AGENT) % pool_id) contents = {self.id_field: 'myid1', 'alive': True} self._test_list_resources(resources, cmd, base_args=[pool_id], path=path, response_contents=contents) class CLITestV20LBaaSV2AgentScheduler(test_cli20.CLITestV20Base): def test_list_loadbalancers_on_agent(self): resources = 'loadbalancers' cmd = agentscheduler.ListLoadBalancersOnLbaasAgent( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.agent_path + self.client.AGENT_LOADBALANCERS) % agent_id) self._test_list_resources(resources, cmd, base_args=[agent_id], path=path) def test_get_lbaas_agent_hosting_pool(self): resources = 'agent' cmd = agentscheduler.GetLbaasAgentHostingLoadBalancer( test_cli20.MyApp(sys.stdout), None) lb_id = 'lb_id1' path = ((self.client.lbaas_loadbalancer_path + self.client.LOADBALANCER_HOSTING_AGENT) % lb_id) contents = {self.id_field: 'myid1', 'alive': True} self._test_list_resources(resources, cmd, base_args=[lb_id], path=path, response_contents=contents) class CLITestV20LBaaSAgentSchedulerXML(CLITestV20LBaaSAgentScheduler): format = 'xml'
Save
cmd:
run