test_class.declarator: _entityMgr
test_class.modifier: @Mock
test_class.original_string: @Mock
      EntityManager _entityMgr;
test_class.type: EntityManager
test_class.var_name: _entityMgr
test_class.declarator: networkTopologyContext
test_class.modifier: @Mock
test_class.original_string: @Mock
      NetworkTopologyContext networkTopologyContext;
test_class.type: NetworkTopologyContext
test_class.var_name: networkTopologyContext
test_class.declarator: _vpcRouterMgr
test_class.modifier: @InjectMocks
test_class.original_string: @InjectMocks
      VpcVirtualNetworkApplianceManagerImpl _vpcRouterMgr;
test_class.type: VpcVirtualNetworkApplianceManagerImpl
test_class.var_name: _vpcRouterMgr
test_class.declarator: vpcVirtualRouterElement
test_class.modifier: @InjectMocks
test_class.original_string: @InjectMocks
      VpcVirtualRouterElement vpcVirtualRouterElement;
test_class.type: VpcVirtualRouterElement
test_class.var_name: vpcVirtualRouterElement
test_class.declarator: _routerDao
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private DomainRouterDao _routerDao;
test_class.type: DomainRouterDao
test_class.var_name: _routerDao
test_class.declarator: zoneRepository
test_class.modifier: @Mock
test_class.original_string: @Mock
      ZoneRepository zoneRepository;
test_class.type: ZoneRepository
test_class.var_name: zoneRepository
test_class.file: cosmic-core/server/src/test/java/com/cloud/network/element/VpcVirtualRouterElementTest.java
test_class.identifier: VpcVirtualRouterElementTest
test_case.body: @Test
      public void testApplyVpnUsers() {
          vpcVirtualRouterElement._vpcRouterMgr = _vpcRouterMgr;
  
          final AdvancedNetworkTopology advancedNetworkTopology = Mockito.mock(AdvancedNetworkTopology.class);
          final BasicNetworkTopology basicNetworkTopology = Mockito.mock(BasicNetworkTopology.class);
  
          networkTopologyContext.setAdvancedNetworkTopology(advancedNetworkTopology);
          networkTopologyContext.setBasicNetworkTopology(basicNetworkTopology);
          networkTopologyContext.init();
  
          final Vpc vpc = Mockito.mock(Vpc.class);
          final Zone zone = Mockito.mock(Zone.class);
          final RemoteAccessVpn remoteAccessVpn = Mockito.mock(RemoteAccessVpn.class);
          final DomainRouterVO domainRouterVO1 = Mockito.mock(DomainRouterVO.class);
          final DomainRouterVO domainRouterVO2 = Mockito.mock(DomainRouterVO.class);
          final VpnUser vpnUser1 = Mockito.mock(VpnUser.class);
          final VpnUser vpnUser2 = Mockito.mock(VpnUser.class);
  
          final List<VpnUser> users = new ArrayList<>();
          users.add(vpnUser1);
          users.add(vpnUser2);
  
          final List<DomainRouterVO> routers = new ArrayList<>();
          routers.add(domainRouterVO1);
          routers.add(domainRouterVO2);
  
          final Long vpcId = new Long(1l);
          final Long zoneId = new Long(1l);
  
          when(remoteAccessVpn.getVpcId()).thenReturn(vpcId);
          when(_vpcRouterMgr.getVpcRouters(vpcId)).thenReturn(routers);
          when(_entityMgr.findById(Vpc.class, vpcId)).thenReturn(vpc);
          when(vpc.getZoneId()).thenReturn(zoneId);
          when(zoneRepository.findById(zoneId)).thenReturn(Optional.of(zone));
          when(networkTopologyContext.retrieveNetworkTopology(zone)).thenReturn(advancedNetworkTopology);
  
          try {
              when(advancedNetworkTopology.applyVpnUsers(remoteAccessVpn, users, domainRouterVO1)).thenReturn(new String[]{"user1", "user2"});
              when(advancedNetworkTopology.applyVpnUsers(remoteAccessVpn, users, domainRouterVO2)).thenReturn(new String[]{"user3", "user4"});
          } catch (final ResourceUnavailableException e) {
              fail(e.getMessage());
          }
  
          try {
              final String[] results = vpcVirtualRouterElement.applyVpnUsers(remoteAccessVpn, users);
  
              assertNotNull(results);
              assertEquals(results[0], "user1");
              assertEquals(results[1], "user2");
              assertEquals(results[2], "user3");
              assertEquals(results[3], "user4");
          } catch (final ResourceUnavailableException e) {
              fail(e.getMessage());
          }
  
          verify(remoteAccessVpn, times(1)).getVpcId();
          verify(vpc, times(1)).getZoneId();
          verify(zoneRepository, times(1)).findById(zoneId);
          verify(networkTopologyContext, times(1)).retrieveNetworkTopology(zone);
      }
