use of io.fabric8.groups.Group in project fabric8 by jboss-fuse.
the class MQManager method createConfigDTOs.
public static List<MQBrokerConfigDTO> createConfigDTOs(MQService mqService, Profile profile) {
List<MQBrokerConfigDTO> answer = new ArrayList<MQBrokerConfigDTO>();
Map<String, Map<String, String>> configurations = profile.getConfigurations();
Set<Map.Entry<String, Map<String, String>>> entries = configurations.entrySet();
for (Map.Entry<String, Map<String, String>> entry : entries) {
String key = entry.getKey();
Map<String, String> configuration = entry.getValue();
if (isBrokerConfigPid(key)) {
String brokerName = getBrokerNameFromPID(key);
String profileId = profile.getId();
MQBrokerConfigDTO dto = new MQBrokerConfigDTO();
dto.setProfile(profileId);
dto.setBrokerName(brokerName);
String version = profile.getVersion();
dto.setVersion(version);
List<String> parentIds = profile.getParentIds();
if (parentIds.size() > 0) {
dto.setParentProfile(parentIds.get(0));
}
if (configuration != null) {
dto.setData(configuration.get(DATA));
dto.setConfigUrl(configuration.get(CONFIG_URL));
dto.setGroup(configuration.get(GROUP));
dto.setKind(BrokerKind.fromValue(configuration.get(KIND)));
dto.setMinimumInstances(Maps.integerValue(configuration, MINIMUM_INSTANCES));
dto.setNetworks(Maps.stringValues(configuration, NETWORKS));
dto.setNetworksUserName(configuration.get(NETWORK_USER_NAME));
dto.setNetworksPassword(configuration.get(NETWORK_PASSWORD));
dto.setReplicas(Maps.integerValue(configuration, REPLICAS));
for (Map.Entry<String, String> configurationEntry : configuration.entrySet()) {
if (configurationEntry.getKey().endsWith("-port")) {
dto.getPorts().put(configurationEntry.getKey().substring(0, configurationEntry.getKey().indexOf("-port")), configurationEntry.getValue());
}
}
}
answer.add(dto);
}
}
return answer;
}
use of io.fabric8.groups.Group in project fabric8 by jboss-fuse.
the class ContainerCreateCloud method doExecute.
@Override
protected Object doExecute() throws Exception {
// validate input before creating containers
preCreateContainer(name);
FabricValidations.validateProfileNames(profiles);
if (isEnsembleServer && newUserPassword == null) {
newUserPassword = zookeeperPassword != null ? zookeeperPassword : fabricService.getZookeeperPassword();
}
CreateJCloudsContainerOptions.Builder builder = CreateJCloudsContainerOptions.builder().name(name).bindAddress(bindAddress).resolver(resolver).manualIp(manualIp).ensembleServer(isEnsembleServer).credential(credential).group(group).hardwareId(hardwareId).identity(identity).osFamily(osFamily).osVersion(osVersion).imageId(imageId).instanceType(instanceType).locationId(locationId).number(number).nodeOptions(CloudUtils.parseProviderOptions(options)).owner(owner).adminAccess(!disableAdminAccess).publicKeyFile(publicKeyFile).contextName(contextName).providerName(providerName).apiName(apiName).user(user).password(password).proxyUri(proxyUri != null ? proxyUri : fabricService.getMavenRepoURI()).zookeeperUrl(fabricService.getZookeeperUrl()).zookeeperPassword(isEnsembleServer && zookeeperPassword != null ? zookeeperPassword : fabricService.getZookeeperPassword()).jvmOpts(jvmOpts).environmentalVariable(environmentalVariables).version(version).withUser(newUser, newUserPassword, newUserRole).profiles(getProfileNames()).dataStoreProperties(getDataStoreProperties()).uploadDistribution(!distributionUploadDisable);
if (path != null && !path.isEmpty()) {
builder.path(path);
}
CreateContainerMetadata[] metadatas = fabricService.createContainers(builder.build(), new PrintStreamCreationStateListener(System.out));
if (isEnsembleServer && metadatas != null && metadatas.length > 0 && metadatas[0].isSuccess()) {
ShellUtils.storeZookeeperPassword(session, metadatas[0].getCreateOptions().getZookeeperPassword());
}
// display containers
displayContainers(metadatas);
return null;
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanInterfaceManager method setupLeavesLocalBroadcastGroups.
private void setupLeavesLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
List<String> interfaces = new ArrayList<>();
if (newDpnInterface != null) {
interfaces = newDpnInterface.getInterfaces();
}
for (String ifName : interfaces) {
// In case if there is a InterfacePort in the cache which is not
// in
// operational state, skip processing it
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
if (!isOperational(ifInfo)) {
continue;
}
if (!interfaceManager.isExternalInterface(ifName)) {
// only add root interfaces
bucketId = addInterfaceIfRootInterface(bucketId, ifName, listBucket, ifInfo);
}
}
if (listBucket.isEmpty()) {
// No Buckets
createDropBucket(listBucket);
}
long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("installing the localBroadCast Group:{}", group);
mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
}
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanInterfaceManager method removeLeavesLocalBroadcastGroup.
private void removeLeavesLocalBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeInstance.getEtreeLeafTagVal().getValue());
List<Bucket> listBuckets = new ArrayList<>();
int bucketId = 0;
listBuckets.add(getLocalBCGroupBucketInfo(interfaceInfo, bucketId));
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleted the localBroadCast Group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanInterfaceManager method setupStandardLocalBroadcastGroups.
public void setupStandardLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
long groupId = ElanUtils.getElanLocalBCGId(elanInfo.getElanTag());
List<String> interfaces = new ArrayList<>();
if (newDpnInterface != null) {
interfaces = newDpnInterface.getInterfaces();
}
for (String ifName : interfaces) {
// In case if there is a InterfacePort in the cache which is not in
// operational state, skip processing it
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
if (!isOperational(ifInfo)) {
continue;
}
if (!interfaceManager.isExternalInterface(ifName)) {
listBucket.add(MDSALUtil.buildBucket(getInterfacePortActions(ifInfo), MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
}
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("installing the localBroadCast Group:{}", group);
mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
}
Aggregations