use of io.fabric8.groups.Group in project fabric8-maven-plugin by fabric8io.
the class MavenProjectEnricherTest method testOldStyleGeneratedResources.
@Test
public void testOldStyleGeneratedResources() {
final Properties properties = new Properties();
properties.setProperty("fabric8.enricher.fmp-project.useProjectLabel", "true");
new Expectations() {
{
mavenProject.getProperties();
result = properties;
}
};
ProjectEnricher projectEnricher = new ProjectEnricher(context);
KubernetesListBuilder builder = createListWithDeploymentConfig();
projectEnricher.adapt(builder);
KubernetesList list = builder.build();
Map<String, String> labels = list.getItems().get(0).getMetadata().getLabels();
assertNotNull(labels);
assertEquals("groupId", labels.get("group"));
assertEquals("artifactId", labels.get("project"));
assertEquals("version", labels.get("version"));
assertNull(labels.get("app"));
Map<String, String> selectors = projectEnricher.getSelector(Kind.DEPLOYMENT_CONFIG);
assertEquals("groupId", selectors.get("group"));
assertEquals("artifactId", selectors.get("project"));
assertNull(selectors.get("version"));
assertNull(selectors.get("app"));
}
use of io.fabric8.groups.Group in project fabric8-maven-plugin by fabric8io.
the class MavenProjectEnricherTest method testGeneratedResources.
@Test
public void testGeneratedResources() {
ProjectEnricher projectEnricher = new ProjectEnricher(context);
KubernetesListBuilder builder = createListWithDeploymentConfig();
projectEnricher.adapt(builder);
KubernetesList list = builder.build();
Map<String, String> labels = list.getItems().get(0).getMetadata().getLabels();
assertNotNull(labels);
assertEquals("groupId", labels.get("group"));
assertEquals("artifactId", labels.get("app"));
assertEquals("version", labels.get("version"));
assertNull(labels.get("project"));
Map<String, String> selectors = projectEnricher.getSelector(Kind.DEPLOYMENT_CONFIG);
assertEquals("groupId", selectors.get("group"));
assertEquals("artifactId", selectors.get("app"));
assertNull(selectors.get("version"));
assertNull(selectors.get("project"));
}
use of io.fabric8.groups.Group in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getContainerTestWithUser.
@Test
public void getContainerTestWithUser() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
// container name with user and image with tag
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/").cleanup("try").tags(tags).compression("gzip").dockerFile("testFile").dockerFileDir("/demo").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("user/test:latest").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("user-test-artifact", containers.get(0).getName());
assertEquals("docker.io/user/test:latest", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of io.fabric8.groups.Group in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateTunnelAggregationGroup.
private void updateTunnelAggregationGroup(InterfaceParentEntry parentEntry) {
String logicTunnelName = parentEntry.getParentInterface();
InternalTunnel logicInternalTunnel = ItmUtils.ITM_CACHE.getInternalTunnel(logicTunnelName);
if (logicInternalTunnel == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: {} not found in internal tunnels list", logicTunnelName);
return;
}
InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
BigInteger srcDpnId = logicInternalTunnel.getSourceDPN();
List<Bucket> listBuckets = new ArrayList<>();
List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", parentEntry.getParentInterface());
return;
}
for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
String curChildName = interfaceChildEntry.getChildInterface();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface childIface = ItmUtils.getInterface(curChildName, interfaceManager);
IfTunnel ifTunnel = childIface != null ? childIface.getAugmentation(IfTunnel.class) : null;
if (ifTunnel == null || !ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: not tunnel interface {} found in group {}", curChildName, logicTunnelName);
continue;
}
ParentRefs parentRefs = childIface.getAugmentation(ParentRefs.class);
if (parentRefs == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: parent refs not specified for interface {} in group {}", curChildName, logicTunnelName);
continue;
}
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildName);
if (ifInfo == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: interface state not found for {} in groupId {}", curChildName, groupId);
continue;
}
int bucketId = interfaceChildEntries.indexOf(interfaceChildEntry);
LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateTunnelAggregationGroup - add bucketId {} to groupId {}", bucketId, groupId);
listBuckets.add(createBucket(curChildName, ifTunnel, bucketId, ifInfo.getPortNo()));
}
if (!listBuckets.isEmpty()) {
Group group = MDSALUtil.buildGroup(groupId, logicTunnelName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(listBuckets));
mdsalManager.syncInstallGroup(srcDpnId, group);
}
}
use of io.fabric8.groups.Group in project genius by opendaylight.
the class OvsInterfaceConfigAddHelper method createLogicalTunnelSelectGroup.
private long createLogicalTunnelSelectGroup(BigInteger srcDpnId, String interfaceName, int lportTag) {
long groupId = IfmUtil.getLogicalTunnelSelectGroupId(lportTag);
Group group = MDSALUtil.buildGroup(groupId, interfaceName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(Collections.emptyList()));
LOG.debug("MULTIPLE_VxLAN_TUNNELS: group id {} installed for {} srcDpnId {}", group.getGroupId().getValue(), interfaceName, srcDpnId);
mdsalApiManager.syncInstallGroup(srcDpnId, group);
return groupId;
}
Aggregations