test_case.class_method_signature: VpcVirtualRouterElementTest.testApplyVpnUsers()
test_case.full_signature: @Test public void testApplyVpnUsers()
test_case.identifier: testApplyVpnUsers
test_case.invocations: mock mock setAdvancedNetworkTopology setBasicNetworkTopology init mock mock mock mock mock mock mock add add add add thenReturn when getVpcId thenReturn when getVpcRouters thenReturn when findById thenReturn when getZoneId thenReturn when findById of thenReturn when retrieveNetworkTopology thenReturn when applyVpnUsers thenReturn when applyVpnUsers fail getMessage applyVpnUsers assertNotNull assertEquals assertEquals assertEquals assertEquals fail getMessage getVpcId verify times getZoneId verify times findById verify times retrieveNetworkTopology verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testApplyVpnUsers()
focal_class.declarator: s_logger = LoggerFactory.getLogger(VpcVirtualRouterElement.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(VpcVirtualRouterElement.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: capabilities = setCapabilities()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
focal_class.type: Map<Service, Map<Capability, String>>
focal_class.var_name: capabilities
focal_class.declarator: _vpcMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      VpcManager _vpcMgr;
focal_class.type: VpcManager
focal_class.var_name: _vpcMgr
focal_class.declarator: _vpcRouterMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      VpcVirtualNetworkApplianceManager _vpcRouterMgr;
focal_class.type: VpcVirtualNetworkApplianceManager
focal_class.var_name: _vpcRouterMgr
focal_class.declarator: _vpnGatewayDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      Site2SiteVpnGatewayDao _vpnGatewayDao;
focal_class.type: Site2SiteVpnGatewayDao
focal_class.var_name: _vpnGatewayDao
focal_class.declarator: _ipAddressDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      IPAddressDao _ipAddressDao;
focal_class.type: IPAddressDao
focal_class.var_name: _ipAddressDao
focal_class.declarator: _ntwkModel
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      NetworkModel _ntwkModel;
focal_class.type: NetworkModel
focal_class.var_name: _ntwkModel
focal_class.declarator: _networkDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      NetworkDao _networkDao;
focal_class.type: NetworkDao
focal_class.var_name: _networkDao
focal_class.declarator: _networkACLItemDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      NetworkACLItemDao _networkACLItemDao;
focal_class.type: NetworkACLItemDao
focal_class.var_name: _networkACLItemDao
focal_class.declarator: _entityMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      EntityManager _entityMgr;
focal_class.type: EntityManager
focal_class.var_name: _entityMgr
focal_class.declarator: routerDeploymentDefinitionBuilder
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      RouterDeploymentDefinitionBuilder routerDeploymentDefinitionBuilder;
focal_class.type: RouterDeploymentDefinitionBuilder
focal_class.var_name: routerDeploymentDefinitionBuilder
focal_class.file: cosmic-core/server/src/main/java/com/cloud/network/element/VpcVirtualRouterElement.java
focal_class.identifier: VpcVirtualRouterElement
focal_class.interfaces: implements VpcProvider, Site2SiteVpnServiceProvider, NetworkACLServiceProvider
focal_class.class_method_signature: VpcVirtualRouterElement.setCapabilities()
focal_class.full_signature: private static Map<Service, Map<Capability, String>> setCapabilities()
focal_class.identifier: setCapabilities
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: Map<Service, Map<Capability, String>>
focal_class.signature: Map<Service, Map<Capability, String>> setCapabilities()
focal_class.class_method_signature: VpcVirtualRouterElement.implementVpc(final Vpc vpc, final DeployDestination dest, final ReservationContext context)
focal_class.full_signature: @Override public boolean implementVpc(final Vpc vpc, final DeployDestination dest, final ReservationContext context)
focal_class.identifier: implementVpc
focal_class.modifiers: @Override public
focal_class.parameters: (final Vpc vpc, final DeployDestination dest, final ReservationContext context)
focal_class.return: boolean
focal_class.signature: boolean implementVpc(final Vpc vpc, final DeployDestination dest, final ReservationContext context)
focal_class.class_method_signature: VpcVirtualRouterElement.shutdownVpc(final Vpc vpc, final ReservationContext context)
focal_class.full_signature: @Override public boolean shutdownVpc(final Vpc vpc, final ReservationContext context)
focal_class.identifier: shutdownVpc
focal_class.modifiers: @Override public
focal_class.parameters: (final Vpc vpc, final ReservationContext context)
focal_class.return: boolean
focal_class.signature: boolean shutdownVpc(final Vpc vpc, final ReservationContext context)
focal_class.class_method_signature: VpcVirtualRouterElement.createPrivateGateway(final PrivateGateway gateway)
focal_class.full_signature: @Override public boolean createPrivateGateway(final PrivateGateway gateway)
focal_class.identifier: createPrivateGateway
focal_class.modifiers: @Override public
focal_class.parameters: (final PrivateGateway gateway)
focal_class.return: boolean
focal_class.signature: boolean createPrivateGateway(final PrivateGateway gateway)
focal_class.class_method_signature: VpcVirtualRouterElement.deletePrivateGateway(final PrivateGateway gateway)
focal_class.full_signature: @Override public boolean deletePrivateGateway(final PrivateGateway gateway)
focal_class.identifier: deletePrivateGateway
focal_class.modifiers: @Override public
focal_class.parameters: (final PrivateGateway gateway)
focal_class.return: boolean
focal_class.signature: boolean deletePrivateGateway(final PrivateGateway gateway)
focal_class.class_method_signature: VpcVirtualRouterElement.applyStaticRoutes(final Vpc vpc, final List<StaticRouteProfile> routes)
focal_class.full_signature: @Override public boolean applyStaticRoutes(final Vpc vpc, final List<StaticRouteProfile> routes)
focal_class.identifier: applyStaticRoutes
focal_class.modifiers: @Override public
focal_class.parameters: (final Vpc vpc, final List<StaticRouteProfile> routes)
focal_class.return: boolean
focal_class.signature: boolean applyStaticRoutes(final Vpc vpc, final List<StaticRouteProfile> routes)
focal_class.class_method_signature: VpcVirtualRouterElement.applyACLItemsToPrivateGw(final PrivateGateway gateway, final List<? extends NetworkACLItem> rules)
focal_class.full_signature: @Override public boolean applyACLItemsToPrivateGw(final PrivateGateway gateway, final List<? extends NetworkACLItem> rules)
focal_class.identifier: applyACLItemsToPrivateGw
focal_class.modifiers: @Override public
focal_class.parameters: (final PrivateGateway gateway, final List<? extends NetworkACLItem> rules)
focal_class.return: boolean
focal_class.signature: boolean applyACLItemsToPrivateGw(final PrivateGateway gateway, final List<? extends NetworkACLItem> rules)
focal_class.class_method_signature: VpcVirtualRouterElement.applyACLItemsToPublicIp(final IpAddress publicIp, final List<? extends NetworkACLItem> rules)
focal_class.full_signature: @Override public boolean applyACLItemsToPublicIp(final IpAddress publicIp, final List<? extends NetworkACLItem> rules)
focal_class.identifier: applyACLItemsToPublicIp
focal_class.modifiers: @Override public
focal_class.parameters: (final IpAddress publicIp, final List<? extends NetworkACLItem> rules)
focal_class.return: boolean
focal_class.signature: boolean applyACLItemsToPublicIp(final IpAddress publicIp, final List<? extends NetworkACLItem> rules)
focal_class.class_method_signature: VpcVirtualRouterElement.applyNetworkACLs(final Network network, final List<? extends NetworkACLItem> rules)
focal_class.full_signature: @Override public boolean applyNetworkACLs(final Network network, final List<? extends NetworkACLItem> rules)
focal_class.identifier: applyNetworkACLs
focal_class.modifiers: @Override public
focal_class.parameters: (final Network network, final List<? extends NetworkACLItem> rules)
focal_class.return: boolean
focal_class.signature: boolean applyNetworkACLs(final Network network, final List<? extends NetworkACLItem> rules)
focal_class.class_method_signature: VpcVirtualRouterElement.getCapabilities()
focal_class.full_signature: @Override public Map<Service, Map<Capability, String>> getCapabilities()
focal_class.identifier: getCapabilities
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Map<Service, Map<Capability, String>>
focal_class.signature: Map<Service, Map<Capability, String>> getCapabilities()
focal_class.class_method_signature: VpcVirtualRouterElement.startSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.full_signature: @Override public boolean startSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.identifier: startSite2SiteVpn
focal_class.modifiers: @Override public
focal_class.parameters: (final Site2SiteVpnConnection conn)
focal_class.return: boolean
focal_class.signature: boolean startSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.class_method_signature: VpcVirtualRouterElement.refreshSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.full_signature: @Override public boolean refreshSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.identifier: refreshSite2SiteVpn
focal_class.modifiers: @Override public
focal_class.parameters: (final Site2SiteVpnConnection conn)
focal_class.return: boolean
focal_class.signature: boolean refreshSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.class_method_signature: VpcVirtualRouterElement.getProvider()
focal_class.full_signature: @Override public Provider getProvider()
focal_class.identifier: getProvider
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Provider
focal_class.signature: Provider getProvider()
focal_class.class_method_signature: VpcVirtualRouterElement.stopSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.full_signature: @Override public boolean stopSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.identifier: stopSite2SiteVpn
focal_class.modifiers: @Override public
focal_class.parameters: (final Site2SiteVpnConnection conn)
focal_class.return: boolean
focal_class.signature: boolean stopSite2SiteVpn(final Site2SiteVpnConnection conn)
focal_class.class_method_signature: VpcVirtualRouterElement.implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context)
focal_class.full_signature: @Override public boolean implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context)
focal_class.identifier: implement
focal_class.modifiers: @Override public
focal_class.parameters: (final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context)
focal_class.return: boolean
focal_class.signature: boolean implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context)
focal_class.class_method_signature: VpcVirtualRouterElement.configureGuestNetwork(final Network network, final List<DomainRouterVO> routers)
focal_class.full_signature: protected void configureGuestNetwork(final Network network, final List<DomainRouterVO> routers)
focal_class.identifier: configureGuestNetwork
focal_class.modifiers: protected
focal_class.parameters: (final Network network, final List<DomainRouterVO> routers)
focal_class.return: void
focal_class.signature: void configureGuestNetwork(final Network network, final List<DomainRouterVO> routers)
focal_class.class_method_signature: VpcVirtualRouterElement.prepare(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context)
focal_class.full_signature: @Override public boolean prepare(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context)
focal_class.identifier: prepare
focal_class.modifiers: @Override public
focal_class.parameters: (final Network network, final NicProfile nic, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context)
focal_class.return: boolean
focal_class.signature: boolean prepare(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context)
focal_class.class_method_signature: VpcVirtualRouterElement.canHandle(final Network network, final Service service)
focal_class.full_signature: @Override protected boolean canHandle(final Network network, final Service service)
focal_class.identifier: canHandle
focal_class.modifiers: @Override protected
focal_class.parameters: (final Network network, final Service service)
focal_class.return: boolean
focal_class.signature: boolean canHandle(final Network network, final Service service)
focal_class.class_method_signature: VpcVirtualRouterElement.shutdown(final Network network, final ReservationContext context, final boolean cleanup)
focal_class.full_signature: @Override public boolean shutdown(final Network network, final ReservationContext context, final boolean cleanup)
focal_class.identifier: shutdown
focal_class.modifiers: @Override public
focal_class.parameters: (final Network network, final ReservationContext context, final boolean cleanup)
focal_class.return: boolean
focal_class.signature: boolean shutdown(final Network network, final ReservationContext context, final boolean cleanup)
focal_class.class_method_signature: VpcVirtualRouterElement.destroy(final Network config, final ReservationContext context)
focal_class.full_signature: @Override public boolean destroy(final Network config, final ReservationContext context)
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: (final Network config, final ReservationContext context)
focal_class.return: boolean
focal_class.signature: boolean destroy(final Network config, final ReservationContext context)
focal_class.class_method_signature: VpcVirtualRouterElement.getVirtualRouterProvider()
focal_class.full_signature: @Override protected Type getVirtualRouterProvider()
focal_class.identifier: getVirtualRouterProvider
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: Type
focal_class.signature: Type getVirtualRouterProvider()
focal_class.class_method_signature: VpcVirtualRouterElement.applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_class.full_signature: @Override public String[] applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_class.identifier: applyVpnUsers
focal_class.modifiers: @Override public
focal_class.parameters: (final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_class.return: String[]
focal_class.signature: String[] applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_class.class_method_signature: VpcVirtualRouterElement.startVpn(final RemoteAccessVpn vpn)
focal_class.full_signature: @Override public boolean startVpn(final RemoteAccessVpn vpn)
focal_class.identifier: startVpn
focal_class.modifiers: @Override public
focal_class.parameters: (final RemoteAccessVpn vpn)
focal_class.return: boolean
focal_class.signature: boolean startVpn(final RemoteAccessVpn vpn)
focal_class.class_method_signature: VpcVirtualRouterElement.stopVpn(final RemoteAccessVpn vpn)
focal_class.full_signature: @Override public boolean stopVpn(final RemoteAccessVpn vpn)
focal_class.identifier: stopVpn
focal_class.modifiers: @Override public
focal_class.parameters: (final RemoteAccessVpn vpn)
focal_class.return: boolean
focal_class.signature: boolean stopVpn(final RemoteAccessVpn vpn)
focal_class.class_method_signature: VpcVirtualRouterElement.applyIps(final Network network, final List<? extends PublicIpAddress> ipAddress, final Set<Service> services)
focal_class.full_signature: @Override public boolean applyIps(final Network network, final List<? extends PublicIpAddress> ipAddress, final Set<Service> services)
focal_class.identifier: applyIps
focal_class.modifiers: @Override public
focal_class.parameters: (final Network network, final List<? extends PublicIpAddress> ipAddress, final Set<Service> services)
focal_class.return: boolean
focal_class.signature: boolean applyIps(final Network network, final List<? extends PublicIpAddress> ipAddress, final Set<Service> services)
focal_class.class_method_signature: VpcVirtualRouterElement.getRouters(final Network network, final DeployDestination dest)
focal_class.full_signature: @Override protected List<DomainRouterVO> getRouters(final Network network, final DeployDestination dest)
focal_class.identifier: getRouters
focal_class.modifiers: @Override protected
focal_class.parameters: (final Network network, final DeployDestination dest)
focal_class.return: List<DomainRouterVO>
focal_class.signature: List<DomainRouterVO> getRouters(final Network network, final DeployDestination dest)
focal_class.superclass: extends VirtualRouterElement
focal_method.body: @Override
      public String[] applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users) throws ResourceUnavailableException {
          final Long vpcId = vpn.getVpcId();
          if (vpcId == null) {
              return null;
          }
  
          final List<DomainRouterVO> routers = _vpcRouterMgr.getVpcRouters(vpcId);
          if (routers == null) {
              s_logger.debug("Cannot apply vpn users on the backend; virtual router doesn't exist in the network " + vpcId);
              return null;
          }
  
          final Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
          final Zone zone = zoneRepository.findById(vpc.getZoneId()).orElse(null);
          final NetworkTopology networkTopology = networkTopologyContext.retrieveNetworkTopology(zone);
  
          String[] result;
          final List<String> combinedResults = new ArrayList<>();
          for (final DomainRouterVO domainRouterVO : routers) {
              result = networkTopology.applyVpnUsers(vpn, users, domainRouterVO);
              combinedResults.addAll(Arrays.asList(result));
          }
          result = new String[combinedResults.size()];
          final Object[] resultCast = combinedResults.toArray();
          System.arraycopy(resultCast, 0, result, 0, resultCast.length);
  
          return result;
      }
focal_method.class_method_signature: VpcVirtualRouterElement.applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_method.full_signature: @Override public String[] applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_method.identifier: applyVpnUsers
focal_method.invocations: getVpcId getVpcRouters debug findById orElse findById getZoneId retrieveNetworkTopology applyVpnUsers addAll asList size toArray arraycopy
focal_method.modifiers: @Override public
focal_method.parameters: (final RemoteAccessVpn vpn, final List<? extends VpnUser> users)
focal_method.return: String[]
focal_method.signature: String[] applyVpnUsers(final RemoteAccessVpn vpn, final List<? extends VpnUser> users)