1111# under the License.
1212
1313from openstack .network import network_service
14- from openstack import resource
14+ from openstack import resource2 as resource
1515from openstack import utils
1616
1717
1818class Agent (resource .Resource ):
19+ """Neutron agent extension."""
1920 resource_key = 'agent'
2021 resources_key = 'agents'
2122 base_path = '/agents'
2223 service = network_service .NetworkService ()
2324
2425 # capabilities
2526 allow_create = False
26- allow_retrieve = True
27+ allow_get = True
2728 allow_update = True
2829 allow_delete = True
2930 allow_list = True
3031
32+ # NOTE: We skip query for JSON fields and datetime fields
33+ _query_mapping = resource .QueryParameters (
34+ 'agent_type' , 'availability_zone' , 'binary' , 'description' , 'host' ,
35+ 'topic' ,
36+ is_admin_state_up = 'admin_state_up' , is_alive = 'alive' ,
37+ )
38+
3139 # Properties
3240 #: The type of network agent.
33- agent_type = resource .prop ('agent_type' )
41+ agent_type = resource .Body ('agent_type' )
3442 #: Availability zone for the network agent.
35- availability_zone = resource .prop ('availability_zone' )
43+ availability_zone = resource .Body ('availability_zone' )
3644 #: The name of the network agent's application binary.
37- binary = resource .prop ('binary' )
45+ binary = resource .Body ('binary' )
3846 #: Network agent configuration data specific to the agent_type.
39- configuration = resource .prop ('configurations' )
47+ configuration = resource .Body ('configurations' )
4048 #: Timestamp when the network agent was created.
41- created_at = resource .prop ('created_at' )
49+ created_at = resource .Body ('created_at' )
4250 #: The network agent description.
43- description = resource .prop ('description' )
51+ description = resource .Body ('description' )
4452 #: Timestamp when the network agent's heartbeat was last seen.
45- last_heartbeat_at = resource .prop ('heartbeat_timestamp' )
53+ last_heartbeat_at = resource .Body ('heartbeat_timestamp' )
4654 #: The host the agent is running on.
47- host = resource .prop ('host' )
55+ host = resource .Body ('host' )
4856 #: The administrative state of the network agent, which is up
4957 #: ``True`` or down ``False``. *Type: bool*
50- is_admin_state_up = resource .prop ('admin_state_up' , type = bool )
58+ is_admin_state_up = resource .Body ('admin_state_up' , type = bool )
5159 #: Whether or not the network agent is alive.
5260 #: *Type: bool*
53- is_alive = resource .prop ('alive' , type = bool )
61+ is_alive = resource .Body ('alive' , type = bool )
5462 #: Timestamp when the network agent was last started.
55- started_at = resource .prop ('started_at' )
63+ started_at = resource .Body ('started_at' )
5664 #: The messaging queue topic the network agent subscribes to.
57- topic = resource .prop ('topic' )
65+ topic = resource .Body ('topic' )
5866
5967 def add_agent_to_network (self , session , ** body ):
6068 url = utils .urljoin (self .base_path , self .id , 'dhcp-networks' )
@@ -77,7 +85,9 @@ class DHCPAgentHostingNetwork(resource.Resource):
7785
7886 # capabilities
7987 allow_create = False
80- allow_retrieve = True
88+ allow_get = True
8189 allow_update = False
8290 allow_delete = False
8391 allow_list = True
92+
93+ # NOTE: No query parameter is supported
0 commit comments