3737import com .cloud .network .vpc .VpcVO ;
3838import com .cloud .network .vpc .dao .VpcDao ;
3939import com .cloud .offering .NetworkOffering ;
40+ import com .cloud .offerings .NetworkOfferingVO ;
4041import com .cloud .offerings .dao .NetworkOfferingDao ;
4142import com .cloud .offerings .dao .NetworkOfferingServiceMapDao ;
4243import com .cloud .user .Account ;
@@ -307,6 +308,7 @@ public void testCreateNsxSegmentForVpc() {
307308 @ Test
308309 public void testCreateNsxSegmentForIsolatedNetwork () {
309310 NetworkVO networkVO = Mockito .mock (NetworkVO .class );
311+ NetworkOfferingVO offeringVO = Mockito .mock (NetworkOfferingVO .class );
310312 DataCenter dataCenter = Mockito .mock (DataCenter .class );
311313
312314 when (networkVO .getAccountId ()).thenReturn (1L );
@@ -315,6 +317,9 @@ public void testCreateNsxSegmentForIsolatedNetwork() {
315317 anyLong ())).thenReturn (new NsxAnswer (new NsxCommand (), true , "" ));
316318 when (nsxControllerUtils .sendNsxCommand (any (CreateNsxSegmentCommand .class ),
317319 anyLong ())).thenReturn (new NsxAnswer (new NsxCommand (), true , "" ));
320+ when (networkVO .getNetworkOfferingId ()).thenReturn (1L );
321+ when (networkOfferingDao .findById (1L )).thenReturn (offeringVO );
322+ when (offeringVO .getNsxMode ()).thenReturn (NetworkOffering .NsxMode .NATTED .name ());
318323 guru .createNsxSegment (networkVO , dataCenter );
319324 verify (nsxControllerUtils , times (1 )).sendNsxCommand (any (CreateNsxTier1GatewayCommand .class ),
320325 anyLong ());
0 commit comments