@@ -1169,6 +1169,19 @@ def _create_test_agent(self):
1169
1169
_ , status = self .plugin .create_or_update_agent (self .context , agent )
1170
1170
return status ['id' ]
1171
1171
1172
+ def _check_chassis_registers (self , present = True ):
1173
+ chassis = self .sb_api .lookup ('Chassis' , self .chassis , default = None )
1174
+ chassis_name = chassis .name if chassis else None
1175
+ if self .sb_api .is_table_present ('Chassis_Private' ):
1176
+ ch_private = self .sb_api .lookup (
1177
+ 'Chassis_Private' , self .chassis , default = None )
1178
+ ch_private_name = ch_private .name if ch_private else None
1179
+ self .assertEqual (chassis_name , ch_private_name )
1180
+ if present :
1181
+ self .assertEqual (self .chassis , chassis_name )
1182
+ else :
1183
+ self .assertIsNone (chassis )
1184
+
1172
1185
def test_agent_show (self ):
1173
1186
for agent_id in self .agent_types .values ():
1174
1187
self .assertTrue (self .plugin .get_agent (self .context , agent_id ))
@@ -1217,12 +1230,15 @@ def test_agent_delete(self):
1217
1230
self .assertRaises (agent_exc .AgentNotFound , self .plugin .get_agent ,
1218
1231
self .context , agent_id )
1219
1232
1220
- # OVN controller agent deletion, that triggers the "Chassis" register
1221
- # deletion. The "Chassis" register deletion triggers the host OVN
1222
- # agents deletion, both controller and metadata if present.
1233
+ # OVN controller agent deletion, that triggers the "Chassis" and
1234
+ # "Chassis_Private" registers deletion. The registers deletion triggers
1235
+ # the host OVN agents deletion, both controller and metadata if
1236
+ # present.
1223
1237
controller_id = self .agent_types [ovn_const .OVN_CONTROLLER_AGENT ]
1224
1238
metadata_id = self .agent_types [ovn_const .OVN_METADATA_AGENT ]
1239
+ self ._check_chassis_registers ()
1225
1240
self .plugin .delete_agent (self .context , controller_id )
1241
+ self ._check_chassis_registers (present = False )
1226
1242
self .assertRaises (agent_exc .AgentNotFound , self .plugin .get_agent ,
1227
1243
self .context , controller_id )
1228
1244
self .assertEqual (
0 commit comments