7272import org .mockito .junit .jupiter .MockitoSettings ;
7373import org .mockito .quality .Strictness ;
7474
75- import com .cloud .utils .Pair ;
7675import com .cloud .utils .exception .CloudRuntimeException ;
7776
7877import feign .FeignException ;
@@ -966,12 +965,13 @@ public void testGetNetworkInterface_nfs() {
966965 .thenReturn (interfaceResponse );
967966
968967 // Execute
969- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
968+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
970969
971970 // Verify
972971 assertNotNull (result );
973- assertEquals ("192.168.1.50" , result .first ());
974- assertTrue (result .second () == null , "Expect no warning when a suitable LIF is found" );
972+ assertEquals ("192.168.1.50" , result .get (OntapStorageConstants .DATA_LIF ));
973+ assertTrue (result .get (OntapStorageConstants .LIF_WARNING ) == null ,
974+ "Expect no warning when a suitable LIF is found" );
975975 verify (networkFeignClient , times (1 )).getNetworkIpInterfaces (anyString (), anyMap ());
976976 }
977977
@@ -1008,12 +1008,13 @@ public void testGetNetworkInterface_iscsi() {
10081008 .thenReturn (interfaceResponse );
10091009
10101010 // Execute
1011- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
1011+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
10121012
10131013 // Verify
10141014 assertNotNull (result );
1015- assertEquals ("192.168.1.51" , result .first ());
1016- assertTrue (result .second () == null , "Expect no warning when a suitable LIF is found" );
1015+ assertEquals ("192.168.1.51" , result .get (OntapStorageConstants .DATA_LIF ));
1016+ assertTrue (result .get (OntapStorageConstants .LIF_WARNING ) == null ,
1017+ "Expect no warning when a suitable LIF is found" );
10171018 }
10181019
10191020 @ Test
@@ -1141,10 +1142,10 @@ public void testGetNetworkInterface_nfs_tier1_homeNodeMatch() {
11411142 when (networkFeignClient .getNetworkIpInterfaces (anyString (), anyMap ()))
11421143 .thenReturn (wrapLifs (List .of (lif )));
11431144
1144- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
1145+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
11451146
1146- assertEquals ("10.0.0.1" , result .first ( ));
1147- assertTrue (result .second ( ) == null , "Tier 1 should produce no warning" );
1147+ assertEquals ("10.0.0.1" , result .get ( OntapStorageConstants . DATA_LIF ));
1148+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ) == null , "Tier 1 should produce no warning" );
11481149 }
11491150
11501151 /**
@@ -1160,11 +1161,11 @@ public void testGetNetworkInterface_nfs_tier2_currentNodeMatch() {
11601161 when (networkFeignClient .getNetworkIpInterfaces (anyString (), anyMap ()))
11611162 .thenReturn (wrapLifs (List .of (lif )));
11621163
1163- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
1164+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
11641165
1165- assertEquals ("10.0.0.2" , result .first ( ));
1166- assertTrue (result .second ( ) != null , "Tier 2 should produce a warning" );
1167- assertTrue (result .second ( ).contains ("node-a" ));
1166+ assertEquals ("10.0.0.2" , result .get ( OntapStorageConstants . DATA_LIF ));
1167+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ) != null , "Tier 2 should produce a warning" );
1168+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ).contains ("node-a" ));
11681169 }
11691170
11701171 /**
@@ -1181,13 +1182,13 @@ public void testGetNetworkInterface_nfs_tier3_crossNodeFallback() {
11811182 when (networkFeignClient .getNetworkIpInterfaces (anyString (), anyMap ()))
11821183 .thenReturn (wrapLifs (List .of (lif )));
11831184
1184- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
1185+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
11851186
1186- assertEquals ("10.0.0.3" , result .first ( ));
1187- assertTrue (result .second ( ) != null , "Tier 3 fallback should produce a warning" );
1188- assertTrue (result .second ( ).contains ("node-a" ),
1187+ assertEquals ("10.0.0.3" , result .get ( OntapStorageConstants . DATA_LIF ));
1188+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ) != null , "Tier 3 fallback should produce a warning" );
1189+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ).contains ("node-a" ),
11891190 "Warning should mention the expected node" );
1190- assertTrue (result .second ( ).contains ("10.0.0.3" ),
1191+ assertTrue (result .get ( OntapStorageConstants . LIF_WARNING ).contains ("10.0.0.3" ),
11911192 "Warning should mention the fallback LIF IP" );
11921193 }
11931194
@@ -1225,10 +1226,11 @@ public void testGetNetworkInterface_nfs_tier1Down_tier2Used() {
12251226 when (networkFeignClient .getNetworkIpInterfaces (anyString (), anyMap ()))
12261227 .thenReturn (wrapLifs (List .of (lifDown , lifFailover )));
12271228
1228- Pair <String , String > result = storageStrategy .getNetworkInterface (aggregate );
1229+ Map <String , String > result = storageStrategy .getNetworkInterface (aggregate );
12291230
1230- assertEquals ("10.0.0.6" , result .first ());
1231- assertTrue (result .second () != null , "Should warn that the home-node LIF is not in use" );
1231+ assertEquals ("10.0.0.6" , result .get (OntapStorageConstants .DATA_LIF ));
1232+ assertTrue (result .get (OntapStorageConstants .LIF_WARNING ) != null ,
1233+ "Should warn that the home-node LIF is not in use" );
12321234 }
12331235
12341236 // ========== Helper Methods ==========
0 commit comments