File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
tests/functional/agent/ovn/agent Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,14 @@ def _load_sb_idl(self):
151
151
return ovsdb .MonitorAgentOvnSbIdl (tables , events ,
152
152
chassis = self .chassis ).start ()
153
153
154
+ def update_neutron_sb_cfg_key (self ):
155
+ nb_cfg = self .sb_idl .db_get ('Chassis_Private' ,
156
+ self .chassis , 'nb_cfg' ).execute ()
157
+ external_ids = {ovn_const .OVN_AGENT_NEUTRON_SB_CFG_KEY : str (nb_cfg )}
158
+ self .sb_idl .db_set (
159
+ 'Chassis_Private' , self .chassis ,
160
+ ('external_ids' , external_ids )).execute (check_error = True )
161
+
154
162
def start (self ):
155
163
self .ext_manager_api .ovs_idl = self ._load_ovs_idl ()
156
164
self .load_config ()
@@ -159,6 +167,8 @@ def start(self):
159
167
self .ext_manager_api .sb_idl = self ._load_sb_idl ()
160
168
self .ext_manager_api .nb_idl = self ._load_nb_idl ()
161
169
self .ext_manager .start ()
170
+
171
+ self .update_neutron_sb_cfg_key ()
162
172
LOG .info ('OVN Neutron Agent started' )
163
173
self .wait ()
164
174
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ def resync(self):
161
161
Reload the configuration and sync the agent again.
162
162
"""
163
163
self .agent_api .load_config ()
164
+ self .agent_api .update_neutron_sb_cfg_key ()
164
165
self .sync ()
165
166
166
167
def start (self ):
@@ -177,6 +178,7 @@ def start(self):
177
178
178
179
# Register the agent with its corresponding Chassis
179
180
self .register_metadata_agent ()
181
+ self .agent_api .update_neutron_sb_cfg_key ()
180
182
181
183
# Start the metadata server.
182
184
proxy_thread = threading .Thread (target = self ._proxy .wait )
Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ def _start_ovn_neutron_agent(self):
77
77
mock .patch .object (server_socket .UnixDomainMetadataProxy ,
78
78
'wait' ):
79
79
agt .start ()
80
+ external_ids = agt .sb_idl .db_get (
81
+ 'Chassis_Private' , agt .chassis , 'external_ids' ).execute (
82
+ check_error = True )
83
+ self .assertEqual (
84
+ external_ids [ovn_const .OVN_AGENT_NEUTRON_SB_CFG_KEY ],
85
+ '0' )
86
+
80
87
self ._check_loaded_and_started_extensions (agt )
81
88
82
89
self .addCleanup (agt .ext_manager_api .ovs_idl .ovsdb_connection .stop )
@@ -128,9 +135,10 @@ def test_check_metadata_started(self):
128
135
# Check the metadata extension is registered.
129
136
chassis_id = uuid .UUID (self .chassis_name )
130
137
agent_id = uuid .uuid5 (chassis_id , 'metadata_agent' )
131
- ext_ids = {ovn_const .OVN_AGENT_METADATA_ID_KEY : str (agent_id )}
132
138
ch_private = self .sb_api .lookup ('Chassis_Private' , self .chassis_name )
133
- self .assertEqual (ext_ids , ch_private .external_ids )
139
+ self .assertEqual (
140
+ ch_private .external_ids [ovn_const .OVN_AGENT_METADATA_ID_KEY ],
141
+ str (agent_id ))
134
142
135
143
# Check Unix proxy is running.
136
144
metadata_extension = self .ovn_agent [METADATA_EXTENSION ]
You can’t perform that action at this time.
0 commit comments