@Test(expected = InvalidParameterValueException.class) public void testCheckCapabilityPerServiceProviderFail() { final Map<Capability, String> capabilities = new HashMap<>(); final Set<Network.Provider> providers = this.prepareVpcManagerForCheckingCapabilityPerService(Service.Connectivity, capabilities); this.manager.checkCapabilityPerServiceProvider(providers, Capability.RedundantRouter, Service.SourceNat); }
protected void checkCapabilityPerServiceProvider(final Set<Provider> providers, final Capability capability, final Service service) { if (providers != null) { for (final Provider provider : providers) { final NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName()); final Map<Service, Map<Capability, String>> capabilities = element.getCapabilities(); if (capabilities != null && !capabilities.isEmpty()) { final Map<Capability, String> connectivityCapabilities = capabilities.get(service); if (connectivityCapabilities == null || connectivityCapabilities != null && !connectivityCapabilities.keySet().contains(capability)) { throw new InvalidParameterValueException(String.format("Provider %s does not support %s capability.", provider.getName(), capability.getName())); } } } } }
VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvisioningService, VpcService { protected void checkCapabilityPerServiceProvider(final Set<Provider> providers, final Capability capability, final Service service) { if (providers != null) { for (final Provider provider : providers) { final NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName()); final Map<Service, Map<Capability, String>> capabilities = element.getCapabilities(); if (capabilities != null && !capabilities.isEmpty()) { final Map<Capability, String> connectivityCapabilities = capabilities.get(service); if (connectivityCapabilities == null || connectivityCapabilities != null && !connectivityCapabilities.keySet().contains(capability)) { throw new InvalidParameterValueException(String.format("Provider %s does not support %s capability.", provider.getName(), capability.getName())); } } } } } }
VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvisioningService, VpcService { protected void checkCapabilityPerServiceProvider(final Set<Provider> providers, final Capability capability, final Service service) { if (providers != null) { for (final Provider provider : providers) { final NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName()); final Map<Service, Map<Capability, String>> capabilities = element.getCapabilities(); if (capabilities != null && !capabilities.isEmpty()) { final Map<Capability, String> connectivityCapabilities = capabilities.get(service); if (connectivityCapabilities == null || connectivityCapabilities != null && !connectivityCapabilities.keySet().contains(capability)) { throw new InvalidParameterValueException(String.format("Provider %s does not support %s capability.", provider.getName(), capability.getName())); } } } } }  }
VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvisioningService, VpcService { protected void checkCapabilityPerServiceProvider(final Set<Provider> providers, final Capability capability, final Service service) { if (providers != null) { for (final Provider provider : providers) { final NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName()); final Map<Service, Map<Capability, String>> capabilities = element.getCapabilities(); if (capabilities != null && !capabilities.isEmpty()) { final Map<Capability, String> connectivityCapabilities = capabilities.get(service); if (connectivityCapabilities == null || connectivityCapabilities != null && !connectivityCapabilities.keySet().contains(capability)) { throw new InvalidParameterValueException(String.format("Provider %s does not support %s capability.", provider.getName(), capability.getName())); } } } } }  @Override @DB boolean configure(final String name, final Map<String, Object> params); @Override boolean start(); @Override boolean stop(); @Override List<? extends Network> getVpcNetworks(final long vpcId); @Override VpcOffering getVpcOffering(final long vpcOffId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, eventDescription = "creating vpc offering", create = true) VpcOffering createVpcOffering(final String name, final String displayText,
                                         final List<String> supportedServices, final Map<String, List<String>> serviceProviders,
                                         final Map serviceCapabilitystList, final Long serviceOfferingId, final Long secondaryServiceOfferingId); @Override Pair<List<? extends VpcOffering>, Integer> listVpcOfferings(final Long id, final String name,
                                                                       final String displayText, final List<String> supportedServicesStr,
                                                                       final Boolean isDefault, final String keyword, final String state, final Long startIndex,
                                                                       final Long pageSizeVal); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_DELETE, eventDescription = "deleting vpc offering") boolean deleteVpcOffering(final long offId); @Override Vpc getActiveVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_UPDATE, eventDescription = "updating vpc offering") VpcOffering updateVpcOffering(final long vpcOffId, final String vpcOfferingName, final String displayText,
                                         final String state); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = "creating vpc", create = true) Vpc createVpc(final long zoneId, final long vpcOffId, final long vpcOwnerId, final String vpcName,
                         final String displayText, final String cidr, String networkDomain, final Boolean displayVpc, final String sourceNatList, final String syslogServerList,
                         Long advertInterval, AdvertMethod advertMethod); @Override Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(final long vpcOffId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_DELETE, eventDescription = "deleting VPC") boolean deleteVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_UPDATE, eventDescription = "updating vpc") Vpc updateVpc(final long vpcId, final String vpcName, final String displayText, final String customId, final Boolean displayVpc, final Long vpcOfferingId, final
    String sourceNatList, final String syslogServerList, Long advertInterval, AdvertMethod advertMethod, final ComplianceStatus complianceStatus); @Override Pair<List<? extends Vpc>, Integer> listVpcs(final Long id, final String vpcName, final String displayText,
                                                       final List<String> supportedServicesStr, final String cidr,
                                                       final Long vpcOffId, final String state, final String accountName, Long domainId, final String keyword,
                                                       final Long startIndex, final Long pageSizeVal,
                                                       final Long zoneId, Boolean isRecursive, final Boolean listAll, final Boolean restartRequired,
                                                       final Map<String, String> tags, final Long projectId,
                                                       final Boolean display, final String complianceStatus); @Override boolean startVpc(final long vpcId, final boolean destroyOnFailure); @Override boolean shutdownVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_RESTART, eventDescription = "restarting vpc") boolean restartVpc(final long vpcId, final boolean cleanUp); @Override PrivateGateway getVpcPrivateGateway(final long id); @Override @DB boolean destroyVpc(final Vpc vpc, final Account caller, final Long callerUserId); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_CREATE, eventDescription = "creating VPC private gateway", create = true) PrivateGateway createVpcPrivateGateway(final long vpcId, final String ipAddress, final String gateway,
                                                  final String netmask, final long gatewayDomainId, final Long networkId, final Boolean isSourceNat, final Long aclId); @Override @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_CREATE, eventDescription = "Applying VPC private gateway", async = true) PrivateGateway applyVpcPrivateGateway(final long gatewayId, final boolean destroyOnFailure); @Override @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_DELETE, eventDescription = "deleting private gateway") @DB boolean deleteVpcPrivateGateway(final long gatewayId); @Override Pair<List<PrivateGateway>, Integer> listPrivateGateway(final ListPrivateGatewaysCmd cmd); @Override StaticRoute getStaticRoute(final long routeId); @Override boolean applyStaticRoutesForVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_DELETE, eventDescription = "deleting static route") boolean revokeStaticRoute(final long routeId); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_CREATE, eventDescription = "creating static route", create = true) StaticRoute createStaticRoute(final long vpcId, final String cidr, final String gwIpAddress); @DB @Override void validateNtwkOffForNtwkInVpc(final Long networkId, final long newNtwkOffId, final String newCidr,
                                            final String newNetworkDomain, final Vpc vpc,
                                            final String gateway, final Account networkOwner, final Long aclId); @Override void validateNtwkOffForVpc(final NetworkOffering guestNtwkOff, final List<Service> supportedSvcs); @Override Pair<List<? extends StaticRoute>, Integer> listStaticRoutes(final ListStaticRoutesCmd cmd); @DB @Override @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "associating Ip", async = true) IpAddress associateIPToVpc(final long ipId, final long vpcId); @Override List<? extends Vpc> getVpcsForAccount(final long accountId); @Override @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_CREATE, eventDescription = "Applying static route", async = true) boolean applyStaticRoute(final long routeId); @Override List<PrivateGateway> getVpcPrivateGateways(final long vpcId); @Inject void setVpcElements(final List<VpcProvider> vpcElements); @Override void unassignIPFromVpcNetwork(final long ipId, final long networkId); @Override boolean isIpAllocatedToVpc(final IpAddress ip); @DB @Override Network createVpcGuestNetwork(final long ntwkOffId, final String name, final String displayText, final String gateway, final String cidr, final String vlanId,
                                         String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType,
                                         final Boolean subdomainAccess, final long vpcId, final Long aclId, final Account caller, final Boolean isDisplayNetworkEnabled,
                                         final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer, final String dhcpBootfileName); @Override PublicIp assignSourceNatIpAddressToVpc(final Account owner, final Vpc vpc); @Override List<HypervisorType> getSupportedVpcHypervisors(); }
VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvisioningService, VpcService { protected void checkCapabilityPerServiceProvider(final Set<Provider> providers, final Capability capability, final Service service) { if (providers != null) { for (final Provider provider : providers) { final NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName()); final Map<Service, Map<Capability, String>> capabilities = element.getCapabilities(); if (capabilities != null && !capabilities.isEmpty()) { final Map<Capability, String> connectivityCapabilities = capabilities.get(service); if (connectivityCapabilities == null || connectivityCapabilities != null && !connectivityCapabilities.keySet().contains(capability)) { throw new InvalidParameterValueException(String.format("Provider %s does not support %s capability.", provider.getName(), capability.getName())); } } } } }  @Override @DB boolean configure(final String name, final Map<String, Object> params); @Override boolean start(); @Override boolean stop(); @Override List<? extends Network> getVpcNetworks(final long vpcId); @Override VpcOffering getVpcOffering(final long vpcOffId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, eventDescription = "creating vpc offering", create = true) VpcOffering createVpcOffering(final String name, final String displayText,
                                         final List<String> supportedServices, final Map<String, List<String>> serviceProviders,
                                         final Map serviceCapabilitystList, final Long serviceOfferingId, final Long secondaryServiceOfferingId); @Override Pair<List<? extends VpcOffering>, Integer> listVpcOfferings(final Long id, final String name,
                                                                       final String displayText, final List<String> supportedServicesStr,
                                                                       final Boolean isDefault, final String keyword, final String state, final Long startIndex,
                                                                       final Long pageSizeVal); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_DELETE, eventDescription = "deleting vpc offering") boolean deleteVpcOffering(final long offId); @Override Vpc getActiveVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_UPDATE, eventDescription = "updating vpc offering") VpcOffering updateVpcOffering(final long vpcOffId, final String vpcOfferingName, final String displayText,
                                         final String state); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = "creating vpc", create = true) Vpc createVpc(final long zoneId, final long vpcOffId, final long vpcOwnerId, final String vpcName,
                         final String displayText, final String cidr, String networkDomain, final Boolean displayVpc, final String sourceNatList, final String syslogServerList,
                         Long advertInterval, AdvertMethod advertMethod); @Override Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(final long vpcOffId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_DELETE, eventDescription = "deleting VPC") boolean deleteVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_UPDATE, eventDescription = "updating vpc") Vpc updateVpc(final long vpcId, final String vpcName, final String displayText, final String customId, final Boolean displayVpc, final Long vpcOfferingId, final
    String sourceNatList, final String syslogServerList, Long advertInterval, AdvertMethod advertMethod, final ComplianceStatus complianceStatus); @Override Pair<List<? extends Vpc>, Integer> listVpcs(final Long id, final String vpcName, final String displayText,
                                                       final List<String> supportedServicesStr, final String cidr,
                                                       final Long vpcOffId, final String state, final String accountName, Long domainId, final String keyword,
                                                       final Long startIndex, final Long pageSizeVal,
                                                       final Long zoneId, Boolean isRecursive, final Boolean listAll, final Boolean restartRequired,
                                                       final Map<String, String> tags, final Long projectId,
                                                       final Boolean display, final String complianceStatus); @Override boolean startVpc(final long vpcId, final boolean destroyOnFailure); @Override boolean shutdownVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_RESTART, eventDescription = "restarting vpc") boolean restartVpc(final long vpcId, final boolean cleanUp); @Override PrivateGateway getVpcPrivateGateway(final long id); @Override @DB boolean destroyVpc(final Vpc vpc, final Account caller, final Long callerUserId); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_CREATE, eventDescription = "creating VPC private gateway", create = true) PrivateGateway createVpcPrivateGateway(final long vpcId, final String ipAddress, final String gateway,
                                                  final String netmask, final long gatewayDomainId, final Long networkId, final Boolean isSourceNat, final Long aclId); @Override @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_CREATE, eventDescription = "Applying VPC private gateway", async = true) PrivateGateway applyVpcPrivateGateway(final long gatewayId, final boolean destroyOnFailure); @Override @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_DELETE, eventDescription = "deleting private gateway") @DB boolean deleteVpcPrivateGateway(final long gatewayId); @Override Pair<List<PrivateGateway>, Integer> listPrivateGateway(final ListPrivateGatewaysCmd cmd); @Override StaticRoute getStaticRoute(final long routeId); @Override boolean applyStaticRoutesForVpc(final long vpcId); @Override @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_DELETE, eventDescription = "deleting static route") boolean revokeStaticRoute(final long routeId); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_CREATE, eventDescription = "creating static route", create = true) StaticRoute createStaticRoute(final long vpcId, final String cidr, final String gwIpAddress); @DB @Override void validateNtwkOffForNtwkInVpc(final Long networkId, final long newNtwkOffId, final String newCidr,
                                            final String newNetworkDomain, final Vpc vpc,
                                            final String gateway, final Account networkOwner, final Long aclId); @Override void validateNtwkOffForVpc(final NetworkOffering guestNtwkOff, final List<Service> supportedSvcs); @Override Pair<List<? extends StaticRoute>, Integer> listStaticRoutes(final ListStaticRoutesCmd cmd); @DB @Override @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "associating Ip", async = true) IpAddress associateIPToVpc(final long ipId, final long vpcId); @Override List<? extends Vpc> getVpcsForAccount(final long accountId); @Override @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_CREATE, eventDescription = "Applying static route", async = true) boolean applyStaticRoute(final long routeId); @Override List<PrivateGateway> getVpcPrivateGateways(final long vpcId); @Inject void setVpcElements(final List<VpcProvider> vpcElements); @Override void unassignIPFromVpcNetwork(final long ipId, final long networkId); @Override boolean isIpAllocatedToVpc(final IpAddress ip); @DB @Override Network createVpcGuestNetwork(final long ntwkOffId, final String name, final String displayText, final String gateway, final String cidr, final String vlanId,
                                         String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType,
                                         final Boolean subdomainAccess, final long vpcId, final Long aclId, final Account caller, final Boolean isDisplayNetworkEnabled,
                                         final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer, final String dhcpBootfileName); @Override PublicIp assignSourceNatIpAddressToVpc(final Account owner, final Vpc vpc); @Override List<HypervisorType> getSupportedVpcHypervisors(); static final String SERVICE; static final String CAPABILITYTYPE; static final String CAPABILITYVALUE; static final String TRUE_VALUE; static final String FALSE_VALUE; }